liuhairui vor 1 Jahr
Ursprung
Commit
8caa139132

+ 7 - 92
src/view/yunyin/shengchanguanli/components/addGongYi.vue

@@ -132,32 +132,25 @@
       >
       </el-tree>
     </el-dialog>
+
   </div>
 </template>
 
 <script setup>
-import {ref, reactive} from 'vue'
+import {ref, reactive,onMounted} from 'vue'
 import {
   gdzl_MachineList, PrintDetailList, WastageList, getDepartName, capacityList, ProcessDetailAdd, workOrderListDetail,
 } from '@/api/yunyin/yunying'
 import { ElMessage } from 'element-plus'
-
 const form = reactive({})
 const visible = ref(false)
 const yjdisplay = ref(false)
 const cjdisplay = ref(false)
 const gxshdisplay = ref(false)
 const id = ref()
-
 const gxList = ref([])
 const yjList = ref()
-const cjList = ref([
-  // {
-  //   label: '标准工艺',
-  //   value: '标准工艺',
-  //   children: []
-  // }
-])
+const cjList = ref([])
 const gdzl_MachineList_address = ref()
 import { useUserStore } from '@/pinia/modules/user'
 const userStore = useUserStore()
@@ -173,27 +166,14 @@ const add_gyzlent = async (event,id1,id2,id3) => {
       }
       document.getElementById(id3).focus()
     }
-
   }
   if (id2 === '车间名称' && event.key==='Tab') {
     document.getElementById(id3).focus()
     cjdisplay.value = true
   }
-
-  // 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 (id2 === '工序名称' &&  event.key==='Tab') {
@@ -218,7 +198,6 @@ const add_gyzlent = async (event,id1,id2,id3) => {
     if(id1!='' && document.getElementById(id2).value==''){
       document.getElementById(id1).focus()
     }
-    // console.log(document.getElementById(id2).value)
   }else if (event.keyCode === 37) { // 向左箭头
     if(id1!='' && document.getElementById(id2).selectionStart==0){
       document.getElementById(id1).focus()
@@ -234,7 +213,6 @@ const open = async (gdbh, gxlist) => {
   Object.keys(form).forEach(key => {
     form[key] = '';
   });
-
   visible.value = true
   id.value = gdbh
   const res = await PrintDetailList({workOrder: id.value})
@@ -255,18 +233,6 @@ const open = async (gdbh, gxlist) => {
   }
   // 使用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
 }
@@ -284,20 +250,6 @@ const getGxshList = async ()=>{
     })
   }
   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)=>{
@@ -308,30 +260,6 @@ 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
-  // }else{
-  //   form['车间名称'] = _node.label
-  // }
-  // form['工艺名称'] = _node.label
-
   console.log(node)
   if(node.value){
     form['工艺名称'] = node.value
@@ -339,6 +267,7 @@ const selectHandle = async (node)=>{
     cjdisplay.value = false
   }else{
     form['车间名称'] = node.label
+    return false;
   }
   form['设备编号'] = []
   //通过车间名称查询机台
@@ -347,23 +276,8 @@ const selectHandle = async (node)=>{
   form['shdh'] = ''
   //通过车间名称查询工序损耗
   await getGxshList()
-
 }
 
-// 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 => {
@@ -393,6 +307,7 @@ const _capacityList = async () => {
 };
 
 const sbbh = ref(null)
+const gongdanziliao = ref(null)
 
 //新增工艺资料确定
 const add_gdgyenterDialog = async () => {
@@ -440,10 +355,10 @@ const add_gdgyenterDialog = async () => {
   const ProcessDetailAdd_add = await ProcessDetailAdd(formattedData);
   console.log(ProcessDetailAdd_add)
   if (ProcessDetailAdd_add.code === 0) {
-    const workOrderListDetail_data = await workOrderListDetail({Gd_gdbh:id.value});
-    gytableData.value = workOrderListDetail_data.data.processList;
     ElMessage({type: 'success', message: '新增成功'})
     visible.value = false
+    const workOrderListDetail_data = await workOrderListDetail({Gd_gdbh:id.value});
+    gytableData.value = workOrderListDetail_data.data.processList;
   } else {
     ElMessage({type: 'error',message: '新增失败'})
   }

+ 1 - 0
src/view/yunyin/shengchanguanli/gongdanziliao.vue

@@ -3120,6 +3120,7 @@ const tableRowClick = async (row) => {
   yjzuidahaoma.value = Number(tmp[0]) + 1
 };
 
+
 // 行为控制标记(弹窗内部需要增还是改)
 const type = ref('')