吴羡
3 小时以前 a1faa94fbf85553f22da934a1abc745d89dd8667
fix: 取消设备核查/比对的身份限制与三张设备计划的审批功能

- 核查记录、期间核查比对:确定/通过按钮不再限制责任人身份
- 设备核查、校准、保养计划:移除批准通知/批准(审核)入口,编辑删除不再受审批状态锁定
- 标准物质:统一名称为标准物质台账,移除导入功能及模板下载接口
已修改7个文件
428 ■■■■■ 文件已修改
src/api/cnas/resourceDemand/standardMaterial/standardMaterial.js 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/resourceDemand/device/component/checkRecord.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/resourceDemand/device/component/equipmentCalibrationPlan.vue 113 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/resourceDemand/device/component/equipmentCheck.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/resourceDemand/device/component/equipmentMaintenancePlan.vue 108 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/resourceDemand/device/component/equipmentVerificationPlan.vue 105 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/CNAS/resourceDemand/standardMaterial/index.vue 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/cnas/resourceDemand/standardMaterial/standardMaterial.js
@@ -9,7 +9,7 @@
  })
}
//标准物质清单新增编辑
//标准物质台账新增编辑
export function addStandardSubstance(query) {
  return request({
    url: '/feStandardSubstance/addStandardSubstance',
@@ -18,7 +18,7 @@
  })
}
//删除标准物质清单
//删除标准物质台账
export function removeStandardSubstance(query) {
  return request({
    url: '/feStandardSubstance/removeStandardSubstance',
@@ -37,16 +37,7 @@
  });
}
// 下载标准物质导入模板
export function downloadStandardSubstanceImportTemplate() {
  return request({
    url: '/feStandardSubstance/importTemplate',
    method: 'get',
    responseType: 'blob'
  })
}
//标准物质清单借用
//标准物质台账借用
export function borrowSubstance(query) {
  return request({
    url: '/feStandardSubstanceRecord/borrowSubstance',
src/views/CNAS/resourceDemand/device/component/checkRecord.vue
@@ -210,10 +210,10 @@
      </el-row>
      <template #footer><span  class="dialog-footer">
        <el-button @click="resetForm">取 消</el-button>
        <el-button v-if="currentStep === 0 && checkChargerUserId == userId" :loading="submitFormLoading" type="primary" @click="submitCheck">确
        <el-button v-if="currentStep === 0" :loading="submitFormLoading" type="primary" @click="submitCheck">确
          定</el-button>
        <el-button v-if="currentStep === 1 && userId == reviewUserId" :loading="submitFormLoading" @click="examine(0)">不通过</el-button>
        <el-button v-if="currentStep === 1 && userId == reviewUserId" :loading="submitFormLoading" type="primary" @click="examine(1)">通
        <el-button v-if="currentStep === 1" :loading="submitFormLoading" @click="examine(0)">不通过</el-button>
        <el-button v-if="currentStep === 1" :loading="submitFormLoading" type="primary" @click="examine(1)">通
          过</el-button>
      </span></template>
    </el-dialog>
src/views/CNAS/resourceDemand/device/component/equipmentCalibrationPlan.vue
@@ -11,10 +11,6 @@
        </div>
        <div>
          <el-button size="small" type="primary" @click="loadPlan">刷新</el-button>
          <el-button size="small" type="primary" :disabled="planInfo.ratifyStatus === 1"
            @click="tellApprove">批准通知</el-button>
          <el-button size="small" type="primary"
            :disabled="planInfo.ratifyStatus === 1 || userId != planInfo.ratifyUserId" @click="handleApprove">批准</el-button>
          <el-button size="small" type="primary" @click="downLoadPost">导出</el-button>
        </div>
      </div>
@@ -67,10 +63,10 @@
          <template #default="scope">
            <el-button size="small" link type="primary" :disabled="!scope.row.deviceId"
              @click="handleExecute(scope.row)">执行</el-button>
            <el-button size="small" link type="primary" :disabled="planInfo.ratifyStatus === 1"
            <el-button size="small" link type="primary"
              @click="handleForm('edit', scope.row)">编辑</el-button>
            <el-button size="small" link type="primary" @click="handleForm('view', scope.row)">查看</el-button>
            <el-button size="small" link type="danger" :disabled="planInfo.ratifyStatus === 1"
            <el-button size="small" link type="danger"
              @click="deleteFun1(scope.row.planDetailId)">删除</el-button>
          </template>
        </el-table-column>
@@ -138,29 +134,6 @@
          认</el-button>
      </span></template>
    </el-dialog>
    <el-dialog v-model="approvalDialog" title="批准" width="30%" @close="approvalDialog = false">
      <span>
        批准备注:
        <el-input v-model="ratifyRemark" type="textarea"></el-input>
      </span>
      <template #footer><span class="dialog-footer">
        <el-button :loading="approvalLoading" @click="handleApproval(0)">不批准</el-button>
        <el-button :loading="approvalLoading" type="primary" @click="handleApproval(1)">批 准</el-button>
      </span></template>
    </el-dialog>
    <el-dialog v-model="notificationDia" title="提交批准" width="30%" @close="closeNotificationDia">
      <span style="margin-top: 10px;display: inline-block">
        请选择批准人:
        <el-select v-model="ratifyUserId" clearable filterable size="small" style="width: 90%;">
          <el-option v-for="item in responsibleOptions" :key="item.value" :label="item.label" :value="item.value">
          </el-option>
        </el-select>
      </span>
      <template #footer><span class="dialog-footer">
        <el-button :loading="notificationLoading" @click="closeNotificationDia">取 消</el-button>
        <el-button :loading="notificationLoading" type="primary" @click="notification">提 交</el-button>
      </span></template>
    </el-dialog>
    <!-- 添加/查看校准记录弹窗 -->
    <calibration-record-dia ref="calibrationRecordDia" @success="getYearTableDetailData"></calibration-record-dia>
  </div>
@@ -171,15 +144,11 @@
import {
  pageDeviceCalibrationPlan,
  getCalibrationPlanByYear,
  submiatRatifyDeviceCalibrationPlan,
  exportDeviceCalibrationPlanDetail,
  delDeviceCalibrationPlanDetail,
  pageDeviceCalibrationPlanDetail,
  updateDeviceCalibrationPlanDetail,
  ratifyDeviceCalibrationPlan,
} from '@/api/cnas/resourceDemand/device.js'
import { selectUserCondition } from "@/api/performance/class";
import { mapGetters } from "@/utils/store-compat";
import { formatDateOnly } from './dateFormat'
import { saveBlobOrShowError } from '@/utils/saveBlob'
export default {
@@ -229,15 +198,7 @@
        planDate: [{ required: true, message: '请选择日期', trigger: 'change' }],
      },
      yearTableDetailDataLoading: false,
      approvalDialog: false,
      approvalLoading: false,
      submitFormLoading: false,
      ratifyRemark: '',
      currentRowId: '',
      responsibleOptions: [],
      notificationDia: false,
      notificationLoading: false,
      ratifyUserId: '',
    }
  },
  mounted() {
@@ -383,60 +344,6 @@
        });
      });
    },
    // 打开提交批准弹框
    tellApprove() {
      this.getUserList()
      this.notificationDia = true
    },
    // 关闭提交批准弹框
    closeNotificationDia() {
      this.notificationDia = false
      this.ratifyUserId = ''
    },
    // 提交批准通知
    notification() {
      if (!this.ratifyUserId) {
        this.$message.warning('请选择批准人')
        return
      }
      this.notificationLoading = true
      submiatRatifyDeviceCalibrationPlan({
        ratifyUserId: this.ratifyUserId,
        planId: this.planInfo.planId,
      }).then(res => {
        this.notificationLoading = false
        if (res.code == 200) {
          this.closeNotificationDia()
          this.loadPlan()
        }
      }).catch(err => {
        this.notificationLoading = false
      })
    },
    // 批准
    handleApprove() {
      this.currentRowId = this.planInfo.planId
      this.approvalDialog = true
    },
    // 提交批准结果
    handleApproval(status) {
      const personTrainingUpdateDto = {
        planId: this.currentRowId,
        ratifyRemark: this.ratifyRemark,
        ratifyStatus: status
      }
      this.approvalLoading = true
      ratifyDeviceCalibrationPlan(personTrainingUpdateDto).then(res => {
        if (res.code === 200) {
          this.$message.success('提交成功!');
          this.approvalDialog = false
          this.loadPlan()
        }
        this.approvalLoading = false
      }).catch(() => {
        this.approvalLoading = false
      })
    },
    // 导出
    downLoadPost() {
      exportDeviceCalibrationPlanDetail({ planId: this.planInfo.planId }).then(res => {
@@ -446,25 +353,9 @@
    resetForm() {
      this.$refs.modelForm.resetFields();
      this.dialogVisible = false
    },
    // 获取负责人信息接口
    getUserList() {
      selectUserCondition().then(res => {
        if (res.code == 200) {
          let data = [];
          res.data.forEach((a) => {
            data.push({
              label: a.name,
              value: a.id,
            });
          });
          this.responsibleOptions = data
        }
      });
    }
  },
  computed: {
    ...mapGetters(["userId"]),
    // 是否已完成审批(批准/不批准)
    isRatified() {
      return this.planInfo.ratifyStatus === 0 || this.planInfo.ratifyStatus === 1;
src/views/CNAS/resourceDemand/device/component/equipmentCheck.vue
@@ -128,10 +128,10 @@
      </div>
      <template #footer><span  class="dialog-footer">
        <el-button @click="handleCancel">取 消</el-button>
        <el-button v-if="currentStep === 0 && userId == checkChargerUserId" :loading="submitFormLoading" type="primary" @click="submitCheck">确
        <el-button v-if="currentStep === 0" :loading="submitFormLoading" type="primary" @click="submitCheck">确
          定</el-button>
        <el-button v-if="currentStep === 1 && userId == reviewUserId" :loading="submitFormLoading" @click="examine(0)">不通过</el-button>
        <el-button v-if="currentStep === 1 && userId == reviewUserId" :loading="submitFormLoading" type="primary" @click="examine(1)">通
        <el-button v-if="currentStep === 1" :loading="submitFormLoading" @click="examine(0)">不通过</el-button>
        <el-button v-if="currentStep === 1" :loading="submitFormLoading" type="primary" @click="examine(1)">通
          过</el-button>
      </span></template>
    </el-dialog>
src/views/CNAS/resourceDemand/device/component/equipmentMaintenancePlan.vue
@@ -11,10 +11,6 @@
        </div>
        <div>
          <el-button size="small" type="primary" @click="loadPlan">刷新</el-button>
          <el-button size="small" type="primary" :disabled="planInfo.status === 1"
            @click="tellApprove">审核通知</el-button>
          <el-button size="small" type="primary"
            :disabled="planInfo.status === 1 || userId != planInfo.auditId" @click="handleApprove">审核</el-button>
          <el-button size="small" type="primary" :loading="outLoading" @click="handleDownOne">导出</el-button>
        </div>
      </div>
@@ -23,7 +19,6 @@
        <span>编制日期:{{ planInfo.datePreparationStr || '—' }}</span>
        <span v-if="planInfo.status === 1">审核状态:<el-tag type="success">通 过</el-tag></span>
        <span v-else-if="planInfo.status === 0">审核状态:<el-tag type="danger">不通过</el-tag></span>
        <span v-else>审核状态:<el-tag type="info">未审核</el-tag></span>
        <span v-if="planInfo.auditRemark">审核信息:{{ planInfo.auditRemark }}</span>
        <span v-if="isAudited && planInfo.audit">审核人:{{ planInfo.audit }}</span>
        <span v-if="isAudited && planInfo.auditDateStr">审核时间:{{ planInfo.auditDateStr }}</span>
@@ -66,10 +61,10 @@
          :formatter="formatDateCell"></el-table-column>
        <el-table-column align="center" fixed="right" label="操作" min-width="160">
          <template #default="scope">
            <el-button size="small" link type="primary" :disabled="planInfo.status === 1"
            <el-button size="small" link type="primary"
              @click="handleForm('edit', scope.row)">编辑</el-button>
            <el-button size="small" link type="primary" @click="handleForm('view', scope.row)">查看</el-button>
            <el-button size="small" link type="danger" :disabled="planInfo.status === 1"
            <el-button size="small" link type="danger"
              @click="deleteRow(scope.row)">删除</el-button>
          </template>
        </el-table-column>
@@ -132,45 +127,18 @@
          v-if="operationType !== 'view'">确 认</el-button>
      </span></template>
    </el-dialog>
    <el-dialog v-model="approvalDialog" title="审核" width="30%" @close="approvalDialog = false">
      <span>
        审核信息:
        <el-input v-model="approvalRemark" type="textarea"></el-input>
      </span>
      <template #footer><span class="dialog-footer">
        <el-button :loading="approvalLoading" @click="handleApproval(0)">不通过</el-button>
        <el-button :loading="approvalLoading" type="primary" @click="handleApproval(1)">通 过</el-button>
      </span></template>
    </el-dialog>
    <el-dialog v-model="notificationDia" title="提交审核" width="30%" @close="closeNotificationDia">
      <span style="margin-top: 10px;display: inline-block">
        请选择审核人:
        <el-select v-model="auditUserId" clearable filterable size="small" style="width: 90%;">
          <el-option v-for="item in responsibleOptions" :key="item.value" :label="item.label" :value="item.value">
          </el-option>
        </el-select>
      </span>
      <template #footer><span class="dialog-footer">
        <el-button :loading="notificationLoading" @click="closeNotificationDia">取 消</el-button>
        <el-button :loading="notificationLoading" type="primary" @click="notification">提 交</el-button>
      </span></template>
    </el-dialog>
  </div>
</template>
<script>
import {
  selectDeviceMaintenancePlanByPage,
  submitReviewMaintenancePlanStatus,
  getMaintenancePlanByYear,
  pageMaintenancePlanDetail,
  updateMaintenancePlanDetail,
  deleteMaintenancePlanDetail,
  exportDeviceMaintenancePlan,
  reviewMaintenancePlanStatus,
} from '@/api/cnas/resourceDemand/device.js'
import { selectUserCondition } from "@/api/business/inspectionTask";
import { mapGetters } from "@/utils/store-compat";
import { formatDateOnly } from './dateFormat'
import { saveBlobOrShowError } from '@/utils/saveBlob'
export default {
@@ -207,13 +175,6 @@
      },
      submitFormLoading: false,
      outLoading: false,
      responsibleOptions: [],
      notificationDia: false,
      notificationLoading: false,
      auditUserId: '',
      approvalDialog: false,
      approvalLoading: false,
      approvalRemark: '',
    }
  },
  mounted() {
@@ -374,59 +335,6 @@
        });
      });
    },
    // 打开提交审核弹框
    tellApprove() {
      this.getUserList()
      this.notificationDia = true
    },
    // 关闭提交审核弹框
    closeNotificationDia() {
      this.notificationDia = false
      this.auditUserId = ''
    },
    // 提交审核通知
    notification() {
      if (!this.auditUserId) {
        this.$message.warning('请选择审核人')
        return
      }
      this.notificationLoading = true
      submitReviewMaintenancePlanStatus({
        auditId: this.auditUserId,
        maintenancePlanId: this.planInfo.maintenancePlanId,
      }).then(res => {
        this.notificationLoading = false
        if (res.code == 200) {
          this.closeNotificationDia()
          this.loadPlan()
        }
      }).catch(() => {
        this.notificationLoading = false
      })
    },
    // 打开审核弹框
    handleApprove() {
      this.approvalRemark = ''
      this.approvalDialog = true
    },
    // 提交审核结果
    handleApproval(status) {
      this.approvalLoading = true
      reviewMaintenancePlanStatus({
        maintenancePlanId: this.planInfo.maintenancePlanId,
        status: status,
        auditRemark: this.approvalRemark,
      }).then(res => {
        if (res.code == 200) {
          this.$message.success('审核成功!');
          this.approvalDialog = false
          this.loadPlan()
        }
        this.approvalLoading = false
      }).catch(() => {
        this.approvalLoading = false
      })
    },
    // 导出
    handleDownOne() {
      this.outLoading = true
@@ -436,21 +344,9 @@
      }).catch(() => {
        this.outLoading = false
      })
    },
    // 获取负责人信息接口
    getUserList() {
      selectUserCondition().then(res => {
        if (res.code == 200) {
          this.responsibleOptions = (res.data || []).map(item => ({
            label: item.name,
            value: item.id,
          }))
        }
      });
    }
  },
  computed: {
    ...mapGetters(["userId"]),
    // 是否已完成审核(通过/不通过)
    isAudited() {
      return this.planInfo.status === 0 || this.planInfo.status === 1;
src/views/CNAS/resourceDemand/device/component/equipmentVerificationPlan.vue
@@ -11,10 +11,6 @@
        </div>
        <div>
          <el-button size="small" type="primary" @click="loadPlan">刷新</el-button>
          <el-button size="small" type="primary" :disabled="planInfo.ratifyStatus === 1"
            @click="tellApprove">批准通知</el-button>
          <el-button size="small" type="primary"
            :disabled="planInfo.ratifyStatus === 1 || userId != planInfo.ratifyUserId" @click="handleApprove">批准</el-button>
          <el-button size="small" type="primary" @click="downLoadPost">导出</el-button>
        </div>
      </div>
@@ -80,13 +76,13 @@
        <!-- 操作按钮 -->
        <el-table-column align="center" fixed="right" label="操作" min-width="260">
          <template #default="scope">
            <el-button size="small" link type="primary" :disabled="planInfo.ratifyStatus === 1"
            <el-button size="small" link type="primary"
              @click="handleForm('edit', scope.row)">编辑</el-button>
            <el-button size="small" link type="primary" @click="handleForm('view', scope.row)">查看</el-button>
            <el-button size="small" link type="primary" @click="handleRecord(scope.row)">记录</el-button>
            <el-button size="small" link type="primary" @click="handleCheck(scope.row)">对比</el-button>
            <el-button size="small" link type="primary" @click="handleDown(scope.row)">导出</el-button>
            <el-button size="small" link type="danger" :disabled="planInfo.ratifyStatus === 1"
            <el-button size="small" link type="danger"
              @click="deleteFun1(scope.row.planDetailsId)">删除</el-button>
          </template>
        </el-table-column>
@@ -155,16 +151,6 @@
          v-if="operationType !== 'view'">确 认</el-button>
      </span></template>
    </el-dialog>
    <el-dialog v-model="approvalDialog" title="批准" width="30%" @close="approvalDialog = false">
      <span>
        批准备注:
        <el-input v-model="ratifyRemark" type="textarea"></el-input>
      </span>
      <template #footer><span class="dialog-footer">
        <el-button :loading="approvalLoading" @click="handleApproval(0)">不批准</el-button>
        <el-button :loading="approvalLoading" type="primary" @click="handleApproval(1)">批 准</el-button>
      </span></template>
    </el-dialog>
    <el-dialog v-model="downloadDialog" title="导出" width="600px">
      <span>
        <el-button :loading="outLoading" type="primary" :disabled="!downRow.recordStatus"
@@ -174,19 +160,6 @@
      </span>
      <template #footer><span class="dialog-footer">
        <el-button @click="downloadDialog = false">取 消</el-button>
      </span></template>
    </el-dialog>
    <el-dialog v-model="notificationDia" title="提交批准" width="30%" @close="closeNotificationDia">
      <span style="margin-top: 10px;display: inline-block">
        请选择批准人:
        <el-select v-model="ratifyUserId" clearable filterable size="small" style="width: 90%;">
          <el-option v-for="item in responsibleOptions" :key="item.id" :label="item.name" :value="item.id">
          </el-option>
        </el-select>
      </span>
      <template #footer><span class="dialog-footer">
        <el-button :loading="notificationLoading" @click="closeNotificationDia">取 消</el-button>
        <el-button :loading="notificationLoading" type="primary" @click="notification">提 交</el-button>
      </span></template>
    </el-dialog>
    <equipment-check v-if="equipmentCheck" ref="equipmentCheck" @closeDialog="closeDialog"></equipment-check>
@@ -200,17 +173,14 @@
import {
  pageDeviceExaminePlan,
  getExaminePlanByYear,
  submitRatifyDeviceExaminePlan,
  exportDeviceExaminePlanDetail,
  delDeviceExaminePlanDetail,
  pageDeviceExaminePlanDetail,
  updateDeviceExaminePlanDetail,
  ratifyDeviceExaminePlan,
  exportReviewExamineRecordDetail,
  exportReviewExamineRecordContrast,
} from '@/api/cnas/resourceDemand/device.js'
import { selectUserCondition } from "@/api/performance/class";
import { mapGetters } from "@/utils/store-compat";
import draftSave from '@/mixins/draftSave'
import { formatListDate } from './dateFormat'
export default {
@@ -262,21 +232,13 @@
        checkMethod: [{ required: true, message: '请填写核查方法', trigger: 'blur' }],
      },
      yearTableDetailDataLoading: false,
      approvalDialog: false,
      approvalLoading: false,
      submitFormLoading: false,
      ratifyRemark: '',
      currentRowId: '',
      userList: [],
      equipmentCheck: false,
      checkRecord: false,
      downloadDialog: false,
      outLoading: false,
      downRow: {},
      responsibleOptions: [],
      notificationDia: false,
      notificationLoading: false,
      ratifyUserId: '',
    }
  },
  mounted() {
@@ -435,60 +397,6 @@
        });
      });
    },
    // 打开提交批准弹框
    tellApprove() {
      this.getUserList1()
      this.notificationDia = true
    },
    // 关闭提交批准弹框
    closeNotificationDia() {
      this.notificationDia = false
      this.ratifyUserId = ''
    },
    // 提交批准通知
    notification() {
      if (!this.ratifyUserId) {
        this.$message.warning('请选择批准人')
        return
      }
      this.notificationLoading = true
      submitRatifyDeviceExaminePlan({
        ratifyUserId: this.ratifyUserId,
        planId: this.planInfo.planId,
      }).then(res => {
        this.notificationLoading = false
        if (res.code == 200) {
          this.closeNotificationDia()
          this.loadPlan()
        }
      }).catch(err => {
        this.notificationLoading = false
      })
    },
    // 批准
    handleApprove() {
      this.currentRowId = this.planInfo.planId
      this.approvalDialog = true
    },
    // 提交批准结果
    handleApproval(status) {
      const personTrainingUpdateDto = {
        planId: this.currentRowId,
        ratifyRemark: this.ratifyRemark,
        ratifyStatus: status
      }
      this.approvalLoading = true
      ratifyDeviceExaminePlan(personTrainingUpdateDto).then(res => {
        if (res.code === 200) {
          this.$message.success('提交成功!');
          this.approvalDialog = false
          this.loadPlan()
        }
        this.approvalLoading = false
      }).catch(() => {
        this.approvalLoading = false
      })
    },
    // 导出年度计划表
    downLoadPost() {
      exportDeviceExaminePlanDetail({ planId: this.planInfo.planId }).then(res => {
@@ -577,18 +485,9 @@
      if (index > -1) {
        this.form.checkChargerUser = this.userList[index].name
      }
    },
    // 获取负责人信息接口
    getUserList1() {
      selectUserCondition().then(res => {
        if (res.code == 200) {
          this.responsibleOptions = res.data
        }
      });
    }
  },
  computed: {
    ...mapGetters(["userId"]),
    // 是否已完成审批(批准/不批准)
    isRatified() {
      return this.planInfo.ratifyStatus === 0 || this.planInfo.ratifyStatus === 1;
src/views/CNAS/resourceDemand/standardMaterial/index.vue
@@ -19,7 +19,6 @@
      </div>
      <div>
        <el-button size="small" @click="exportFun">导 出</el-button>
        <el-button size="small" type="primary" @click="importVisible = true">导 入</el-button>
      </div>
    </div>
    <div class="table">
@@ -28,22 +27,6 @@
    </div>
    <form-dia v-if="formDia" ref="formDia" @closeYearDia="closeYearDia"></form-dia>
    <borrow-dia v-if="borrowDia" ref="borrowDia" @closeBorrowDia="closeBorrowDia"></borrow-dia>
    <el-dialog title="标准物质导入" v-model="importVisible" width="500px" @closed="resetImport">
      <div style="margin-bottom: 12px;">
        请使用标准物质导入模板填写数据,单个文件不超过10MB。
        <el-button link type="primary" @click="downloadTemplate">下载导入模板</el-button>
      </div>
      <el-upload ref="standardSubstanceUpload" drag name="file" accept=".xlsx" :action="importAction"
                 :headers="uploadHeader" :auto-upload="false" :limit="1" :file-list="importFiles"
                 :before-upload="beforeImport" :on-success="importSuccess" :on-error="importError">
        <lims-icon name="el-icon-upload"></lims-icon>
        <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
      </el-upload>
      <template #footer><span  class="dialog-footer">
        <el-button @click="importVisible = false">取消</el-button>
        <el-button type="primary" :loading="importing" @click="submitImport">导入</el-button>
      </span></template>
    </el-dialog>
  </div>
</template>
@@ -54,8 +37,7 @@
import {
  getPageStandardSubstance,
  removeStandardSubstance,
  exportOfStandardSubstanceList,
  downloadStandardSubstanceImportTemplate
  exportOfStandardSubstanceList
} from '@/api/cnas/resourceDemand/standardMaterial/standardMaterial'
import FormDia from '../standardMaterial/component/formDia.vue';
import BorrowDia from '../standardMaterial/component/borrowDia.vue';
@@ -197,71 +179,18 @@
      total: 0,
      formDia: false,
      borrowDia: false,
      importVisible: false,
      importing: false,
      importFiles: [],
    }
  },
  computed: {
    importAction() {
      return this.javaApi + '/feStandardSubstance/importStandardSubstance'
    }
  },
  mounted() {
    this.searchList()
  },
  methods: {
    downloadTemplate() {
      downloadStandardSubstanceImportTemplate().then(res => {
        this.$download.saveAs(new Blob([res]), '标准物质导入模板.xlsx')
      })
    },
    submitImport() {
      if (!this.$refs.standardSubstanceUpload.uploadFiles.length) {
        this.$message.warning('请选择需要导入的Excel文件')
        return
      }
      this.$refs.standardSubstanceUpload.submit()
    },
    beforeImport(file) {
      if (!file.name.toLowerCase().endsWith('.xlsx')) {
        this.$message.error('仅支持.xlsx格式文件')
        return false
      }
      if (file.size > 10 * 1024 * 1024) {
        this.$message.error('导入文件不能超过10MB')
        return false
      }
      this.importing = true
      return true
    },
    importSuccess(response) {
      this.importing = false
      if (response.code !== 200) {
        this.$message.error(response.message || response.msg || '导入失败')
        return
      }
      this.$message.success(`成功导入${response.data}条标准物质`)
      this.importVisible = false
      this.searchList()
    },
    importError() {
      this.importing = false
      this.$message.error('导入失败')
    },
    resetImport() {
      this.importing = false
      this.importFiles = []
      if (this.$refs.standardSubstanceUpload) {
        this.$refs.standardSubstanceUpload.clearFiles()
      }
    },
    exportFun() {
      this.outLoading = true
      exportOfStandardSubstanceList(this.searchForm).then(res => {
        this.outLoading = false
        const blob = new Blob([res], { type: 'application/octet-stream' }, false);
        this.$download.saveAs(blob, '标准物质清单.xlsx')
        this.$download.saveAs(blob, '标准物质台账.xlsx')
      })
    },
    // 查询列表