@epxing/core 5.3.0-beta.2 → 5.3.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/API.md +715 -714
  2. package/README.md +3 -1
  3. package/dist/.cache/route-chart-release/frontend/frame/public/js/ecStat.min.js +4 -0
  4. package/dist/.cache/route-chart-release/frontend/frame/public/js/echarts-wordcloud.min.js +6 -0
  5. package/dist/.cache/route-chart-release/frontend/frame/public/js/echarts.min.js +49 -0
  6. package/dist/_virtual/_plugin-vue_export-helper.js +10 -0
  7. package/dist/_virtual/jsencrypt.min.js +1 -1
  8. package/dist/assets/role_select-DTqRlFNz.webp +0 -0
  9. package/dist/{_vendor → frontend/frame/_vendor}/.pnpm/jsencrypt@3.5.4/_vendor/jsencrypt/bin/jsencrypt.min.js +1 -1
  10. package/dist/src/RootApp.js +54 -0
  11. package/dist/src/api/createHttp.js +6 -0
  12. package/dist/src/app-ui-settings.js +49 -0
  13. package/dist/src/axios.js +10 -15
  14. package/dist/src/chart-runtime-assets.js +19 -0
  15. package/dist/src/chart-runtime-sources.js +8 -0
  16. package/dist/src/create-app.js +3 -6
  17. package/dist/src/index.js +2 -0
  18. package/dist/src/loadComponent.js +2 -2
  19. package/dist/src/menu-route.js +11 -0
  20. package/dist/src/mixins/component.js +3 -0
  21. package/dist/src/navigation-context.js +47 -0
  22. package/dist/src/navigation.js +43 -12
  23. package/dist/src/package-install.js +3 -2
  24. package/dist/src/plugins/element-plus.js +8 -8
  25. package/dist/src/public-api.js +4 -2
  26. package/dist/src/route-components.js +9 -0
  27. package/dist/src/router/config.js +7 -8
  28. package/dist/src/runtime-services.js +1 -1
  29. package/dist/src/runtime-utils/meta.js +3 -0
  30. package/dist/src/runtime-utils/pdf.viewer.js +31 -15
  31. package/dist/src/runtime-utils/util.js +28 -5
  32. package/dist/src/shared-packages.js +1 -3
  33. package/dist/src/store/modules/list.js +25 -3
  34. package/dist/src/store/modules/meta.js +49 -7
  35. package/dist/src/style-presets.js +4 -4
  36. package/dist/src/ui-settings.js +90 -18
  37. package/dist/src/views/App.js +48 -0
  38. package/dist/src/views/AppRoleSelect.js +233 -0
  39. package/dist/src/views/Error.js +210 -0
  40. package/dist/src/views/Module.js +173 -0
  41. package/dist/style.css +251 -0
  42. package/package.json +4 -4
  43. package/src/RootApp.vue +75 -0
  44. package/src/api/createHttp.js +7 -0
  45. package/src/api/index.js +47 -47
  46. package/src/app-ui-settings.js +31 -0
  47. package/src/axios.js +311 -318
  48. package/src/chart-runtime-assets.js +13 -0
  49. package/src/chart-runtime-sources.js +5 -0
  50. package/src/create-app.js +3 -7
  51. package/src/index.js +28 -28
  52. package/src/install.js +157 -157
  53. package/src/loadComponent.js +187 -187
  54. package/src/loadLibrary.js +99 -99
  55. package/src/menu-route.js +12 -1
  56. package/src/mixins/component.js +1464 -1461
  57. package/src/navigation-context.js +49 -0
  58. package/src/navigation.js +208 -176
  59. package/src/package-install.js +2 -1
  60. package/src/plugins/element-plus.js +302 -302
  61. package/src/plugins/frame.js +178 -178
  62. package/src/public-api.js +1 -0
  63. package/src/route-components.js +7 -0
  64. package/src/router/config.js +861 -864
  65. package/src/router/public.js +1 -1
  66. package/src/runtime-services.js +1 -1
  67. package/src/runtime-utils/fieldFactory.js +179 -179
  68. package/src/runtime-utils/meta.js +399 -378
  69. package/src/runtime-utils/pdf.viewer.js +672 -644
  70. package/src/runtime-utils/util.js +1359 -1330
  71. package/src/shared-packages.js +1 -3
  72. package/src/store/modules/config.js +351 -351
  73. package/src/store/modules/list.js +30 -3
  74. package/src/store/modules/locale.js +236 -236
  75. package/src/store/modules/meta.js +314 -265
  76. package/src/style-presets.js +4 -4
  77. package/src/ui-settings.js +84 -23
  78. package/src/views/App.vue +53 -0
  79. package/src/views/AppRoleSelect.vue +334 -0
  80. package/src/views/Error.vue +63 -0
  81. package/src/views/Module.vue +210 -0
  82. package/src/xss.js +26 -26
  83. package/types/app.d.ts +10 -10
  84. package/types/axios.d.ts +1 -1
  85. package/types/component-mixin.d.ts +1 -1
  86. package/types/field-factory.d.ts +1 -1
  87. package/types/global-mixin.d.ts +1 -1
  88. package/types/http.d.ts +1 -1
  89. package/types/index.d.ts +3 -0
  90. package/types/meta.d.ts +1 -1
  91. package/types/navigation.d.ts +21 -21
  92. package/types/pdf-viewer.d.ts +1 -1
  93. package/types/runtime.d.ts +13 -13
  94. package/types/store.d.ts +1 -1
  95. package/types/util.d.ts +2 -2
  96. /package/dist/{build → .cache/route-chart-release/frontend/frame/build}/stubs/empty-components.js +0 -0
  97. /package/dist/{src → .cache/route-chart-release/frontend/frame/src}/element-icons.names.js +0 -0
  98. /package/dist/{src → .cache/route-chart-release/frontend/frame/src}/element-plus.lazy.js +0 -0
  99. /package/dist/{_vendor → frontend/frame/_vendor}/.pnpm/element-plus@2.14.3_vue@3.5.39_typescript@5.9.3_/_vendor/element-plus/dist/locale/en.js +0 -0
  100. /package/dist/{_vendor → frontend/frame/_vendor}/.pnpm/element-plus@2.14.3_vue@3.5.39_typescript@5.9.3_/_vendor/element-plus/dist/locale/zh-cn.js +0 -0
