From 81150f2c6e86f747a7e7539e91f7b75e9fa87075 Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期二, 10 十二月 2024 14:14:38 +0800
Subject: [PATCH] 电路试验退出保存优化

---
 src/components/do/b1-inspect-order-plan/circuit-parameters1.vue |   43 ++++++++++++++++++++-
 src/components/do/b1-inspect-order-plan/circuit-parameters2.vue |   43 ++++++++++++++++++++-
 src/components/do/b1-inspect-order-plan/Inspection.vue          |   14 +++---
 src/view/index.vue                                              |    4 +-
 src/assets/api/controller.js                                    |    1 
 5 files changed, 90 insertions(+), 15 deletions(-)

diff --git a/src/assets/api/controller.js b/src/assets/api/controller.js
index 32fa955..2f5953d 100644
--- a/src/assets/api/controller.js
+++ b/src/assets/api/controller.js
@@ -198,6 +198,7 @@
   doInsOrder: "/insOrderPlan/doInsOrder", //鎵ц妫�楠屾搷浣�
   saveInsContext: "/insOrderPlan/saveInsContext", //淇濆瓨妫�楠屽唴瀹�
   saveInsContext2: "/insOrderPlan/saveInsContext2", //淇濆瓨妫�楠屽唴瀹�--鐢佃矾璇曢獙
+  saveInsContext2s: "/insOrderPlan/saveInsContext2s", //淇濆瓨妫�楠屽唴瀹�--鐢佃矾璇曢獙--涓�娆℃�т繚瀛�
   saveInsContext3: "/insOrderPlan/saveInsContext3", //淇濆瓨妫�楠屽唴瀹�--娓╂箍搴︽楠�
   deleteInsContext: "/insOrderPlan/deleteInsContext", //鍒犻櫎棰戞
   deleteInsContext2: "/insOrderPlan/deleteInsContext2", //鍒犻櫎棰戠偣
diff --git a/src/components/do/b1-inspect-order-plan/Inspection.vue b/src/components/do/b1-inspect-order-plan/Inspection.vue
index c09a890..014a596 100644
--- a/src/components/do/b1-inspect-order-plan/Inspection.vue
+++ b/src/components/do/b1-inspect-order-plan/Inspection.vue
@@ -802,7 +802,7 @@
     </el-drawer>
     <el-dialog title="妫�楠屽鏍�" :visible.sync="reviewDia" width="500px">
       <div class="body" style="display: flex;padding: 10px;" v-if="reviewDia">
-        <div class="search_label" style="width: 150px;"><span class="required-span">* </span>涓嶉�氳繃鐨勭悊鐢憋細</div>
+        <div class="search_label" style="width: 150px;"><span class="required-span">* </span>鍐嶆璇曢獙鐨勭悊鐢憋細</div>
         <div class="search_input" style="width: 100%;">
           <el-input size="small" clearable v-model="noReason" type="textarea" :autosize="{ minRows: 4}"></el-input>
         </div>
@@ -3319,7 +3319,7 @@
           this.addVerifyDia = true
         }
       },
-      handleSubmit(){
+      async handleSubmit(){
         if(!this.otherForm.temperature){
           this.$message.error('璇疯緭鍏ユ俯搴�')
           return
@@ -3328,7 +3328,7 @@
           this.$message.error('璇疯緭鍏ユ箍搴�')
           return
         }
-        if(this.sonLaboratory === '鐢佃矾璇曢獙'&&!this.$refs.CircuitParameters.saveAll()){
+        if(this.sonLaboratory === '鐢佃矾璇曢獙'&&!(await this.$refs.CircuitParameters.saveAll())){
           return
         }
         this.experimentDia = true
@@ -3734,12 +3734,12 @@
           }
 				}
 			},
-      beforeUpload(file) {
+      async beforeUpload(file) {
         if(this.sonLaboratory === '鐢佃矾璇曢獙'&&!this.$refs.CircuitParameters.allBandList.find(m=>m.band)){
           this.$message.error('涓婁紶闄勪欢鍓嶈鍏堝~鍐欏苟淇濆瓨棰戞');
           return false
         }else{
-          this.$refs.CircuitParameters.saveAll()
+          await this.$refs.CircuitParameters.saveAll()
           if (file.size > 1024 * 1024 * 10) {
             this.$message.error('涓婁紶鏂囦欢涓嶈秴杩�10M');
             this.$refs.upload.clearFiles()
@@ -3846,8 +3846,8 @@
             confirmButtonText: '纭畾',
             cancelButtonText: '鍙栨秷',
             type: 'warning'
-          }).then(() => {
-            if(this.$refs.CircuitParameters.saveAll()){
+          }).then(async () => {
+            if(await this.$refs.CircuitParameters.saveAll()){
               this.$emit('goback')
             }
           })
diff --git a/src/components/do/b1-inspect-order-plan/circuit-parameters1.vue b/src/components/do/b1-inspect-order-plan/circuit-parameters1.vue
index f38bd20..b1a94cc 100644
--- a/src/components/do/b1-inspect-order-plan/circuit-parameters1.vue
+++ b/src/components/do/b1-inspect-order-plan/circuit-parameters1.vue
@@ -798,15 +798,52 @@
         console.log(err)
       })
     },
