吴羡
4 天以前 cc121bdad21d778a3ba471082665bd34026d8c1a
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>
@@ -596,13 +596,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 +629,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 +697,7 @@
.title {
  position: relative;
  font-size: 16px;
  color: #333;
  color: var(--lims-text);
  font-weight: 400;
  padding-left: 10px;
  margin-bottom: 10px;