-
{{ section.title }}
-
-
-
- ⋮⋮
- onToggleColumnVisible(item.prop, !!val)"
- >
- {{ item.label || item.prop }}
-
-
-
-
-
- ←
-
-
- →
-
-
-
- →
-
-
-
- ←
-
-
- ↑
-
-
- ↓
-
-
-
-
-
将列拖到此处固定
+
+
+
+
+
列表字段
+
+ 当前表格:勾选显示列、拖动调整顺序;导出/导入配置与故障修复请前往「数据与维护」。
+
恢复默认
-
-
-
- 关闭
+
+
+
+
{{ section.title }}
+
+
+
+ ⋮⋮
+ onToggleColumnVisible(item.prop, !!val)"
+ >
+ {{ item.label || item.prop }}
+
+
+
+
+
+ ←
+
+
+ →
+
+
+
+ →
+
+
+
+ ←
+
+
+ ↑
+
+
+ ↓
+
+
+
+
+ 将列拖到此处固定
+
+
+
+
+
+
-
+
-
-
-
-
+
+
+
+
diff --git a/src/components/settings/registry.ts b/src/components/settings/registry.ts
new file mode 100644
index 00000000..e949b636
--- /dev/null
+++ b/src/components/settings/registry.ts
@@ -0,0 +1,98 @@
+/**
+ * 设置中心分区注册表
+ *
+ * - 新增一个设置分区 = 加一条 + 在 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)
+}
diff --git a/src/components/settings/sections/AllTablesSection.vue b/src/components/settings/sections/AllTablesSection.vue
new file mode 100644
index 00000000..7939b4ae
--- /dev/null
+++ b/src/components/settings/sections/AllTablesSection.vue
@@ -0,0 +1,418 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
{{ current.title || current.tableId }}
+
{{ current.tableId }}
+
+
+
+
+ 恢复默认
+
+
+
+
+
+ 该表格没有可配置的字段
+
+
+
{{ section.title }}
+
+
toggleVisible(col.prop, !!val)"
+ >
+ {{ col.label || col.prop }}
+
+
{{ col.prop }}
+
+ ←
+ →
+ →
+ ←
+ ↑
+ ↓
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/settings/sections/CacheSection.vue b/src/components/settings/sections/CacheSection.vue
new file mode 100644
index 00000000..34402d0c
--- /dev/null
+++ b/src/components/settings/sections/CacheSection.vue
@@ -0,0 +1,116 @@
+
+
+
+
+
+
+
页面缓存
+
通过顶部导航栏 / 页面 tab 切换的路由页面缓存策略
+
+
+
+ 页面缓存
+
+ 关闭后切换页面会重新加载
+
+
+ 最大缓存页面数量
+
+ 超出后淘汰最久未使用的页面
+
+
+
+
+
+
tab 缓存
+
含 tab 标签页切换功能页面的 KeepAlive 缓存策略
+
+
+
+ tab 缓存
+
+
+
+ 最大缓存 tab 数量
+
+ 超出后淘汰最久未使用的 tab
+
+
+
+
+
+
+
+
+
diff --git a/src/components/settings/sections/DataSection.vue b/src/components/settings/sections/DataSection.vue
new file mode 100644
index 00000000..14fb4519
--- /dev/null
+++ b/src/components/settings/sections/DataSection.vue
@@ -0,0 +1,398 @@
+
+
+
+
+
+
配置文件
+
+ 导出/导入当前账号在本机的全部可配置项(字段设置、标签排序、界面显示、缓存、快捷键等)。
+ 文件名:tbyc-config.json。
+
+
+ 导出配置
+
+ 导入配置
+
+
+
+ 导入会覆盖同名配置,不会清空文件中未涉及的项;旧版字段配置文件仍可导入。
+
+
+
+
+
+
恢复默认
+
+ 恢复字段设置、界面显示、表格与缓存、标签排序为本机默认值(不影响快捷入口)。
+
+
+ 恢复全部默认
+
+
+
+
+
+
故障修复
+
+ 清除当前电脑中此账号的全部字段配置、标签排序、显示设置、表格与缓存设置及快捷键,并恢复默认配置(不可撤销)。
+
+
+ 故障修复
+
+
+
+
+
+
诊断信息
+
反馈问题时可提供以下信息(均为本机浏览器存储,不会上传)。
+
+ {{ identity.userId }}
+ {{ identity.roleId }}
+ {{ identity.warehouseId || '—' }}
+ tbyc-config v{{ TBYC_CONFIG_VERSION }}
+ {{ storageSizeText }}
+ {{ columnProfileCount }} 张表
+
+
+
+
+ {{ item.label }}
+ {{ item.key }}
+
+
+
+
+
+
+
+
+
diff --git a/src/components/settings/sections/DeviceSection.vue b/src/components/settings/sections/DeviceSection.vue
new file mode 100644
index 00000000..d61ef411
--- /dev/null
+++ b/src/components/settings/sections/DeviceSection.vue
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
diff --git a/src/components/settings/sections/DisplaySection.vue b/src/components/settings/sections/DisplaySection.vue
new file mode 100644
index 00000000..e24e5dbc
--- /dev/null
+++ b/src/components/settings/sections/DisplaySection.vue
@@ -0,0 +1,134 @@
+
+
+
+
+
+
+
+ 布局模式
+
+ 顶部导航(默认)
+ 侧边栏
+
+ 切换后立即生效
+
+
+
+ 固定头部
+
+ 滚动时导航栏保持可见
+
+
+
+ 侧栏 Logo
+
+ 侧边栏模式下是否显示 Logo
+
+
+
+ Scan-box 显示模式
+
+ 紧凑(默认)
+ 标准
+
+ 紧凑模式行高更小,一屏显示更多筛选条件
+
+
+
+ 工具栏按钮模式
+
+ 平铺(默认)
+ 折叠
+
+ 工具栏按钮组的排列方式
+
+
+
+ 快捷键区域
+
+ 展开顶部快捷键面板(默认收起)
+
+
+
+
+
+
+
+
diff --git a/src/components/settings/sections/ExportColumnsSection.vue b/src/components/settings/sections/ExportColumnsSection.vue
new file mode 100644
index 00000000..db07ae35
--- /dev/null
+++ b/src/components/settings/sections/ExportColumnsSection.vue
@@ -0,0 +1,400 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 全选
+
+ 反选
+ 清空
+ 已选 {{ selected.length }} / {{ allFields.length }}
+ 恢复默认(全选)
+
+
+
+
+
+ {{ group.name }}
+ handleToggleGroup(group.name, v)"
+ >
+ 全选
+
+
+ {{ getGroupSelectedCount(group.name) }}/{{ group.fields.length }}
+
+
+
+
+
+ {{ field }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/settings/sections/PerformanceSection.vue b/src/components/settings/sections/PerformanceSection.vue
new file mode 100644
index 00000000..b40f73f9
--- /dev/null
+++ b/src/components/settings/sections/PerformanceSection.vue
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+ 表格工作模式
+
+ 低占用(默认)
+ 高性能
+
+ 低占用优先减少资源开销;高性能优先滚动与渲染流畅度
+
+
+
+
+
+
+
+
diff --git a/src/components/settings/sections/ShortcutsSection.vue b/src/components/settings/sections/ShortcutsSection.vue
new file mode 100644
index 00000000..8a70d1e2
--- /dev/null
+++ b/src/components/settings/sections/ShortcutsSection.vue
@@ -0,0 +1,104 @@
+
+
+
+
+
+
+
+
+ {{ item.title }}
+ {{ item.path }}
+
+
移除
+
+
+
+
+
+
+
+
+
diff --git a/src/components/settings/sections/TabOrderSection.vue b/src/components/settings/sections/TabOrderSection.vue
new file mode 100644
index 00000000..56b6aa73
--- /dev/null
+++ b/src/components/settings/sections/TabOrderSection.vue
@@ -0,0 +1,16 @@
+
+
+
+
+
+
diff --git a/src/components/settings/sections/shared.scss b/src/components/settings/sections/shared.scss
new file mode 100644
index 00000000..f2a6713e
--- /dev/null
+++ b/src/components/settings/sections/shared.scss
@@ -0,0 +1,96 @@
+/* 设置中心分区通用样式
+ 视觉基准:task-panel(order/waveOrder 新建波次策略、basicManagement 新增投递计划)
+ —— 输入/选项行透明无容器,12px 标签 #606266,间距 16px */
+
+.settings-section {
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+}
+
+/* ===== 分区标题区 ===== */
+.section-header {
+ display: flex;
+ align-items: flex-start;
+ justify-content: space-between;
+ gap: 12px;
+ padding: 4px 0 0 12px;
+}
+
+.section-title {
+ font-size: 13px;
+ line-height: 20px;
+ font-weight: 600;
+ color: #303133;
+}
+
+.section-desc {
+ margin-top: 4px;
+ font-size: 12px;
+ line-height: 18px;
+ color: #909399;
+}
+
+/* ===== 分组容器:保持透明,不再使用灰色圆角背景 ===== */
+.settings-card {
+ display: flex;
+ flex-direction: column;
+ padding: 0;
+ border: none;
+ border-radius: 0;
+ background: transparent;
+}
+
+/* ===== 设置行(对齐 task-panel__field--input) ===== */
+.setting-row {
+ display: flex;
+ align-items: center;
+ gap: 16px;
+ min-height: 40px;
+ padding: 4px 0 0 12px;
+}
+
+.setting-label {
+ flex: 0 0 88px;
+ width: 88px;
+ font-size: 12px;
+ line-height: 20px;
+ color: #606266;
+ text-align: left;
+}
+
+.setting-hint {
+ font-size: 12px;
+ line-height: 18px;
+ color: #909399;
+}
+
+/* ===== 数据/维护类区块 ===== */
+.section-block + .section-block {
+ margin-top: 12px;
+}
+
+.block-title {
+ font-size: 13px;
+ line-height: 20px;
+ font-weight: 600;
+ color: #303133;
+ padding-left: 2px;
+}
+
+.block-desc {
+ margin: 4px 0 8px;
+ padding-left: 2px;
+ font-size: 12px;
+ line-height: 18px;
+ color: #909399;
+}
+
+.block-actions {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ flex-wrap: wrap;
+ padding-left: 2px;
+}
+
diff --git a/src/config/tbyc-config-sections.ts b/src/config/tbyc-config-sections.ts
index 14a4dee8..cffc30a8 100644
--- a/src/config/tbyc-config-sections.ts
+++ b/src/config/tbyc-config-sections.ts
@@ -10,7 +10,12 @@
import { useUserStore } from '@/stores/modules/user'
import { useSettingsStore } from '@/stores/modules/settings'
import { useShortcutsStore } from '@/stores/modules/shortcuts'
+import { useExperimentalStore } from '@/stores/modules/experimental'
+import { useUserPreferenceStore } from '@/stores/modules/userPreference'
+import { PRINTER_AUTO_RECONNECT_SCOPE } from '@/stores/modules/printerComponent'
import { getTabOrderPageKeys } from '@/config/tab-order-registry'
+import { ORDER_INDEX_EXPORT_SCOPES } from '@/views/order/shared/orderListExport'
+import { getOrderExportColumnsByMode } from '@/views/order/orderManagement/config/order-common-config'
import {
normalizeTabOrderDoc,
readTabOrderDoc,
@@ -201,7 +206,70 @@ const displaySection: TbycConfigSection = {
}
}
-/** ============ 分区 4:快捷键 ============ */
+/** ============ 分区 4:表格与缓存(experimental store) ============ */
+const experimentalSection: TbycConfigSection = {
+ key: 'experimental',
+ title: '表格与缓存',
+ collect: () => {
+ const store = useExperimentalStore()
+ return {
+ tableMode: store.tableMode,
+ tabCacheEnabled: store.tabCacheEnabled,
+ tabCacheMax: store.tabCacheMax,
+ pageCacheEnabled: store.pageCacheEnabled,
+ pageCacheMax: store.pageCacheMax
+ }
+ },
+ apply: (data) => {
+ if (!data || typeof data !== 'object' || Array.isArray(data)) return 0
+ const source = data as Record
+ const store = useExperimentalStore()
+ let count = 0
+
+ if (source.tableMode === 'performance' || source.tableMode === 'resource') {
+ store.setTableMode(source.tableMode)
+ count += 1
+ }
+ if (typeof source.tabCacheEnabled === 'boolean') {
+ store.setTabCacheEnabled(source.tabCacheEnabled)
+ count += 1
+ }
+ if (Number.isInteger(source.tabCacheMax) && source.tabCacheMax > 0) {
+ store.setTabCacheMax(source.tabCacheMax)
+ count += 1
+ }
+ if (typeof source.pageCacheEnabled === 'boolean') {
+ store.setPageCacheEnabled(source.pageCacheEnabled)
+ count += 1
+ }
+ if (Number.isInteger(source.pageCacheMax) && source.pageCacheMax > 0) {
+ store.setPageCacheMax(source.pageCacheMax)
+ count += 1
+ }
+
+ return count
+ }
+}
+
+/**
+ * ============ 分区 5:设备与打印(暂无 UI,仅导出/导入) ============
+ * 数据源:userPreference 的仓库级 scope `printer.autoReconnect`
+ */
+const printerSection: TbycConfigSection = {
+ key: 'printer',
+ title: '设备与打印',
+ collect: () => {
+ const value = useUserPreferenceStore().get(PRINTER_AUTO_RECONNECT_SCOPE)
+ return value ?? undefined
+ },
+ apply: (data) => {
+ if (!data || typeof data !== 'object' || Array.isArray(data)) return 0
+ useUserPreferenceStore().set(PRINTER_AUTO_RECONNECT_SCOPE, data)
+ return 1
+ }
+}
+
+/** ============ 分区 6:快捷键 ============ */
const shortcutsSection: TbycConfigSection = {
key: 'shortcuts',
title: '快捷键',
@@ -225,11 +293,69 @@ const shortcutsSection: TbycConfigSection = {
}
}
+/** ============ 分区 7:订单导出字段(订单管理 · 导出弹窗的字段勾选) ============ */
+const ORDER_EXPORT_MODES = ['waybill', 'item'] as const
+
+const orderExportColumnsSection: TbycConfigSection = {
+ key: 'orderExportColumns',
+ title: '订单导出字段',
+ collect: () => {
+ const { userId, roleId } = currentIdentity()
+ const prefix = `order_export_columns_${userId}_${roleId}_`
+ const result: Record> = {}
+ Object.keys(localStorage).forEach((key) => {
+ if (!key.startsWith(prefix)) return
+ const [scopeKey, mode] = key.slice(prefix.length).split('_')
+ if (!scopeKey || !mode) return
+ try {
+ const parsed = JSON.parse(localStorage.getItem(key) || 'null')
+ if (!Array.isArray(parsed)) return
+ const scope = result[scopeKey] || (result[scopeKey] = {})
+ scope[mode] = parsed.filter((field: unknown): field is string => typeof field === 'string')
+ } catch {
+ // 忽略损坏的配置
+ }
+ })
+ return Object.keys(result).length ? result : undefined
+ },
+ apply: (data) => {
+ if (!data || typeof data !== 'object' || Array.isArray(data)) return 0
+ const { userId, roleId } = currentIdentity()
+ const prefix = `order_export_columns_${userId}_${roleId}_`
+ const source = data as Record>
+ let count = 0
+
+ Object.keys(source).forEach((scopeKey) => {
+ if (!(scopeKey in ORDER_INDEX_EXPORT_SCOPES)) return
+ const scoped = source[scopeKey]
+ if (!scoped || typeof scoped !== 'object' || Array.isArray(scoped)) return
+
+ ORDER_EXPORT_MODES.forEach((mode) => {
+ const list = scoped[mode]
+ if (!Array.isArray(list)) return
+ const valid = new Set(getOrderExportColumnsByMode(mode))
+ const fields = list.filter((field): field is string => typeof field === 'string' && valid.has(field))
+ try {
+ localStorage.setItem(`${prefix}${scopeKey}_${mode}`, JSON.stringify(fields))
+ count += 1
+ } catch {
+ // localStorage 不可用时跳过
+ }
+ })
+ })
+
+ return count
+ }
+}
+
export const TBYC_CONFIG_SECTIONS: TbycConfigSection[] = [
fieldColumnsSection,
tabOrderSection,
displaySection,
- shortcutsSection
+ experimentalSection,
+ printerSection,
+ shortcutsSection,
+ orderExportColumnsSection
]
/** 按 key 取分区 */
diff --git a/src/layout/component/Navbar.vue b/src/layout/component/Navbar.vue
index 1ff92436..5d8488a8 100644
--- a/src/layout/component/Navbar.vue
+++ b/src/layout/component/Navbar.vue
@@ -70,6 +70,10 @@
{{ tMenu('Profile') }}
+
+
+ 设置
+
{{ $t('login.logOut') || 'Log Out' }}
@@ -86,6 +90,9 @@