refactor: 判断vxe-table的复选框是否选中
This commit is contained in:
@@ -1,16 +1,14 @@
|
||||
<script setup lang="ts">
|
||||
import type { Recordable } from '@vben/types';
|
||||
|
||||
import { ref } from 'vue';
|
||||
|
||||
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
|
||||
import { getVxePopupContainer } from '@vben/utils';
|
||||
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
|
||||
import {
|
||||
tableCheckboxEvent,
|
||||
useVbenVxeGrid,
|
||||
vxeCheckboxChecked,
|
||||
type VxeGridProps,
|
||||
} from '#/adapter/vxe-table';
|
||||
import { noticeList, noticeRemove } from '#/api/system/notice';
|
||||
@@ -60,14 +58,9 @@ const gridOptions: VxeGridProps = {
|
||||
id: 'system-notice-index',
|
||||
};
|
||||
|
||||
const checked = ref(false);
|
||||
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
gridEvents: {
|
||||
checkboxChange: tableCheckboxEvent(checked),
|
||||
checkboxAll: tableCheckboxEvent(checked),
|
||||
},
|
||||
});
|
||||
|
||||
const [NoticeModal, modalApi] = useVbenModal({
|
||||
@@ -99,7 +92,6 @@ function handleMultiDelete() {
|
||||
onOk: async () => {
|
||||
await noticeRemove(ids);
|
||||
await tableApi.query();
|
||||
checked.value = false;
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -111,7 +103,7 @@ function handleMultiDelete() {
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
<a-button
|
||||
:disabled="!checked"
|
||||
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||
danger
|
||||
type="primary"
|
||||
v-access:code="['system:notice:remove']"
|
||||
|
Reference in New Issue
Block a user