MrShi
2025-08-19 30e858fa504b268b9b436afca0a1259cf6e8c488
admin/src/components/base/BaseTable.vue
@@ -1,6 +1,6 @@
<script>
import BasePage from './BasePage'
import {mapState} from "vuex";
import { isFunction } from 'element-ui'
export default {
  name: 'BaseTable',
@@ -102,6 +102,9 @@
      this.$refs.searchForm.resetFields()
      this.search()
    },
    refresh () {
     window.location.reload()
    },
    /**
     * 页容量变更处理(切换页容量时触发)
     *
@@ -166,7 +169,7 @@
     * @param row 行对象
     * @param childConfirm 删除子节点时是否进行二次确认
     */
    deleteById (row, childConfirm = true) {
    deleteById (row, childConfirm = true, call) {
      this.__checkApi()
      let message = `确认删除${this.module}吗?`
      if (childConfirm && row.children != null && row.children.length > 0) {
@@ -178,6 +181,9 @@
          this.api.deleteById(row[this.configData['field.id']])
            .then(() => {
              this.__afterDelete()
              if (call) {
                call()
              }
            })
            .catch(e => {
              this.$tip.apiFailed(e)
@@ -193,7 +199,7 @@
     *
     * @param childConfirm 删除子节点时是否进行二次确认
     */
    deleteByIdInBatch (childConfirm = true) {
    deleteByIdInBatch (childConfirm = true, call) {
      this.__checkApi()
      if (this.tableData.selectedRows.length === 0) {
        this.$tip.warning('请至少选择一条数据')
@@ -217,6 +223,9 @@
          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)