-    saveAll(){
+    async saveAll(){
       if(this.allBandList.find(m=>!m.band)){
         this.$message.error('璇峰厛濉啓棰戞')
         return false
       }else{
+        let arr0 = []
         this.allBandList.forEach((h,j)=>{
-          this.save(h,j)
+          // this.save(h,j)
+          let arr = h.projectList.map(item=>{
+            if(item.portList&&item.portList.length>0){
+              item.value.forEach(m=>{
+                m = m.splice(item.portList.length)
+              })
+            }
+            let obj = {
+              insProductId:item.id,
+              equipValue:this.insProductNew.find(m=>m.id==item.id).equipValue,
+              equipName:this.insProductNew.find(m=>m.id==item.id).equipName,
+              port:item.portList.map(m=>m.value).join(','),
+              angle:item.angleList.map(m=>m.value).join(','),
+              value:JSON.stringify(item.value),
+              often:item.often
+            }
+            return obj
+          })
+          let obj0 = {
+            sampleId:this.orderId,
+            sonLaboratory:h.projectList[0].sonLaboratory,
+            frequency:h.band,
+            insProductResult2s:arr
+          }
+          arr0.push(obj0)
         })
-        return true
+        let res = await this.$axios.post(this.$api.insOrderPlan.saveInsContext2s, {insProductResultDtos:arr0
+        }, {
+        headers: {
+          'Content-Type': 'application/json'
+        },
+        noQs:true})
+        if(res.code===201){
+          this.$message.error('淇濆瓨澶辫触')
+          return false
+        }else{
+          this.$message.success('宸蹭繚瀛�')
+          return true
+        }
       }
     },
     // 鏇存柊妯℃澘
diff --git a/src/components/do/b1-inspect-order-plan/circuit-parameters2.vue b/src/components/do/b1-inspect-order-plan/circuit-parameters2.vue
index dd90199..a03c9a6 100644
--- a/src/components/do/b1-inspect-order-plan/circuit-parameters2.vue
+++ b/src/components/do/b1-inspect-order-plan/circuit-parameters2.vue
@@ -674,15 +674,52 @@
         console.log(err)
       })
     },
-    saveAll(){
+    async saveAll(){
       if(this.allBandList.find(m=>!m.band)){
         this.$message.error('璇峰厛濉啓棰戞')
         return false
       }else{
+        let arr0 = []
         this.allBandList.forEach((h,j)=>{
-          this.save(h,j)
+          // this.save(h,j)
+          let arr = h.projectList.map(item=>{
+            if(item.portList&&item.portList.length>0){
+              item.value.forEach(m=>{
+                m = m.splice(item.portList.length)
+              })
+            }
+            let obj = {
+              insProductId:item.id,
+              equipValue:this.insProductNew.find(m=>m.id==item.id).equipValue,
+              equipName:this.insProductNew.find(m=>m.id==item.id).equipName,
+              port:item.portList.map(m=>m.value).join(','),
+              angle:item.angleList.map(m=>m.value).join(','),
+              value:JSON.stringify(item.value),
+              often:item.often
+            }
+            return obj
+          })
+          let obj0 = {
+            sampleId:this.orderId,
+            sonLaboratory:h.projectList[0].sonLaboratory,
+            frequency:h.band,
+            insProductResult2s:arr
+          }
+          arr0.push(obj0)
         })
-        return true
+        let res = await this.$axios.post(this.$api.insOrderPlan.saveInsContext2s, {insProductResultDtos:arr0
+        }, {
+        headers: {
+          'Content-Type': 'application/json'
+        },
+        noQs:true})
+        if(res.code===201){
+          this.$message.error('淇濆瓨澶辫触')
+          return false
+        }else{
+          this.$message.success('宸蹭繚瀛�')
+          return true
+        }
       }
     },
     // 鏇存柊妯℃澘
diff --git a/src/view/index.vue b/src/view/index.vue
index efe8884..3716b4c 100644
--- a/src/view/index.vue
+++ b/src/view/index.vue
@@ -518,8 +518,8 @@
             confirmButtonText: '纭畾',
             cancelButtonText: '鍙栨秷',
             type: 'warning'
-          }).then(() => {
-            if(obj.$refs.Inspection.$refs.CircuitParameters.saveAll()){
+          }).then( async () => {
+            if(await obj.$refs.Inspection.$refs.CircuitParameters.saveAll()){
               this.tabs.splice(index, 1);
               let data = this.tabs[this.tabs.length - 1]
               this.upTabActive(data.k)

--
Gitblit v1.9.3