refactor: 判断vxe-table的复选框是否选中

This commit is contained in:
dap
2024-12-11 11:09:16 +08:00
parent 3014b62086
commit 7ec3cfb3fd
19 changed files with 62 additions and 157 deletions

View File

@@ -9,8 +9,8 @@ import { getVxePopupContainer } from '@vben/utils';
import { Modal, Popconfirm, Space } from 'ant-design-vue';
import {
tableCheckboxEvent,
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps,
} from '#/adapter/vxe-table';
import { postExport, postList, postRemove } from '#/api/system/post';
@@ -79,14 +79,9 @@ const gridOptions: VxeGridProps = {
id: 'system-post-index',
};
const checked = ref(false);
const [BasicTable, tableApi] = useVbenVxeGrid({
formOptions,
gridOptions,
gridEvents: {
checkboxChange: tableCheckboxEvent(checked),
checkboxAll: tableCheckboxEvent(checked),
},
});
const [PostDrawer, drawerApi] = useVbenDrawer({
@@ -118,7 +113,6 @@ function handleMultiDelete() {
onOk: async () => {
await postRemove(ids);
await tableApi.query();
checked.value = false;
},
});
}
@@ -146,7 +140,7 @@ function handleDownloadExcel() {
{{ $t('pages.common.export') }}
</a-button>
<a-button
:disabled="!checked"
:disabled="!vxeCheckboxChecked(tableApi)"
danger
type="primary"
v-access:code="['system:post:remove']"