From f51920b6d720dd10cb61b2fb2973cfdb0dc59577 Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期六, 03 八月 2024 11:55:29 +0800
Subject: [PATCH] 修改委托要求温度循环提交报错

---
 src/components/do/b1-inspect-order-plan/Inspection.vue |  197 ++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 153 insertions(+), 44 deletions(-)

diff --git a/src/components/do/b1-inspect-order-plan/Inspection.vue b/src/components/do/b1-inspect-order-plan/Inspection.vue
index 284db80..53f9118 100644
--- a/src/components/do/b1-inspect-order-plan/Inspection.vue
+++ b/src/components/do/b1-inspect-order-plan/Inspection.vue
@@ -125,6 +125,9 @@
     width: 100%;
     height: 100%;
   }
+  .table_input >>>.el-input__inner{
+    border-color: rgba(0, 0, 0, 0.5) !important;
+  }
 
   .collection {
     width: 50px;
@@ -143,7 +146,7 @@
   .table_caret{
     font-size: 16px;
     margin: 0 5px;
-    color: rgba(0, 0, 0, 0.1);
+    color: rgba(0, 0, 0, 0.5);
   }
   .table_caret:hover{
     color: #409eff;
@@ -225,6 +228,9 @@
   .thermal-table .el-input{
     display: flex;
     align-items: center;
+  }
+  .custom-dialog .el-dialog__body {
+    max-width: 1000px; /* 璁剧疆鏈�澶у搴� */
   }
 </style>
 <template>
@@ -364,7 +370,8 @@
                     </template>
                   </template>
                   <template v-else-if="n.v.ps!=undefined && n.v.ps.value==='璁惧缂栫爜' && state==1">
-                    <el-select v-model="n.v.v" placeholder="璁惧" @visible-change="e=>getEquipOptions(e,n.i)" remote
+                    <el-select v-model="n.v.v" placeholder="璁惧"
+                    class="table_input" @visible-change="e=>getEquipOptions(e,n.i)" remote
                       @change="(val)=>changeEquip(val, n)">
                       <el-option v-for="item in equipOptions" :key="item.value" :label="item.value" :value="item.value">
                       </el-option>
@@ -784,7 +791,7 @@
         <el-button type="primary" @click="submit()">纭� 瀹�</el-button>
       </span>
     </el-dialog>
-    <el-dialog title="鏁版嵁閲囬泦" :visible.sync="dataGetDia" min-width="400px" :close-on-click-modal="false" :close-on-press-escape="false" :before-close="beforeDataGetDia">
+    <el-dialog title="鏁版嵁閲囬泦-璁$畻鏁版嵁閫夋嫨" :visible.sync="dataGetDia" :close-on-click-modal="false" :close-on-press-escape="false" :show-close="false" custom-class="custom-dialog">
       <div>
         <table border="1" cellpadding="10" class="thermal-table">
           <tr>
@@ -796,23 +803,19 @@
             <tr>
               <td :rowspan="item.child.length">{{item.faName}}</td>
               <td>{{ item.child[0].name }}</td>
-              <td>
+              <td style="text-align: left;">
                 <el-checkbox-group
-                  v-model="item.child[0].value"
-                  :min="0"
-                  :max="item.child[0].maxNum">
-                  <el-checkbox v-for="(n,j) in item.child[0].arr" :label="n" :key="j+'ppppppppp'">{{n}}</el-checkbox>
+                  v-model="getDataIndex" :max="item.child[0].maxNum">
+                  <el-checkbox v-for="(n,j) in item.child[0].arr" :label="j" :key="j+'ppppppppp'">{{n}}</el-checkbox>
                 </el-checkbox-group>
               </td>
             </tr>
             <tr v-for="(m,i) in item.child" :key="i+'bbbbbbbbbbbbbb'" v-show="i>0">
               <td>{{ m.name }}</td>
-              <td>
+              <td style="text-align: left;">
                 <el-checkbox-group
-                  v-model="m.value"
-                  :min="0"
-                  :max="m.maxNum">
-                  <el-checkbox v-for="(n,j) in m.arr" :label="n" :key="j+'bbbbbbbbbbbbbb'">{{n}}</el-checkbox>
+                  v-model="getDataIndex" :max="m.maxNum">
+                  <el-checkbox v-for="(n,j) in m.arr" :label="j" :key="j+'bbbbbbbbbbbbbb'" >{{n}}</el-checkbox>
                 </el-checkbox-group>
               </td>
             </tr>
@@ -820,8 +823,7 @@
         </table>
       </div>
       <span slot="footer" class="dialog-footer">
-        <el-button @click="beforeDataGetDia()">鍙� 娑�</el-button>
-        <el-button type="primary" @click="submitDataGet()">纭� 瀹�</el-button>
+        <el-button type="primary" @click="submitDataGet()" :loading="getDataIndexLoading">纭� 瀹�</el-button>
       </span>
     </el-dialog>
   </div>
@@ -988,6 +990,7 @@
         worker0: null,
         wareLength:[],
         dataAcquisitionInfo:{},
+        dataAcquisitionInfoNew:{},
         dataAcquisitionEidt:0,
         dataAcquisitionEidtAble:false,
         dataAcquisitionLoading:false,
@@ -1008,15 +1011,11 @@
             child:[
               {
                 name:'1285nm~1330nm',
-                arr:[12,13],
-                maxNum:1,
-                value:[]
+                arr:[12,13,14,15],
               },
               {
                 name:'1525nm~1575nm',
-                arr:[12,13],
-                maxNum:1,
-                value:[]
+                arr:[12,13,14,15],
               },
             ]
           },
@@ -1026,12 +1025,12 @@
               {
                 name:'鎴嚦娉㈤暱',
                 arr:[12,13,14,15],
-                maxNum:3,
-                value:[]
               }
             ]
           }
