| | |
| | | } from '@/api/cnas/resourceDemand/device.js' |
| | | import { selectUserCondition } from "@/api/business/inspectionTask"; |
| | | import { mapGetters } from "@/utils/store-compat"; |
| | | import draftSave from '@/mixins/draftSave' |
| | | export default { |
| | | name: "equipment-maintenance-plan", |
| | | // import 引入的组件需要注入到对象中才能使用 |
| | | components: {}, |
| | | mixins: [draftSave], |
| | | props: { |
| | | clickNodeVal: { |
| | | type: Object, |
| | |
| | | if (res.code === 200) { |
| | | this.form = res.data |
| | | this.deviceMaintenancePlanDetails = this.form.deviceMaintenancePlanDetails |
| | | this.restoreMaintenancePlanDraft() |
| | | } |
| | | }).catch(error => { |
| | | console.error(error) |
| | | }) |
| | | } else { |
| | | this.restoreMaintenancePlanDraft() |
| | | } |
| | | this.getEquipOptions() |
| | | }, |
| | | restoreMaintenancePlanDraft() { |
| | | if (this.operationType === 'add' || this.operationType === 'edit') { |
| | | const rid = this.operationType === 'edit' ? this.maintenancePlanId : '' |
| | | this.draftRestore('maintenancePlanForm', 'form', rid, 'applicationForm') |
| | | this.draftRestore('maintenancePlanRows', 'deviceMaintenancePlanDetails', rid, 'applicationForm') |
| | | } |
| | | }, |
| | | // 添加设备 |
| | | addTableRow() { |
| | |
| | | addMaintenancePlan(this.form).then(res => { |
| | | if (res.code == 200) { |
| | | this.$message.success('新增成功') |
| | | this.draftClear('maintenancePlanForm') |
| | | this.draftClear('maintenancePlanRows') |
| | | this.applicationForm = false |
| | | this.getYearTableDetailData() |
| | | } |
| | |
| | | updateMaintenancePlan(this.form).then(res => { |
| | | if (res.code == 200) { |
| | | this.$message.success('修改成功') |
| | | this.draftClear('maintenancePlanForm') |
| | | this.draftClear('maintenancePlanRows') |
| | | this.applicationForm = false |
| | | this.getYearTableDetailData() |
| | | } |