Skip to content

baTable相关优化 #53

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 3 commits into
base: v2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions web/src/components/table/fieldRender/buttons.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
:class="btn.class"
class="ba-table-render-buttons-item"
:type="btn.type"
:loading="btn.loading && btn.loading(row, field)"
:disabled="btn.disabled && btn.disabled(row, field)"
v-bind="btn.attr"
>
Expand All @@ -31,6 +32,7 @@
:class="btn.class"
class="ba-table-render-buttons-item"
:type="btn.type"
:loading="btn.loading && btn.loading(row, field)"
:disabled="btn.disabled && btn.disabled(row, field)"
v-bind="btn.attr"
>
Expand All @@ -42,6 +44,7 @@
<!-- 带确认框的按钮 -->
<el-popconfirm
v-if="btn.render == 'confirmButton' && ((btn.name == 'delete' && baTable.auth('del')) || btn.name != 'delete')"
:loading="btn.loading && btn.loading(row, field)"
:disabled="btn.disabled && btn.disabled(row, field)"
v-bind="btn.popconfirm"
@confirm="onButtonClick(btn)"
Expand All @@ -59,6 +62,7 @@
:class="btn.class"
class="ba-table-render-buttons-item"
:type="btn.type"
:loading="btn.loading && btn.loading(row, field)"
:disabled="btn.disabled && btn.disabled(row, field)"
v-bind="btn.attr"
>
Expand All @@ -82,6 +86,7 @@
:class="btn.class"
class="ba-table-render-buttons-item move-button"
:type="btn.type"
:loading="btn.loading && btn.loading(row, field)"
:disabled="btn.disabled && btn.disabled(row, field)"
v-bind="btn.attr"
>
Expand Down
8 changes: 4 additions & 4 deletions web/src/utils/baTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,10 +497,10 @@ export default class baTable {
if (this.table.acceptQuery && !isEmpty(route.query)) {
// 根据当前 URL 的 query 初始化公共搜索默认值
this.setComSearchData(route.query)

// 获取公共搜索数据合并至表格筛选条件
this.table.filter!.search = this.getComSearchData().concat(this.table.filter?.search ?? [])
}

// 获取公共搜索数据合并至表格筛选条件
this.table.filter!.search = this.getComSearchData().concat(this.table.filter?.search ?? [])
}

/**
Expand Down Expand Up @@ -546,7 +546,7 @@ export default class baTable {
}
}

this.comSearch.form = Object.assign(this.comSearch.form, form)
this.comSearch.form = Object.assign(form, this.comSearch.form)
}

/**
Expand Down
7 changes: 7 additions & 0 deletions web/types/table.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,13 @@ declare global {
*/
disabled?: (row: TableRow, field: TableColumn) => boolean

/**
* 按钮点击是否在加载中(请返回布尔值)
* @param row 当前行数据
* @param field 当前列数据
*/
loading?: (row: TableRow, field: TableColumn) => boolean

/**
* 自定义 el-button 的其他属性
*/
Expand Down