1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
| import {
| defineOverridesPreferences,
| definePreferencesExtension,
| } from './packages/preferences/src';
|
| declare const __APP_LOGO__: string;
| declare const __APP_NAME__: string;
|
| interface WebAntdPreferencesExtension {
| defaultTableSize: number;
| enableFormFullscreen: boolean;
| reportTitle: string;
| tenantMode: 'multi' | 'single';
| }
|
| /** 门户外观;首次升级时同步到已有用户,后续保留用户自己的偏好。 */
| export const portalAppearancePreferences = defineOverridesPreferences({
| app: {
| layout: 'mixed-nav',
| defaultAvatar: '/static/imgs/portal-avatar.svg',
| contentPadding: 16,
| contentPaddingTop: 16,
| contentPaddingRight: 16,
| contentPaddingBottom: 16,
| contentPaddingLeft: 16,
| },
| header: { height: 72, menuAlign: 'start', mode: 'fixed' },
| navigation: { split: true, accordion: true, styleType: 'rounded' },
| sidebar: { width: 228, autoActivateChild: true, expandOnHover: false, collapsed: false, hidden: false, enable: true },
| tabbar: { height: 40, styleType: 'plain', persist: false },
| theme: {
| builtinType: 'custom',
| colorPrimary: '#b7242d',
| mode: 'light',
| radius: '0.5',
| semiDarkHeader: false,
| semiDarkSidebar: false,
| semiDarkSidebarSub: false,
| },
| widget: { globalSearch: true, languageToggle: false, timezone: false },
| });
|
| /**
| * @description 项目配置文件
| * 只需要覆盖项目中的一部分配置,不需要的配置不用覆盖,会自动使用默认配置
| * !!! 更改配置后请清空缓存,否则可能不生效
| */
| export const overridesPreferences = defineOverridesPreferences({
| ...portalAppearancePreferences,
| // overrides
| app: {
| ...portalAppearancePreferences.app,
| /** 后端路由模式 */
| accessMode: 'backend',
| name: __APP_NAME__ || import.meta.env.VITE_APP_TITLE,
| enableRefreshToken: true,
| },
| footer: {
| /** 默认关闭 footer 页脚,因为有一定遮挡 */
| enable: false,
| fixed: false,
| },
| copyright: {
| companyName: __APP_NAME__ || import.meta.env.VITE_APP_TITLE,
| companySiteLink: '#',
| },
| logo: {
| source: __APP_LOGO__ || undefined,
| },
| tabbar: {
| ...portalAppearancePreferences.tabbar,
| /** 刷新浏览器后只保留当前页面,不持久化所有标签页 */
| persist: false,
| },
| });
|
| export const preferencesExtension =
| definePreferencesExtension<WebAntdPreferencesExtension>({
| tabLabel: 'preferences.antd.tabLabel',
| title: 'preferences.antd.title',
| fields: [
| {
| component: 'switch',
| defaultValue: true,
| key: 'enableFormFullscreen',
| label: 'preferences.antd.fields.enableFormFullscreen.label',
| tip: 'preferences.antd.fields.enableFormFullscreen.tip',
| },
| {
| component: 'select',
| defaultValue: 'single',
| key: 'tenantMode',
| label: 'preferences.antd.fields.tenantMode.label',
| options: [
| {
| label: 'preferences.antd.fields.tenantMode.options.single.label',
| value: 'single',
| },
| {
| label: 'preferences.antd.fields.tenantMode.options.multi.label',
| value: 'multi',
| },
| ],
| },
| {
| component: 'number',
| componentProps: {
| max: 200,
| min: 10,
| step: 10,
| },
| defaultValue: 20,
| key: 'defaultTableSize',
| label: 'preferences.antd.fields.defaultTableSize.label',
| },
| {
| component: 'input',
| defaultValue: '',
| key: 'reportTitle',
| label: 'preferences.antd.fields.reportTitle.label',
| placeholder: 'preferences.antd.fields.reportTitle.placeholder',
| },
| ].filter((field) => import.meta.env.VITE_COMPANY !== 'JSSM' || field.key !== 'tenantMode'),
| });
|
|