From b40d8371913805a2926ba1c5f9bdcafd36dfff05 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期四, 21 八月 2025 16:42:16 +0800
Subject: [PATCH] 电路试验修改

---
 src/components/do/b1-inspect-order-plan/Inspection.vue |  104 ++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 97 insertions(+), 7 deletions(-)

diff --git a/src/components/do/b1-inspect-order-plan/Inspection.vue b/src/components/do/b1-inspect-order-plan/Inspection.vue
index e8e5583..3f2c62e 100644
--- a/src/components/do/b1-inspect-order-plan/Inspection.vue
+++ b/src/components/do/b1-inspect-order-plan/Inspection.vue
@@ -315,6 +315,7 @@
           <span style="color: #3A7BFA;">淇濆瓨妯℃澘</span>
         </el-button>
         <!-- <el-button size="small" type="primary" @click="sampleVisible=true;uploadSample()">鏍峰搧鍒囨崲</el-button> -->
+        <el-button size="small" type="primary" @click="showSampleChangeDialog"  v-show="!isLook">鏍峰搧缂栧彿鏇存敼</el-button>
         <el-button size="small" type="primary" @click="taskVisible = true" v-show="!isLook">浠诲姟鍒囨崲</el-button>
         <el-button size="small" type="primary" @click="handleSubmit" v-if="state == 1"
           :loading="submitLoading">鎻愪氦</el-button>
@@ -961,7 +962,7 @@
         sampleId: id,
         sonLaboratory: sonLaboratory
       }" v-if="state == 1 && fileAdd" :on-success="handleSuccessUp" :show-file-list="false"
-        accept=".jpg,.jpeg,.png,.gif,.docx,.xls,.xlsx,.pdf,.zip,.rar,.csv" :headers="headers"
+        accept=".jpg,.jpeg,.png,.gif,.docx,.doc,.xls,.xlsx,.pdf,.zip,.rar,.csv" :headers="headers"
         :before-upload="beforeUpload" style="width: 80px !important;" :on-error="onError" ref="upload">
         <el-button size="small" type="primary" v-if="state == 1">闄勪欢涓婁紶</el-button></el-upload>
       <!-- <span v-if="sonLaboratory === '杩滃満'||sonLaboratory === '杩戝満'" style="color: red;font-size: 12px;">杈愬皠璇曢獙灏介噺涓婁紶璁惧瀵煎嚭鐨刢sv鏂囦欢锛屼笉鐒惰Е鍙戜笉浜嗘姤鍛婄敓鎴�</span> -->
@@ -1168,6 +1169,21 @@
         <el-button type="primary" @click="upInsReview" :loading="reviewLoading">纭� 瀹�</el-button>
       </span>
     </el-dialog>
