WEB/src/components/settings/registry.ts
yin 03f7f73d70 feat(settings): 新增统一设置中心,集中管理字段、标签、缓存等本地配置
- 新增 SettingsDialog 及 registry 分区注册表,按「表格 / 显示与交互 / 性能 /
  导航 / 数据与维护」分组,分区组件全部懒加载,支持关键字搜索与作用域提示
- 新增 10 个设置分区:列表字段(宿主插槽)、所有表格字段、界面显示、
  设备与打印、表格与性能、页面与标签缓存、标签排序、快捷入口、
  导出字段、导入/导出与维护(tbyc-config.json)
- Navbar 头像下拉新增「设置」入口;UpperTable 工具栏的「更多设置 / 标签排序」
  收敛为「字段设置」,通过 #field-section 插槽注入当前表格列配置
- TabOrderSettingsDialog 重命名为可复用面板 TabOrderPanel,接入设置中心
- 抽离 table-column-config 工具与 tableColumnConfig store,支持跨页面管理
  所有表格列配置,修改后按 tableId 版本号通知已打开表格重建列配置
- tbyc-config 新增 experimental、printer、订单导出字段等分区,
  导入/导出覆盖更多本地配置,并兼容旧版字段配置与 tabOrders 文件
- 移除 MoreSettingsDialog;OrderExportColumnsDialog 与设置中心共用导出字段
  存储,区分「未配置」与「空选择」;订单各页清理重复的下拉选项映射逻辑
- 新增《设置中心-设计与实施》文档,更新标签排序与 tbyc-config 说明
2026-11-08 18:00:13 +08:00

99 lines
2.9 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 设置中心分区注册表
*
* - 新增一个设置分区 = 加一条 + 在 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)
}