| | |
| | | <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: { |
| | |
| | | computed: { |
| | | ...mapGetters(["nickName"]), |
| | | action() { |
| | | return this.javaApi + this.$api.personnel.saveCNASFile |
| | | return this.javaApi + '/personBasicInfo/saveCNASFile' |
| | | } |
| | | }, |
| | | mounted() { |
| | |
| | | // 获取当前状态 |
| | | 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) |
| | |
| | | }, |
| | | 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 |
| | |
| | | }, |
| | | // 获取负责人信息接口 |
| | | 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 |
| | |
| | | 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('删除成功!') |
| | | } |
| | |
| | | this.form.fileName = response.data |
| | | this.$message.success('上传成功') |
| | | } else { |
| | | this.$message.error(response.message) |
| | | this.$message.error(response.msg) |
| | | } |
| | | }, |
| | | onError(error, file, fileList) { |
| | |
| | | }, |
| | | //获取所有信息 |
| | | getTableList(deviceId) { |
| | | this.$axios.get(this.$api.deviceCheck.deviceFaultOnePage + '?deviceId=' + deviceId + "&size=" + this.search.size + "¤t=" + 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 |
| | |
| | | //导出 |
| | | 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) { |
| | |
| | | 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) |