@@ -1,351 +1,351 @@
1
- /**
2
- * 获取页面配置
3
- */
4
- import { GET_SYSTEM_CONFIG, GET_APP_CONFIG, GET_MENU, CLEAR_MENU, SWITCH_MENU_SHOW, GET_VIEWPORT } from '../actions'
5
- import { ElMessage } from 'element-plus/es/components/message/index.mjs'
6
- import http from '@epxing/core/src/api'
7
- import util from '@epxing/core/src/runtime-utils/util'
8
- import { resolveRouteRole } from '@epxing/core/src/menu-route'
9
- import axios from '@epxing/core/src/axios'
10
- import { applyViewportAttr } from '@epxing/core/src/viewport'
11
- import { ensureIcons, collectIconNames } from '@epxing/icons/src/runtime.mjs'
12
- const screenWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth
13
- const mobileWidth = 992
14
-
15
- // 引导期:初始 state 是模块求值期算出来的,属性要在这一刻就落下,
16
- // 否则首帧到第一次 resize 之间移动端拿不到令牌轴。
17
- applyViewportAttr(screenWidth <= mobileWidth)
18
-
19
- export default {
20
- state: {
21
- systemConfig: {},
22
- appConfig: {}, // 应用配置
23
- configSystem: {},
24
- clientConfig: {}, // 客户信息
25
- appMenus: [],
26
- currentMenu: {},
27
- route: {},
28
- routers: [],
29
- showMenu: true,
30
- showAppNav: true,
31
- screen: {
32
- width: screenWidth,
33
- height: window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight
34
- },
35
- mobileWidth: 992,
36
- isMobile: screenWidth <= mobileWidth,
37
- isPcMd: screenWidth > mobileWidth && screenWidth <= 1400,
38
- isPcLg: screenWidth > 1400 && screenWidth <= 1680,
39
- isPcXl: screenWidth > 1680,
40
- systemVariableList: [],
41
- decryptKey: {
42
- rsaKey: ''
43
- },
44
- temporaryRole: null, // 临时角色
45
- componentGlobalConfig: null,
46
- systemComponentGlobalConfig: null
47
- },
48
- mutations: {
49
- [GET_SYSTEM_CONFIG] (state, data) {
50
- state.systemConfig = { ...state.systemConfig, ...data }
51
- },
52
- [GET_APP_CONFIG] (state, data) {
53
- state.appConfig = { ...state.appConfig, ...data }
54
- },
55
- 'GET_COMPONENT_GLOBAL_CONFIG' (state, data) {
56
- state.componentGlobalConfig = { ...state.componentGlobalConfig, ...data }
57
- },
58
- 'GET_SYSTEM_COMPONENT_GLOBAL_CONFIG' (state, data) {
59
- state.systemComponentGlobalConfig = { ...state.systemComponentGlobalConfig, ...data }
60
- },
61
- 'GET_CONFIG_SYSTEM' (state, data) {
62
- state.configSystem = { ...state.configSystem, ...data }
63
- },
64
- 'GET_CLIENT_CONFIG' (state, data) {
65
- state.clientConfig = { ...state.clientConfig, ...data }
66
- },
67
- 'SET_MENUS' (state, menus) {
68
- state.appMenus = menus
69
- },
70
- [GET_MENU] (state, menu) {
71
- state.currentMenu = { ...menu }
72
- },
73
- [CLEAR_MENU] (state) {
74
- state.currentMenu = { }
75
- },
76
- [SWITCH_MENU_SHOW] (state, flag) {
77
- state.showMenu = (flag !== undefined ? flag : !state.showMenu)
78
- },
79
- 'SWITCH_APP_NAV_SHOW' (state, flag) {
80
- state.showAppNav = (flag !== undefined ? flag : !state.showMenu)
81
- },
82
- [GET_VIEWPORT] (state) {
83
- const width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth
84
- state.screen = {
85
- width: width,
86
- height: window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight
87
- }
88
- state.isMobile = width <= state.mobileWidth
89
- state.isPcMd = width > state.mobileWidth && width <= 1400
90
- state.isPcLg = width > 1400 && width <= 1680
91
- state.isPcXl = width > 1680
92
- applyViewportAttr(state.isMobile)
93
- },
94
- 'SET_MOBILE_WIDTH' (state, payload) {
95
- state.mobileWidth = payload
96
- const width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth
97
- state.screen = {
98
- width: width,
99
- height: window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight
100
- }
101
- state.isMobile = width <= state.mobileWidth
102
- state.isPcMd = width > state.mobileWidth && width <= 1400
103
- state.isPcLg = width > 1400 && width <= 1680
104
- state.isPcXl = width > 1680
105
- applyViewportAttr(state.isMobile)
106
- },
107
- 'GET_SYSTEM_VARIABLE' (state, entitys) {
108
- state.systemVariableList = [...entitys]
109
- },
110
- 'GET_DECRYPT_KEY' (state, key) {
111
- state.decryptKey = key
112
- },
113
- 'SET_TEMPORARY_ROLE' (state, role) {
114
- state.temporaryRole = role
115
- }
116
- },
117
- actions: {
118
- [GET_SYSTEM_CONFIG] ({ commit }, payload) {
119
- // eslint-disable-next-line no-async-promise-executor
120
- return new Promise(async resolve => {
121
- const data = await http.getSystemInfo()
122
- if (data) {
123
- commit(GET_SYSTEM_CONFIG, data || {})
124
- resolve(data || {})
125
- } else {
126
- commit(GET_SYSTEM_CONFIG, {})
127
- resolve({})
128
- }
129
- })
130
- },
131
- [GET_APP_CONFIG] ({ commit }, payload) {
132
- const { client, system, app } = payload
133
-
134
- const params = {
135
- action: 'getInitInfo',
136
- entityId: 'FM_MGN_SYSTEM',
137
- clientCode: client,
138
- systemCode: system,
139
- serviceCode: app
140
- }
141
- return new Promise((resolve, reject) => {
142
- http.get(params, {
143
- client: 'frame',
144
- system: 'epxing-frame-manage',
145
- headers: {
146
- Language: util.getCurrentLanguage(client)
147
- }
148
- })
149
- .then(data => {
150
- let service = {}
151
- if (data) {
152
- if (data.service && data.service.data) service = data.service.data
153
- const client = data.client.data
154
- const system = data.system.data
155
- for (const key in client) {
156
- service['CLIENT|' + key] = client[key]
157
- }
158
- for (const key in system) {
159
- service['SYSTEM|' + key] = system[key]
160
- }
161
- commit('GET_CLIENT_CONFIG', client || {})
162
- commit(GET_APP_CONFIG, service || {})
163
- resolve(service || {})
164
- if (data.versionVary) {
165
- ElMessage.warning('当前程序不是单独部署,需要满足最新版本的平台配置,请联系工作人员升级,或单独部署')
166
- }
167
- } else {
168
- commit(GET_APP_CONFIG, {})
169
- resolve({})
170
- }
171
- })
172
- .catch(err => {
173
- commit(GET_APP_CONFIG, {})
174
- reject(err)
175
- })
176
- })
177
- },
178
- 'GET_COMPONENT_GLOBAL_CONFIG' ({ commit }, payload) {
179
- const scopeParams = [
180
- {
181
- lb: '((',
182
- field: 'SYSTEM',
183
- mode: 'is_null',
184
- values: '',
185
- rb: '',
186
- link: 'and',
187
- text: '(所属系统 为空 '
188
- },
189
- {
190
- lb: '',
191
- field: 'CLIENT',
192
- mode: 'equal',
193
- values: payload.client,
194
- rb: ')',
195
- link: 'or'
196
- },
197
- {
198
- lb: '(',
199
- field: 'SYSTEM',
200
- mode: 'equal',
201
- values: payload.system,
202
- rb: '',
203
- link: 'and'
204
- },
205
- {
206
- lb: '',
207
- field: 'CLIENT',
208
- mode: 'equal',
209
- values: payload.client,
210
- rb: '))'
211
- }
212
- ]
213
- return http.list({
214
- entityId: 'FM_COMPONENT_GLOBAL_SET',
215
- scopeParams: JSON.stringify(scopeParams)
216
- })
217
- .then(data => {
218
- let componentConfig = {}
219
- let systemComponentConfig = {}
220
- data.entitys.forEach(item => {
221
- if (item.CLIENT === payload.client && item.SYSTEM === payload.system) {
222
- if (item.CONTENT) {
223
- systemComponentConfig = JSON.parse(item.CONTENT)
224
- }
225
- }
226
- if (item.CLIENT === payload.client && item.SYSTEM === '') {
227
- if (item.CONTENT) {
228
- componentConfig = JSON.parse(item.CONTENT)
229
- }
230
- }
231
- })
232
- // 图标按需:**第三条**配置来源(组件全局配置,启动时加载一次)。
233
- //
234
- // ⚠️ 这条**不 await**,与 store/modules/page.js 那两条不同:它在启动路径上,
235
- // 挡住它等于挡住整个应用起步。而注入一条 CSS 规则会**追溯地**修好已经渲染出来
236
- // 的元素(是样式不是 DOM),所以晚到无非是图标晚一拍出现,不需要等。
237
- // page.js 那两条 await 是因为要的是「零闪烁」,代价花在页面级、不是启动级。
238
- ensureIcons(collectIconNames([componentConfig, systemComponentConfig]))
239
- commit('GET_COMPONENT_GLOBAL_CONFIG', componentConfig)
240
- commit('GET_SYSTEM_COMPONENT_GLOBAL_CONFIG', systemComponentConfig)
241
- return Promise.resolve(componentConfig)
242
- })
243
- .catch(() => {
244
- commit('GET_COMPONENT_GLOBAL_CONFIG', {})
245
- commit('GET_SYSTEM_COMPONENT_GLOBAL_CONFIG', {})
246
- return Promise.resolve({})
247
- })
248
- },
249
- 'GET_CONFIG_SYSTEM' ({ commit }, payload) {
250
- return http.find({
251
- entityId: 'FM_SYSTEM',
252
- link: 'client',
253
- 'scope.CLIENT|CODE': payload.client,
254
- 'scope.CODE': payload.system
255
- })
256
- .then(data => {
257
- commit('GET_CONFIG_SYSTEM', data.data || {})
258
- return Promise.resolve(data.data)
259
- })
260
- .catch(() => {
261
- commit('GET_CONFIG_SYSTEM', {})
262
- return Promise.resolve({})
263
- })
264
- },
265
- 'GET_CONFIG_CLIENT' ({ commit }, payload) {
266
- http.find({
267
- entityId: 'FM_CLIENT',
268
- 'scope.CODE': payload.client
269
- })
270
- .then(data => {
271
- commit('GET_CONFIG_CLIENT', data.data || {})
272
- return Promise.resolve({})
273
- })
274
- .catch(() => {
275
- commit('GET_CONFIG_CLIENT', {})
276
- return Promise.resolve({})
277
- })
278
- },
279
- [GET_MENU] ({ commit }, payload) {
280
- // eslint-disable-next-line no-async-promise-executor
281
- return new Promise(async resolve => {
282
- const moduleData = await http.get({
283
- entityId: 'FM_MODULE',
284
- id: payload.moduleId
285
- })
286
- let { roleId } = this.$route.params
287
- // 菜单直达路由不带 role 段:URL role 优先,其次 localStorage(menu-route.resolveRouteRole)
288
- const role = resolveRouteRole(this.$route)
289
- if (!roleId) {
290
- const { serviceRoles = {} } = this.user
291
- const roleList = serviceRoles[this.appConfig.ID] || []
292
- const currentRole = roleList.find(item => item.code === role) || {}
293
- roleId = currentRole.id
294
- }
295
- const data = await http.getUserMenuTreeData({
296
- moduleId: payload.moduleId,
297
- roleId,
298
- mode: payload.isMobile ? 'move' : 'pc'
299
- })
300
- data.map(item => {
301
- if (item.HIDDEN_SUB_MENU === '1') {
302
- item.children = []
303
- }
304
- return item
305
- })
306
- if (data) {
307
- const { data: module } = moduleData.bean || {}
308
-
309
- commit(GET_MENU, { name: module.NAME, data: data || [] })
310
- resolve(data)
311
- }
312
- })
313
- },
314
- 'GET_SYSTEM_VARIABLE' ({ commit }) {
315
- return http.list({
316
- action: 'searchParam',
317
- entityId: 'FM_SEARCH_PARAM',
318
- order_field: 'ORDER_NUM',
319
- order_mode: 'asc'
320
- })
321
- .then(data => {
322
- const systemVariableList = []
323
- for (const key in data) {
324
- if (key === 'user.propertyMap') {
325
- const children = []
326
- for (const propertyKey in data[key]) {
327
- children.push({ name: data[key][propertyKey], text: data[key][propertyKey], code: `#{${key}.${propertyKey}}`, value: `#{${key}.${propertyKey}}`, type: 'variable' })
328
- }
329
- systemVariableList.push({ name: '用户扩展信息', code: `#{${key}}`, value: `#{${key}}`, type: 'variable', children })
330
- } else {
331
- systemVariableList.push({ name: data[key], code: `#{${key}}`, value: `#{${key}}`, type: 'variable' })
332
- }
333
- }
334
- commit('GET_SYSTEM_VARIABLE', systemVariableList)
335
- return data.entitys
336
- })
337
- },
338
- 'GET_DECRYPT_KEY' ({ commit }) {
339
- // v2 接口已不再下发对称密钥 aesKey,仅返回 RSA 公钥;
340
- // AES key 改为前端本地随机生成,永不在 server→client 明文传输。
341
- return axios.get('/' + window.BASE_PROJECT_NAME + '/api/v1/rsa/public/v2')
342
- .then(data => {
343
- const decryptKey = {
344
- rsaKey: data.publicKey
345
- }
346
- commit('GET_DECRYPT_KEY', decryptKey)
347
- return decryptKey
348
- })
349
- }
350
- }
351
- }
1
+ /**
2
+ * 获取页面配置
3
+ */
4
+ import { GET_SYSTEM_CONFIG, GET_APP_CONFIG, GET_MENU, CLEAR_MENU, SWITCH_MENU_SHOW, GET_VIEWPORT } from '../actions'
5
+ import { ElMessage } from 'element-plus/es/components/message/index.mjs'
6
+ import http from '@epxing/core/src/api'
7
+ import util from '@epxing/core/src/runtime-utils/util'
8
+ import { resolveRouteRole } from '@epxing/core/src/menu-route'
9
+ import axios from '@epxing/core/src/axios'
10
+ import { applyViewportAttr } from '@epxing/core/src/viewport'
11
+ import { ensureIcons, collectIconNames } from '@epxing/icons/src/runtime.mjs'
12
+ const screenWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth
13
+ const mobileWidth = 992
14
+
15
+ // 引导期:初始 state 是模块求值期算出来的,属性要在这一刻就落下,
16
+ // 否则首帧到第一次 resize 之间移动端拿不到令牌轴。
17
+ applyViewportAttr(screenWidth <= mobileWidth)
18
+
19
+ export default {
20
+ state: {
21
+ systemConfig: {},
22
+ appConfig: {}, // 应用配置
23
+ configSystem: {},
24
+ clientConfig: {}, // 客户信息
25
+ appMenus: [],
26
+ currentMenu: {},
27
+ route: {},
28
+ routers: [],
29
+ showMenu: true,
30
+ showAppNav: true,
31
+ screen: {
32
+ width: screenWidth,
33
+ height: window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight
34
+ },
35
+ mobileWidth: 992,
36
+ isMobile: screenWidth <= mobileWidth,
37
+ isPcMd: screenWidth > mobileWidth && screenWidth <= 1400,
38
+ isPcLg: screenWidth > 1400 && screenWidth <= 1680,
39
+ isPcXl: screenWidth > 1680,
40
+ systemVariableList: [],
41
+ decryptKey: {
42
+ rsaKey: ''
43
+ },
44
+ temporaryRole: null, // 临时角色
45
+ componentGlobalConfig: null,
46
+ systemComponentGlobalConfig: null
47
+ },
48
+ mutations: {
49
+ [GET_SYSTEM_CONFIG] (state, data) {
50
+ state.systemConfig = { ...state.systemConfig, ...data }
51
+ },
52
+ [GET_APP_CONFIG] (state, data) {
53
+ state.appConfig = { ...state.appConfig, ...data }
54
+ },
55
+ 'GET_COMPONENT_GLOBAL_CONFIG' (state, data) {
56
+ state.componentGlobalConfig = { ...state.componentGlobalConfig, ...data }
57
+ },
58
+ 'GET_SYSTEM_COMPONENT_GLOBAL_CONFIG' (state, data) {
59
+ state.systemComponentGlobalConfig = { ...state.systemComponentGlobalConfig, ...data }
60
+ },
61
+ 'GET_CONFIG_SYSTEM' (state, data) {
62
+ state.configSystem = { ...state.configSystem, ...data }
63
+ },
64
+ 'GET_CLIENT_CONFIG' (state, data) {
65
+ state.clientConfig = { ...state.clientConfig, ...data }
66
+ },
67
+ 'SET_MENUS' (state, menus) {
68
+ state.appMenus = menus
69
+ },
70
+ [GET_MENU] (state, menu) {
71
+ state.currentMenu = { ...menu }
72
+ },
73
+ [CLEAR_MENU] (state) {
74
+ state.currentMenu = { }
75
+ },
76
+ [SWITCH_MENU_SHOW] (state, flag) {
77
+ state.showMenu = (flag !== undefined ? flag : !state.showMenu)
78
+ },
79
+ 'SWITCH_APP_NAV_SHOW' (state, flag) {
80
+ state.showAppNav = (flag !== undefined ? flag : !state.showMenu)
81
+ },
82
+ [GET_VIEWPORT] (state) {
83
+ const width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth
84
+ state.screen = {
85
+ width: width,
86
+ height: window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight
87
+ }
88
+ state.isMobile = width <= state.mobileWidth
89
+ state.isPcMd = width > state.mobileWidth && width <= 1400
90
+ state.isPcLg = width > 1400 && width <= 1680
91
+ state.isPcXl = width > 1680
92
+ applyViewportAttr(state.isMobile)
93
+ },
94
+ 'SET_MOBILE_WIDTH' (state, payload) {
95
+ state.mobileWidth = payload
96
+ const width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth
97
+ state.screen = {
98
+ width: width,
99
+ height: window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight
100
+ }
101
+ state.isMobile = width <= state.mobileWidth
102
+ state.isPcMd = width > state.mobileWidth && width <= 1400
103
+ state.isPcLg = width > 1400 && width <= 1680
104
+ state.isPcXl = width > 1680
105
+ applyViewportAttr(state.isMobile)
106
+ },
107
+ 'GET_SYSTEM_VARIABLE' (state, entitys) {
108
+ state.systemVariableList = [...entitys]
109
+ },
110
+ 'GET_DECRYPT_KEY' (state, key) {
111
+ state.decryptKey = key
112
+ },
113
+ 'SET_TEMPORARY_ROLE' (state, role) {
114
+ state.temporaryRole = role
115
+ }
116
+ },
117
+ actions: {
118
+ [GET_SYSTEM_CONFIG] ({ commit }, payload) {
119
+ // eslint-disable-next-line no-async-promise-executor
120
+ return new Promise(async resolve => {
121
+ const data = await http.getSystemInfo()
122
+ if (data) {
123
+ commit(GET_SYSTEM_CONFIG, data || {})
124
+ resolve(data || {})
125
+ } else {
126
+ commit(GET_SYSTEM_CONFIG, {})
127
+ resolve({})
128
+ }
129
+ })
130
+ },
131
+ [GET_APP_CONFIG] ({ commit }, payload) {
132
+ const { client, system, app } = payload
133
+
134
+ const params = {
135
+ action: 'getInitInfo',
136
+ entityId: 'FM_MGN_SYSTEM',
137
+ clientCode: client,
138
+ systemCode: system,
139
+ serviceCode: app
140
+ }
141
+ return new Promise((resolve, reject) => {
142
+ http.get(params, {
143
+ client: 'frame',
144
+ system: 'epxing-frame-manage',
145
+ headers: {
146
+ Language: util.getCurrentLanguage(client)
147
+ }
148
+ })
149
+ .then(data => {
150
+ let service = {}
151
+ if (data) {
152
+ if (data.service && data.service.data) service = data.service.data
153
+ const client = data.client.data
154
+ const system = data.system.data
155
+ for (const key in client) {
156
+ service['CLIENT|' + key] = client[key]
157
+ }
158
+ for (const key in system) {
159
+ service['SYSTEM|' + key] = system[key]
160
+ }
161
+ commit('GET_CLIENT_CONFIG', client || {})
162
+ commit(GET_APP_CONFIG, service || {})
163
+ resolve(service || {})
164
+ if (data.versionVary) {
165
+ ElMessage.warning('当前程序不是单独部署,需要满足最新版本的平台配置,请联系工作人员升级,或单独部署')
166
+ }
167
+ } else {
168
+ commit(GET_APP_CONFIG, {})
169
+ resolve({})
170
+ }
171
+ })
172
+ .catch(err => {
173
+ commit(GET_APP_CONFIG, {})
174
+ reject(err)
175
+ })
176
+ })
177
+ },
178
+ 'GET_COMPONENT_GLOBAL_CONFIG' ({ commit }, payload) {
179
+ const scopeParams = [
180
+ {
181
+ lb: '((',
182
+ field: 'SYSTEM',
183
+ mode: 'is_null',
184
+ values: '',
185
+ rb: '',
186
+ link: 'and',
187
+ text: '(所属系统 为空 '
188
+ },
189
+ {
190
+ lb: '',
191
+ field: 'CLIENT',
192
+ mode: 'equal',
193
+ values: payload.client,
194
+ rb: ')',
195
+ link: 'or'
196
+ },
197
+ {
198
+ lb: '(',
199
+ field: 'SYSTEM',
200
+ mode: 'equal',
201
+ values: payload.system,
202
+ rb: '',
203
+ link: 'and'
204
+ },
205
+ {
206
+ lb: '',
207
+ field: 'CLIENT',
208
+ mode: 'equal',
209
+ values: payload.client,
210
+ rb: '))'
211
+ }
212
+ ]
213
+ return http.list({
214
+ entityId: 'FM_COMPONENT_GLOBAL_SET',
215
+ scopeParams: JSON.stringify(scopeParams)
216
+ })
217
+ .then(data => {
218
+ let componentConfig = {}
219
+ let systemComponentConfig = {}
220
+ data.entitys.forEach(item => {
221
+ if (item.CLIENT === payload.client && item.SYSTEM === payload.system) {
222
+ if (item.CONTENT) {
223
+ systemComponentConfig = JSON.parse(item.CONTENT)
224
+ }
225
+ }
226
+ if (item.CLIENT === payload.client && item.SYSTEM === '') {
227
+ if (item.CONTENT) {
228
+ componentConfig = JSON.parse(item.CONTENT)
229
+ }
230
+ }
231
+ })
232
+ // 图标按需:**第三条**配置来源(组件全局配置,启动时加载一次)。
233
+ //
234
+ // ⚠️ 这条**不 await**,与 store/modules/page.js 那两条不同:它在启动路径上,
235
+ // 挡住它等于挡住整个应用起步。而注入一条 CSS 规则会**追溯地**修好已经渲染出来
236
+ // 的元素(是样式不是 DOM),所以晚到无非是图标晚一拍出现,不需要等。
237
+ // page.js 那两条 await 是因为要的是「零闪烁」,代价花在页面级、不是启动级。
238
+ ensureIcons(collectIconNames([componentConfig, systemComponentConfig]))
239
+ commit('GET_COMPONENT_GLOBAL_CONFIG', componentConfig)
240
+ commit('GET_SYSTEM_COMPONENT_GLOBAL_CONFIG', systemComponentConfig)
241
+ return Promise.resolve(componentConfig)
242
+ })
243
+ .catch(() => {
244
+ commit('GET_COMPONENT_GLOBAL_CONFIG', {})
245
+ commit('GET_SYSTEM_COMPONENT_GLOBAL_CONFIG', {})
246
+ return Promise.resolve({})
247
+ })
248
+ },
249
+ 'GET_CONFIG_SYSTEM' ({ commit }, payload) {
250
+ return http.find({
251
+ entityId: 'FM_SYSTEM',
252
+ link: 'client',
253
+ 'scope.CLIENT|CODE': payload.client,
254
+ 'scope.CODE': payload.system
255
+ })
256
+ .then(data => {
257
+ commit('GET_CONFIG_SYSTEM', data.data || {})
258
+ return Promise.resolve(data.data)
259
+ })
260
+ .catch(() => {
261
+ commit('GET_CONFIG_SYSTEM', {})
262
+ return Promise.resolve({})
263
+ })
264
+ },
265
+ 'GET_CONFIG_CLIENT' ({ commit }, payload) {
266
+ http.find({
267
+ entityId: 'FM_CLIENT',
268
+ 'scope.CODE': payload.client
269
+ })
270
+ .then(data => {
271
+ commit('GET_CONFIG_CLIENT', data.data || {})
272
+ return Promise.resolve({})
273
+ })
274
+ .catch(() => {
275
+ commit('GET_CONFIG_CLIENT', {})
276
+ return Promise.resolve({})
277
+ })
278
+ },
279
+ [GET_MENU] ({ commit }, payload) {
280
+ // eslint-disable-next-line no-async-promise-executor
281
+ return new Promise(async resolve => {
282
+ const moduleData = await http.get({
283
+ entityId: 'FM_MODULE',
284
+ id: payload.moduleId
285
+ })
286
+ let { roleId } = this.$route.params
287
+ // 菜单直达路由不带 role 段:URL role 优先,其次 localStorage(menu-route.resolveRouteRole)
288
+ const role = resolveRouteRole(this.$route)
289
+ if (!roleId) {
290
+ const { serviceRoles = {} } = this.user
291
+ const roleList = serviceRoles[this.appConfig.ID] || []
292
+ const currentRole = roleList.find(item => item.code === role) || {}
293
+ roleId = currentRole.id
294
+ }
295
+ const data = await http.getUserMenuTreeData({
296
+ moduleId: payload.moduleId,
297
+ roleId,
298
+ mode: payload.isMobile ? 'move' : 'pc'
299
+ })
300
+ data.map(item => {
301
+ if (item.HIDDEN_SUB_MENU === '1') {
302
+ item.children = []
303
+ }
304
+ return item
305
+ })
306
+ if (data) {
307
+ const { data: module } = moduleData.bean || {}
308
+
309
+ commit(GET_MENU, { name: module.NAME, data: data || [] })
310
+ resolve(data)
311
+ }
312
+ })
313
+ },
314
+ 'GET_SYSTEM_VARIABLE' ({ commit }) {
315
+ return http.list({
316
+ action: 'searchParam',
317
+ entityId: 'FM_SEARCH_PARAM',
318
+ order_field: 'ORDER_NUM',
319
+ order_mode: 'asc'
320
+ })
321
+ .then(data => {
322
+ const systemVariableList = []
323
+ for (const key in data) {
324
+ if (key === 'user.propertyMap') {
325
+ const children = []
326
+ for (const propertyKey in data[key]) {
327
+ children.push({ name: data[key][propertyKey], text: data[key][propertyKey], code: `#{${key}.${propertyKey}}`, value: `#{${key}.${propertyKey}}`, type: 'variable' })
328
+ }
329
+ systemVariableList.push({ name: '用户扩展信息', code: `#{${key}}`, value: `#{${key}}`, type: 'variable', children })
330
+ } else {
331
+ systemVariableList.push({ name: data[key], code: `#{${key}}`, value: `#{${key}}`, type: 'variable' })
332
+ }
333
+ }
334
+ commit('GET_SYSTEM_VARIABLE', systemVariableList)
335
+ return data.entitys
336
+ })
337
+ },
338
+ 'GET_DECRYPT_KEY' ({ commit }) {
339
+ // v2 接口已不再下发对称密钥 aesKey,仅返回 RSA 公钥;
340
+ // AES key 改为前端本地随机生成,永不在 server→client 明文传输。
341
+ return axios.get('/' + window.BASE_PROJECT_NAME + '/api/v1/rsa/public/v2')
342
+ .then(data => {
343
+ const decryptKey = {
344
+ rsaKey: data.publicKey
345
+ }
346
+ commit('GET_DECRYPT_KEY', decryptKey)
347
+ return decryptKey
348
+ })
349
+ }
350
+ }
351
+ }