diff --git a/src/components/Table/src/BasicTable.vue b/src/components/Table/src/BasicTable.vue index 256e450..0c2fdc7 100644 --- a/src/components/Table/src/BasicTable.vue +++ b/src/components/Table/src/BasicTable.vue @@ -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]代码生成 内嵌子表模式 没有滚动条------------ diff --git a/src/components/Table/src/hooks/useCustomSelection.tsx b/src/components/Table/src/hooks/useCustomSelection.tsx index cce9161..3d36da6 100644 --- a/src/components/Table/src/hooks/useCustomSelection.tsx +++ b/src/components/Table/src/hooks/useCustomSelection.tsx @@ -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, }; } diff --git a/src/views/demo/table/TreeTable.vue b/src/views/demo/table/TreeTable.vue index 5196253..88afe63 100644 --- a/src/views/demo/table/TreeTable.vue +++ b/src/views/demo/table/TreeTable.vue @@ -19,7 +19,6 @@ const [register, { expandAll, collapseAll }] = useTable({ title: '树形表格', isTreeTable: true, - expandIconColumnIndex: 1, rowSelection: { type: 'checkbox', getCheckboxProps(record: Recordable) { diff --git a/src/views/system/category/index.vue b/src/views/system/category/index.vue index 87c85af..bb4a998 100644 --- a/src/views/system/category/index.vue +++ b/src/views/system/category/index.vue @@ -68,7 +68,6 @@ schemas: searchFormSchema, }, isTreeTable: true, - expandIconColumnIndex: 1, }, exportConfig: { name: '分类字典列表', diff --git a/src/views/system/menu/index.vue b/src/views/system/menu/index.vue index 92817e8..c83a432 100644 --- a/src/views/system/menu/index.vue +++ b/src/views/system/menu/index.vue @@ -52,7 +52,6 @@ size: 'small', pagination: false, isTreeTable: true, - expandIconColumnIndex: 1, striped: true, useSearchForm: true, showTableSetting: true,