From 7d13a4cb61429d9e5880baeb2c013ee1d731078d Mon Sep 17 00:00:00 2001 From: chenlin Date: Tue, 27 Jan 2026 00:30:27 +0800 Subject: [PATCH] no message --- .../LowTable/components/ColumnConfigDialog.vue | 15 ++++++++++----- src/components/LowDesign/src/LowTable/index.vue | 3 --- src/components/LowDesign/src/utils/tableUtil.ts | 5 +++-- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/components/LowDesign/src/LowTable/components/ColumnConfigDialog.vue b/src/components/LowDesign/src/LowTable/components/ColumnConfigDialog.vue index 6c77477..7257f53 100644 --- a/src/components/LowDesign/src/LowTable/components/ColumnConfigDialog.vue +++ b/src/components/LowDesign/src/LowTable/components/ColumnConfigDialog.vue @@ -69,6 +69,7 @@ interface ColumnConfig { filterable: boolean sortable: string | boolean showColumn: boolean + sortNum?: number } interface Props { @@ -93,10 +94,6 @@ const initColumnConfig = () => { if (!props.columns) return columnConfigList.value = Object.keys(props.columns) - .filter(key => { - const column = props.columns[key] - return column.showColumn !== false && column.prop - }) .map(key => { const column = props.columns[key] return { @@ -106,10 +103,18 @@ const initColumnConfig = () => { fixed: column.fixed || false, filterable: column.filterable || false, sortable: column.sortable || false, - showColumn: column.showColumn !== false + showColumn: column.showColumn !== false, + sortNum: column.sortNum } }) .sort((a, b) => { + // 优先按 sortNum 排序(从小到大) + if (a.sortNum !== undefined && b.sortNum !== undefined) { + return a.sortNum - b.sortNum + } + if (a.sortNum !== undefined) return -1 + if (b.sortNum !== undefined) return 1 + // 如果都没有 sortNum,则按 label 排序 const labelA = a.label || '' const labelB = b.label || '' return labelA.localeCompare(labelB, 'zh-CN') diff --git a/src/components/LowDesign/src/LowTable/index.vue b/src/components/LowDesign/src/LowTable/index.vue index fcff1f7..5058ecd 100644 --- a/src/components/LowDesign/src/LowTable/index.vue +++ b/src/components/LowDesign/src/LowTable/index.vue @@ -1417,7 +1417,6 @@ const replaceColumnButton = () => { // 添加新的事件监听器 newButtonClone.addEventListener('click', (e) => { - debugger e.preventDefault() e.stopPropagation() showColumnConfigDrawer.value = true @@ -1555,12 +1554,10 @@ const loadColumnConfigToFieldList = async () => { try { const pageId = (route.params.id as string) || props.tableId const savedConfig = await getColumnConfig(pageId) - debugger if (savedConfig) { // 修改 fieldList 中的 webEntity.isShowColumn fieldListRef.value.forEach((field: any) => { - debugger if (field.webEntity && field.fieldCode && savedConfig[field.fieldCode] !== undefined) { const colConfig = savedConfig[field.fieldCode] // 优先使用 isShowColumn,如果没有则使用 hide 转换 diff --git a/src/components/LowDesign/src/utils/tableUtil.ts b/src/components/LowDesign/src/utils/tableUtil.ts index 834edfb..9929124 100644 --- a/src/components/LowDesign/src/utils/tableUtil.ts +++ b/src/components/LowDesign/src/utils/tableUtil.ts @@ -116,7 +116,7 @@ const initColumn = (data, componentData, columnParams) => { const summaryBottom = {} const tableDic = {} data.forEach(item => { - const { dictEntity, webEntity, queryEntity, exportEntity, summaryEntity, fieldCode, fieldName, fieldType, fieldLen, fieldPointLen, fieldDefaultVal } = item + const { dictEntity, webEntity, queryEntity, exportEntity, summaryEntity, fieldCode, fieldName, fieldType, fieldLen, fieldPointLen, fieldDefaultVal, sortNum } = item const { cellWidthType, cellWidth, controlsConfig, verifyConfig, isShowForm, isShowList, isDbSelect, isShowColumn, isShowSort, isRequired } = webEntity let controlType = webEntity.controlType || 'input' const { queryIsWeb, queryMode, queryConfig, queryDefaultVal } = queryEntity @@ -140,7 +140,8 @@ const initColumn = (data, componentData, columnParams) => { dataType: ['Integer', 'BigInt', 'BigDecimal'].includes(fieldType) || controlType == 'number' ? 'number' : 'string', overHidden: isCardTable ? false : true, className: `low-field__${fieldCode} control-${controlType}`, - labelClassName: `low-header__${fieldCode}` + labelClassName: `low-header__${fieldCode}`, + sortNum: sortNum } //租户字段的列表、表单权限控制