自定义checkbox后,树展开列表,样式乱了,动态计算 expandIconColumnIndex

pull/663/head
zhangdaiscott 2023-07-18 21:16:16 +08:00
parent 3aa81e50da
commit 6203e202d8
5 changed files with 18 additions and 3 deletions

View File

@ -146,6 +146,7 @@
handleCustomSelectColumn,
clearSelectedRowKeys,
deleteSelectRowByKey,
getExpandIconColumnIndex,
} = useCustomSelection(
getProps,
emit,
@ -248,6 +249,8 @@
dataSource,
footer: unref(getFooterProps),
...unref(getExpandOption),
// QQYUN-5837 expandIconColumnIndex
expandIconColumnIndex: getExpandIconColumnIndex.value,
};
//update-begin---author:wangshuai ---date:20230214 for[QQYUN-4237] ------------

View File

@ -435,6 +435,20 @@ export function useCustomSelection(
}
}
// 【QQYUN-5837】动态计算 expandIconColumnIndex
const getExpandIconColumnIndex = computed(() => {
const { expandIconColumnIndex } = unref(propsRef);
// 未设置选择列,则保持不变
if (getRowSelectionRef.value == null) {
return expandIconColumnIndex;
}
// 设置了选择列,并且未传入 index 参数,则返回 1
if (expandIconColumnIndex == null) {
return 1;
}
return expandIconColumnIndex;
});
return {
getRowSelection,
getRowSelectionRef,
@ -446,6 +460,7 @@ export function useCustomSelection(
isCustomSelection,
handleCustomSelectColumn,
clearSelectedRowKeys,
getExpandIconColumnIndex,
};
}

View File

@ -19,7 +19,6 @@
const [register, { expandAll, collapseAll }] = useTable({
title: '树形表格',
isTreeTable: true,
expandIconColumnIndex: 1,
rowSelection: {
type: 'checkbox',
getCheckboxProps(record: Recordable) {

View File

@ -68,7 +68,6 @@
schemas: searchFormSchema,
},
isTreeTable: true,
expandIconColumnIndex: 1,
},
exportConfig: {
name: '分类字典列表',

View File

@ -52,7 +52,6 @@
size: 'small',
pagination: false,
isTreeTable: true,
expandIconColumnIndex: 1,
striped: true,
useSearchForm: true,
showTableSetting: true,