jiangping
2024-05-09 b62578f8b43f15be89b3d14f463f11aed03e6fb9
admin/src/components/base/BaseOpera.vue
@@ -14,6 +14,16 @@
      }
    }
  },
  // watch: {
  //   visible() {
  //     console.log(this.visible);
  //   }
  // },
  watch: {
    $route (to, from) {
      this.close()
    }
  },
  methods: {
    // 配置
    config (extParams = {}) {
@@ -23,7 +33,11 @@
      if (extParams.api == null) {
        throw new Error('Missing config option \'api\'.')
      }
      this.api = require('@/api' + extParams.api)
      if(extParams.api.indexOf('@/') ==-1){
        this.api = require('@/api' + extParams.api)
      }else{
        this.api = require(extParams.api)
      }
      extParams['field.id'] && (this.configData['field.id'] = extParams['field.id'])
    },
    /**
@@ -49,6 +63,9 @@
        }
      })
    },
    close () {
      this.visible = false
    },
    // 确认新建/修改
    confirm () {
      if (this.form.id == null || this.form.id === '') {
@@ -60,9 +77,12 @@
    // 确认新建
    __confirmCreate () {
      this.$refs.form.validate((valid) => {
        // debugger
        if (!valid) {
          return
        }
        // console.log(this.form);
        // debugger
        // 调用新建接口
        this.isWorking = true
        this.api.create(this.form)