| | |
| | | reviewDeviceInspectionRecord, |
| | | } from '@/api/cnas/resourceDemand/device.js' |
| | | import { selectUserCondition } from "@/api/business/inspectionTask"; |
| | | import draftSave from '@/mixins/draftSave' |
| | | export default { |
| | | name: "inspection-form", |
| | | // import 引入的组件需要注入到对象中才能使用 |
| | | components: {}, |
| | | mixins: [draftSave], |
| | | data() { |
| | | // 这里存放数据 |
| | | return { |
| | |
| | | this.getUserList() |
| | | if (this.form.inspectionRecordId) { |
| | | this.searchInfo() |
| | | } else if (this.operationType !== 'check') { |
| | | this.draftRestore('inspectionForm', 'form', this.form.deviceId, 'dialogVisible') |
| | | } |
| | | }, |
| | | searchInfo() { |
| | |
| | | inspectionRecordId: this.form.inspectionRecordId |
| | | }).then(res => { |
| | | if (res.code === 200) { |
| | | const id = this.form.inspectionRecordId |
| | | this.form = { ...res.data } |
| | | this.details = this.form.details || [] |
| | | if (this.operationType !== 'check') { |
| | | this.draftRestore('inspectionForm', 'form', id, 'dialogVisible') |
| | | } |
| | | } |
| | | }).catch(error => { |
| | | console.error(error) |
| | |
| | | addDeviceInspectionRecord(this.form).then(res => { |
| | | if (res.code == 200) { |
| | | this.$message.success('新增成功') |
| | | this.draftClear('inspectionForm') |
| | | this.resetForm() |
| | | } |
| | | this.submitFormLoading = false |
| | |
| | | updateDeviceInspectionRecord(this.form).then(res => { |
| | | if (res.code == 200) { |
| | | this.$message.success('新增成功') |
| | | this.draftClear('inspectionForm') |
| | | this.resetForm() |
| | | } |
| | | this.submitFormLoading = false |
| | |
| | | }) |
| | | }, |
| | | resetForm() { |
| | | this.draftStop('inspectionForm') |
| | | this.dialogVisible = false |
| | | this.$emit('closeDialog') |
| | | }, |