Crunchy
2025-04-29 e5454b769d44a34af423bf87ac8a740bf8c20341
src/views/CNAS/resourceDemand/device/component/usageAuthorization.vue
@@ -3,7 +3,6 @@
    <div class="search">
      <el-button size="small" type="primary" @click="refreshTableList">刷 新</el-button>
      <el-button size="small" type="primary" @click="openDia('add')">新 增</el-button>
      <el-button :loading="outLoading" size="small" type="primary" @click="openHandleOut">导 出</el-button>
    </div>
    <div>
      <lims-table :tableData="tableData" :column="column"
@@ -98,6 +97,19 @@
        <el-button :loading="submitFormLoading" type="primary" @click="changeMachineName">确认</el-button>
      </span>
    </el-dialog>
    <el-dialog :visible.sync="notificationDia" title="提交审核" width="30%" @close="closeNotificationDia">
      <span style="margin-top: 10px;display: inline-block">
        请选择审核人:
        <el-select v-model="auditId" 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>
      <span slot="footer" class="dialog-footer">
        <el-button :loading="notificationLoading" @click="closeNotificationDia">取 消</el-button>
        <el-button :loading="notificationLoading" type="primary" @click="notification">提 交</el-button>
      </span>
    </el-dialog>
  </div>
</template>
@@ -106,10 +118,10 @@
import {
  addImpower,
  deleteImpower, deviceScopeSearch, getImpowerDetail, reviewImpowerStatus,
  selectDeviceImpowerByPage, updateImpower
  selectDeviceImpowerByPage, submitReviewImpowerStatus, updateImpower, exportDeviceImpower
} from "@/api/cnas/resourceDemand/device";
import {exportQualityMonitorDetail} from "@/api/cnas/process/ensureResults/qualityMonitor";
import {selectUserCondition} from "@/api/system/user";
import {mapGetters} from "vuex";
export default {
  name: '',
@@ -177,14 +189,31 @@
              },
            },
            {
              name: '授权',
              name: '审核通知',
              type: 'text',
              clickFun: (row) => {
                this.tellApprove(row.impowerId);
              },
              disabled: (row) => {
                return row.status === 1;
              },
            },
            {
              name: '审核',
              type: 'text',
              clickFun: (row) => {
                this.openDia('check', row);
              },
              disabled: (row) => {
                return row.status === 1;
                return row.status === 1 || this.userId !== row.auditId;
              },
            },
            {
              name: '导出',
              type: 'text',
              clickFun: (row) => {
                this.openHandleOut(row);
              }
            },
            {
              name: '删除',
@@ -211,7 +240,10 @@
        impowerYear: ''
      },
      delegatedUser: [],
      impowerId: ''
      impowerId: '',
      notificationDia: false,
      auditId: '',
      notificationLoading: false,
    };
  },
  mounted() {
@@ -240,6 +272,37 @@
      }).catch(err => {
        this.tableLoading = false
      })
    },
    // 打开提交批准弹框
    tellApprove(impowerId) {
      this.getUserList()
      this.notificationDia = true
      this.impowerId = impowerId
    },
    // 提交批准通知
    notification() {
      if (!this.auditId) {
        this.$message.warning('请选择审核人')
        return
      }
      this.notificationLoading = true
      submitReviewImpowerStatus({
        auditId: this.auditId,
        impowerId: this.impowerId,
      }).then(res => {
        this.notificationLoading = false
        if (res.code == 200) {
          this.closeNotificationDia()
          this.refreshTableList()
        }
      }).catch(err => {
        this.notificationLoading = false
      })
    },
    // 关闭提交批准弹框
    closeNotificationDia() {
      this.notificationDia = false
      this.auditId = ''
    },
    // 打开操作弹框
    openDia (type, row) {
@@ -357,10 +420,10 @@
      })
    },
    openHandleOut (row) {
      exportQualityMonitorDetail({ impowerId: row.impowerId }).then(res => {
      exportDeviceImpower({ impowerId: row.impowerId }).then(res => {
        this.outLoading = false
        const blob = new Blob([res], { type: 'application/msword' });
        this.$download.saveAs(blob, row.monitorName + '.docx')
        this.$download.saveAs(blob, '设备使用授权表' + '.docx')
      })
    },
    handleDeleteClick(row) {
@@ -400,6 +463,9 @@
      }
    },
  },
  computed: {
    ...mapGetters(["userId"]),
  },
};
</script>