| | |
| | | <script> |
| | | import BasePage from './BasePage' |
| | | import {mapState} from "vuex"; |
| | | import { isFunction } from 'element-ui' |
| | | |
| | | export default { |
| | | name: 'BaseTable', |
| | |
| | | this.$refs.searchForm.resetFields() |
| | | this.search() |
| | | }, |
| | | refresh () { |
| | | window.location.reload() |
| | | }, |
| | | /** |
| | | * 页容量变更处理(切换页容量时触发) |
| | | * |
| | |
| | | * @param row 行对象 |
| | | * @param childConfirm 删除子节点时是否进行二次确认 |
| | | */ |
| | | deleteById (row, childConfirm = true) { |
| | | deleteById (row, childConfirm = true, call) { |
| | | this.__checkApi() |
| | | let message = `确认删除${this.module}【${row[this.configData['field.main']]}】吗?` |
| | | let message = `确认删除${this.module}吗?` |
| | | if (childConfirm && row.children != null && row.children.length > 0) { |
| | | message = `确认删除${this.module}【${row[this.configData['field.main']]}】及其子${this.module}吗?` |
| | | } |
| | |
| | | this.api.deleteById(row[this.configData['field.id']]) |
| | | .then(() => { |
| | | this.__afterDelete() |
| | | if (call) { |
| | | call() |
| | | } |
| | | }) |
| | | .catch(e => { |
| | | this.$tip.apiFailed(e) |
| | |
| | | * |
| | | * @param childConfirm 删除子节点时是否进行二次确认 |
| | | */ |
| | | deleteByIdInBatch (childConfirm = true) { |
| | | deleteByIdInBatch (childConfirm = true, call) { |
| | | this.__checkApi() |
| | | if (this.tableData.selectedRows.length === 0) { |
| | | this.$tip.warning('请至少选择一条数据') |
| | |
| | | this.api.deleteByIdInBatch(this.tableData.selectedRows.map(row => row[this.configData['field.id']]).join(',')) |
| | | .then(() => { |
| | | this.__afterDelete(this.tableData.selectedRows.length) |
| | | if (call) { |
| | | call() |
| | | } |
| | | }) |
| | | .catch(e => { |
| | | this.$tip.apiFailed(e) |