src/views/CNAS/resourceDemand/device/component/equipmentVerificationPlan.vue
@@ -203,8 +203,8 @@
    </el-dialog>
    <el-dialog v-model="downloadDialog" title="导出" width="600px">
      <span>
        <el-button :loading="outLoading" plain type="primary" @click="controlDown">核查记录</el-button>
        <el-button :loading="outLoading" plain type="primary" @click="processingDown">核查比对记录</el-button>
        <el-button :loading="outLoading" type="primary" :disabled="!downRow.recordStatus" @click="controlDown">核查记录</el-button>
        <el-button :loading="outLoading" type="primary" :disabled="!downRow.recordContrastStatus" @click="processingDown">核查比对记录</el-button>
      </span>
      <template #footer><span  class="dialog-footer">
        <el-button @click="downloadDialog = false">取 消</el-button>
@@ -249,10 +249,12 @@
} from '@/api/cnas/resourceDemand/device.js'
import { selectUserCondition } from "@/api/performance/class";
import { mapGetters } from "@/utils/store-compat";
import draftSave from '@/mixins/draftSave'
export default {
  name: "equipment-verification-plan",
  // import 引入的组件需要注入到对象中才能使用
  components: { AddVerificationYearPlanDia, CheckRecord, EquipmentCheck },
  mixins: [draftSave],
  props: {
    clickNodeVal: {
      type: Object,
@@ -495,6 +497,9 @@
      if (this.operationType !== 'add') {
        this.$nextTick(() => {
          this.form = this.HaveJson(row)
          if (this.operationType !== 'view') {
            this.draftRestore('equipmentVerificationPlan', 'form', this.form.planDetailsId, 'dialogVisible')
          }
        })
      } else {
        this.form = {
@@ -510,6 +515,7 @@
          planId: this.currentRow.planId,
          planDetailsId: '',
        }
        this.draftRestore('equipmentVerificationPlan', 'form', this.form.planId, 'dialogVisible')
      }
    },
    // 提交表单
@@ -521,6 +527,7 @@
            addDeviceExaminePlanDetail(this.form).then(res => {
              if (res.code == 200) {
                this.$message.success('新增成功')
                this.draftClear('equipmentVerificationPlan')
                this.dialogVisible = false
                this.getYearTableData()
              }
@@ -533,6 +540,7 @@
            updateDeviceExaminePlanDetail(this.form).then(res => {
              if (res.code == 200) {
                this.$message.success('新增成功')
                this.draftClear('equipmentVerificationPlan')
                this.dialogVisible = false
                this.getYearTableData()
              }
@@ -564,6 +572,7 @@
      })
    },
    resetForm() {
      this.draftStop('equipmentVerificationPlan')
      this.$refs.modelForm.resetFields();
      this.dialogVisible = false
    },
@@ -596,13 +605,32 @@
      this.downRow = row
      this.downloadDialog = true
    },
    // 导出结果拦截: 后端返回错误 JSON 时提示错误, 不存成坏文件
    saveDocx(res, filename) {
      const reader = new FileReader();
      reader.readAsText(res, 'utf-8');
      reader.onload = () => {
        const text = (reader.result || '').trim();
        if (text.startsWith('{') || text.startsWith('[')) {
          let msg = '导出失败';
          try { msg = JSON.parse(text).msg || msg; } catch (e) {}
          this.$message.error(msg);
        } else {
          this.$download.saveAs(new Blob([res], { type: 'application/msword' }), filename);
        }
      };
      reader.onerror = () => {
        this.$download.saveAs(new Blob([res], { type: 'application/msword' }), filename);
      };
    },
    // 核查记录导出
    controlDown() {
      this.outLoading = true
      exportReviewExamineRecordDetail({ planDetailsId: this.downRow.planDetailsId }).then(res => {
        this.outLoading = false
        const blob = new Blob([res], { type: 'application/octet-stream' });
        this.$download.saveAs(blob, '仪器设备期间核查记录表.doc')
        this.saveDocx(res, '仪器设备期间核查记录表.doc')
      }).catch(() => {
        this.outLoading = false
      })
    },
    // 核查对比导出
@@ -610,8 +638,9 @@
      this.outLoading = true
      exportReviewExamineRecordContrast({ planDetailsId: this.downRow.planDetailsId }).then(res => {
        this.outLoading = false
        const blob = new Blob([res], { type: 'application/octet-stream' });
        this.$download.saveAs(blob, '仪器设备期间核查比对记录表.doc')
        this.saveDocx(res, '仪器设备期间核查比对记录表.doc')
      }).catch(() => {
        this.outLoading = false
      })
    },
    // 导入流程
@@ -677,7 +706,7 @@
.title {
  position: relative;
  font-size: 16px;
  color: #333;
  color: var(--lims-text);
  font-weight: 400;
  padding-left: 10px;
  margin-bottom: 10px;