gaoluyang
2025-03-10 d3793edc9e3479f162c0cab6930d17c919ecacae
src/views/CNAS/resourceDemand/device/component/fault.vue
@@ -278,6 +278,13 @@
<script>
import { dateFormat } from '@/utils/date'
import { mapGetters } from "vuex";
import {
  addOrUpdateDeviceFaultOne,
  deleteCNASFile, deleteDeviceFaultOne,
  deviceFaultOnePage, exportRewardAndPunishmentRecords,
  selectDeviceByCode
} from "@/api/cnas/resourceDemand/device";
import {selectUserCondition} from "@/api/system/user";
export default {
  props: {
    clickNodeVal: {
@@ -310,7 +317,7 @@
  computed: {
    ...mapGetters(["nickName"]),
    action() {
      return this.javaApi + this.$api.personnel.saveCNASFile
      return this.javaApi + '/personBasicInfo/saveCNASFile'
    }
  },
  mounted() {
@@ -399,11 +406,7 @@
          // 获取当前状态
          this.form.currentState = currentStepAction === 5 ? '关闭' : this.steps[currentStepAction]
          this.form.deviceId = this.clickNodeVal.value
          this.$axios.post(this.$api.deviceCheck.addOrUpdateDeviceFaultOne, this.form, {
            headers: {
              'Content-Type': 'application/json'
            }
          }).then(res => {
          addOrUpdateDeviceFaultOne(this.form).then(res => {
            if (res.code == 200) {
              this.$message.success('提交成功')
              this.getTableList(this.clickNodeVal.value)
@@ -425,7 +428,7 @@
    },
    openRecordAcceptance() {
      // 获取设备基础信息
      this.$axios.get(this.$api.deviceScope.selectDeviceByCode + '?id=' + this.clickNodeVal.value).then(res => {
      selectDeviceByCode({id: this.clickNodeVal.value}).then(res => {
        this.form.deviceName = res.data.deviceName
        this.form.manufacturer = res.data.manufacturer
        this.form.specificationModel = res.data.specificationModel
@@ -436,11 +439,9 @@
    },
    // 获取负责人信息接口
    getUserList() {
      this.$axios.get(this.$api.deviceScope.selectUserList).then(res => {
        if (res.code == 200) {
          this.users = res.data
        }
      })
      selectUserCondition().then((res) => {
        this.users = res.data;
      });
    },
    handleSizeChange(val) {
      this.search.size = val
@@ -456,7 +457,7 @@
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$axios.delete(this.$api.personnel.deleteCNASFile + "?fileName=" + this.form.systemFileName).then(res => {
        deleteCNASFile({fileName: this.form.systemFileName}).then(res => {
          if (res.code == 200) {
            this.$message.success('删除成功!')
          }
@@ -477,7 +478,7 @@
        this.form.fileName = response.data
        this.$message.success('上传成功')
      } else {
        this.$message.error(response.message)
        this.$message.error(response.msg)
      }
    },
    onError(error, file, fileList) {
@@ -505,7 +506,13 @@
    },
    //获取所有信息
    getTableList(deviceId) {
      this.$axios.get(this.$api.deviceCheck.deviceFaultOnePage + '?deviceId=' + deviceId + "&size=" + this.search.size + "&current=" + this.search.current + "&processNumber=" + this.search.processNumber).then(res => {
      const params = {
        deviceId: deviceId,
        size: this.search.size,
        current: this.search.current,
        processNumber: this.search.processNumber,
      }
      deviceFaultOnePage(params).then(res => {
        if (res.code == 200) {
          this.faultParam = res.data.records
          this.search.total = res.data.total
@@ -515,19 +522,10 @@
    //导出
    handleDown() {
      this.outLoading = true
      this.$axios.post(this.$api.deviceCheck.exportRewardAndPunishmentRecords, {
        deviceId: this.clickNodeVal.value
      }, { responseType: "blob" }).then(res => {
      exportRewardAndPunishmentRecords({deviceId: this.clickNodeVal.value}).then(res => {
        this.outLoading = false
        this.$message.success('导出成功')
        const blob = new Blob([res], { type: 'application/octet-stream' });
        const url = URL.createObjectURL(blob);
        const link = document.createElement('a');
        link.href = url;
        link.download = '设备故障表.xlsx';
        link.click();
      }).finally(() => {
        this.outLoading = false
        this.$dowmload.saveAs(blob, '设备故障表.xlsx')
      })
    },
    selectAllByOne(row) {
@@ -556,7 +554,7 @@
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$axios.delete(this.$api.deviceCheck.deleteDeviceFaultOne + '?id=' + row.id).then(res => {
        deleteDeviceFaultOne({id: row.id}).then(res => {
          if (res.code == 200) {
            this.$message.success('删除成功')
            this.getTableList(this.clickNodeVal.value)