refactor: 通用的表格复选框是否选中事件
This commit is contained in:
parent
c6984c164c
commit
6e7fade539
@ -100,7 +100,6 @@ export { useVbenVxeGrid };
|
||||
export type * from '@vben/plugins/vxe-table';
|
||||
|
||||
/**
|
||||
* 暂时没用上,先保留
|
||||
* 通用的表格复选框是否选中事件
|
||||
* @param checked 是否选中
|
||||
* @returns function
|
||||
|
@ -9,7 +9,11 @@ import { getPopupContainer } from '@vben/utils';
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table';
|
||||
import {
|
||||
tableCheckboxEvent,
|
||||
useVbenVxeGrid,
|
||||
type VxeGridProps,
|
||||
} from '#/adapter/vxe-table';
|
||||
import { downloadExcel } from '#/utils/file/download';
|
||||
|
||||
import { demoExport, demoList, demoRemove } from './api';
|
||||
@ -74,12 +78,8 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
gridEvents: {
|
||||
checkboxChange: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
},
|
||||
checkboxAll: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
},
|
||||
checkboxChange: tableCheckboxEvent(checked),
|
||||
checkboxAll: tableCheckboxEvent(checked),
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -9,7 +9,12 @@ import { getPopupContainer } from '@vben/utils';
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table';
|
||||
import {
|
||||
tableCheckboxEvent,
|
||||
useVbenVxeGrid,
|
||||
type VxeGridDefines,
|
||||
type VxeGridProps,
|
||||
} from '#/adapter/vxe-table';
|
||||
import {
|
||||
loginInfoClean,
|
||||
loginInfoExport,
|
||||
@ -82,13 +87,12 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
gridEvents: {
|
||||
checkboxChange: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
canUnlock.value = e.records.length === 1 && e.records[0]?.status === '1';
|
||||
},
|
||||
checkboxAll: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
checkboxChange: (e: VxeGridDefines.CheckboxChangeEventParams) => {
|
||||
const records = e.$table.getCheckboxRecords();
|
||||
checked.value = records.length > 0;
|
||||
canUnlock.value = records.length === 1 && records[0]?.status === '1';
|
||||
},
|
||||
checkboxAll: tableCheckboxEvent(checked),
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -12,7 +12,11 @@ import { Modal, Space } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
import { isEmpty } from 'lodash-es';
|
||||
|
||||
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table';
|
||||
import {
|
||||
tableCheckboxEvent,
|
||||
useVbenVxeGrid,
|
||||
type VxeGridProps,
|
||||
} from '#/adapter/vxe-table';
|
||||
import {
|
||||
operLogClean,
|
||||
operLogDelete,
|
||||
@ -98,12 +102,8 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
sortChange: () => {
|
||||
tableApi.query();
|
||||
},
|
||||
checkboxChange: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
},
|
||||
checkboxAll: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
},
|
||||
checkboxChange: tableCheckboxEvent(checked),
|
||||
checkboxAll: tableCheckboxEvent(checked),
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -9,7 +9,11 @@ import { getPopupContainer } from '@vben/utils';
|
||||
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table';
|
||||
import {
|
||||
tableCheckboxEvent,
|
||||
useVbenVxeGrid,
|
||||
type VxeGridProps,
|
||||
} from '#/adapter/vxe-table';
|
||||
import {
|
||||
clientChangeStatus,
|
||||
clientExport,
|
||||
@ -68,12 +72,8 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
gridEvents: {
|
||||
checkboxChange: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
},
|
||||
checkboxAll: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
},
|
||||
checkboxChange: tableCheckboxEvent(checked),
|
||||
checkboxAll: tableCheckboxEvent(checked),
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -9,7 +9,11 @@ import { getPopupContainer } from '@vben/utils';
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table';
|
||||
import {
|
||||
tableCheckboxEvent,
|
||||
useVbenVxeGrid,
|
||||
type VxeGridProps,
|
||||
} from '#/adapter/vxe-table';
|
||||
import {
|
||||
configExport,
|
||||
configList,
|
||||
@ -78,12 +82,8 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
gridEvents: {
|
||||
checkboxChange: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
},
|
||||
checkboxAll: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
},
|
||||
checkboxChange: tableCheckboxEvent(checked),
|
||||
checkboxAll: tableCheckboxEvent(checked),
|
||||
},
|
||||
});
|
||||
const [ConfigModal, modalApi] = useVbenModal({
|
||||
|
@ -9,7 +9,11 @@ import { getPopupContainer } from '@vben/utils';
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table';
|
||||
import {
|
||||
tableCheckboxEvent,
|
||||
useVbenVxeGrid,
|
||||
type VxeGridProps,
|
||||
} from '#/adapter/vxe-table';
|
||||
import {
|
||||
dictDataExport,
|
||||
dictDataList,
|
||||
@ -87,12 +91,8 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
gridEvents: {
|
||||
checkboxChange: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
},
|
||||
checkboxAll: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
},
|
||||
checkboxChange: tableCheckboxEvent(checked),
|
||||
checkboxAll: tableCheckboxEvent(checked),
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -18,7 +18,11 @@ import {
|
||||
} from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table';
|
||||
import {
|
||||
tableCheckboxEvent,
|
||||
useVbenVxeGrid,
|
||||
type VxeGridProps,
|
||||
} from '#/adapter/vxe-table';
|
||||
import {
|
||||
dictTypeExport,
|
||||
dictTypeList,
|
||||
@ -102,12 +106,8 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
emitter.emit('rowClick', row.dictType);
|
||||
lastDictType.value = row.dictType;
|
||||
},
|
||||
checkboxChange: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
},
|
||||
checkboxAll: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
},
|
||||
checkboxChange: tableCheckboxEvent(checked),
|
||||
checkboxAll: tableCheckboxEvent(checked),
|
||||
},
|
||||
});
|
||||
const [DictTypeModal, modalApi] = useVbenModal({
|
||||
|
@ -9,7 +9,11 @@ import { getPopupContainer } from '@vben/utils';
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table';
|
||||
import {
|
||||
tableCheckboxEvent,
|
||||
useVbenVxeGrid,
|
||||
type VxeGridProps,
|
||||
} from '#/adapter/vxe-table';
|
||||
import { noticeList, noticeRemove } from '#/api/system/notice';
|
||||
|
||||
import { columns, querySchema } from './data';
|
||||
@ -74,12 +78,8 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
gridEvents: {
|
||||
checkboxChange: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
},
|
||||
checkboxAll: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
},
|
||||
checkboxChange: tableCheckboxEvent(checked),
|
||||
checkboxAll: tableCheckboxEvent(checked),
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -10,7 +10,11 @@ import { getPopupContainer } from '@vben/utils';
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table';
|
||||
import {
|
||||
tableCheckboxEvent,
|
||||
useVbenVxeGrid,
|
||||
type VxeGridProps,
|
||||
} from '#/adapter/vxe-table';
|
||||
import {
|
||||
ossConfigChangeStatus,
|
||||
ossConfigList,
|
||||
@ -77,12 +81,8 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
gridEvents: {
|
||||
checkboxChange: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
},
|
||||
checkboxAll: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
},
|
||||
checkboxChange: tableCheckboxEvent(checked),
|
||||
checkboxAll: tableCheckboxEvent(checked),
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -20,7 +20,11 @@ import {
|
||||
import dayjs from 'dayjs';
|
||||
import { isEmpty } from 'lodash-es';
|
||||
|
||||
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table';
|
||||
import {
|
||||
tableCheckboxEvent,
|
||||
useVbenVxeGrid,
|
||||
type VxeGridProps,
|
||||
} from '#/adapter/vxe-table';
|
||||
import { configInfoByKey } from '#/api/system/config';
|
||||
import { ossDownload, ossList, ossRemove } from '#/api/system/oss';
|
||||
import { downloadByData } from '#/utils/file/download';
|
||||
@ -100,12 +104,8 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
sortChange: () => {
|
||||
tableApi.query();
|
||||
},
|
||||
checkboxChange: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
},
|
||||
checkboxAll: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
},
|
||||
checkboxChange: tableCheckboxEvent(checked),
|
||||
checkboxAll: tableCheckboxEvent(checked),
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -9,7 +9,11 @@ import { getPopupContainer } from '@vben/utils';
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table';
|
||||
import {
|
||||
tableCheckboxEvent,
|
||||
useVbenVxeGrid,
|
||||
type VxeGridProps,
|
||||
} from '#/adapter/vxe-table';
|
||||
import { postExport, postList, postRemove } from '#/api/system/post';
|
||||
import { downloadExcel } from '#/utils/file/download';
|
||||
import DeptTree from '#/views/system/user/dept-tree.vue';
|
||||
@ -91,12 +95,8 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
gridEvents: {
|
||||
checkboxChange: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
},
|
||||
checkboxAll: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
},
|
||||
checkboxChange: tableCheckboxEvent(checked),
|
||||
checkboxAll: tableCheckboxEvent(checked),
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -9,7 +9,11 @@ import { getPopupContainer } from '@vben/utils';
|
||||
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
|
||||
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table';
|
||||
import {
|
||||
tableCheckboxEvent,
|
||||
useVbenVxeGrid,
|
||||
type VxeGridProps,
|
||||
} from '#/adapter/vxe-table';
|
||||
import {
|
||||
roleAllocatedList,
|
||||
roleAuthCancel,
|
||||
@ -67,12 +71,8 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
gridEvents: {
|
||||
checkboxChange: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
},
|
||||
checkboxAll: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
},
|
||||
checkboxChange: tableCheckboxEvent(checked),
|
||||
checkboxAll: tableCheckboxEvent(checked),
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -4,7 +4,11 @@ import { useRoute } from 'vue-router';
|
||||
|
||||
import { useVbenDrawer, type VbenFormProps } from '@vben/common-ui';
|
||||
|
||||
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table';
|
||||
import {
|
||||
tableCheckboxEvent,
|
||||
useVbenVxeGrid,
|
||||
type VxeGridProps,
|
||||
} from '#/adapter/vxe-table';
|
||||
import { roleSelectAll, roleUnallocatedList } from '#/api/system/role';
|
||||
|
||||
import { columns, querySchema } from './data';
|
||||
@ -63,12 +67,8 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
gridEvents: {
|
||||
checkboxChange: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
},
|
||||
checkboxAll: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
},
|
||||
checkboxChange: tableCheckboxEvent(checked),
|
||||
checkboxAll: tableCheckboxEvent(checked),
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -23,7 +23,11 @@ import {
|
||||
} from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table';
|
||||
import {
|
||||
tableCheckboxEvent,
|
||||
useVbenVxeGrid,
|
||||
type VxeGridProps,
|
||||
} from '#/adapter/vxe-table';
|
||||
import {
|
||||
roleChangeStatus,
|
||||
roleExport,
|
||||
@ -97,12 +101,8 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
gridEvents: {
|
||||
checkboxChange: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
},
|
||||
checkboxAll: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
},
|
||||
checkboxChange: tableCheckboxEvent(checked),
|
||||
checkboxAll: tableCheckboxEvent(checked),
|
||||
},
|
||||
});
|
||||
const [RoleDrawer, drawerApi] = useVbenDrawer({
|
||||
|
@ -11,7 +11,11 @@ import { getPopupContainer } from '@vben/utils';
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table';
|
||||
import {
|
||||
tableCheckboxEvent,
|
||||
useVbenVxeGrid,
|
||||
type VxeGridProps,
|
||||
} from '#/adapter/vxe-table';
|
||||
import {
|
||||
tenantExport,
|
||||
tenantList,
|
||||
@ -86,12 +90,8 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
gridEvents: {
|
||||
checkboxChange: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
},
|
||||
checkboxAll: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
},
|
||||
checkboxChange: tableCheckboxEvent(checked),
|
||||
checkboxAll: tableCheckboxEvent(checked),
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -11,7 +11,11 @@ import { getPopupContainer } from '@vben/utils';
|
||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table';
|
||||
import {
|
||||
tableCheckboxEvent,
|
||||
useVbenVxeGrid,
|
||||
type VxeGridProps,
|
||||
} from '#/adapter/vxe-table';
|
||||
import {
|
||||
packageChangeStatus,
|
||||
packageExport,
|
||||
@ -83,12 +87,8 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
gridEvents: {
|
||||
checkboxChange: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
},
|
||||
checkboxAll: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
},
|
||||
checkboxChange: tableCheckboxEvent(checked),
|
||||
checkboxAll: tableCheckboxEvent(checked),
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -24,7 +24,11 @@ import {
|
||||
} from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table';
|
||||
import {
|
||||
tableCheckboxEvent,
|
||||
useVbenVxeGrid,
|
||||
type VxeGridProps,
|
||||
} from '#/adapter/vxe-table';
|
||||
import {
|
||||
userExport,
|
||||
userList,
|
||||
@ -128,12 +132,8 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
gridEvents: {
|
||||
checkboxChange: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
},
|
||||
checkboxAll: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
},
|
||||
checkboxChange: tableCheckboxEvent(checked),
|
||||
checkboxAll: tableCheckboxEvent(checked),
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -9,7 +9,11 @@ import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
|
||||
import { message, Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { useVbenVxeGrid, type VxeGridProps } from '#/adapter/vxe-table';
|
||||
import {
|
||||
tableCheckboxEvent,
|
||||
useVbenVxeGrid,
|
||||
type VxeGridProps,
|
||||
} from '#/adapter/vxe-table';
|
||||
import {
|
||||
batchGenCode,
|
||||
generatedList,
|
||||
@ -79,12 +83,8 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
gridEvents: {
|
||||
checkboxChange: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
},
|
||||
checkboxAll: (e: any) => {
|
||||
checked.value = e.records.length > 0;
|
||||
},
|
||||
checkboxChange: tableCheckboxEvent(checked),
|
||||
checkboxAll: tableCheckboxEvent(checked),
|
||||
},
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user