+    <el-dialog
+      title="淇敼鏍峰搧缂栧彿"
+      :visible.sync="changeSampleDialog"
+      width="30%"
+      :before-close="handleCloseSampleChangeDialog">
+      <el-form ref="changeSampleFormRef" :model="changeSampleForm" :rules="{sampleCode:[{required:true,message:'璇疯緭鍏ユ牱鍝佺紪鍙�',trigger:'blur'}]}">
+        <el-form-item label="鏍峰搧缂栧彿:" prop="sampleCode" >
+        <el-input clearable v-model="changeSampleForm.sampleCode" placeholder='鏍峰搧缂栧彿'></el-input>
+      </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="handleCloseSampleChangeDialog">鍙� 娑�</el-button>
+        <el-button type="primary" @click="confirmChangeSample">纭� 瀹�</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 
@@ -1206,6 +1222,10 @@
   },
   data() {
     return {
+      changeSampleDialog: false,
+      changeSampleForm:{
+        sampleCode:null,
+      },
       lookFileVisible: false, //棰勮鏂囦欢
       experimentDia: false,
       experimentDia0: false,
@@ -1645,6 +1665,37 @@
     this.stopWorker();
   },
   methods: {
+    handleCloseSampleChangeDialog(){
+      this.changeSampleForm = {sampleChange:null}
+      this.$refs.changeSampleFormRef.resetFields();
+      this.changeSampleDialog = false
+    },
+    //纭淇敼鏍峰搧缂栧彿
+    confirmChangeSample(){
+      this.$refs.changeSampleFormRef.validate((valid)=>{
+        if(valid){
+          this.$axios.post(this.$api.insOrderPlan.changeSampleCode,{
+            id:this.currentSample.id,
+            sampleCode:this.changeSampleForm.sampleCode
+          },{
+            headers:{"Content-Type":"application/json"}
+          }).then(res=>{
+            if(res.code==200){
+              this.$message.success("淇敼鎴愬姛")
+              //璋冪敤鍒锋柊鏂规硶
+              this.currentSample.sampleCode = this.changeSampleForm.sampleCode
+            }
+            this.$nextTick(()=>{
+              this.handleCloseSampleChangeDialog()
+            })
+          })
+        }
+      })
+    },
+    //鏄剧ず淇敼鏍峰搧缂栧彿
+    showSampleChangeDialog(){
+      this.changeSampleDialog = true
+    },
     // 鏁版嵁閲囬泦
     getDataAcquisitionDevice() {
       if (
@@ -3927,8 +3978,13 @@
       if (name == '妫�楠屽師濮嬭褰�' || name == '杈愬皠璇曢獙妫�娴嬪師濮嬭褰�') {
         let num = 0
         for (let i in this.param) {
-          if (this.param[i].insResult.v.v != 0 && this.param[i].insResult.v.v != 1) {
-            num++;
+          if (!this.param[i].insResult || !this.param[i].insResult.v || (!this.param[i].insResult.v.v && this.param[i].insResult.v.v !== 0)) {
+            this.$message.error("璇疯緭鍏ユ楠岃繃绋嬪��");
+            return;
+          } else {
+            if (this.param[i].insResult.v.v != 0 && this.param[i].insResult.v.v != 1) {
+              num++;
+            }
           }
         }
         console.log(3333, num)
@@ -4236,10 +4292,13 @@
         this.saveInsContext(n.i);
       } else if ('瀹為獙缁撴灉') {
         // 瀹為獙缁撴灉
-        this.$set(this.param[n.i].insResult, "v", {});
         if (val == '鏃犲紓甯�') {
+          this.$set(this.param[n.i], "insResult", {});
+          this.$set(this.param[n.i].insResult, "v", {});
           this.$set(this.param[n.i].insResult.v, "v", 1);
         } else if (val == '涓嶅悎鏍�') {
+          this.$set(this.param[n.i], "insResult", {});
+          this.$set(this.param[n.i].insResult, "v", {});
           this.$set(this.param[n.i].insResult.v, "v", 0);
         }
         this.saveInsContext(n.i);
@@ -4430,12 +4489,40 @@
         if (this.sonLaboratory === "鐢佃矾璇曢獙") {
           // // 鐢佃矾璇曢獙鏁伴噰
           // 鑾峰彇褰撳墠鏍峰搧鐨勬楠岄」
-          let list = await this.getCurrentProduct(this.currentSample.id, 0);
-          this.currentSample.insProduct = this.HaveJson(list);
-          this.currentNum++;
+          if (response.data &&
+            ((response.data.includes('xlsx') && response.data.includes('浜よ皟')) ||
+              (response.data.includes('csv') && response.data.includes('椹绘尝')))) {
+            let list = await this.getCurrentProduct(this.currentSample.id, 0);
+            this.currentSample.insProduct = this.HaveJson(list);
+            this.currentNum++;
+          }
+        } else if (this.sonLaboratory === "鎸姩") {
+          this.getDocAnalysis(response.data)
         }
       } else {
         this.$message.error(response.message);
+      }
+    },
+    getDocAnalysis(data) {
+      const psToDataKeyMap = {
+        '妫�楠屽��1': '1',
+        '妫�楠屽��9': '9',
+        '妫�楠屽��10': '10',
+        '妫�楠屽��11': '11',
+        '妫�楠屽��12': '12',
+        '妫�楠屽��13': '13',
+      };
+
+      for (let i in this.param) {
+        this.param[i].insValue.forEach(a => {
+          // 妫�鏌ュ綋鍓嶇殑ps.value鏄惁鍦ㄦ槧灏勮〃涓瓨鍦�
+          if (a.v.ps.value && psToDataKeyMap.hasOwnProperty(a.v.ps.value)) {
+            // 浣跨敤鏄犲皠琛ㄤ腑鐨勫�间粠data瀵硅薄鑾峰彇瀵瑰簲鐨勫��
+            a.v.v = data[psToDataKeyMap[a.v.ps.value]];
+            // 璋冪敤淇濆瓨涓婁笅鏂囩殑鏂规硶
+            this.saveInsContext(a.i);
+          }
+        });
       }
     },
     beforeUpload(file) {
@@ -4474,9 +4561,11 @@
             let url = "";
             if (res.data.type == 1) {
               url = this.javaApi + "/img/" + res.data.fileUrl;
+              url = url.replace(/#/g, "%23");
               file.downloadIamge(url, row.fileName);
             } else {
               url = this.javaApi + "/word/" + res.data.fileUrl;
+              url = url.replace(/#/g, "%23");
               const link = document.createElement("a");
               link.href = url;
               link.download = row.fileName;
@@ -4550,6 +4639,7 @@
       } else {
         this.currentFile.url = this.javaApi + "/word/" + row.fileUrl;
       }
+      this.currentFile.url = this.currentFile.url.replace(/#/g, "%23");
       this.lookFileVisible = true;
     },
     handleBack() {

--
Gitblit v1.9.3