-        ]
+        ],
+        getDataIndex:[],
+        getDataIndexLoading:false
       }
     },
     computed: {
@@ -1267,27 +1266,92 @@
             if(res.code!=200){
               return
             }
-            this.dataAcquisitionInfo = res.data
-            try {
-              // 鍚� Worker 鍙戦�佹秷鎭紝寮�濮嬪鐞嗛�昏緫
-              this.worker0.postMessage(JSON.stringify({
-                dataAcquisitionInfo: this.dataAcquisitionInfo,
-                list:this.tableList[0].arr
-              }));
-            } catch (error) {
-              console.log(1111,error);
-            }
-            // 鐩戝惉 Worker 杩斿洖鐨勭粨鏋�
-            this.worker0.onmessage = (event) => {
-              let result = JSON.parse(event.data);
-              if(result.method=='changeInput'){
-                let {list,n} = result.value
-                this.$set(this.tableList[0],'arr',list)
-                this.changeInput('',`${this.currentSample.insProduct[0].templateId}-${n.r}-${n.c}-${n.i}`,n)
-              }
-            };
+            this.dataAcquisitionInfoNew = this.HaveJson(res.data)
+            this.handleDataAcquisition(res.data)
           })
         }
+      },
+      handleDataAcquisition(data){
+        this.dataAcquisitionInfo = {}
+        this.getData = []
+        for (let i in data){
+          let obj = {
+            faName:i,
+            child:[]
+          }
+          for(let j in data[i]){
+            if(j!='frequency'&&data[i][j]&&!data[i][j].isCalculation){
+              this.dataAcquisitionInfo[i+','+j] = {
+                value:data[i][j].result,
+                frequency:data[i].frequency
+              }
+            }else if(j!='frequency'&&data[i][j]&&data[i][j].isCalculation){
+              let str0 = i+','+j
+              let list = this.tableList[0].arr
+              let maxNum = 0
+              list.forEach((item,index)=>{
+                let num0 = 0;
+                let str = ''
+                item.forEach(m=>{
+                  if(m.v.ps&&(m.v.ps.value=='妫�楠屽瓙椤�'||m.v.ps.value=='妫�楠岄」')){
+                    if(m.v.ps&&m.v.ps.value=='妫�楠岄」'){
+                      if(num0==0){
+                        str = m.v.v+','
+                        num0++
+                      }
+                    }
+                    if(m.v.ps&&m.v.ps.value=='妫�楠屽瓙椤�'){
+                      if(num0==1){
+                        str = str+m.v.v
+                      }
+                    }
+                    let num = 0;
+                    list[index].forEach(n=>{
+                      if(n.v.ps&&n.v.ps.value&&typeof n.v.ps.value == 'string'&&n.v.ps.value.includes('妫�楠屽��')){
+                        num++
+                      }
+                    })
+                    if(str0==str){
+                      maxNum = num
+                    }
+                  }
+                })
+              })
+              console.log(44444444444,maxNum)
+              let obj0 = {
+                name:j,
+                arr:data[i][j].result,
+                maxNum:maxNum
+              }
+              obj.child.push(obj0)
+            }
+          }
+          if(obj.child.length>0){
+            this.getData.push(obj)
+          }
+        }
+        if(this.getData.length>0){
+          this.dataGetDia = true
+        }else{
+          try {
+            // 鍚� Worker 鍙戦�佹秷鎭紝寮�濮嬪鐞嗛�昏緫
+            this.worker0.postMessage(JSON.stringify({
+              dataAcquisitionInfo: this.dataAcquisitionInfo,
+              list:this.tableList[0].arr
+            }));
+          } catch (error) {
+            console.log(1111,error);
+          }
+        }
+        // 鐩戝惉 Worker 杩斿洖鐨勭粨鏋�
+        this.worker0.onmessage = (event) => {
+          let result = JSON.parse(event.data);
+          if(result.method=='changeInput'){
+            let {list,n} = result.value
+            this.$set(this.tableList[0],'arr',list)
+            this.changeInput('',`${this.currentSample.insProduct[0].templateId}-${n.r}-${n.c}-${n.i}`,n)
+          }
+        };
       },
       beforeDataGetDia(done){
         this.$confirm('鏄惁鍙栨秷鏁版嵁閲囬泦?', "鎻愮ず", {
@@ -1299,10 +1363,49 @@
             done()
           }else{
             this.dataGetDia = false
+            this.getDataIndex = []
           }
         }).catch(() => {})
       },
