From 377e3ac45cc55557cbbfe0ac72051002ceb292b4 Mon Sep 17 00:00:00 2001 From: wangyufei <2267742828@qq.com> Date: Tue, 2 Jul 2024 09:05:14 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E5=BA=93=E5=AD=98=E4=BD=99=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/wms/inventoryManage/balance/index.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/views/wms/inventoryManage/balance/index.vue b/src/views/wms/inventoryManage/balance/index.vue index 595b8ceb1..5ca4ea0ea 100644 --- a/src/views/wms/inventoryManage/balance/index.vue +++ b/src/views/wms/inventoryManage/balance/index.vue @@ -30,8 +30,8 @@ @getSelectionRows="getSelectionRows" > \ No newline at end of file diff --git a/src/components/Table/src/Table.vue b/src/components/Table/src/Table.vue index 7fb9ee6cf..590b64baa 100644 --- a/src/components/Table/src/Table.vue +++ b/src/components/Table/src/Table.vue @@ -63,7 +63,7 @@ export default defineComponent({ searchTableSelectionsList:[],//回显列表 selectionColor: propTypes.bool.def(false), }, - emits: ['update:pageSize', 'update:currentPage', 'register', 'update:sort','getSelectionRows'], + emits: ['update:pageSize', 'update:currentPage', 'register', 'update:sort','getSelectionRows','rowClick'], setup(props, { attrs, slots, emit, expose }) { const elTableRef = ref>() @@ -120,12 +120,24 @@ export default defineComponent({ const sortRef = ref() // 选中某行 const selectRow = ()=>{ + console.log(currentPageRef.value,elTableRef.value?.getSelectionRows()) emit('getSelectionRows', currentPageRef.value,elTableRef.value?.getSelectionRows()) } //全选回调 const selectAll = ()=>{ emit('getSelectionRows', currentPageRef.value,elTableRef.value?.getSelectionRows()) } + const rowClick = (row: any, column: any, event: Event)=>{ + // const selected = elTableRef.value?.getSelectionRows().some(item => item.id === row.id) + // if (!selected) { + // elTableRef.value?.toggleRowSelection(row, true); + // } else { + // // 取消 + // elTableRef.value?.toggleRowSelection(row, false); + // } + // console.log(elTableRef.value?.getSelectionRows()) + emit('rowClick',row,column,event) + } //反选 const togglePageSelection = ()=>{ unref(getProps).data.forEach(row=>{ @@ -165,7 +177,8 @@ export default defineComponent({ selectAll, toggleAllSelection, togglePageSelection, - clearSelection + clearSelection, + elTableRef }) const pagination = computed(() => { @@ -388,6 +401,7 @@ export default defineComponent({ onSelect-all={selectAll} onSelection-change={selectionChange} onSort-change={sortChange} + onRow-click={rowClick} {...unref(getBindValue)} > {{ @@ -397,7 +411,7 @@ export default defineComponent({ }} {unref(getProps).selectionTotal ? ( -
已选{selections.value.length}条数据
+
已选{selections.value.length}条数据
):undefined} {unref(getProps).pagination ? ( // update by 芋艿:保持和 Pagination 组件一致 @@ -416,18 +430,17 @@ export default defineComponent({ diff --git a/src/components/TableForm/src/TableForm.vue b/src/components/TableForm/src/TableForm.vue index 778cdba15..e73b602aa 100644 --- a/src/components/TableForm/src/TableForm.vue +++ b/src/components/TableForm/src/TableForm.vue @@ -1,341 +1,420 @@