| | |
| | | |
| | | <script> |
| | | import FailureForm from "./failureForm.vue"; |
| | | |
| | | import { |
| | | pageDeviceBreakdownMaintenance, |
| | | exportDeviceBreakdownMaintenance, |
| | | delDeviceBreakdownMaintenance, |
| | | } from '@/api/cnas/resourceDemand/device.js' |
| | | export default { |
| | | name: "equipment-failure", |
| | | // import 引入的组件需要注入到对象中才能使用 |
| | |
| | | // 查询 |
| | | getYearTableDetailData(deviceId) { |
| | | this.yearTableDetailDataLoading = true |
| | | this.$axios.post(this.$api.deviceBreakdownMaintenance.pageDeviceBreakdownMaintenance, { |
| | | page: { |
| | | current: this.pagination1.current, |
| | | size: this.pagination1.size, |
| | | }, |
| | | entity: { |
| | | deviceId: deviceId, |
| | | } |
| | | }, { |
| | | headers: { |
| | | 'Content-Type': 'application/json' |
| | | }, |
| | | noQs: true |
| | | pageDeviceBreakdownMaintenance({ |
| | | current: this.pagination1.current, |
| | | size: this.pagination1.size, |
| | | deviceId: deviceId, |
| | | }).then(res => { |
| | | if (res.code == 200) { |
| | | this.yearTableDetailData = res.data.records |
| | |
| | | // 导出 |
| | | handleDownOne(id) { |
| | | this.outLoading = true |
| | | this.$axios.get(this.$api.deviceBreakdownMaintenance.exportDeviceBreakdownMaintenance + '?maintenanceId=' + id, { |
| | | responseType: "blob" |
| | | exportDeviceBreakdownMaintenance({ |
| | | maintenanceId: id |
| | | }).then(res => { |
| | | this.outLoading = false |
| | | const blob = new Blob([res], { type: 'application/octet-stream' }); |
| | | //将Blob 对象转换成字符串 |
| | | let reader = new FileReader(); |
| | | reader.readAsText(blob, 'utf-8'); |
| | | reader.onload = () => { |
| | | try { |
| | | let result = JSON.parse(reader.result); |
| | | if (result.message) { |
| | | this.$message.error(result.message); |
| | | } else { |
| | | const url = URL.createObjectURL(blob); |
| | | const link = document.createElement('a'); |
| | | link.href = url; |
| | | link.download = '仪器设备修理申请表.doc'; |
| | | link.click(); |
| | | this.$message.success('导出成功') |
| | | } |
| | | } catch (err) { |
| | | console.log(err); |
| | | const url = URL.createObjectURL(blob); |
| | | const link = document.createElement('a'); |
| | | link.href = url; |
| | | link.download = '仪器设备修理申请表.doc'; |
| | | link.click(); |
| | | this.$message.success('导出成功') |
| | | } |
| | | } |
| | | this.$download.saveAs(blob, '仪器设备修理申请表.doc') |
| | | this.$message.success('导出成功') |
| | | }) |
| | | }, |
| | | // 删除 |
| | |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | this.$axios.get(this.$api.deviceBreakdownMaintenance.delDeviceBreakdownMaintenance + '?maintenanceId=' + id).then(res => { |
| | | delDeviceBreakdownMaintenance({ |
| | | maintenanceId: id |
| | | }).then(res => { |
| | | this.$message.success('删除成功!'); |
| | | this.getYearTableDetailData(this.clickNodeVal.value); |
| | | }); |