Browse Source

文档内容优化

Lexie 1 year ago
parent
commit
9da1e4953b

+ 16 - 2
src/api/yunyin/yunying.js

@@ -279,8 +279,22 @@ export const addProductYbInfo = (data) => {
         data
     })
 }
-
-
+//3.14产品印件资料删除
+export const PrintlDel = (params) => {
+    return service({
+        url: '/mes_server/product/PrintDetailDel',
+        method: 'get',
+        params
+    })
+}
+//3.15产品工艺资料删除
+export const ProcessDel = (params) => {
+    return service({
+        url: '/mes_server/product/ProcessDetailDel',
+        method: 'get',
+        params
+    })
+}
 /** 生产管理 工单资料管理*/
 // 1.工单资料菜单列表
 export const DataList = (params) => {

+ 8 - 0
src/view/performance/jjgzzhys.vue

@@ -146,12 +146,20 @@ const jjgzzhysclick = async () => {
   };
   console.log(formattedData);
   const staffSalaryCount_add = await staffSalaryCount(formattedData);//调用接口
+<<<<<<< HEAD
   console.log(staffSalaryCount_add);
   // if (staffSalaryCount_add.code === 0) {
   //   ElMessage({type: 'success',message: msg})
   // }else{
   //   ElMessage({type: 'error',message: '更新失败'})
   // }
+=======
+  if (staffSalaryCount_add.code === 0) {
+    ElMessage({type: 'success',message: msg})
+  }else{
+    ElMessage({type: 'error',message: '更新成功'})
+  }
+>>>>>>> de9ed826175bbf174cd077b307a9089dbda4147c
 };
 </script>
 <style scoped>

+ 50 - 8
src/view/yunyin/chanpinziliao/chanpinziliao.vue

@@ -20,6 +20,8 @@
               <el-button type="primary" class="bt" icon="edit"  @click="addcpyj_onclick" >新增印件资料</el-button>
               <el-button type="primary" class="bt" icon="edit"  @click="addcpgy_onclick" >新增工艺资料</el-button>
               <el-button type="primary" class="bt" icon="edit"  @click="addyb_onclick" >新增印版资料</el-button>
+			  <el-button type="primary" class="bt" icon="edit"  @click="DELonclick" >删除印版资料</el-button>
+			  <el-button type="primary" icon="edit"   @click="delgd_delclick"  :disabled="yjSelection === '' && gySelection === ''"  class="bt" title="选择批量删除(印件资料或工艺资料)"  >删除</el-button>
 <!--              <el-button type="primary" class="bt" icon="Download" @click="cpexportToExcel" disabled>导出产品资料</el-button>-->
 <!--              <el-button type="primary" class="bt" icon="Download" @click="gyexportToExcel" disabled>导出工艺流程</el-button>-->
             </el-form-item>
@@ -651,7 +653,7 @@
                         :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
                         :header-cell-style="{ padding: '0px' }"
                         @row-dblclick="yjupdateCompanyFunc"
-                        style="width: 100%;height: 40vh" border tooltip-effect="dark" :data="yjtableData" row-key="ID" @selection-change="handleSelectionChange">
+                        style="width: 100%;height: 40vh" border tooltip-effect="dark" :data="yjtableData" row-key="ID" @selection-change="selectionChange($event, '印件资料')">
                 <el-table-column  type="selection" width="30" />
                 <el-table-column  align="left" sortable label="印件号" prop="yj_yjno"  width="100"/>
                 <el-table-column  align="left" sortable label="印件代号" prop="yj_yjdh" width="110" />
@@ -678,7 +680,7 @@
                         :header-cell-style="{ padding: '0px' }"
                         @row-dblclick="gyupdateCompanyFunc"
                         :row-class-name="rowClassStyle"
-                        style="width: 100%;height: 40vh" border tooltip-effect="dark" :data="gytableData" row-key="ID" @selection-change="handleSelectionChange"
+                        style="width: 100%;height: 40vh" border tooltip-effect="dark" :data="gytableData" row-key="ID" @selection-change="selectionChange($event, '工艺资料')"
                         @row-click="clickybupdate">
                 <el-table-column type="selection" width="30" />
                 <el-table-column align="left" sortable   label="方案" prop="方案"  width="110"/>
@@ -692,11 +694,11 @@
                 <el-table-column align="left" sortable   label="工价系数" prop="工价系数" width="110" />
                 <el-table-column align="left" sortable   label="损耗系数" prop="损耗系数" width="110" />
                 <el-table-column align="left" sortable   label="计损色数" prop="Gy0_Ms" width="110" />
