| | |
| | | pageSize: 10, |
| | | total: 0 |
| | | } |
| | | } |
| | | }, |
| | | tableHeight: 400 |
| | | } |
| | | }, |
| | | methods: { |
| | |
| | | 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']) |
| | |
| | | this.tableData.pagination.total = data.total |
| | | }) |
| | | .catch(e => { |
| | | this.$tip.apiFailed(e) |
| | | // this.$tip.apiFailed(e) |
| | | }) |
| | | .finally(() => { |
| | | this.isWorking.search = false |
| | |
| | | // 删除 |
| | | 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(() => { |
| | |
| | | this.__afterDelete() |
| | | }) |
| | | .catch(e => { |
| | | this.$tip.apiFailed(e) |
| | | // this.$tip.apiFailed(e) |
| | | }) |
| | | .finally(() => { |
| | | this.isWorking.delete = false |
| | |
| | | } |
| | | } |
| | | if (containChildrenRows.length > 0) { |
| | | message = `本次将删除${this.module}【${containChildrenRows.join('、')}】及其子${this.module}记录,确认删除吗?` |
| | | message = '本次将删除该数据及其子数据,确认删除吗?' |
| | | } |
| | | } |
| | | this.$dialog.deleteConfirm(message) |
| | |
| | | this.__afterDelete(this.tableData.selectedRows.length) |
| | | }) |
| | | .catch(e => { |
| | | this.$tip.apiFailed(e) |
| | | // this.$tip.apiFailed(e) |
| | | }) |
| | | .finally(() => { |
| | | this.isWorking.delete = false |