MrShi
2 天以前 39fc2d6754953e41a7334a2166347baacfcfb40a
admin/src/components/base/BaseTable.vue
@@ -39,7 +39,8 @@
          pageSize: 10,
          total: 0
        }
      }
      },
      tableHeight: 400
    }
  },
  methods: {
@@ -51,7 +52,13 @@
      if (extParams.api == null) {
        throw new Error('Missing config option \'api\'.')
      }
      this.api = require('@/api' + extParams.api)
      if(extParams.api.indexOf('@/',0) === 0){
        this.api = require(extParams.api)
      }else {
        this.api = require('@/api' + extParams.api)
      }
      // this.api = require('@/api' + extParams.api)
      extParams.module && (this.module = extParams.module)
      extParams['field.id'] && (this.configData['field.id'] = extParams['field.id'])
      extParams['field.main'] && (this.configData['field.main'] = extParams['field.main'])
@@ -126,7 +133,7 @@
          this.tableData.pagination.total = data.total
        })
        .catch(e => {
          this.$tip.apiFailed(e)
          // this.$tip.apiFailed(e)
        })
        .finally(() => {
          this.isWorking.search = false
@@ -135,9 +142,11 @@
    // 删除
    deleteById (row, childConfirm = true) {
      this.__checkApi()
      let message = `确认删除${this.module}【${row[this.configData['field.main']]}】吗?`
      // let message = `确认删除${this.module}【${row[this.configData['field.main']]}】吗?`
      let message = `确认删除该记录吗?`
      if (childConfirm && row.children != null && row.children.length > 0) {
        message = `确认删除${this.module}【${row[this.configData['field.main']]}】及其子${this.module}吗?`
        // message = `确认删除${this.module}【${row[this.configData['field.main']]}】及其子${this.module}吗?`
        message = `确认删除该记录及其子数据吗?`
      }
      this.$dialog.deleteConfirm(message)
        .then(() => {
@@ -148,7 +157,7 @@
              this.__afterDelete()
            })
            .catch(e => {
              this.$tip.apiFailed(e)
              // this.$tip.apiFailed(e)
            })
            .finally(() => {
              this.isWorking.delete = false
@@ -175,7 +184,7 @@
          }
        }
        if (containChildrenRows.length > 0) {
          message = `本次将删除${this.module}【${containChildrenRows.join('、')}】及其子${this.module}记录,确认删除吗?`
          message = '本次将删除该数据及其子数据,确认删除吗?'
        }
      }
      this.$dialog.deleteConfirm(message)
@@ -187,7 +196,7 @@
              this.__afterDelete(this.tableData.selectedRows.length)
            })
            .catch(e => {
              this.$tip.apiFailed(e)
              // this.$tip.apiFailed(e)
            })
            .finally(() => {
              this.isWorking.delete = false