src/views/CNAS/resourceDemand/device/component/accidentForm.vue
@@ -100,10 +100,12 @@
  getDeviceAccidentReport,
  addDeviceAccidentReport,
} from '@/api/cnas/resourceDemand/device.js'
import draftSave from '@/mixins/draftSave'
export default {
  name: "accident-form",
  // import 引入的组件需要注入到对象中才能使用
  components: {},
  mixins: [draftSave],
  data() {
    // 这里存放数据
    return {
@@ -150,13 +152,17 @@
      this.getUserList()
      if (this.form.accidentReportId) {
        this.searchInfo()
      } else {
        this.draftRestore('accidentForm', 'form', this.form.deviceId, 'dialogVisible')
      }
    },
    // 查询详情
    searchInfo() {
      getDeviceAccidentReport({ accidentReportId: this.form.accidentReportId }).then(res => {
        if (res.code === 200) {
          const id = this.form.accidentReportId
          this.form = { ...res.data }
          this.draftRestore('accidentForm', 'form', id, 'dialogVisible')
          if (res.data.isFinish === 0) {
            if (this.form.assessorUserId) {
              this.currentStep = 1
@@ -194,6 +200,7 @@
          addDeviceAccidentReport(this.form).then(res => {
            if (res.code == 200) {
              this.$message.success('新增成功')
              this.draftClear('accidentForm')
              this.resetForm()
            }
            this.submitFormLoading = false
@@ -205,6 +212,7 @@
    },
    // 关闭弹框
    resetForm() {
      this.draftStop('accidentForm')
      this.dialogVisible = false
      this.$emit('closeDialog')
    },