From 332125c247b8cec21af77479f07ef35558eb6bba Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期五, 02 八月 2024 17:24:09 +0800
Subject: [PATCH] 合并冲突

---
 src/components/do/b1-ins-order/add.vue                 |    2 
 static/js/worker0.js                                   |   74 ++++++++++++------
 src/main.js                                            |    2 
 src/components/do/b1-inspect-order-plan/Inspection.vue |  141 +++++++++++++++++++++++++---------
 src/assets/api/controller.js                           |    1 
 5 files changed, 155 insertions(+), 65 deletions(-)

diff --git a/src/assets/api/controller.js b/src/assets/api/controller.js
index 394fb22..9602a9e 100644
--- a/src/assets/api/controller.js
+++ b/src/assets/api/controller.js
@@ -157,6 +157,7 @@
   treeDevice: "/deviceScope/treeDevice", // 璁惧鏍戝舰
   temDataAcquisition: "/deviceScope/temDataAcquisition", // PK8000鏁伴噰
   temDataAcquisition2: "/deviceScope/temDataAcquisition2", // PK8000鏁伴噰--澶氭潯
+  formulaCalculation: "/deviceScope/formulaCalculation", // 鏁伴噰-鍏紡璁$畻
 }
 
 const insOrder = {
diff --git a/src/components/do/b1-ins-order/add.vue b/src/components/do/b1-ins-order/add.vue
index 88699bb..49505a1 100644
--- a/src/components/do/b1-ins-order/add.vue
+++ b/src/components/do/b1-ins-order/add.vue
@@ -1778,6 +1778,7 @@
       },
       saveMethod(sampleList){
         this.saveLoad = true
+        console.log(333333,sampleList)
         this.$axios.post(this.$api.insOrder.addInsOrder, {
           str: JSON.stringify({
             insOrder: this.addObj,
@@ -2109,7 +2110,6 @@
           row.bsm1 = false
         }else if(arr.length>0){
           try{
-          row.bsmRow = this.HaveJson(row)
           let section = arr[0].section
           let arr0 = JSON.parse(row.section)
           let arr1 = JSON.parse(row.ask)
diff --git a/src/components/do/b1-inspect-order-plan/Inspection.vue b/src/components/do/b1-inspect-order-plan/Inspection.vue
index fb039ae..cf3a9cd 100644
--- a/src/components/do/b1-inspect-order-plan/Inspection.vue
+++ b/src/components/do/b1-inspect-order-plan/Inspection.vue
@@ -798,10 +798,8 @@
               <td>{{ item.child[0].name }}</td>
               <td>
                 <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">
+                  <el-checkbox v-for="(n,j) in item.child[0].arr" :label="j" :key="j+'ppppppppp'">{{n}}</el-checkbox>
                 </el-checkbox-group>
               </td>
             </tr>
@@ -809,10 +807,8 @@
               <td>{{ m.name }}</td>
               <td>
                 <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">
+                  <el-checkbox v-for="(n,j) in m.arr" :label="j" :key="j+'bbbbbbbbbbbbbb'">{{n}}</el-checkbox>
                 </el-checkbox-group>
               </td>
             </tr>
@@ -820,7 +816,7 @@
         </table>
       </div>
       <span slot="footer" class="dialog-footer">
-        <el-button type="primary" @click="submitDataGet()">纭� 瀹�</el-button>
+        <el-button type="primary" @click="submitDataGet()" :loading="getDataIndexLoading">纭� 瀹�</el-button>
       </span>
     </el-dialog>
   </div>
@@ -987,6 +983,7 @@
         worker0: null,
         wareLength:[],
         dataAcquisitionInfo:{},
+        dataAcquisitionInfoNew:{},
         dataAcquisitionEidt:0,
         dataAcquisitionEidtAble:false,
         dataAcquisitionLoading:false,
@@ -1007,15 +1004,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],
               },
             ]
           },
@@ -1025,12 +1018,12 @@
               {
                 name:'鎴嚦娉㈤暱',
                 arr:[12,13,14,15],
-                maxNum:3,
-                value:[]
               }
             ]
           }
