From b87e9e675beff118396cedd9d7af20569c3d63b1 Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期三, 11 十二月 2024 10:30:16 +0800
Subject: [PATCH] 电路试验上传文件报错

---
 src/components/do/b1-inspect-order-plan/circuit-parameters1.vue |   93 +++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 90 insertions(+), 3 deletions(-)

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..14bf808 100644
--- a/src/components/do/b1-inspect-order-plan/circuit-parameters1.vue
+++ b/src/components/do/b1-inspect-order-plan/circuit-parameters1.vue
@@ -439,6 +439,7 @@
     // 鍒濆鍖栨暟鎹�
     initData(){
       this.allBandList = []
+      this.intermodulationNum = 0
       // 澶勭悊椤圭洰
       this.insProductNew = JSON.parse(JSON.stringify(this.insProduct)).filter(m=>m.inspectionItem.includes('鐢佃矾璇曢獙'))
       this.insProductNew.forEach(async item => {
@@ -452,6 +453,55 @@
         // 宸茬粡瀛樺湪鍊兼椂锛岃祴鍊�
         let bandList = this.insProductNew[0].insProductResult2.map(m=>m.frequency)
         bandList = Array.from(new Set(bandList))
+        // 涓婁紶闄勪欢鍚庯紝璁剧疆妫�楠岄」鏁版嵁涓虹┖鐨勫唴瀹�
+        let sample = this.insProductNew[0];//鑾峰彇椹绘尝姣旂殑鏁版嵁锛屽鏋滈┗娉㈡瘮鍊煎瓨鍦ㄨ�屽叾浠栨楠岄」鍊间笉瀛樺湪锛屽垯鏍规嵁椹绘尝姣旇缃粯璁ゆ暟鎹�
+        if(sample.insProductResult2&&sample.insProductResult2.length>0){
+          this.insProductNew.forEach(item => {
+            if(!item.inspectionItemSubclass.includes('椹绘尝姣�')&&(!item.insProductResult2||item.insProductResult2.length==0||item.insProductResult2.length<bandList.length)){
+              if(!(item.insProductResult2.length>0&&item.insProductResult2.length<bandList.length)){
+                item.insProductResult2 = []
+              }
+              sample.insProductResult2.forEach(m=>{
+                let obj = this.HaveJson(m)
+                // 濡傛灉鏁版嵁鏈夛紝浣嗘槸涓嶅鎵�鏈夐娈电殑鏁伴噺锛屽垯琛ュ叏鏁版嵁
+                if(item.insProductResult2.length>0&&item.insProductResult2.length<bandList.length){
+                  let obj0 = item.insProductResult2.find(n=>m.frequency==n.frequency)
+                  if(!obj0){
+                    let port = '1,2,3,4'
+                    let value = JSON.parse(m.value)
+                    let value0 = []
+                    value.forEach(n=>{
+                      if(!item.inspectionItemSubclass.includes('鑰﹀悎搴�')){
+                        value0.push(['','','',''])
+                      }else{
+                        value0.push([''])
+                      }
+                    })
+                    obj.port = port
+                    obj.value = JSON.stringify(value0)
+                    item.insProductResult2.push(obj)
+                  }
+                }else{
+                  // 濡傛灉涓�鏉℃暟鎹兘娌℃湁锛屽垯琛ュ叏鏁版嵁
+                  let port = '1,2,3,4'
+                  let value = JSON.parse(m.value)
+                  let value0 = []
+                  value.forEach(n=>{
+                    if(!item.inspectionItemSubclass.includes('鑰﹀悎搴�')){
+                      value0.push(['','','',''])
+                    }else{
+                      value0.push([''])
+                    }
+                  })
+                  obj.port = port
+                  obj.value = JSON.stringify(value0)
+                  item.insProductResult2.push(obj)
+                }
+              })
+            }
+          })
+        }
+        // 缁х画鍥炴樉鏁版嵁
         this.allBandList = []
         for(let i = 0;i<bandList.length;i++){
           let arr = []
@@ -798,15 +848,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
+        }
       }
     },
     // 鏇存柊妯℃澘

--
Gitblit v1.9.3