diff --git a/src/components/LowDesign/src/LowTable/components/ColumnConfigDialog.vue b/src/components/LowDesign/src/LowTable/components/ColumnConfigDialog.vue
index 7257f53..3deaafe 100644
--- a/src/components/LowDesign/src/LowTable/components/ColumnConfigDialog.vue
+++ b/src/components/LowDesign/src/LowTable/components/ColumnConfigDialog.vue
@@ -35,14 +35,6 @@
/>
-
-
-
-
-
+
+
+
+ { row.isExport = val ? 'Y' : 'N'; handleConfigChange() }"
+ />
+
+
@@ -66,10 +67,10 @@ interface ColumnConfig {
label: string
hide: boolean
fixed: string | boolean
- filterable: boolean
sortable: string | boolean
showColumn: boolean
sortNum?: number
+ isExport?: string // 'Y' 表示导出,'N' 表示不导出
}
interface Props {
@@ -101,10 +102,11 @@ const initColumnConfig = () => {
label: column.label || key,
hide: column.hide || false,
fixed: column.fixed || false,
- filterable: column.filterable || false,
sortable: column.sortable || false,
showColumn: column.showColumn !== false,
- sortNum: column.sortNum
+ sortNum: column.sortNum,
+ // 默认全部勾选导出,如果已有配置则使用配置值
+ isExport: column.isExport !== undefined ? column.isExport : 'Y'
}
})
.sort((a, b) => {
@@ -129,8 +131,8 @@ const saveConfig = debounce(() => {
config[item.prop] = {
hide: item.hide,
fixed: item.fixed,
- filterable: item.filterable,
- sortable: item.sortable
+ sortable: item.sortable,
+ isExport: item.isExport || 'Y' // 默认导出
}
})
diff --git a/src/components/LowDesign/src/LowTable/index.vue b/src/components/LowDesign/src/LowTable/index.vue
index 5058ecd..0bf83f0 100644
--- a/src/components/LowDesign/src/LowTable/index.vue
+++ b/src/components/LowDesign/src/LowTable/index.vue
@@ -1499,12 +1499,12 @@ const handleColumnConfigConfirm = async (config: Record) =
if (colConfig.fixed !== undefined) {
tableOption.value.column[prop].fixed = colConfig.fixed
}
- if (colConfig.filterable !== undefined) {
- tableOption.value.column[prop].filterable = colConfig.filterable
- }
if (colConfig.sortable !== undefined) {
tableOption.value.column[prop].sortable = colConfig.sortable
}
+ if (colConfig.isExport !== undefined) {
+ tableOption.value.column[prop].isExport = colConfig.isExport
+ }
}
})
@@ -1520,18 +1520,22 @@ const handleColumnConfigConfirm = async (config: Record) =
if (colConfig.fixed !== undefined) {
column.fixed = colConfig.fixed
}
- if (colConfig.filterable !== undefined) {
- column.filterable = colConfig.filterable
- }
if (colConfig.sortable !== undefined) {
column.sortable = colConfig.sortable
}
+ if (colConfig.isExport !== undefined) {
+ column.isExport = colConfig.isExport
+ }
}
})
- // 强制更新表格布局
- if (crudRef.value.$refs && crudRef.value.$refs.table) {
+ // 强制更新表格布局和配置
+ await nextTick()
+ if (crudRef.value && crudRef.value.$refs && crudRef.value.$refs.table) {
+ // 强制更新表格布局
crudRef.value.$refs.table.doLayout()
+ // 强制 Vue 重新渲染列配置
+ await nextTick()
}
}
@@ -1541,7 +1545,8 @@ const handleColumnConfigConfirm = async (config: Record) =
Object.keys(config).forEach(prop => {
saveConfig[prop] = {
...config[prop],
- isShowColumn: config[prop].hide ? 'N' : 'Y' // hide=true checkbox选中→'N',hide=false checkbox不选中→'Y'
+ isShowColumn: config[prop].hide ? 'N' : 'Y', // hide=true checkbox选中→'N',hide=false checkbox不选中→'Y'
+ isExport: config[prop].isExport || 'Y' // 默认导出
}
})
await saveColumnConfig(pageId, saveConfig)
@@ -1599,12 +1604,12 @@ const loadColumnConfigToCrudRef = async () => {
if (colConfig.fixed !== undefined) {
tableOption.value.column[prop].fixed = colConfig.fixed
}
- if (colConfig.filterable !== undefined) {
- tableOption.value.column[prop].filterable = colConfig.filterable
- }
if (colConfig.sortable !== undefined) {
tableOption.value.column[prop].sortable = colConfig.sortable
}
+ if (colConfig.isExport !== undefined) {
+ tableOption.value.column[prop].isExport = colConfig.isExport
+ }
}
})
@@ -1630,12 +1635,12 @@ const loadColumnConfigToCrudRef = async () => {
if (colConfig.fixed !== undefined) {
column.fixed = colConfig.fixed
}
- if (colConfig.filterable !== undefined) {
- column.filterable = colConfig.filterable
- }
if (colConfig.sortable !== undefined) {
column.sortable = colConfig.sortable
}
+ if (colConfig.isExport !== undefined) {
+ column.isExport = colConfig.isExport
+ }
}
})
diff --git a/src/utils/indexedDB.ts b/src/utils/indexedDB.ts
index 5b968ce..e40d6f7 100644
--- a/src/utils/indexedDB.ts
+++ b/src/utils/indexedDB.ts
@@ -113,15 +113,15 @@ const initDB = (): Promise => {
export interface ColumnConfig {
hide?: boolean
fixed?: string | boolean
- filterable?: boolean
sortable?: string | boolean
isShowColumn?: string // 'Y' 表示显示,'N' 表示隐藏
+ isExport?: string // 'Y' 表示导出,'N' 表示不导出
}
/**
* 保存列配置
* @param key 唯一标识(通常是 route.params.id)
- * @param config 列配置对象,格式:{ prop: { hide, fixed, filterable, sortable } }
+ * @param config 列配置对象,格式:{ prop: { hide, fixed, sortable, isExport } }
*/
export const saveColumnConfig = async (key: string, config: Record): Promise => {
try {
@@ -142,7 +142,7 @@ export const saveColumnConfig = async (key: string, config: Record | null> => {
try {