/** * 设置中心分区注册表 * * - 新增一个设置分区 = 加一条 + 在 sections/ 下新建组件 * - `slot: true` 的分区不在此渲染组件,由宿主(UpperTable)通过 #field-section 插槽注入 * - 组件全部懒加载,避免设置弹窗拖慢首屏 */ import { defineAsyncComponent, type Component } from 'vue' export interface SettingsSectionMeta { key: string title: string group: string /** 作用域提示(右侧小字),帮助用户理解"这条配置影响谁" */ scopeLabel?: string /** 由宿主通过插槽提供内容(如表格列配置依赖当前表实例) */ slot?: boolean component?: Component } export const SETTINGS_GROUPS = ['表格', '显示与交互', '性能', '导航', '数据与维护'] as const export const SETTINGS_SECTIONS: SettingsSectionMeta[] = [ { key: 'field', title: '列表字段', group: '表格', scopeLabel: '当前表格', slot: true }, { key: 'tables', title: '所有表格字段', group: '表格', scopeLabel: '账号 + 角色', component: defineAsyncComponent(() => import('./sections/AllTablesSection.vue')) }, { key: 'display', title: '界面显示', group: '显示与交互', scopeLabel: '账号 + 角色', component: defineAsyncComponent(() => import('./sections/DisplaySection.vue')) }, { key: 'device', title: '设备与打印', group: '显示与交互', scopeLabel: '账号 + 仓库', component: defineAsyncComponent(() => import('./sections/DeviceSection.vue')) }, { key: 'performance', title: '表格与性能', group: '性能', scopeLabel: '账号 + 角色', component: defineAsyncComponent(() => import('./sections/PerformanceSection.vue')) }, { key: 'cache', title: '页面与标签缓存', group: '性能', scopeLabel: '账号 + 角色', component: defineAsyncComponent(() => import('./sections/CacheSection.vue')) }, { key: 'tabOrder', title: '标签排序', group: '导航', scopeLabel: '账号', component: defineAsyncComponent(() => import('./sections/TabOrderSection.vue')) }, { key: 'shortcuts', title: '快捷入口', group: '导航', scopeLabel: '账号 + 角色', component: defineAsyncComponent(() => import('./sections/ShortcutsSection.vue')) }, { key: 'exportColumns', title: '导出字段', group: '数据与维护', scopeLabel: '账号 + 角色', component: defineAsyncComponent(() => import('./sections/ExportColumnsSection.vue')) }, { key: 'data', title: '导入 / 导出与维护', group: '数据与维护', scopeLabel: '本机', component: defineAsyncComponent(() => import('./sections/DataSection.vue')) } ] export function getSettingsSection(key: string): SettingsSectionMeta | undefined { return SETTINGS_SECTIONS.find((section) => section.key === key) }