-      submitDataGet(){},
+      submitDataGet(){
+        if(this.getDataIndex.length==0){
+          this.$message.error('璇烽�夋嫨闇�瑕佽绠楃殑鏁版嵁')
+          return
+        }
+        this.getDataIndex.sort((a, b) => a - b);
+        for (let i in this.dataAcquisitionInfoNew){
+          for(let j in this.dataAcquisitionInfoNew[i]){
+            if(j!='frequency'&&this.dataAcquisitionInfoNew[i]&&this.dataAcquisitionInfoNew[i][j]&&this.dataAcquisitionInfoNew[i][j].isCalculation){
+              let arr = []
+              for(let k = 0;k<this.dataAcquisitionInfoNew[i][j].result.length;k++){
+                if(this.getDataIndex.includes(k)){
+                  arr.push(this.dataAcquisitionInfoNew[i][j].result[k])
+                }
+              }
+              if(arr.length>0){
+                this.dataAcquisitionInfoNew[i][j].result = arr
+              }
+            }
+          }
+        }
+        this.getDataIndexLoading = true;
+        this.$axios.post(this.$api.deviceScope.formulaCalculation,{
+          ...this.dataAcquisitionInfoNew
+        }, {
+          headers: {
+            'Content-Type': 'application/json'
+          },
+          noQs:true
+        }).then(res=>{
+          this.getDataIndexLoading = false;
+          if(res.code!=200){
+            return
+          }
+          this.dataGetDia = false
+          this.handleDataAcquisition(res.data)
+          this.getDataIndex = []
+        })
+      },
       // 澶氱嚎绋�
       startWorker() {
         if (this.worker) {
@@ -1933,6 +2036,12 @@
         this.getTableLists();
         this.currentKey = row.index
         this.currentTab = null;
+        this.worker.postMessage(JSON.stringify({
+          type: 'saveData',
+          tableList:this.tableList,
+          param:this.param,
+          currentTable:this.currentTable
+        }));
       },
       getReportModel(id){
         if(this.PROJECT!='妫�娴嬩腑蹇�'){

--
Gitblit v1.9.3