@epxing/core 5.3.0-beta.1 → 5.3.0-beta.3

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 (149) hide show
  1. package/API.md +30 -27
  2. package/README.md +5 -4
  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 +4 -0
  5. package/dist/.cache/route-chart-release/frontend/frame/public/js/echarts.min.js +4 -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/ecStat.min-BrTYPOXX.js +1 -0
  9. package/dist/assets/echarts-wordcloud.min-nWR4Hzny.js +3 -0
  10. package/dist/assets/echarts.min-DROS9E5X.js +45 -0
  11. package/dist/assets/role_select-DTqRlFNz.webp +0 -0
  12. package/dist/{_vendor → frontend/frame/_vendor}/.pnpm/jsencrypt@3.5.4/_vendor/jsencrypt/bin/jsencrypt.min.js +1 -1
  13. package/dist/src/Container.js +1 -0
  14. package/dist/src/RootApp.js +54 -0
  15. package/dist/src/api/config.js +1 -0
  16. package/dist/src/api/createHttp.js +7 -0
  17. package/dist/src/api/index.js +1 -0
  18. package/dist/src/app-layout.js +1 -0
  19. package/dist/src/app-ui-settings.js +49 -0
  20. package/dist/src/app.js +1 -0
  21. package/dist/src/axios.js +11 -15
  22. package/dist/src/capture-ref.js +1 -0
  23. package/dist/src/chart-runtime-assets.js +9 -0
  24. package/dist/src/components/draggable/index.js +1 -0
  25. package/dist/src/create-app.js +4 -6
  26. package/dist/src/directives/clickoutside.js +1 -0
  27. package/dist/src/directives/global.js +1 -0
  28. package/dist/src/index.js +3 -0
  29. package/dist/src/lazy-library.js +1 -0
  30. package/dist/src/loadComponent.js +3 -2
  31. package/dist/src/loadLibrary.js +1 -0
  32. package/dist/src/menu-route.js +12 -0
  33. package/dist/src/mixins/component.js +4 -0
  34. package/dist/src/mixins/custom-option.js +1 -0
  35. package/dist/src/mixins/el-locale.js +1 -0
  36. package/dist/src/mixins/global.js +1 -0
  37. package/dist/src/mixins/index.js +1 -0
  38. package/dist/src/mixins/methods-to-prototype.js +1 -0
  39. package/dist/src/mixins/optimized-global.js +1 -0
  40. package/dist/src/mixins/popper.js +1 -0
  41. package/dist/src/navigation-context.js +47 -0
  42. package/dist/src/navigation.js +44 -12
  43. package/dist/src/package-install.js +4 -2
  44. package/dist/src/plugins/element-plus.js +9 -8
  45. package/dist/src/plugins/i18n.js +1 -0
  46. package/dist/src/plugins/library-locale.js +1 -0
  47. package/dist/src/progress-bar.js +1 -0
  48. package/dist/src/public-api.js +5 -2
  49. package/dist/src/register-components.js +1 -0
  50. package/dist/src/remote-deps.js +1 -0
  51. package/dist/src/route-components.js +9 -0
  52. package/dist/src/router/config.js +8 -8
  53. package/dist/src/router/index.js +1 -0
  54. package/dist/src/router/public.js +1 -0
  55. package/dist/src/runtime-services.js +2 -1
  56. package/dist/src/runtime-utils/fieldFactory.js +1 -0
  57. package/dist/src/runtime-utils/meta.js +4 -0
  58. package/dist/src/runtime-utils/pdf.viewer.js +32 -15
  59. package/dist/src/runtime-utils/util.js +30 -5
  60. package/dist/src/shallow-same.js +1 -0
  61. package/dist/src/shared-packages.js +2 -3
  62. package/dist/src/store/actions.js +1 -0
  63. package/dist/src/store/create-store.js +1 -0
  64. package/dist/src/store/index.js +1 -0
  65. package/dist/src/store/lru.js +1 -0
  66. package/dist/src/store/modules/config.js +1 -0
  67. package/dist/src/store/modules/file.js +1 -0
  68. package/dist/src/store/modules/index.js +1 -0
  69. package/dist/src/store/modules/list.js +26 -3
  70. package/dist/src/store/modules/locale.js +1 -0
  71. package/dist/src/store/modules/meta.js +50 -7
  72. package/dist/src/store/modules/page.js +1 -0
  73. package/dist/src/store/modules/router.js +1 -0
  74. package/dist/src/store/modules/tabs.js +1 -0
  75. package/dist/src/store/modules/user.js +1 -0
  76. package/dist/src/style-presets.js +5 -4
  77. package/dist/src/ui-settings.js +91 -18
  78. package/dist/src/viewport.js +1 -0
  79. package/dist/src/views/App.js +48 -0
  80. package/dist/src/views/AppRoleSelect.js +233 -0
  81. package/dist/src/views/Error.js +210 -0
  82. package/dist/src/views/Module.js +173 -0
  83. package/dist/src/vue.bus.js +1 -0
  84. package/dist/src/vue2-cancel-token-compat.js +1 -0
  85. package/dist/src/vue2-remote-shim.js +1 -0
  86. package/dist/src/vue2-render-compat.js +1 -0
  87. package/dist/src/vue2-select-style-compat.js +1 -0
  88. package/dist/src/watermark.js +1 -0
  89. package/dist/src/xss.js +1 -0
  90. package/dist/src/z-index.js +1 -0
  91. package/dist/style.css +251 -0
  92. package/package.json +6 -5
  93. package/src/RootApp.vue +75 -0
  94. package/src/api/createHttp.js +7 -0
  95. package/src/api/index.js +47 -47
  96. package/src/app-ui-settings.js +31 -0
  97. package/src/axios.js +311 -318
  98. package/src/chart-runtime-assets.js +7 -0
  99. package/src/create-app.js +3 -7
  100. package/src/index.js +28 -28
  101. package/src/install.js +157 -157
  102. package/src/loadComponent.js +187 -187
  103. package/src/loadLibrary.js +99 -99
  104. package/src/menu-route.js +12 -1
  105. package/src/mixins/component.js +1464 -1461
  106. package/src/navigation-context.js +49 -0
  107. package/src/navigation.js +208 -176
  108. package/src/package-install.js +2 -1
  109. package/src/plugins/element-plus.js +302 -302
  110. package/src/plugins/frame.js +178 -178
  111. package/src/public-api.js +1 -0
  112. package/src/route-components.js +7 -0
  113. package/src/router/config.js +861 -864
  114. package/src/router/public.js +1 -1
  115. package/src/runtime-services.js +1 -1
  116. package/src/runtime-utils/fieldFactory.js +179 -179
  117. package/src/runtime-utils/meta.js +399 -378
  118. package/src/runtime-utils/pdf.viewer.js +672 -644
  119. package/src/runtime-utils/util.js +1357 -1330
  120. package/src/shared-packages.js +1 -3
  121. package/src/store/modules/config.js +351 -351
  122. package/src/store/modules/list.js +30 -3
  123. package/src/store/modules/locale.js +236 -236
  124. package/src/store/modules/meta.js +314 -265
  125. package/src/style-presets.js +4 -4
  126. package/src/ui-settings.js +84 -23
  127. package/src/views/App.vue +53 -0
  128. package/src/views/AppRoleSelect.vue +334 -0
  129. package/src/views/Error.vue +63 -0
  130. package/src/views/Module.vue +210 -0
  131. package/src/xss.js +26 -26
  132. package/types/app.d.ts +10 -10
  133. package/types/axios.d.ts +1 -1
  134. package/types/component-mixin.d.ts +1 -1
  135. package/types/field-factory.d.ts +1 -1
  136. package/types/global-mixin.d.ts +1 -1
  137. package/types/http.d.ts +1 -1
  138. package/types/index.d.ts +3 -0
  139. package/types/meta.d.ts +1 -1
  140. package/types/navigation.d.ts +21 -21
  141. package/types/pdf-viewer.d.ts +1 -1
  142. package/types/runtime.d.ts +13 -13
  143. package/types/store.d.ts +1 -1
  144. package/types/util.d.ts +2 -2
  145. /package/dist/{build → .cache/route-chart-release/frontend/frame/build}/stubs/empty-components.js +0 -0
  146. /package/dist/{src → .cache/route-chart-release/frontend/frame/src}/element-icons.names.js +0 -0
  147. /package/dist/{src → .cache/route-chart-release/frontend/frame/src}/element-plus.lazy.js +0 -0
  148. /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
  149. /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,3 +1,4 @@
