From 80ec265349139b265d134db29c8f2eb1c92963c4 Mon Sep 17 00:00:00 2001 From: yufei0306 <13417315+yufei0306@user.noreply.gitee.com> Date: Tue, 16 Apr 2024 10:36:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=B9=E9=87=8F=E6=89=93=E5=8D=B0=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Table/src/Table.vue | 19 ++++++++++++++++--- src/utils/disposition/defaultButtons.ts | 13 +++++++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/components/Table/src/Table.vue b/src/components/Table/src/Table.vue index e5ac25805..15b93be06 100644 --- a/src/components/Table/src/Table.vue +++ b/src/components/Table/src/Table.vue @@ -58,7 +58,7 @@ export default defineComponent({ default: () => [] } }, - emits: ['update:pageSize', 'update:currentPage', 'register', 'update:sort'], + emits: ['update:pageSize', 'update:currentPage', 'register', 'update:sort','getSelectionRows'], setup(props, { attrs, slots, emit, expose }) { const elTableRef = ref>() @@ -101,9 +101,19 @@ export default defineComponent({ } } + const toggleRowSelection = (row: Recordable, selected: boolean) => { + const tableRef = unref(elTableRef) + tableRef?.toggleRowSelection(unref(getProps).data.find(item=>item.id === row.id), selected) + } + const selections = ref([]) const sortRef = ref() - + const selectRow = ()=>{ + emit('getSelectionRows', currentPageRef.value,elTableRef.value?.getSelectionRows()) + } + const selectAll = (val)=>{ + emit('getSelectionRows', currentPageRef.value,elTableRef.value?.getSelectionRows()) + } const selectionChange = (selection: Recordable[]) => { selections.value = selection } @@ -116,7 +126,8 @@ export default defineComponent({ expose({ setProps, setColumn, - selections + selections, + toggleRowSelection }) const pagination = computed(() => { @@ -306,6 +317,8 @@ export default defineComponent({ header-cell-class-name="tableHeader" row-class-name="tableRow" cell-class-name="tableRow" + onSelect={selectRow} + onSelect-all={selectAll} onSelection-change={selectionChange} onSort-change={sortChange} {...unref(getBindValue)} diff --git a/src/utils/disposition/defaultButtons.ts b/src/utils/disposition/defaultButtons.ts index a427b2449..e8d89e7d8 100644 --- a/src/utils/disposition/defaultButtons.ts +++ b/src/utils/disposition/defaultButtons.ts @@ -741,6 +741,19 @@ export function mainListPointBtn(option:any) { hasPermi: '' }) } +// 主列表-批量打印 +export function mainLisSelectiontPointBtn(option:any) { + return __defaultBtnOption(option,{ + label: '批量打印', + name: 'selection_point', + hide: false, + type: 'primary', + icon: 'ep:download', + color: '', + float:'left', + hasPermi: '' + }) +} // 主列表-生成采购收货申请 export function mainListGenerateApplicationBtn(option:any) { return __defaultBtnOption(option,{