吴羡
10 小时以前 a1faa94fbf85553f22da934a1abc745d89dd8667
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;