1
+ import '../../../style.css';
1
2
  import { GET_USER_INFO, GET_USER, DELETE_USER } from "../actions.js";
2
3
  import client from "../../api/index.js";
3
4
  const user = {
@@ -1,3 +1,4 @@
1
+ import '../style.css';
1
2
  import uiSettings, { AXIS_ATTRS } from "./ui-settings.js";
2
3
  const STYLE_PRESETS = [
3
4
  { key: "default", name: "默认", styleRadius: "", styleFont: "", styleDensity: "", styleElevation: "" },
@@ -44,16 +45,16 @@ const STYLE_AXES = [
44
45
  ]
45
46
  }
46
47
  ];
47
- function applyStylePreset(presetKey) {
48
+ function applyStylePreset(presetKey, settings = uiSettings) {
48
49
  const preset = STYLE_PRESETS.find((p) => p.key === presetKey);
49
50
  if (!preset) return;
50
51
  Object.keys(AXIS_ATTRS).forEach((k) => {
51
- uiSettings[k] = preset[k];
52
+ settings[k] = preset[k];
52
53
  });
53
54
  }
54
- function matchStylePreset() {
55
+ function matchStylePreset(settings = uiSettings) {
55
56
  const cur = {};
56
- for (const k of Object.keys(AXIS_ATTRS)) cur[k] = uiSettings[k];
57
+ for (const k of Object.keys(AXIS_ATTRS)) cur[k] = settings[k];
57
58
  const hit = STYLE_PRESETS.find((p) => Object.keys(AXIS_ATTRS).every((k) => cur[k] === p[k]));
58
59
  return hit ? hit.key : "";
59
60
  }
@@ -1,3 +1,4 @@
1
+ import '../style.css';
1
2
  import { reactive, watch } from "vue";
2
3
  const AXIS_ATTRS = {
3
4
  styleRadius: "data-radius",
@@ -15,6 +16,8 @@ const DEFAULTS = {
15
16
  // 主题模式 light|dark|auto(auto 跟随系统 prefers-color-scheme)
16
17
  themeColor: "",
17
18
  // 主题色预设名(classicblue/purple/...;'' = 默认蓝,走既有 data-theme 兜底)
19
+ customTheme: null,
20
+ // 用户选择的自定义主题色快照 { code, color },刷新后也能在引导期恢复
18
21
  grayMode: false,
19
22
  // 灰色模式(全站置灰,哀悼日用)
20
23
  weakMode: false,
@@ -60,7 +63,7 @@ const DEFAULTS = {
60
63
  // 页签风格 smart|card|chrome(谷歌)
61
64
  tabsKeepAlive: true,
62
65
  // 页签缓存(会话级 keep-alive):开=切走保活/点回保持原样;关=切走即销毁/每次点开重新加载。不落盘不整组恢复
63
- settingsGroups: ["theme", "layout", "tabs", "page", "security"]
66
+ settingsGroups: ["theme", "style", "layout", "tabs", "page", "security"]
64
67
  // 设置抽屉折叠分组的展开态(记住用户的折叠选择,跨会话)
65
68
  };
66
69
  const NAV_MODES = [
@@ -141,16 +144,15 @@ if (!("isDark" in uiSettings)) {
141
144
  let _watching = false;
142
145
  let _suppressPersist = false;
143
146
  const _appDefaultVals = {};
144
- function persistDiff() {
147
+ function persistDiff(current, previous) {
145
148
  try {
146
- const out = {};
149
+ const out = JSON.parse(window.localStorage.getItem(KEY) || "{}") || {};
150
+ const next = JSON.parse(current);
151
+ const before = JSON.parse(previous);
147
152
  for (const k of Object.keys(DEFAULTS)) {
148
- if (k in _appDefaultVals && uiSettings[k] === _appDefaultVals[k]) continue;
149
- const cur = uiSettings[k];
150
- const def = DEFAULTS[k];
151
- const changed = Array.isArray(def) ? JSON.stringify(cur) !== JSON.stringify(def) : cur !== def;
152
- if (changed) out[k] = cur;
153
+ if (k !== "tabsKeepAlive" && JSON.stringify(next[k]) !== JSON.stringify(before[k])) out[k] = next[k];
153
154
  }
155
+ delete out.tabsKeepAlive;
154
156
  window.localStorage.setItem(KEY, JSON.stringify(out));
155
157
  } catch (e) {
156
158
  }
@@ -158,18 +160,46 @@ function persistDiff() {
158
160
  function persistUiSettings() {
159
161
  if (_watching) return;
160
162
  _watching = true;
161
- watch(uiSettings, () => {
163
+ watch(() => JSON.stringify(Object.fromEntries(Object.keys(DEFAULTS).map((k) => [k, uiSettings[k]]))), (current, previous) => {
162
164
  if (_suppressPersist) return;
163
- persistDiff();
164
- }, { deep: true, flush: "sync" });
165
+ persistDiff(current, previous);
166
+ }, { flush: "sync" });
165
167
  }
166
168
  persistUiSettings();
167
169
  let _mql = null;
168
170
  let _baseTheme = "";
171
+ function normalizeThemeColor(color) {
172
+ if (typeof color !== "string") return "";
173
+ const value = color.trim();
174
+ const hex = value.match(/^#([\da-f]{3}|[\da-f]{6})$/i);
175
+ if (hex) {
176
+ const full = hex[1].length === 3 ? [...hex[1]].map((c) => c + c).join("") : hex[1];
177
+ return [0, 2, 4].map((i) => parseInt(full.slice(i, i + 2), 16)).join(",");
178
+ }
179
+ const rgb = value.match(/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i);
180
+ return rgb && rgb.slice(1).every((c) => Number(c) <= 255) ? rgb.slice(1).map(Number).join(",") : "";
181
+ }
169
182
  function applyTheme() {
183
+ var _a;
170
184
  const html = document.documentElement;
185
+ const preset = THEME_COLORS.find((c) => c.name === uiSettings.themeColor);
186
+ const custom = ((_a = uiSettings.customTheme) == null ? void 0 : _a.code) === uiSettings.themeColor ? uiSettings.customTheme : null;
187
+ const channels = normalizeThemeColor((preset == null ? void 0 : preset.color) || (custom == null ? void 0 : custom.color));
188
+ let colorStyle = document.getElementById("epx-ui-theme-color");
189
+ if (channels) {
190
+ html.style.removeProperty("--color-primary");
191
+ if (!colorStyle) {
192
+ colorStyle = document.createElement("style");
193
+ colorStyle.id = "epx-ui-theme-color";
194
+ document.head.appendChild(colorStyle);
195
+ }
196
+ const selector = `html[data-theme="${preset ? preset.name : "custom"}"]`;
197
+ colorStyle.textContent = `${selector}, ${selector} body { --color-primary: ${channels}; }`;
198
+ } else if (colorStyle) {
199
+ colorStyle.remove();
200
+ }
171
201
  if (uiSettings.themeColor) {
172
- html.setAttribute("data-theme", uiSettings.themeColor);
202
+ html.setAttribute("data-theme", custom && channels ? "custom" : uiSettings.themeColor);
173
203
  } else if (_baseTheme) {
174
204
  html.setAttribute("data-theme", _baseTheme);
175
205
  } else {
@@ -197,6 +227,7 @@ function initTheme() {
197
227
  watch(() => [
198
228
  uiSettings.themeMode,
199
229
  uiSettings.themeColor,
230
+ uiSettings.customTheme,
200
231
  uiSettings.grayMode,
201
232
  uiSettings.weakMode,
202
233
  uiSettings.styleRadius,
@@ -213,7 +244,8 @@ function initTheme() {
213
244
  else if (_mql.addListener) _mql.addListener(onChange);
214
245
  }
215
246
  }
216
- function applyAppDefaults(defaults = {}) {
247
+ function applyAppDefaults(defaults = {}, { replace = false } = {}) {
248
+ var _a;
217
249
  let userSet = {};
218
250
  try {
219
251
  userSet = JSON.parse(window.localStorage.getItem(KEY) || "{}") || {};
@@ -221,15 +253,25 @@ function applyAppDefaults(defaults = {}) {
221
253
  }
222
254
  _suppressPersist = true;
223
255
  try {
256
+ if (replace) {
257
+ Object.keys(_appDefaultVals).forEach((k) => {
258
+ delete _appDefaultVals[k];
259
+ });
260
+ _baseTheme = "";
261
+ (_a = document.getElementById("custom-theme")) == null ? void 0 : _a.remove();
262
+ document.documentElement.style.removeProperty("--color-primary");
263
+ }
224
264
  for (const k of Object.keys(DEFAULTS)) {
225
- if (defaults[k] !== void 0 && (userSet[k] === void 0 || userSet[k] === DEFAULTS[k])) {
226
- uiSettings[k] = defaults[k];
227
- _appDefaultVals[k] = defaults[k];
265
+ if (defaults[k] !== void 0) _appDefaultVals[k] = defaults[k];
266
+ if (replace || defaults[k] !== void 0) {
267
+ const value = userSet[k] !== void 0 ? userSet[k] : _appDefaultVals[k] ?? DEFAULTS[k];
268
+ uiSettings[k] = Array.isArray(value) ? [...value] : value;
228
269
  }
229
270
  }
230
271
  } finally {
231
272
  _suppressPersist = false;
232
273
  }
274
+ if (replace) applyTheme();
233
275
  }
234
276
  function migrateLegacyTheme(src) {
235
277
  if (!src) return "";
@@ -246,15 +288,44 @@ function migrateLegacyTheme(src) {
246
288
  return src;
247
289
  }
248
290
  function resetUiSettings() {
249
- Object.assign(uiSettings, DEFAULTS);
291
+ _suppressPersist = true;
292
+ Object.assign(uiSettings, DEFAULTS, { settingsGroups: [...DEFAULTS.settingsGroups] });
293
+ _suppressPersist = false;
294
+ Object.keys(_appDefaultVals).forEach((k) => {
295
+ delete _appDefaultVals[k];
296
+ });
297
+ try {
298
+ window.localStorage.removeItem(KEY);
299
+ } catch (e) {
300
+ }
250
301
  _baseTheme = "";
251
302
  try {
252
303
  const legacyKeys = ["epx_frame_theme", LEGACY_STYLE, LEGACY_PERSIST];
253
- legacyKeys.forEach((k) => window.localStorage.removeItem(k));
304
+ legacyKeys.forEach((k) => {
305
+ window.localStorage.removeItem(k);
306
+ window.sessionStorage.removeItem(k);
307
+ });
254
308
  } catch (e) {
255
309
  }
256
310
  const custom = document.getElementById("custom-theme");
257
311
  if (custom && custom.parentNode) custom.parentNode.removeChild(custom);
312
+ document.documentElement.style.removeProperty("--color-primary");
313
+ applyTheme();
314
+ }
315
+ function restoreAppUiDefaults() {
316
+ var _a;
317
+ const defaults = { ..._appDefaultVals };
318
+ const baseTheme = _baseTheme;
319
+ const legacyColor = (_a = document.getElementById("custom-theme")) == null ? void 0 : _a.textContent;
320
+ resetUiSettings();
321
+ applyAppDefaults(defaults, { replace: true });
322
+ _baseTheme = baseTheme;
323
+ if (legacyColor) {
324
+ const style = document.createElement("style");
325
+ style.id = "custom-theme";
326
+ style.textContent = legacyColor;
327
+ document.head.appendChild(style);
328
+ }
258
329
  applyTheme();
259
330
  }
260
331
  if (typeof window !== "undefined") window.__epxUiSettings = uiSettings;
@@ -272,7 +343,9 @@ export {
272
343
  initTheme,
273
344
  migrateLegacyTheme,
274
345
  navModeFlags,
346
+ normalizeThemeColor,
275
347
  persistUiSettings,
276
348
  resetUiSettings,
349
+ restoreAppUiDefaults,
277
350
  uiSettings
278
351
  };
@@ -1,3 +1,4 @@
1
+ import '../style.css';
1
2
  function applyViewportAttr(isMobile) {
2
3
  const el = typeof document !== "undefined" && document.documentElement;
3
4
  if (!el) return;
@@ -0,0 +1,48 @@
1
+ import '../../style.css';
2
+ import { openBlock, createBlock, resolveDynamicComponent, createCommentVNode } from "vue";
3
+ import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
4
+ const _sfc_main = {
5
+ name: "epx-app",
6
+ computed: {
7
+ appConfig() {
8
+ return this.$store.state.config.appConfig;
9
+ }
10
+ },
11
+ data() {
12
+ return {
13
+ load: false,
14
+ component: "epx-app-index",
15
+ firstPage: {}
16
+ };
17
+ },
18
+ methods: {
19
+ getPage() {
20
+ const { FIRST_PAGE, MOBILE_FIRST_PAGE } = this.appConfig;
21
+ this.$store.dispatch({
22
+ // 加回调
23
+ type: "ADD_PAGE",
24
+ pageId: this.$isMobile ? MOBILE_FIRST_PAGE : FIRST_PAGE
25
+ }).then((page = {}) => {
26
+ const { pagePath } = page;
27
+ this.firstPage = page;
28
+ this.component = this.$loadComponent(pagePath, this.component);
29
+ this.load = true;
30
+ }).catch(() => {
31
+ this.load = true;
32
+ });
33
+ }
34
+ },
35
+ created() {
36
+ this.getPage();
37
+ }
38
+ };
39
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
40
+ return $data.load ? (openBlock(), createBlock(resolveDynamicComponent($data.component), {
41
+ key: 0,
42
+ page: $data.firstPage
43
+ }, null, 8, ["page"])) : createCommentVNode("", true);
44
+ }
45
+ const App = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
46
+ export {
47
+ App as default
48
+ };
@@ -0,0 +1,233 @@
1
+ import '../../style.css';
2
+ import { mapState } from "vuex";
3
+ import { roleStorage } from "../menu-route.js";
4
+ import { migrateLegacyTheme, initTheme } from "../ui-settings.js";
5
+ import storage from "@epxing/utils/src/storage";
6
+ import { resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, toDisplayString, createBlock, withCtx, Fragment, renderList, withModifiers, createVNode, createTextVNode, createCommentVNode } from "vue";
7
+ /* empty css */
8
+ import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
9
+ const _sfc_main = {
10
+ name: "epx-app-role-select",
11
+ data() {
12
+ return {
13
+ roleList: null,
14
+ radio: "",
15
+ mainRole: null
16
+ };
17
+ },
18
+ computed: {
19
+ ...mapState({
20
+ clientConfig: (state) => state.config.clientConfig || {},
21
+ appConfig: (state) => state.config.appConfig || {},
22
+ // 应用配置
23
+ $isMobile: (state) => state.config.isMobile
24
+ // 是否为移动端
25
+ })
26
+ },
27
+ methods: {
28
+ setTheme() {
29
+ const { "CLIENT|THEME": clientTheme, "SYSTEM|THEME": systemTheme } = this.appConfig;
30
+ const skinCode = migrateLegacyTheme(storage.get("epx_frame_theme") || systemTheme || clientTheme);
31
+ if (skinCode) {
32
+ this.$http.find({
33
+ entityId: "SKIN_COLOR",
34
+ "scope.CODE": skinCode
35
+ }).then((data) => {
36
+ const flag = /rgb\(([\d,\s]+)\)/.test(data.data.COLOR);
37
+ if (flag) {
38
+ const style = `body {--color-primary: ${RegExp.$1}}`;
39
+ var css = document.createElement("style");
40
+ css.type = "text/css";
41
+ css.id = "custom-theme";
42
+ if (css.styleSheet) {
43
+ css.styleSheet.cssText = style;
44
+ } else {
45
+ css.appendChild(document.createTextNode(style));
46
+ }
47
+ document.head.appendChild(css);
48
+ }
49
+ });
50
+ }
51
+ initTheme();
52
+ },
53
+ getServiceRoles() {
54
+ return this.$http.get({
55
+ action: "getServiceRoles",
56
+ entityId: "FM_ROLE",
57
+ serviceId: this.appConfig.ID,
58
+ order_fields: "ORDER_NUM,LOG_C_TIME",
59
+ order_mode: "asc,asc"
60
+ }).then((role) => {
61
+ if (role.entitys.length === 1) {
62
+ this.openApp(role.entitys[0]);
63
+ } else {
64
+ const mainRole = role.entitys.find((role2) => role2.MAIN_ROLE === "true");
65
+ if (mainRole) {
66
+ this.mainRole = mainRole.ID;
67
+ this.openApp(mainRole);
68
+ } else {
69
+ this.roleList = [...role.entitys];
70
+ }
71
+ }
72
+ });
73
+ },
74
+ setMainRole() {
75
+ this.$http.save({
76
+ action: "setMainRole",
77
+ entityId: "FM_USER_SERVICE_MAIN_ROLE",
78
+ serviceId: this.appConfig.ID,
79
+ roleId: this.mainRole
80
+ }).then(() => {
81
+ this.$message.success("设置成功");
82
+ });
83
+ },
84
+ openApp(role) {
85
+ const roleCode = role.CODE + (role.TYPE === "client" ? "-client" : "");
86
+ const { CODE, "SYSTEM|CODE": systemCode, "CLIENT|CODE": clientCode } = this.appConfig;
87
+ const { client = clientCode, system = systemCode, name: lastRouteName, ...otherParams } = this.$route.params;
88
+ roleStorage.set(client, system, roleCode);
89
+ let name = "app1";
90
+ if (systemCode === "epxing-frame") {
91
+ switch (CODE) {
92
+ case "FM_SERVICE_SYSTEM":
93
+ name = "system";
94
+ break;
95
+ case "FM_SERVICE_CLIENT":
96
+ name = "client";
97
+ break;
98
+ case "FM_SERVICE_HALL":
99
+ name = "hall";
100
+ break;
101
+ }
102
+ }
103
+ const { backMenu, ...restQuery } = this.$route.query;
104
+ if (backMenu) {
105
+ return this.$router.replace({
106
+ name: name === "hall" ? "hallMenu" : "appMenu",
107
+ params: { client, system, app: CODE, menuKey: backMenu },
108
+ query: restQuery
109
+ });
110
+ }
111
+ this.$router.replace({
112
+ name: lastRouteName || name,
113
+ params: {
114
+ client,
115
+ system,
116
+ app: CODE,
117
+ role: roleCode,
118
+ ...otherParams
119
+ },
120
+ query: { ...this.$route.query }
121
+ });
122
+ },
123
+ logout() {
124
+ this.$http.logout().then(() => {
125
+ this.$util.toLogin(true);
126
+ });
127
+ }
128
+ },
129
+ created() {
130
+ this.getServiceRoles();
131
+ this.setTheme();
132
+ }
133
+ };
134
+ const _hoisted_1 = { class: "select__modal" };
135
+ const _hoisted_2 = { class: "app__title" };
136
+ const _hoisted_3 = { class: "app__name" };
137
+ const _hoisted_4 = ["onClick"];
138
+ const _hoisted_5 = { class: "role__name" };
139
+ const _hoisted_6 = {
140
+ key: 1,
141
+ class: "no-role"
142
+ };
143
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
144
+ const _component_el_radio = resolveComponent("el-radio");
145
+ const _component_el_radio_group = resolveComponent("el-radio-group");
146
+ const _component_el_button = resolveComponent("el-button");
147
+ return $data.roleList ? (openBlock(), createElementBlock("div", {
148
+ key: 0,
149
+ class: normalizeClass({ "role-select": true, "m-role-select": _ctx.$isMobile })
150
+ }, [
151
+ createElementVNode("div", {
152
+ class: "role-select__bg",
153
+ style: normalizeStyle(_ctx.clientConfig.BACKGROUND_CHOICEROLE ? { backgroundImage: `url(${_ctx.$util.getFileUrl(_ctx.clientConfig.BACKGROUND_CHOICEROLE)})` } : {})
154
+ }, null, 4),
155
+ createElementVNode("div", _hoisted_1, [
156
+ createElementVNode("div", _hoisted_2, [
157
+ createElementVNode("span", {
158
+ class: "app__prefix",
159
+ style: normalizeStyle({ background: _ctx.appConfig.COLOR })
160
+ }, [
161
+ createElementVNode("i", {
162
+ class: normalizeClass(["app__icon fa", _ctx.appConfig.ICON || "el-icon-menu"])
163
+ }, null, 2)
164
+ ], 4),
165
+ createElementVNode("i", _hoisted_3, toDisplayString(_ctx.appConfig.NAME), 1)
166
+ ]),
167
+ _cache[5] || (_cache[5] = createElementVNode("div", { class: "role__title" }, "请选择您的角色", -1)),
168
+ $data.roleList.length > 0 ? (openBlock(), createBlock(_component_el_radio_group, {
169
+ key: 0,
170
+ class: "radio-group",
171
+ modelValue: $data.mainRole,
172
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => $data.mainRole = $event),
173
+ onChange: $options.setMainRole
174
+ }, {
175
+ default: withCtx(() => [
176
+ createElementVNode("ul", {
177
+ class: normalizeClass({ "role__list": true, "m_role_list": _ctx.$isMobile })
178
+ }, [
179
+ (openBlock(true), createElementBlock(Fragment, null, renderList($data.roleList, (role) => {
180
+ return openBlock(), createElementBlock("li", {
181
+ class: "role__item",
182
+ key: role.ID,
183
+ onClick: ($event) => $options.openApp(role)
184
+ }, [
185
+ createElementVNode("span", {
186
+ class: "role__prefix",
187
+ style: normalizeStyle({ background: _ctx.appConfig.ROLE_COLOR })
188
+ }, [
189
+ createElementVNode("i", {
190
+ class: normalizeClass(["fa", role.ICON || "el-icon-user-solid"])
191
+ }, null, 2)
192
+ ], 4),
193
+ createElementVNode("span", _hoisted_5, toDisplayString(role.NAME), 1),
194
+ createElementVNode("span", {
195
+ class: "role__opera",
196
+ onClick: _cache[0] || (_cache[0] = withModifiers(() => {
197
+ }, ["stop"]))
198
+ }, [
199
+ createVNode(_component_el_radio, {
200
+ class: "radio",
201
+ label: role.ID,
202
+ value: role.ID
203
+ }, {
204
+ default: withCtx(() => [..._cache[2] || (_cache[2] = [
205
+ createTextVNode("设为默认", -1)
206
+ ])]),
207
+ _: 1
208
+ }, 8, ["label", "value"])
209
+ ])
210
+ ], 8, _hoisted_4);
211
+ }), 128))
212
+ ], 2)
213
+ ]),
214
+ _: 1
215
+ }, 8, ["modelValue", "onChange"])) : (openBlock(), createElementBlock("div", _hoisted_6, [
216
+ _cache[4] || (_cache[4] = createElementVNode("p", null, "对不起,您还未得到该应用的访问授权!", -1)),
217
+ createVNode(_component_el_button, {
218
+ type: "primary",
219
+ onClick: $options.logout
220
+ }, {
221
+ default: withCtx(() => [..._cache[3] || (_cache[3] = [
222
+ createTextVNode("退出登录", -1)
223
+ ])]),
224
+ _: 1
225
+ }, 8, ["onClick"])
226
+ ]))
227
+ ])
228
+ ], 2)) : createCommentVNode("", true);
229
+ }
230
+ const AppRoleSelect = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-da37146c"]]);
231
+ export {
232
+ AppRoleSelect as default
233
+ };