From 363678a54142e62fdd4ca39a0db5c54af1a704dc Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期四, 29 二月 2024 15:39:59 +0800
Subject: [PATCH] 生产调度修改

---
 src/views/quality/packageinspect/packageInspect-form.vue |   89 ++++++++++++++++++++++++++++++++++++--------
 1 files changed, 72 insertions(+), 17 deletions(-)

diff --git a/src/views/quality/packageinspect/packageInspect-form.vue b/src/views/quality/packageinspect/packageInspect-form.vue
index 1634f6e..2cf2980 100644
--- a/src/views/quality/packageinspect/packageInspect-form.vue
+++ b/src/views/quality/packageinspect/packageInspect-form.vue
@@ -66,13 +66,12 @@
         <el-row :gutter="10" style="width:100%;z-index: 10;height:30px;">
             <el-col :span="12">妫�楠岄」鐩�</el-col>
             <el-col :span="12" style="text-align: right;">
-                <el-dropdown @command="handleCommand">
+                <el-dropdown @command="handleCommand" v-if="isShow">
                     <el-button size="mini" style="margin-right: 10px;" type="primary" >
-                        鍒囨崲榛樿妫�楠岄」<i class="el-icon-arrow-down el-icon--right"></i>
+                        鍒囨崲妫�楠岄」妯℃澘<i class="el-icon-arrow-down el-icon--right"></i>
                     </el-button>
                     <el-dropdown-menu slot="dropdown">
-                        <el-dropdown-item command="1">妫�楠岄」鐩�1</el-dropdown-item>
-                        <el-dropdown-item divided command="2">妫�楠岄」鐩�2</el-dropdown-item>
+                        <el-dropdown-item :key="index" v-for="(item,index) in inspectMoulds" :command="item.father">{{item.father}}</el-dropdown-item>
                     </el-dropdown-menu>
                 </el-dropdown>
               <el-button v-if="resultVal=='' || resultVal==null" size="mini" @click="clickAddLine()">娣诲姞妫�楠岄」鐩�</el-button>
@@ -93,7 +92,10 @@
                 row-key="randomId" class="l-mes"
                 default-expand-all
                 :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
-                  <el-table-column type="index" label="搴忓彿" width="60">
+                  <el-table-column type="index" prop="parentIndex" label="搴忓彿" width="60">
+                    <template scope="scope">
+                        <span v-if="scope.row.isIndex">{{scope.row.parentIndex}}</span>
+                    </template>
                   </el-table-column>
                   <el-table-column prop="name" label="椤圭洰" width="160">
                     <template slot-scope="scope">
@@ -124,6 +126,7 @@
                         <el-select style="width:100%" :disabled="resultVal!=null" @change="changeResult" v-model="scope.row.result" v-if="!scope.row.children">
                             <el-option label="鍚堟牸" value="鍚堟牸"></el-option>
                             <el-option label="涓嶅悎鏍�" value="涓嶅悎鏍�"></el-option>
+                            <el-option label="涓嶉�傜敤" value="涓嶉�傜敤"></el-option>
                         </el-select>
                     </template>
                   </el-table-column>
@@ -194,13 +197,16 @@
   updatePackageInspectById,
   getCustomer,
 } from '@/api/quality/packageInspect'
-import {inspect1,inspect2} from '@/const/defaultPackageInspect'
+import {getAllTemplateByEnable} from '@/api/quality/packageInspectTemp'
 export default {
-    computed:{},
+    computed:{
+    },
     components:{
     },
     data(){
         return{
+            inspectMoulds: [],
+            isShow: true,
             submitData: {
               id:null,
               result: null,
@@ -251,7 +257,9 @@
           this.resultVal=val
         }
       }
+      this.getAllInspect()
       this.init()
+
     },
     watch:{
       dialogVisible(newVal){
@@ -261,15 +269,34 @@
       }
     },
     methods:{
+      checkShowState(){
+        let num = 0
+        this.list.forEach(ele=>{
+            if(ele.children){
+                ele.children.forEach(c=>{
+                    if(c.pid){
+                        num+=1
+                    }
+                })
+            }
+        })
+        this.isShow = num==0
+      },
+      getAllInspect(){
+        getAllTemplateByEnable().then(res=>{
+            if(res.status===200){
+                this.inspectMoulds = res.data.data
+            }
+        }).catch(error=>{
+            console.error(error)
+        })
+      },
       handleCommand(command) {
-        switch(command){
-            case "1":
-                this.init(inspect1)
-            break;
-            case "2":
-                this.init(inspect2)
-            break;
-        }
+        this.inspectMoulds.forEach(ele=>{
+            if(ele.father==command){
+                this.init(ele.children)
+            }
+        })
       },
       changeResult(){
         let result = ''
@@ -342,6 +369,8 @@
       clickAddLine() {
           this.list.push({
             name: '',
+            isIndex : true,
+            parentIndex : this.list.length + 1,
             randomId: Math.random(),
             isEdit: true,
             children: [{
@@ -431,11 +460,35 @@
             _than.list = []
             let userNameList = []
             if(dataList){
-                _than.list = JSON.parse(JSON.stringify(dataList))
+                let tempList = []
+                dataList.forEach((ele,index)=>{
+                    let obj = {
+                        randomId: Math.random(),
+                        name: ele.inspectName,
+                        isIndex: true,
+                        parentIndex: index+1,
+                        children: []
+                    }
+                    if(ele.children){
+                        ele.children.forEach(e=>{
+                            obj.children.push({
+                                required: e.inspectRequired,
+                                randomId: Math.random(),
+                                isEdit: false,
+                                note: '',
+                                result: ''
+                            })
+                        })
+                    }
+                    tempList.push(obj)
+                })
+                _than.list = tempList
             }
-            data.packageInsProductS.forEach(item => {
+            data.packageInsProductS.forEach((item,index) => {
               if (item.children) {
                     let ele = {
+                      isIndex: true,
+                      parentIndex: index+1,
                       isEdit: true,
                       randomId: Math.random(),
                       name: null,
@@ -460,6 +513,7 @@
                     _than.list.push(ele)
                 }
               })
+
               _than.conclusionTable = [{
                 packageNo: data.packageNo,
                 userName: Array.from(new Set(userNameList)).join(','),
@@ -468,6 +522,7 @@
               _than.$nextTick(()=>{
                 if(_than.list.length>0){
                     _than.changeResult()
+                    _than.checkShowState()
                 }
               })
           }).catch(error=>{

--
Gitblit v1.9.3