From 57e76b55709e8ea88a83ab6c3f665fd9ee7fd64c Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期三, 03 七月 2024 14:23:48 +0800
Subject: [PATCH] Merge branch 'master' of http://114.132.189.42:9002/r/center-lims-before into master

---
 src/components/do/b1-ins-order/add.vue |  139 ++++++++++++++++++++++++++++++++++-----------
 1 files changed, 104 insertions(+), 35 deletions(-)

diff --git a/src/components/do/b1-ins-order/add.vue b/src/components/do/b1-ins-order/add.vue
index 81458d7..20b16e4 100644
--- a/src/components/do/b1-ins-order/add.vue
+++ b/src/components/do/b1-ins-order/add.vue
@@ -436,6 +436,7 @@
             <div style="display: flex;align-items: center;flex-direction: column;font-size: 14px">
               <span>妫�楠岄」</span>
               <el-input
+                v-if="active==1"
               v-model="inspectionItem"
               @input="searchFilterList"
               size="mini"
@@ -449,6 +450,7 @@
             <div style="display: flex;align-items: center;flex-direction: column;font-size: 14px">
               <span>妫�楠岄」瀛愰」</span>
               <el-input
+                v-if="active==1"
                 v-model="inspectionItemSubclass"
                 @input="searchFilterList"
                 size="mini"
@@ -463,6 +465,7 @@
             <div style="display: flex;align-items: center;flex-direction: column;font-size: 14px">
               <span>璇曢獙鏂规硶</span>
               <el-input
+                v-if="active==1"
                 v-model="methodS"
                 @input="searchFilterList"
                 size="mini"
@@ -785,6 +788,9 @@
               :data="opticalProject"
               tooltip-effect="dark"
               style="width: 100%"
+              @row-click="rowClickOptical"
+              @select="selectOpticalProject"
+              @select-all="selectAllOptical"
               @selection-change="handleSelectionChange">
               <el-table-column
                 type="selection"
@@ -811,17 +817,17 @@
             style="width: 100%">
             <el-table-column prop="date" label="娓╁害鐐�(鈩�)" width="120px">
               <template slot-scope="scope">
-                <el-input size="small" v-model="scope.row.temperaturePoint" clearable placeholder="璇疯緭鍏�"></el-input>
+                <el-input size="small" v-model="scope.row.temperaturePoint" clearable placeholder="璇疯緭鍏�" @change="changeTemperature"></el-input>
               </template>
             </el-table-column>
             <el-table-column prop="name" label="瑕佹眰(dB/Km)">
               <template slot-scope="scope">
                 <span>x</span>
-                <el-select v-model="scope.row.askSymbol" placeholder="璇烽�夋嫨" size="small" style="width: 120px">
+                <el-select v-model="scope.row.askSymbol" placeholder="璇烽�夋嫨" size="small" style="width: 120px" @change="changeTemperature">
                   <el-option v-for="item in temperatureDataList" :key="item.value" :label="item.label" :value="item.value">
                   </el-option>
                 </el-select>
-                <el-input size="small" v-model="scope.row.askNum" clearable placeholder="璇疯緭鍏�" style="width: 120px"></el-input>
+                <el-input size="small" v-model="scope.row.askNum" clearable placeholder="璇疯緭鍏�" style="width: 120px" @change="changeTemperature"></el-input>
               </template>
             </el-table-column>
           </el-table>
@@ -1098,22 +1104,31 @@
           this.$message.error('璇峰~鍐欏畬鏁存暟鎹�')
           return
         }
+        // 鎷兼帴瑕佹眰鍊糰sk
         const opticalProjectList = JSON.parse(JSON.stringify(this.opticalProjectList))
+        opticalProjectList.forEach(o => {
+          o.temperatureData.forEach(t => {
+            if (!t.temperaturePoint || !t.askSymbol || !t.askNum) {
+              throw this.$message.error('璇峰~鍐欏畬鏁存暟鎹�')
+            }
+          })
+        })
         let entrustTime = this.circulateForm.entrustTime
         let entrustNum = this.circulateForm.entrustNum
