Browse Source

勾选复选框--取消关联

linshi20240813
wangyufei 3 months ago
parent
commit
568edcae24
  1. 1
      src/components/SearchTable/src/SearchTable.vue
  2. 12
      src/components/Table/src/Table.vue

1
src/components/SearchTable/src/SearchTable.vue

@ -18,6 +18,7 @@
<Table
v-clientSearchTable
ref="searchTableRef"
:isCheckStrictly="isCheckStrictly"
:columns="tableColumns"
:data="tableObjectRef.tableList"
:loading="tableObjectRef.loading"

12
src/components/Table/src/Table.vue

@ -63,6 +63,8 @@ export default defineComponent({
searchTableSelectionsList:[],//
selectionColor: propTypes.bool.def(false),
rowKey: propTypes.string.def(''),
// true ; false
isCheckStrictly: propTypes.bool.def(false),
},
emits: ['update:pageSize', 'update:currentPage', 'register', 'update:sort','getSelectionRows','rowClick'],
setup(props, { attrs, slots, emit, expose }) {
@ -120,8 +122,14 @@ export default defineComponent({
const selections = ref<Recordable[]>([])
const sortRef = ref()
//
const selectRow = ()=>{
console.log(currentPageRef.value,elTableRef.value?.getSelectionRows())
const selectRow = (selection,row)=>{
console.log('selectRow',row)
const selected = elTableRef.value?.getSelectionRows().some((item) => item.id === row.id)
if(props.isCheckStrictly&&selected&&row.children){//
row.children.forEach(item => {
elTableRef.value?.toggleRowSelection(item, false);
});
}
emit('getSelectionRows', currentPageRef.value,elTableRef.value?.getSelectionRows())
}
//

Loading…
Cancel
Save