自定义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, handleCustomSelectColumn,
clearSelectedRowKeys, clearSelectedRowKeys,
deleteSelectRowByKey, deleteSelectRowByKey,
getExpandIconColumnIndex,
} = useCustomSelection( } = useCustomSelection(
getProps, getProps,
emit, emit,
@ -248,6 +249,8 @@
dataSource, dataSource,
footer: unref(getFooterProps), footer: unref(getFooterProps),
...unref(getExpandOption), ...unref(getExpandOption),
// QQYUN-5837 expandIconColumnIndex
expandIconColumnIndex: getExpandIconColumnIndex.value,
}; };
//update-begin---author:wangshuai ---date:20230214 for[QQYUN-4237] ------------ //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 { return {
getRowSelection, getRowSelection,
getRowSelectionRef, getRowSelectionRef,
@ -446,6 +460,7 @@ export function useCustomSelection(
isCustomSelection, isCustomSelection,
handleCustomSelectColumn, handleCustomSelectColumn,
clearSelectedRowKeys, clearSelectedRowKeys,
getExpandIconColumnIndex,
}; };
} }

View File

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

View File

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

View File

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