-        let temperaturePoint1 = JSON.parse(JSON.stringify(this.temperatureData))
-
-        let temperaturePoint = JSON.parse(JSON.stringify(this.temperatureData))
-        temperaturePoint.unshift({temperaturePoint: 20, askSymbol: null, askNum: null})
+        let opticalProjectList2 = JSON.parse(JSON.stringify(this.opticalProjectList))
         let askArr = []
         let opticalProjectArr = []
-        // 鎷兼帴瑕佹眰鍊糰sk
         opticalProjectList.forEach(o => {
           opticalProjectArr.push(o.value)
-          temperaturePoint.forEach(t => {
-            t.temperaturePoint = t.temperaturePoint + '鈩�'
-            const askObj = t.temperaturePoint + ',' + o.value + ',' + t.askSymbol + t.askNum
-            askArr.push(askObj)
+          o.temperatureData.unshift({temperaturePoint: 20})
+          o.temperatureData.forEach(t => {
+            if (!t.askSymbol) {
+                  const askObj = t.temperaturePoint + '鈩�' + ',' + o.value + ',' + null
+                  askArr.push(askObj)
+                } else {
+                  const askObj = t.temperaturePoint + '鈩�' + ',' + o.value + ',' + t.askSymbol + t.askNum
+                  askArr.push(askObj)
+                }
           })
         })
         askArr.push(this.circulateForm.entrustNum)
@@ -1124,22 +1139,22 @@
         let temperaturePointList2 = []
         entrustTime = entrustTime + 'h'
         entrustNum = entrustNum + '娆�'
-        temperaturePoint.forEach(t => {
-          t.temperaturePoint = t.temperaturePoint + '鈩�'
-          temperaturePointList.push(t.temperaturePoint)
+        opticalProjectList2.forEach(o => {
+          o.temperatureData.forEach(t => {
+            t.temperaturePoint = t.temperaturePoint + '鈩�'
+            temperaturePointList2.push(t.temperaturePoint)
+            temperaturePointList.push(t.temperaturePoint)
+            askNum.push(t.askSymbol + t.askNum + 'dB/Km')
+          })
         })
-        temperaturePoint1.forEach(t => {
-          if (!t.temperaturePoint || !t.askSymbol || !t.askNum) {
-            throw this.$message.error('璇峰~鍐欏畬鏁存暟鎹�')
-          }
-          t.temperaturePoint = t.temperaturePoint + '鈩�'
-          askNum.push(t.askSymbol + t.askNum + 'dB/Km')
-          temperaturePointList2.push(t.temperaturePoint)
-        })
+        temperaturePointList = Array.from(new Set(temperaturePointList))
+        temperaturePointList2 = Array.from(new Set(temperaturePointList2))
+        temperaturePointList2.unshift(20 + '鈩�')
         let additionArr = []
         askNum.forEach(a => {
-          additionArr.push(temperaturePointList2.join(',') + a)
+          additionArr.push(temperaturePointList.join(',') + a)
         })
+        additionArr = Array.from(new Set(additionArr))
         const tell = '娓╁害鑼冨洿:' + temperaturePointList2.join(',') + ';' + '淇濇俯鏃堕棿:' + entrustTime + ';' + '寰幆娆℃暟:'
           + entrustNum + ';' + '鍏夌氦(' + opticalProjectArr.join(',') + ')' + '闄勫姞琛板噺缁濆鍊�:' + additionArr.join(';')
         this.productList.forEach(item => {
@@ -1148,6 +1163,8 @@
             item.tell = tell
           }
         })
+        console.log('ask---', ask)
+        console.log('tell---', tell)
         this.circulateShow = false
       },
       beforeCirculateShowClose () {
@@ -1165,14 +1182,48 @@
       handleSelectionChange(val) {
         this.opticalProjectList = val;
       },
+      selectAllOptical (val) {
+        if (val.length > 0) {
+          if (val[val.length-1].temperatureData) {
+            this.temperatureData = this.HaveJson(val.temperatureData)
+          } else {
+            this.temperatureData = []
+          }
+        } else {
+          this.temperatureData = []
+        }
+        this.circulateForm.entrustPoint = this.temperatureData.length
+      },
+      selectOpticalProject (val) {
+        if (val.temperatureData) {
+          this.temperatureData = this.HaveJson(val.temperatureData)
+        } else {
+          this.temperatureData = []
+        }
+        this.circulateForm.entrustPoint = this.temperatureData.length
+      },
+      rowClickOptical (val) {
+        const index = this.opticalProjectList.findIndex(item => item.value === val.value)
+        if (index > -1 && val.temperatureData) {
+          this.temperatureData = this.HaveJson(val.temperatureData)
+        }
+        this.circulateForm.entrustPoint = this.temperatureData.length
+      },
+      changeTemperature () {
+        this.opticalProjectList.forEach(item => {
+          item.temperatureData = this.HaveJson(this.temperatureData)
+        })
+      },
       addTemperatureData () {
         const obj = {}
         this.temperatureData.push(obj)
+        this.circulateForm.entrustPoint = this.temperatureData.length
       },
       deleteTemperatureData () {
         if (this.temperatureData.length > 0) {
           this.temperatureData = this.temperatureData.slice(0,-1)
         }
+        this.circulateForm.entrustPoint = this.temperatureData.length
       },
       changeTemperatureData () {
         const length = this.temperatureData.length
@@ -1324,7 +1375,7 @@
             }
           })
           console.log('isHaveBushing===', isHaveBushing)
-          if (productListSelected && select[2] === '鍏夌紗' && !isHaveBushing) {
+          if (productListSelected && select[2] === '鍏夌紗' && isHaveBushing === false) {
             this.$message.error('鍏夌紗娓╁害寰幆椤圭洰蹇呴』杩涜鍏夌氦閰嶇疆')
             return
           }
@@ -1381,18 +1432,36 @@
                   })
                 }else if(type==1){
                   let arr = this.editTable.filter(b => b.sampleId == item.id)
-                  arr.forEach(f => {
-                    if(a.ask.includes(f.symbolItem)){
-                      let ask = calBack(a.ask, f.symbolItem,f.value)
-                      if (ask) {
-                        a.ask = ask
+                  for (var i=0;i<arr.length;i++){
+                    if(a.ask){
+                      if(a.ask.includes(arr[i].symbolItem)){
+                        let ask = calBack(a.ask, arr[i].symbolItem,arr[i].value)
+                        if (ask) {
+                          a.ask = ask
+                        }
+                        let tell = this.handleTell(a.tell, arr[i].symbolItem,arr[i].value)
+                        if (tell) {
+                          a.tell = tell
+                        }
                       }
-                      let tell = this.handleTell(a.tell, f.symbolItem,f.value)
-                      if (tell) {
-                        a.tell = tell
-                      }
+                    }else{
+                      this.$message.error('瑕佹眰鍊间负绌猴紝闇�瑕佸幓鏍囧噯搴撶淮鎶わ紒')
                     }
-                  })
+                  }
+                  // arr.forEach(f => {
+                  //   if(a.ask){
+                  //     if(a.ask.includes(f.symbolItem)){
+                  //       let ask = calBack(a.ask, f.symbolItem,f.value)
+                  //       if (ask) {
+                  //         a.ask = ask
+                  //       }
+                  //       let tell = this.handleTell(a.tell, f.symbolItem,f.value)
+                  //       if (tell) {
+                  //         a.tell = tell
+                  //       }
+                  //     }
+                  //   }else{}
+                  // })
                 }
               }
             })

--
Gitblit v1.9.3