zss
2025-08-13 647cb2146a5914bf584046234b87839a314c6dc3
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;">辐射试验尽量上传设备导出的csv文件,不然触发不了报告生成</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 (
@@ -3477,9 +3528,9 @@
        }
      }
      // 通信特殊处理,检验值填入之后直接保存数据,判断结果默认为3
      for (var i in this.param) {
        this.param[i].insResult = { v: { v: 3 } };
      }
      // for (var i in this.param) {
      //   this.param[i].insResult = { v: { v: 3 } };
      // }
      this.saveInsContext(n.i);
      return;
      // 以下是正常的判断流程,后面有需要则进入此流程
@@ -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)
@@ -4237,9 +4293,13 @@
      } else if ('实验结果') {
        // 实验结果
        if (val == '无异常') {
          this.param[n.i].insResult.v.v = 1
          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.param[n.i].insResult.v.v = 0
          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);
      } else {
@@ -4429,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) {
@@ -4473,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;
@@ -4549,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() {