-        ]
+        ],
+        getDataIndex:[],
+        getDataIndexLoading:false
       }
     },
     computed: {
@@ -1266,27 +1259,60 @@
             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]){
+            console.log(j,data[i][j])
+            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 obj0 = {
+                name:j,
+                arr:data[i][j].result
+              }
+              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('鏄惁鍙栨秷鏁版嵁閲囬泦?', "鎻愮ず", {
@@ -1298,10 +1324,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][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) {
diff --git a/src/main.js b/src/main.js
index e0c50da..9e816aa 100644
--- a/src/main.js
+++ b/src/main.js
@@ -20,7 +20,7 @@
 //鏈湴
 // Vue.prototype.LOCATIONVUE = "http://127.0.0.1:80";
 // const javaApi = 'http://127.0.0.1:8001';
-const javaApi = 'http://172.20.10.5:8001';
+const javaApi = 'http://172.20.10.4:8001';
 
 //浜�
 // Vue.prototype.LOCATIONVUE = "http://114.132.189.42:8080";
diff --git a/static/js/worker0.js b/static/js/worker0.js
index ffff123..d29f483 100644
--- a/static/js/worker0.js
+++ b/static/js/worker0.js
@@ -13,7 +13,6 @@
 }
 
 function handleData(){
-  // console.log(33333,dataAcquisitionInfo)
   list.forEach((item,index)=>{
     let num = 0;
     let str = ''
@@ -40,35 +39,39 @@
           list[index].forEach((n,i)=>{
             if(n.v.ps&&n.v.ps.value&&typeof n.v.ps.value == 'string'&&n.v.ps.value.includes('妫�楠屽��')){
               let arr = n.v.ps.value.split('鍊�')
-              if(arr[1] ==dataAcquisitionInfo.frequency){
-                setTimeout(()=>{
-                  let num = 0
-                  if(n.v.ct&&n.v.ct.fa&&typeof n.v.ct.fa == 'string'&&n.v.ct.fa.includes('.')){
-                    let str = n.v.ct.fa.split('.')[1]
-                    num = str.length
-                    n.v.v = dataAcquisitionInfo[str]?dataAcquisitionInfo[str].toFixed(num):dataAcquisitionInfo[str]
-                  }else{
-                    n.v.v = dataAcquisitionInfo[str]
+              if(Array.isArray(dataAcquisitionInfo[str].value)){
+                for (let i = 0; i < dataAcquisitionInfo[str].value.length; i++) {
+                  if(i+1==arr[1]){
+                    setTimeout(()=>{
+                      let num0 = 0
+                      if(n.v.ct&&n.v.ct.fa&&typeof n.v.ct.fa == 'string'&&n.v.ct.fa.includes('.')){
+                        let str = n.v.ct.fa.split('.')[1]
+                        num0 = str.length
+                        n.v.v = dataAcquisitionInfo[str].value[i]?dataAcquisitionInfo[str].value[i].toFixed(num0):dataAcquisitionInfo[str].value[i]
+                      }else{
+                        n.v.v = dataAcquisitionInfo[str].value[i]
+                      }
+                      result = {
+                        method:'changeInput',
+                        value:{
+                          list:list,
+                          n:n
+                        }
+                      }
+                      self.postMessage(JSON.stringify(result))
+                    },2000)
                   }
-                  result = {
-                    method:'changeInput',
-                    value:{
-                      list:list,
-                      n:n
-                    }
-                  }
-                  self.postMessage(JSON.stringify(result))
-                },2000)
-              }else if(Number(dataAcquisitionInfo.frequency)>num){
-                if(n.v.ps.value.includes(num)){
+                }
+              }else{
+                if(arr[1] ==dataAcquisitionInfo[str].frequency){
                   setTimeout(()=>{
-                    let num = 0
+                    let num0 = 0
                     if(n.v.ct&&n.v.ct.fa&&typeof n.v.ct.fa == 'string'&&n.v.ct.fa.includes('.')){
                       let str = n.v.ct.fa.split('.')[1]
-                      num = str.length
-                      n.v.v = dataAcquisitionInfo[str]?Number(dataAcquisitionInfo[str]).toFixed(num):dataAcquisitionInfo[str]
+                      num0 = str.length
+                      n.v.v = dataAcquisitionInfo[str].value?dataAcquisitionInfo[str].value.toFixed(num0):dataAcquisitionInfo[str].value
                     }else{
-                      n.v.v = dataAcquisitionInfo[str]
+                      n.v.v = dataAcquisitionInfo[str].value
                     }
                     result = {
                       method:'changeInput',
@@ -79,6 +82,27 @@
                     }
                     self.postMessage(JSON.stringify(result))
                   },2000)
+                }else if(Number(dataAcquisitionInfo[str].frequency)>num){
+                  if(n.v.ps.value.includes(num)){
+                    setTimeout(()=>{
+                      let num0 = 0
+                      if(n.v.ct&&n.v.ct.fa&&typeof n.v.ct.fa == 'string'&&n.v.ct.fa.includes('.')){
+                        let str = n.v.ct.fa.split('.')[1]
+                        num0 = str.length
+                        n.v.v = dataAcquisitionInfo[str].value?Number(dataAcquisitionInfo[str].value).toFixed(num0):dataAcquisitionInfo[str].value
+                      }else{
+                        n.v.v = dataAcquisitionInfo[str].value
+                      }
+                      result = {
+                        method:'changeInput',
+                        value:{
+                          list:list,
+                          n:n
+                        }
+                      }
+                      self.postMessage(JSON.stringify(result))
+                    },2000)
+                  }
                 }
               }
             }

--
Gitblit v1.9.3