-                <el-table-column align="left" sortable   label="人工检_正品版" prop="人工检_正品版" width="150" />
-                <el-table-column align="left" sortable   label="人工检_次品版" prop="人工检_正品版" width="150" />
+                <el-table-column align="left" sortable   label="人工检_正品板" prop="人工检_正品板" width="150" />
+                <el-table-column align="left" sortable   label="人工检_次品板" prop="人工检_次品板" width="150" />
                 <el-table-column align="left" sortable   label="人工检_废检" prop="人工检_废检" width="140"/>
-                <el-table-column align="left" sortable   label="机检_正品版" prop="机检_正品" width="140"/>
-                <el-table-column align="left" sortable   label="机检_次品检" prop="机检_次品" width="140"/>
+                <el-table-column align="left" sortable   label="机检_正品版" prop="机检_正品" width="140"/>
+                <el-table-column align="left" sortable   label="机检_次品检" prop="机检_次品" width="140"/>
                 <el-table-column align="left" sortable   label="机检_废检" prop="机检_废检" width="140"/>
                 <el-table-column align="left" sortable   label="设备编号" prop="Gy0_sbmc" width="110"/>
                 <el-table-column align="left" sortable   label="最后修改" prop="最后修改" width="160"/>
@@ -1605,7 +1607,9 @@ import {
   getAnnexTable,
   annexAdd,
   annexDel,
-  getLossCode
+  getLossCode,
+  PrintlDel,
+  ProcessDel
 } from '@/api/yunyin/yunying'
 defineOptions({   name: 'Company'})
 import { useUserStore } from '@/pinia/modules/user'
@@ -2015,7 +2019,7 @@ const cpgyfzhandleConfirm = async () => {
     ElMessage({ type: 'success', message: '更新成功' });
     cpgyfzlist.value = false;
   } else {
-    ElMessage({ type: 'error', message: '更新失败' });
+    // ElMessage({ type: 'error', message: '更新失败' });
   }
 };
 
@@ -2490,7 +2494,45 @@ const tableRowClick = async (row) => {
   // console.log(yjzuidahaoma.value)
   // yjzuidahaoma.value = yjtableData.length+1
 };
+const yjSelection = ref('')
+const gySelection = ref('')
+// 印件资料多选、工艺资料多选
+const selectionChange = (selection, type) => {
+  const ids = selection.map(item => {
+    return type === '印件资料' ? item.Uniqid: item.UniqId
+  })
+  if (type === '印件资料') {
+    yjSelection.value = ids.join(',')
+  }
+  if (type === '工艺资料') {
+    gySelection.value = ids.join(',')
+  }
+}
+// ===========删除印件资料、工艺资料 ===========
+const delgd_delclick = async () => {
+  if (yjSelection.value !== '') {
+    try {
+		
+      const res1 = await PrintlDel({UniqId: yjSelection.value})
+      res1.code === 0 && ElMessage.success('印件资料删除成功')
+    } catch(err) {
+      ElMessage.error(err)
+    }
+  }
+  if (gySelection.value !== ''){
+    try {
+		
+      const res2 = await ProcessDel({UniqId: gySelection.value})
+      res2.code === 0 && ElMessage.success('工艺资料删除成功')
+    } catch(err) {
+      ElMessage.error(err)
+    }
+  }
 
+  const getProductData_data = await getProductData({product_code:_Gd_gdbh.value});
+  yjtableData.value = getProductData_data.data.yjData;
+  gytableData.value = getProductData_data.data.gyData;
+}
 //搜索查询
 const searchInfo = ref('')
 //点击【查询】按钮

+ 126 - 81
src/view/yunyin/shengchanguanli/components/addGongYi.vue

@@ -38,7 +38,7 @@
               <el-input  v-model="form['工序名称']"  style="width: 300px;" id="工序名称"   @keydown="add_gyzlent($event, '车间名称', '工序名称', '设备编号')" />
             </el-form-item>
             <el-form-item label="计损色数"  class="mab" prop="keyOrder" label-width=" 80">
-              <el-input disabled v-model="form['计损色数']" style="width: 90px;"/>
+              <el-input  v-model="form['计损色数']" style="width: 90px;"/>
             </el-form-item>
           </div>
           <el-form-item label="设备编号:"  class="mab" prop="remark">
@@ -114,9 +114,9 @@
           :props="{children: 'children',label: 'label', value: 'value'}"
           style="border: 1px solid #ececec; padding: 10px;height: 400px;overflow: auto;"
           node-key="value"
-          :default-expanded-keys="['标准工艺']"
       >
       </el-tree>
+<!--         :default-expanded-keys="['标准工艺']"-->
     </el-dialog>
 
 <!--    工序损耗列表-->
