From b572bdc7da9c6c47df9be5939f5d3280f2127546 Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期五, 02 八月 2024 17:18:35 +0800
Subject: [PATCH] Merge branch 'test' of http://114.132.189.42:9002/r/center-lims-before into test

---
 src/components/do/b1-inspect-order-plan/Inspection.vue |  225 ++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 201 insertions(+), 24 deletions(-)

diff --git a/src/components/do/b1-inspect-order-plan/Inspection.vue b/src/components/do/b1-inspect-order-plan/Inspection.vue
index de39416..8db3532 100644
--- a/src/components/do/b1-inspect-order-plan/Inspection.vue
+++ b/src/components/do/b1-inspect-order-plan/Inspection.vue
@@ -784,6 +784,42 @@
         <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">
+      <div>
+        <table border="1" cellpadding="10" class="thermal-table">
+          <tr>
+            <td style="width: 120px;">妫�楠岄」</td>
+            <td style="width: 120px;">妫�楠屽瓙椤�</td>
+            <td>鏁伴噰鏁版嵁</td>
+          </tr>
+          <template v-for="(item,index) in getData">
+            <tr>
+              <td :rowspan="item.child.length">{{item.faName}}</td>
+              <td>{{ item.child[0].name }}</td>
+              <td>
+                <el-checkbox-group
+                  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>
+            <tr v-for="(m,i) in item.child" :key="i+'bbbbbbbbbbbbbb'" v-show="i>0">
+              <td>{{ m.name }}</td>
+              <td>
+                <el-checkbox-group
+                  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>
+          </template>
+        </table>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="beforeDataGetDia()">鍙� 娑�</el-button>
+        <el-button type="primary" @click="submitDataGet()" :loading="getDataIndexLoading">纭� 瀹�</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 
@@ -798,6 +834,7 @@
     },
     data() {
       return {
+        dataGetDia:false,
         wareTableDataLoading:false,
         fileAdd:false,
         sampleVisible: false,
@@ -947,6 +984,7 @@
         worker0: null,
         wareLength:[],
         dataAcquisitionInfo:{},
+        dataAcquisitionInfoNew:{},
         dataAcquisitionEidt:0,
         dataAcquisitionEidtAble:false,
         dataAcquisitionLoading:false,
@@ -961,6 +999,32 @@
         },
         thermalCyclingLoading:false,
         temDataAcquisition:false,
+        getData:[
+          {
+            faName:'娉㈤暱闄勫姞琛板噺',
+            child:[
+              {
+                name:'1285nm~1330nm',
+                arr:[12,13,14,15],
+              },
+              {
+                name:'1525nm~1575nm',
+                arr:[12,13,14,15],
+              },
+            ]
+          },
+          {
+            faName:'鎴嚦娉㈤暱',
+            child:[
+              {
+                name:'鎴嚦娉㈤暱',
+                arr:[12,13,14,15],
+              }
+            ]
+          }
+        ],
+        getDataIndex:[],
+        getDataIndexLoading:false
       }
     },
     computed: {
@@ -1196,27 +1260,113 @@
             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('鏄惁鍙栨秷鏁版嵁閲囬泦?', "鎻愮ず", {
+          confirmButtonText: "纭畾",
+          cancelButtonText: "鍙栨秷",
+          type: "warning"
+        }).then(() => {
+          if(done){
+            done()
+          }else{
+            this.dataGetDia = false
+            this.getDataIndex = []
+          }
+        }).catch(() => {})
+      },
+      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() {
@@ -1848,6 +1998,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!='妫�娴嬩腑蹇�'){
@@ -1874,6 +2030,12 @@
             })
             this.getTableLists0(list)
             this.getReportModel(this.currentSample.id)
+            this.worker.postMessage(JSON.stringify({
+              type: 'saveData',
+              tableList:this.tableList,
+              param:this.param,
+              currentTable:this.currentTable
+            }));
           }else{
             this.tableLists = []
             this.tableList = []
@@ -2308,14 +2470,14 @@
           try {
             let comValue = JSON.parse(a.insProductResult.comValue)
             for (var i = 0; i < comValue.length; i++) {
-              this.param[a.id].comValue[i].v.v = comValue[i].v
+              this.param[a.id].comValue[i].v.v = this.toFixed(comValue[i].v,this.param[a.id].comValue[i].v.ct)
             }
           } catch (e) {}
           try {
             let insValue = JSON.parse(a.insProductResult.insValue)
             for (let i = 0; i < insValue.length; i++) {
               if(this.param[a.id].insValue.find(m=>m.c==insValue[i].c&&m.r==insValue[i].r)){
-                this.param[a.id].insValue.find(m=>m.c==insValue[i].c&&m.r==insValue[i].r).v.v = insValue[i].v
+                this.param[a.id].insValue.find(m=>m.c==insValue[i].c&&m.r==insValue[i].r).v.v = this.toFixed(insValue[i].v,this.param[a.id].insValue.find(m=>m.c==insValue[i].c&&m.r==insValue[i].r).v.ct)
                 this.param[a.id].insValue.find(m=>m.c==insValue[i].c&&m.r==insValue[i].r).u = insValue[i].u
                 // this.param[a.id].insValue[i].v.v = insValue[i].v
                 // this.param[a.id].insValue[i].u = insValue[i].u
@@ -2384,7 +2546,7 @@
             }
           } catch (e) {}
           try {
-            this.param[a.id].resValue.v.v = a.lastValue
+            this.param[a.id].resValue.v.v = this.toFixed(a.lastValue,this.param[a.id].resValue.v.ct)
             this.param[a.id].insResult.v.v = a.insResult
           } catch (e) {}
         })
@@ -2590,6 +2752,15 @@
       },
       getValue(v){
         let str = v.v?v.v:(v.v===0?v.v:(v.ct&&v.ct.s?v.ct.s.length>0&&v.ct.s[0].v.replace(new RegExp('\n', 'g'), '<br/>').replace(new RegExp('@', 'g'), '<br/>'):''))
+        if(v.ct&&v.ct.fa&&v.ct.fa.includes('.')&&str){
+          let num = 0
+          let str0 = v.ct.fa.split('.')[1]
+          num = str0.length
+          str = Number(str).toFixed(num)
+        }
+        if(v.v&&typeof v.v == 'string'&&v.v.includes('@')){
+          str = v.v.replace(new RegExp('@', 'g'), '<br/>')
+        }
         return str
       },
       getInspectionValueType(id) {
@@ -2967,6 +3138,12 @@
           }
         })
         this.getTableLists()
+        this.worker.postMessage(JSON.stringify({
+          type: 'saveData',
+          tableList:this.tableList,
+          param:this.param,
+          currentTable:this.currentTable
+        }));
       },
       caretBushing(num){
         let index = this.currentKey0 + num
@@ -3098,12 +3275,12 @@
        * @returns 鏍煎紡鍖栧悗鐨勫瓧绗︿覆鎴栧師濮嬫暟鍊硷紙鑻ラ厤缃笉绗﹀悎瑕佹眰锛�
        */
       toFixed(v,ct){
-        if(v&&ct&&ct.fa&&ct.fa.includes('##')){
+        if(v&&ct&&ct.fa){
           if(ct.fa.includes('.')){
             let num = ct.fa.slice(4).length
             return Number(v).toFixed(num)
           }else{
-            return Number(v).toFixed(0)
+            return v
           }
         }else{
           return v

--
Gitblit v1.9.3