@@ -152,11 +152,11 @@ const id = ref()
 const gxList = ref([])
 const yjList = ref()
 const cjList = ref([
-  {
-    label: '标准工艺',
-    value: '标准工艺',
-    children: []
-  }
+  // {
+  //   label: '标准工艺',
+  //   value: '标准工艺',
+  //   children: []
+  // }
 ])
 const gdzl_MachineList_address = ref()
 import { useUserStore } from '@/pinia/modules/user'
@@ -180,22 +180,31 @@ const add_gyzlent = async (event,id1,id2,id3) => {
     cjdisplay.value = true
   }
 
-  if (id2 === '车间名称' &&  event.key=== 'Enter') {
-    form['工艺名称'] = form['车间名称']
-    form['设备编号'] = []
-    //通过车间名称查询机台
-    const MachineList_jitai = await gdzl_MachineList({address:form['车间名称']});
-    gdzl_MachineList_address.value = MachineList_jitai.data;
-    form['shdh'] = ''
-    form['工序损耗名称'] = ''
-  }
-  if (id2 === '工序损耗' &&  event.key==='Tab' || id2 === '工序损耗' && event.key=== 'Enter') {
+  // if (id2 === '车间名称' &&  event.key=== 'Enter') {
+  //   form['设备编号'] = []
+  //   //通过车间名称查询机台
+  //   const MachineList_jitai = await gdzl_MachineList({address:form['车间名称']});
+  //   gdzl_MachineList_address.value = MachineList_jitai.data;
+  //   form['shdh'] = ''
+  //   form['工序损耗名称'] = ''
+  // }
+  if (id2 === '工序损耗' &&  event.key==='Tab') {
     if(form['车间名称']){
       await getGxshList();
-      if (gxshList.value[0].children.length > 1) {
-        gxshdisplay.value = true
-      }
+      // if (gxshList.value[0].children.length > 1) {
+      //   gxshdisplay.value = true
+      // }
+    }
+  }
+  if (id2 === '工序名称' &&  event.key==='Tab') {
+    console.log(213)
+    if(form['工艺名称'] === undefined){
+      form['工艺名称'] = '';
+    }
+    if(form['工序名称'] === undefined){
+      form['工序名称'] = '';
     }
+    form['工序损耗名称'] = `${form['工艺名称']} ${form['工序名称']}`;
   }
   if (event.keyCode === 13 || event.keyCode === 40) { // Enter 或向下箭头
     if(id3!=''){
@@ -222,22 +231,42 @@ const add_gyzlent = async (event,id1,id2,id3) => {
 }
 
 const open = async (gdbh, gxlist) => {
-  visible.value = true
+  Object.keys(form).forEach(key => {
+    form[key] = '';
+  });
 
+  visible.value = true
   id.value = gdbh
   const res = await PrintDetailList({workOrder: id.value})
-  const chejian = await getDepartName()
-  if (chejian && Array.isArray(chejian.data) && chejian.data.length === 0) {
-  } else {
-    cjList.value = [
-      {
-        label: '标准工艺',
-        value: '标准工艺',
-        children: []
-      }
-    ]
-    initChejian(chejian.data['标准工艺'])
+  const apiData = await getDepartName()
+  console.log(apiData)
+  function transformDataToTreeFormat(data) {
+    return Object.entries(data).map(([key, value]) => {
+      // key是车间名称,value是车间内的操作列表
+      const children = Object.entries(value).map(([workshop, operations]) => ({
+        label: workshop,
+        children: operations.map(operation => ({
+          label: operation,
+          value: operation // 可以根据需要添加更多属性
+        }))
+      }));
+      return { label: key, children };
+    });
   }
+  // 使用ref来管理转换后的数据
+  cjList.value = ref(transformDataToTreeFormat(apiData.data));
+
+  // if (chejian && Array.isArray(chejian.data) && chejian.data.length === 0) {
+  // } else {
+  //   cjList.value = [
+  //     {
+  //       label: '标准工艺',
+  //       value: '标准工艺',
+  //       children: []
+  //     }
+  //   ]
+  //   initChejian(chejian.data['标准工艺'])
+  // }
   yjList.value = res.data
   gxList.value = gxlist
 }
@@ -245,22 +274,30 @@ const open = async (gdbh, gxlist) => {
 //工序损耗列表
 const gxshList = ref([])
 const getGxshList = async ()=>{
-  const WastageList_data = await WastageList({search: form['车间名称']})
+  const WastageList_data = await WastageList({process: form.工艺名称})
   console.log(WastageList_data)
-  gxshList.value = [{
-    label: form['车间名称'],
-    value: form['车间名称'],
-    children: []
-  }]
-  if (WastageList_data.data.length === 0) return
-  if (WastageList_data.data.length > 1) {
-    gxshList.value[0].children = WastageList_data.data.map(item => {
-      return { label: `${item.编号} - ${item.名称}`, label2: item.名称, UniqId: item.UniqId, value: item.编号 }
+  if(WastageList_data.data === null || WastageList_data.data === ''){
+    form['shdh'] = '';
+    ElMessage({
+      type: 'warning',
+      message: '未获取到工序损耗'
     })
-  } else {
-    form['shdh'] = WastageList_data.data[0].编号;
-    form['工序损耗名称'] = WastageList_data.data[0].名称;
   }
+  form['shdh'] = WastageList_data.data
+  // gxshList.value = [{
+  //   label: form['车间名称'],
+  //   value: form['车间名称'],
+  //   children: []
+  // }]
+  // if (WastageList_data.data.length === 0) return
+  // if (WastageList_data.data.length > 1) {
+  //   gxshList.value[0].children = WastageList_data.data.map(item => {
+  //     return { label: `${item.编号} - ${item.名称}`, label2: item.名称, UniqId: item.UniqId, value: item.编号 }
+  //   })
+  // } else {
+  //   form['shdh'] = WastageList_data.data[0].编号;
+  //   form['工序损耗名称'] = WastageList_data.data[0].名称;
+  // }
 }
 //点击工序损耗列表数据
 const gxshselectHandle = async (node)=>{
@@ -271,54 +308,62 @@ const gxshselectHandle = async (node)=>{
   }
 }
 const selectHandle = async (node)=>{
-  if (node.children && node.children.length> 0) return
-  function findParentInTree(tree, targetValue) {
-    for (let node of tree) {
-      // 如果找到了目标值,返回当前节点作为上级
-      if (node.value === targetValue) {
-        return node;
-      }
-      // 如果当前节点有子节点,递归地在子节点中查找
-      if (node.children && node.children.length > 0) {
-        let parent = findParentInTree(node.children, targetValue);
-        if (parent) return parent
-      }
-    }
-    // 如果没有找到目标值或其上级,返回null
-    return null;
-  }
-  const _node = findParentInTree(cjList.value, node.value)
-  if(_node.parent){
-    form['车间名称'] = _node.parent
+  // if (node.children && node.children.length> 0) return
+  // function findParentInTree(tree, targetValue) {
+  //   for (let node of tree) {
+  //     // 如果找到了目标值,返回当前节点作为上级
+  //     if (node.value === targetValue) {
+  //       return node;
+  //     }
+  //     // 如果当前节点有子节点,递归地在子节点中查找
+  //     if (node.children && node.children.length > 0) {
+  //       let parent = findParentInTree(node.children, targetValue);
+  //       if (parent) return parent
+  //     }
+  //   }
+  //   // 如果没有找到目标值或其上级,返回null
+  //   return null;
+  // }
+  // const _node = findParentInTree(cjList.value, node.value)
+  // if(_node.parent){
+  //   form['车间名称'] = _node.parent
+  // }else{
+  //   form['车间名称'] = _node.label
+  // }
+  // form['工艺名称'] = _node.label
+
+  console.log(node)
+  if(node.value){
+    form['工艺名称'] = node.value
+    form['工序损耗名称'] = node.value
+    cjdisplay.value = false
   }else{
-    form['车间名称'] = _node.label
+    form['车间名称'] = node.label
   }
-  form['工艺名称'] = _node.label
   form['设备编号'] = []
   //通过车间名称查询机台
   const MachineList_jitai = await gdzl_MachineList({address:form['车间名称']});
   gdzl_MachineList_address.value = MachineList_jitai.data;
   form['shdh'] = ''
-  form['工序损耗名称'] = ''
   //通过车间名称查询工序损耗
   await getGxshList()
-  cjdisplay.value = false
-}
 
-const initChejian = (data) => {
-  Object.keys(data).map( (name, index)=>{
-    const tmp = {
-      label: name, value: name, children: []
-    }
-    data[name].map(item => {
-      tmp.children.push({
-        label: item, value: item,parent: name,
-      })
-    })
-    cjList.value[0].children.push(tmp)
-  })
 }
 
+// const initChejian = (data) => {
+//   Object.keys(data).map( (name, index)=>{
+//     const tmp = {
+//       label: name, value: name, children: []
+//     }
+//     data[name].map(item => {
+//       tmp.children.push({
+//         label: item, value: item,parent: name,
+//       })
+//     })
+//     cjList.value[0].children.push(tmp)
+//   })
+// }
+
 const changeHandle = (v) => {
   const no = '0' + v.no
   let list = gxList.value.map(item => {