@gct-paas/core 0.1.4-dev.11 → 0.1.4-dev.13

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 (142) hide show
  1. package/dist/index.esm.min.js +4522 -0
  2. package/es/constants/core.mjs +5 -4
  3. package/es/constants/default-date-type/default-date-type.mjs +73 -21
  4. package/es/constants/editor-register/editor-register.mjs +17 -5
  5. package/es/constants/expression-type/BuiltOperators.mjs +152 -147
  6. package/es/constants/expression-type/FunctionKeys.mjs +75 -79
  7. package/es/constants/expression-type/editor.mjs +10 -3
  8. package/es/constants/expression-type/function.mjs +602 -613
  9. package/es/constants/expression-type/index.mjs +111 -113
  10. package/es/constants/expression-type/modeCfg.mjs +256 -263
  11. package/es/constants/expression-type/variable.mjs +43 -39
  12. package/es/constants/form-container-type/form-container-type.mjs +17 -5
  13. package/es/constants/index.d.ts +1 -0
  14. package/es/constants/index.mjs +31 -10
  15. package/es/constants/page-designer/model.mjs +15 -5
  16. package/es/constants/page-designer/regex.d.ts +2 -0
  17. package/es/constants/page-designer/regex.mjs +5 -0
  18. package/es/create-app-vue.mjs +15 -9
  19. package/es/enums/app-designer/index.d.ts +19 -0
  20. package/es/enums/app-designer/index.mjs +131 -63
  21. package/es/enums/appEnum.mjs +681 -360
  22. package/es/enums/appStateEnum.mjs +17 -10
  23. package/es/enums/authActionEnum.mjs +63 -51
  24. package/es/enums/breakpointEnum.mjs +27 -26
  25. package/es/enums/cacheEnum.mjs +22 -21
  26. package/es/enums/designEnum.mjs +110 -71
  27. package/es/enums/developer-center/integration.mjs +7 -6
  28. package/es/enums/exceptionEnum.mjs +21 -17
  29. package/es/enums/expressionEnum.d.ts +1 -1
  30. package/es/enums/expressionEnum.mjs +81 -74
  31. package/es/enums/globalEnum.mjs +59 -36
  32. package/es/enums/httpEnum.mjs +71 -61
  33. package/es/enums/index.mjs +44 -14
  34. package/es/enums/menuEnum.mjs +42 -38
  35. package/es/enums/page-designer/designer.mjs +403 -407
  36. package/es/enums/page-designer/index.d.ts +1 -0
  37. package/es/enums/page-designer/index.mjs +5 -0
  38. package/es/enums/page-designer/layout.d.ts +12 -0
  39. package/es/enums/page-designer/layout.mjs +17 -0
  40. package/es/enums/page-designer/panel.mjs +341 -213
  41. package/es/enums/page-designer/toolkit.mjs +13 -12
  42. package/es/enums/page-designer/widget.mjs +425 -338
  43. package/es/enums/pageEnum.mjs +14 -13
  44. package/es/enums/plugin-enum.mjs +23 -7
  45. package/es/enums/processEnum.mjs +95 -60
  46. package/es/enums/roleEnum.mjs +7 -6
  47. package/es/enums/sizeEnum.d.ts +18 -0
  48. package/es/enums/sizeEnum.mjs +28 -8
  49. package/es/global/gct/gct.mjs +84 -96
  50. package/es/global/index.mjs +1 -0
  51. package/es/hooks/index.mjs +4 -0
  52. package/es/hooks/use-app-inst/use-app-inst.mjs +11 -5
  53. package/es/hooks/use-modal/use-modal.mjs +16 -10
  54. package/es/hooks/use-sub-app-utils/use-sub-app-utils.mjs +43 -23
  55. package/es/hooks/useCopyToClipboard.mjs +50 -50
  56. package/es/index.mjs +125 -114
  57. package/es/interface/i-pinia-state/i-global-state.d.ts +0 -11
  58. package/es/locale/index.mjs +50 -57
  59. package/es/modules/env-manager/env-manager.const.mjs +16 -8
  60. package/es/modules/env-manager/env-manager.d.ts +2 -0
  61. package/es/modules/env-manager/env-manager.interface.d.ts +2 -0
  62. package/es/modules/env-manager/env-manager.interface.mjs +14 -7
  63. package/es/modules/env-manager/env-manager.mjs +108 -107
  64. package/es/modules/error-handler/error-handler.const.mjs +11 -16
  65. package/es/modules/error-handler/error-strategy.mjs +199 -175
  66. package/es/modules/error-handler/index.mjs +120 -106
  67. package/es/modules/mqtt/constants/mqtt.const.mjs +21 -24
  68. package/es/modules/mqtt/enums/mqtt-status.enum.mjs +23 -9
  69. package/es/modules/mqtt/index.mjs +4 -0
  70. package/es/modules/mqtt/mqtt-client.mjs +228 -261
  71. package/es/modules/mqtt/mqtt-manager.mjs +117 -77
  72. package/es/modules/platform-config/constants/index.mjs +4 -0
  73. package/es/modules/platform-config/constants/login.const.mjs +48 -45
  74. package/es/modules/platform-config/constants/org.const.mjs +57 -52
  75. package/es/modules/platform-config/constants/theme.const.mjs +11 -4
  76. package/es/modules/platform-config/constants/watermark.const.mjs +17 -12
  77. package/es/modules/platform-config/enums/deploy.enum.mjs +13 -6
  78. package/es/modules/platform-config/enums/login.enum.mjs +29 -15
  79. package/es/modules/platform-config/enums/platform.enum.mjs +16 -13
  80. package/es/modules/platform-config/index.mjs +9 -0
  81. package/es/modules/platform-config/store.mjs +68 -79
  82. package/es/modules/platform-config/useBasicSetting.mjs +47 -35
  83. package/es/modules/platform-config/useDeploySetting.mjs +29 -21
  84. package/es/modules/platform-config/useLoginSetting.mjs +151 -173
  85. package/es/modules/platform-config/useOrgSetting.mjs +63 -62
  86. package/es/modules/platform-config/useProjectSetting.mjs +14 -6
  87. package/es/modules/platform-config/useSecuritySetting.mjs +68 -56
  88. package/es/modules/platform-config/useThemeSetting.mjs +78 -59
  89. package/es/modules/platform-config/useWatermarkSetting.mjs +37 -23
  90. package/es/modules/user-stores/index.mjs +3 -0
  91. package/es/modules/user-stores/store/permission.store.mjs +27 -36
  92. package/es/modules/user-stores/store/tenant.store.mjs +20 -22
  93. package/es/modules/user-stores/store/user.store.mjs +94 -117
  94. package/es/router/index.mjs +25 -28
  95. package/es/setup-app.mjs +23 -39
  96. package/es/state/global-pinia-state/global-pinia-state.d.ts +0 -6
  97. package/es/state/global-pinia-state/global-pinia-state.mjs +43 -71
  98. package/es/state/index.mjs +1 -0
  99. package/es/store/global-store.mjs +50 -72
  100. package/es/store/index.mjs +25 -19
  101. package/es/types/index.d.ts +7 -0
  102. package/es/utils/axios/interceptors.mjs +21 -17
  103. package/es/utils/cache-adapter/cache-adapter.mjs +61 -56
  104. package/es/utils/css-loader/css-loader.d.ts +36 -0
  105. package/es/utils/css-loader/css-loader.mjs +82 -0
  106. package/es/utils/design/design.mjs +18 -12
  107. package/es/utils/deviceFingerprint.mjs +77 -63
  108. package/es/utils/dictionary/dictionary.mjs +142 -145
  109. package/es/utils/file/base64Conver.mjs +35 -30
  110. package/es/utils/file/download.mjs +94 -98
  111. package/es/utils/file/parser.d.ts +3 -0
  112. package/es/utils/file/parser.mjs +29 -0
  113. package/es/utils/i18n/index.mjs +14 -3
  114. package/es/utils/index.d.ts +3 -1
  115. package/es/utils/index.mjs +32 -0
  116. package/es/utils/is-sort-filed/is-sort-filed.mjs +42 -37
  117. package/es/utils/linked-list/linked-list.mjs +115 -118
  118. package/es/utils/linked-node/linked-node.mjs +41 -31
  119. package/es/utils/lowcode/utils.mjs +13 -18
  120. package/es/utils/lowcode/validate.mjs +20 -26
  121. package/es/utils/mitt/mitt.mjs +4 -4
  122. package/es/utils/model-loader/model-loader.mjs +280 -325
  123. package/es/utils/namespace/namespace.mjs +178 -164
  124. package/es/utils/openUtil/index.mjs +2 -0
  125. package/es/utils/openUtil/modal/modal.mjs +72 -79
  126. package/es/utils/openUtil/overlay-container/overlay-container.mjs +144 -138
  127. package/es/utils/permission.mjs +33 -37
  128. package/es/utils/plugin-static-resource/plugin-static-resource.mjs +46 -42
  129. package/es/utils/style/index.mjs +94 -138
  130. package/es/utils/tools/tools.mjs +86 -54
  131. package/es/utils/treeHelper/treeHelper.mjs +205 -233
  132. package/es/utils/uploader/uploader.mjs +81 -115
  133. package/es/utils/useUUid.mjs +79 -87
  134. package/es/utils/util.mjs +55 -35
  135. package/es/utils/uuid/uuid.d.ts +2 -0
  136. package/es/utils/uuid/uuid.mjs +33 -43
  137. package/es/utils/validate.mjs +15 -19
  138. package/es/utils/value-helper/value-helper.mjs +113 -98
  139. package/package.json +9 -18
  140. package/dist/index.esm.min.mjs +0 -18322
  141. package/dist/index.min.cjs +0 -393
  142. package/dist/index.system.min.js +0 -393
@@ -1,81 +1,70 @@
1
- import '../../enums/app-designer/index.mjs';
2
- import '../../enums/page-designer/designer.mjs';
3
- import '../../enums/breakpointEnum.mjs';
4
- import { PlatformSettingEnum } from '../../enums/globalEnum.mjs';
5
- import { useBasicSetting } from './useBasicSetting.mjs';
6
- import { useDeploySetting } from './useDeploySetting.mjs';
7
- import { useLoginSetting } from './useLoginSetting.mjs';
8
- import { useOrgSetting } from './useOrgSetting.mjs';
9
- import { useSecuritySetting } from './useSecuritySetting.mjs';
10
- import { useThemeSetting } from './useThemeSetting.mjs';
11
- import { useWatermarkSetting } from './useWatermarkSetting.mjs';
12
- import { useProjectSetting } from './useProjectSetting.mjs';
13
- import { defineStore } from 'pinia';
14
-
15
- const usePlatformConfigStore = defineStore("platform-config", () => {
16
- const base = useBasicSetting();
17
- const login = useLoginSetting();
18
- const org = useOrgSetting();
19
- const security = useSecuritySetting();
20
- const theme = useThemeSetting();
21
- const watermark = useWatermarkSetting();
22
- const deploy = useDeploySetting();
23
- const project = useProjectSetting();
24
- async function init() {
25
- const data = await _api.platform.plat.getList();
26
- const map = {};
27
- if (data && data.length > 0) {
28
- data.forEach((item) => {
29
- if (item.value) {
30
- try {
31
- map[item.configEnum] = JSON.parse(item.value);
32
- } catch (err) {
33
- console.warn(`${item.configEnum}配置解析失败`, err, item);
34
- }
35
- }
36
- });
37
- }
38
- if (map[PlatformSettingEnum.BASIC]) {
39
- base.setBasicSetting(map[PlatformSettingEnum.BASIC]);
40
- }
41
- if (map[PlatformSettingEnum.LOGIN]) {
42
- login.setLoginSetting(map[PlatformSettingEnum.LOGIN]);
43
- }
44
- if (map[PlatformSettingEnum.ORGANIZATION]) {
45
- org.setOrgSetting(map[PlatformSettingEnum.ORGANIZATION]);
46
- }
47
- if (map[PlatformSettingEnum.SECURITY]) {
48
- security.setSecuritySetting(map[PlatformSettingEnum.SECURITY]);
49
- }
50
- if (map[PlatformSettingEnum.THEME]) {
51
- theme.setThemeSetting(map[PlatformSettingEnum.THEME]);
52
- }
53
- if (map[PlatformSettingEnum.WATERMARK]) {
54
- watermark.setWatermarkSetting(map[PlatformSettingEnum.WATERMARK]);
55
- }
56
- if (map[PlatformSettingEnum.DEPLOY]) {
57
- deploy.setDeploySetting(map[PlatformSettingEnum.DEPLOY]);
58
- }
59
- console.debug("平台配置初始化完成", map);
60
- }
61
- async function renderInit() {
62
- const res = await _api.apaas.basicConfig.getDetail({
63
- configEnum: PlatformSettingEnum.THEME
64
- });
65
- if (res) theme.setThemeSetting(res);
66
- }
67
- return {
68
- init,
69
- renderInit,
70
- ...base,
71
- ...login,
72
- ...org,
73
- ...security,
74
- ...theme,
75
- ...watermark,
76
- ...deploy,
77
- ...project
78
- };
1
+ import { PlatformSettingEnum } from "../../enums/globalEnum.mjs";
2
+ import "../../enums/index.mjs";
3
+ import { useBasicSetting } from "./useBasicSetting.mjs";
4
+ import { useDeploySetting } from "./useDeploySetting.mjs";
5
+ import { useLoginSetting } from "./useLoginSetting.mjs";
6
+ import { useOrgSetting } from "./useOrgSetting.mjs";
7
+ import { useSecuritySetting } from "./useSecuritySetting.mjs";
8
+ import { useThemeSetting } from "./useThemeSetting.mjs";
9
+ import { useWatermarkSetting } from "./useWatermarkSetting.mjs";
10
+ import { useProjectSetting } from "./useProjectSetting.mjs";
11
+ import { defineStore } from "pinia";
12
+ //#region src/modules/platform-config/store.ts
13
+ /**
14
+ * 平台配置 Store
15
+ */
16
+ var usePlatformConfigStore = defineStore("platform-config", () => {
17
+ const base = useBasicSetting();
18
+ const login = useLoginSetting();
19
+ const org = useOrgSetting();
20
+ const security = useSecuritySetting();
21
+ const theme = useThemeSetting();
22
+ const watermark = useWatermarkSetting();
23
+ const deploy = useDeploySetting();
24
+ const project = useProjectSetting();
25
+ /**
26
+ * 异步初始化
27
+ *
28
+ * @author chitanda
29
+ * @date 2025-08-21 09:08:40
30
+ * @returns {*} {Promise<void>}
31
+ */
32
+ async function init() {
33
+ const data = await _api.platform.plat.getList();
34
+ const map = {};
35
+ if (data && data.length > 0) data.forEach((item) => {
36
+ if (item.value) try {
37
+ map[item.configEnum] = JSON.parse(item.value);
38
+ } catch (err) {
39
+ console.warn(`${item.configEnum}配置解析失败`, err, item);
40
+ }
41
+ });
42
+ if (map[PlatformSettingEnum.BASIC]) base.setBasicSetting(map[PlatformSettingEnum.BASIC]);
43
+ if (map[PlatformSettingEnum.LOGIN]) login.setLoginSetting(map[PlatformSettingEnum.LOGIN]);
44
+ if (map[PlatformSettingEnum.ORGANIZATION]) org.setOrgSetting(map[PlatformSettingEnum.ORGANIZATION]);
45
+ if (map[PlatformSettingEnum.SECURITY]) security.setSecuritySetting(map[PlatformSettingEnum.SECURITY]);
46
+ if (map[PlatformSettingEnum.THEME]) theme.setThemeSetting(map[PlatformSettingEnum.THEME]);
47
+ if (map[PlatformSettingEnum.WATERMARK]) watermark.setWatermarkSetting(map[PlatformSettingEnum.WATERMARK]);
48
+ if (map[PlatformSettingEnum.DEPLOY]) deploy.setDeploySetting(map[PlatformSettingEnum.DEPLOY]);
49
+ console.debug("平台配置初始化完成", map);
50
+ }
51
+ /**应用前台设置初始化 */
52
+ async function renderInit() {
53
+ const res = await _api.apaas.basicConfig.getDetail({ configEnum: PlatformSettingEnum.THEME });
54
+ if (res) theme.setThemeSetting(res);
55
+ }
56
+ return {
57
+ init,
58
+ renderInit,
59
+ ...base,
60
+ ...login,
61
+ ...org,
62
+ ...security,
63
+ ...theme,
64
+ ...watermark,
65
+ ...deploy,
66
+ ...project
67
+ };
79
68
  });
80
-
69
+ //#endregion
81
70
  export { usePlatformConfigStore };
@@ -1,39 +1,51 @@
1
- import { reactive } from 'vue';
2
- import { omit } from 'lodash-es';
3
-
4
- const basicSetting = reactive({
5
- copyright: 2016-<span class="ownInput">${当前年份}</span> 冠骋信息技术(苏州)有限公司 版权所有',
6
- description: "",
7
- icon: "",
8
- loadingImage: "",
9
- logo: "",
10
- name: "冠骋云PaaS平台",
11
- thumbnail: "",
12
- version: "暂未支持"
1
+ import { omit } from "lodash-es";
2
+ import { reactive } from "vue";
3
+ //#region src/modules/platform-config/useBasicSetting.ts
4
+ /**
5
+ * 基础设置 Composable
6
+ * 用于管理平台的基础配置信息,包括名称、Logo、版本等
7
+ */
8
+ /** 基础配置信息响应式对象 */
9
+ var basicSetting = reactive({
10
+ copyright: "© 2016-<span class=\"ownInput\">${当前年份}</span> 冠骋信息技术(苏州)有限公司 版权所有",
11
+ description: "",
12
+ icon: "",
13
+ loadingImage: "",
14
+ logo: "",
15
+ name: "冠骋云PaaS平台",
16
+ thumbnail: "",
17
+ version: "暂未支持"
13
18
  });
19
+ /**
20
+ * 基础设置 Composable 函数
21
+ * @param isPlatform - 是否为平台模式,默认为 true
22
+ * @returns 返回基础设置相关的响应式数据和方法
23
+ */
14
24
  function useBasicSetting(isPlatform = true) {
15
- const postBasicSetting = () => {
16
- if (isPlatform) {
17
- return _api.platform.plat.postBase(omit({ ...basicSetting }, "version"));
18
- }
19
- return _api.apaas.plat.postBase(omit({ ...basicSetting }, "version"));
20
- };
21
- function setBasicSetting(data, transfer = true) {
22
- const { value } = data;
23
- if (!value) return;
24
- try {
25
- Object.assign(basicSetting, transfer ? JSON.parse(value) : value, {
26
- version: undefined .version
27
- });
28
- } catch (err) {
29
- console.warn(err);
30
- }
31
- }
32
- return {
33
- basicSetting,
34
- setBasicSetting,
35
- postBasicSetting
36
- };
25
+ /** 发送基础配置信息到服务器 */
26
+ const postBasicSetting = () => {
27
+ if (isPlatform) return _api.platform.plat.postBase(omit({ ...basicSetting }, "version"));
28
+ return _api.apaas.plat.postBase(omit({ ...basicSetting }, "version"));
29
+ };
30
+ /**
31
+ * 设置基础配置信息
32
+ * @param data - 系统配置响应数据
33
+ * @param transfer - 是否需要转换数据格式,默认为 true
34
+ */
35
+ function setBasicSetting(data, transfer = true) {
36
+ const { value } = data;
37
+ if (!value) return;
38
+ try {
39
+ Object.assign(basicSetting, transfer ? JSON.parse(value) : value, { version: (void 0).version });
40
+ } catch (err) {
41
+ console.warn(err);
42
+ }
43
+ }
44
+ return {
45
+ basicSetting,
46
+ setBasicSetting,
47
+ postBasicSetting
48
+ };
37
49
  }
38
-
50
+ //#endregion
39
51
  export { useBasicSetting };
@@ -1,27 +1,35 @@
1
- import { reactive, computed } from 'vue';
2
- import { DeployModeEnum } from './enums/deploy.enum.mjs';
3
-
4
- const deploySetting = reactive({
5
- deployMode: DeployModeEnum.STANDARD
6
- });
7
- const isIndependentApp = computed(() => {
8
- return deploySetting.deployMode === DeployModeEnum.INDEPENDENT_APP;
1
+ import { DeployModeEnum } from "./enums/deploy.enum.mjs";
2
+ import { computed, reactive } from "vue";
3
+ //#region src/modules/platform-config/useDeploySetting.ts
4
+ /** 部署设置响应式对象 */
5
+ var deploySetting = reactive({ deployMode: DeployModeEnum.STANDARD });
6
+ /** 是否为独立应用部署模式的计算属性 */
7
+ var isIndependentApp = computed(() => {
8
+ return deploySetting.deployMode === DeployModeEnum.INDEPENDENT_APP;
9
9
  });
10
+ /**
11
+ * 设置部署配置信息
12
+ * @param data - 系统配置响应数据
13
+ */
10
14
  function setDeploySetting(data) {
11
- const { value } = data;
12
- if (!value) return;
13
- try {
14
- Object.assign(deploySetting, JSON.parse(value));
15
- } catch (err) {
16
- console.warn(err);
17
- }
15
+ const { value } = data;
16
+ if (!value) return;
17
+ try {
18
+ Object.assign(deploySetting, JSON.parse(value));
19
+ } catch (err) {
20
+ console.warn(err);
21
+ }
18
22
  }
23
+ /**
24
+ * 部署设置 Composable 函数
25
+ * @returns 返回部署设置相关的响应式数据和方法
26
+ */
19
27
  function useDeploySetting() {
20
- return {
21
- deploySetting,
22
- setDeploySetting,
23
- isIndependentApp
24
- };
28
+ return {
29
+ deploySetting,
30
+ setDeploySetting,
31
+ isIndependentApp
32
+ };
25
33
  }
26
-
34
+ //#endregion
27
35
  export { useDeploySetting };
@@ -1,177 +1,155 @@
1
- import { ref, reactive } from 'vue';
2
- import { LoginTypeEnum, LoginSortTypeEnum } from './enums/login.enum.mjs';
3
- import { getLoginTypeOptions, OTHER_LOGIN_KEYS, SYSTEM_LOGIN_KEYS } from './constants/login.const.mjs';
4
- import { has, isEmpty } from 'lodash-es';
5
-
6
- const loginModeAuthTypes = ref([LoginTypeEnum.ACCOUNT]);
7
- const openIDOAuthAuthTypes = ref([]);
8
- const sysLoginSort = ref(getLoginTypeOptions(SYSTEM_LOGIN_KEYS));
9
- const openIDOAuthAuthSort = ref(
10
- getLoginTypeOptions(OTHER_LOGIN_KEYS)
11
- );
12
- const loginSetting = reactive({
13
- theme: "full",
14
- title: "欢迎登录冠骋云PaaS平台",
15
- subtitle: "让数字化赋能客户成功!",
16
- logo: "",
17
- banner: "",
18
- loginModeConfigs: [],
19
- openIDOAuthConfigs: [],
20
- sortJson: "",
21
- defaultAuthType: LoginTypeEnum.ACCOUNT
1
+ import { LoginSortTypeEnum, LoginTypeEnum } from "./enums/login.enum.mjs";
2
+ import { OTHER_LOGIN_KEYS, SYSTEM_LOGIN_KEYS, getLoginTypeOptions } from "./constants/login.const.mjs";
3
+ import { has, isEmpty } from "lodash-es";
4
+ import { reactive, ref } from "vue";
5
+ //#region src/modules/platform-config/useLoginSetting.ts
6
+ /**
7
+ * 登录设置 Composable
8
+ * 用于管理平台的登录配置,包括系统登录、第三方登录等
9
+ */
10
+ /** 选中的系统登录方式 key 数组 */
11
+ var loginModeAuthTypes = ref([LoginTypeEnum.ACCOUNT]);
12
+ /** 选中的第三方登录方式 key 数组 */
13
+ var openIDOAuthAuthTypes = ref([]);
14
+ /** 系统登录方式排序配置 */
15
+ var sysLoginSort = ref(getLoginTypeOptions(SYSTEM_LOGIN_KEYS));
16
+ /** 第三方登录方式排序配置 */
17
+ var openIDOAuthAuthSort = ref(getLoginTypeOptions(OTHER_LOGIN_KEYS));
18
+ /** 登录配置响应式对象 */
19
+ var loginSetting = reactive({
20
+ theme: "full",
21
+ title: "欢迎登录冠骋云PaaS平台",
22
+ subtitle: "让数字化赋能客户成功!",
23
+ logo: "",
24
+ banner: "",
25
+ loginModeConfigs: [],
26
+ openIDOAuthConfigs: [],
27
+ sortJson: "",
28
+ defaultAuthType: LoginTypeEnum.ACCOUNT
22
29
  });
23
- const loginModeConfig = reactive(
24
- /* @__PURE__ */ new Map([
25
- [
26
- LoginTypeEnum.ACCOUNT,
27
- {
28
- address: "",
29
- authType: LoginTypeEnum.ACCOUNT,
30
- relationField: "",
31
- enabled: 0
32
- }
33
- ],
34
- [
35
- LoginTypeEnum.DOMAIN_ACCOUNT,
36
- {
37
- address: "",
38
- authType: LoginTypeEnum.DOMAIN_ACCOUNT,
39
- relationField: "",
40
- domainSuffix: "",
41
- relationFieldName: "",
42
- enabled: 0
43
- }
44
- ],
45
- [
46
- LoginTypeEnum.MOBILE,
47
- {
48
- smsServiceProvider: "",
49
- // 短信服务商
50
- smsKey: "",
51
- // 授权key
52
- smsKeySecret: "",
53
- // 授权secret
54
- smsTemplateCode: "",
55
- // 模板代码
56
- smsSignName: "",
57
- // 短信签名
58
- phoneNumb: "",
59
- smsSdkAppId: "",
60
- authType: LoginTypeEnum.MOBILE,
61
- enabled: 0
62
- }
63
- ],
64
- [
65
- LoginTypeEnum.DINGDING,
66
- {
67
- appId: "",
68
- authType: LoginTypeEnum.DINGDING,
69
- secret: "",
70
- redirectURL: "",
71
- enabled: 0
72
- }
73
- ],
74
- [
75
- LoginTypeEnum.FEISHU,
76
- {
77
- appId: "",
78
- authType: LoginTypeEnum.FEISHU,
79
- secret: "",
80
- redirectURL: "",
81
- enabled: 0
82
- }
83
- ],
84
- [
85
- LoginTypeEnum.QIYEWEIXIN,
86
- {
87
- appId: "",
88
- agentId: "",
89
- authType: LoginTypeEnum.QIYEWEIXIN,
90
- secret: "",
91
- redirectURL: "",
92
- enabled: 0,
93
- certFileName: ""
94
- }
95
- ]
96
- ])
97
- );
30
+ /** 系统登录配置 Map,存储各种登录方式的具体配置 */
31
+ var loginModeConfig = reactive(new Map([
32
+ [LoginTypeEnum.ACCOUNT, {
33
+ address: "",
34
+ authType: LoginTypeEnum.ACCOUNT,
35
+ relationField: "",
36
+ enabled: 0
37
+ }],
38
+ [LoginTypeEnum.DOMAIN_ACCOUNT, {
39
+ address: "",
40
+ authType: LoginTypeEnum.DOMAIN_ACCOUNT,
41
+ relationField: "",
42
+ domainSuffix: "",
43
+ relationFieldName: "",
44
+ enabled: 0
45
+ }],
46
+ [LoginTypeEnum.MOBILE, {
47
+ smsServiceProvider: "",
48
+ smsKey: "",
49
+ smsKeySecret: "",
50
+ smsTemplateCode: "",
51
+ smsSignName: "",
52
+ phoneNumb: "",
53
+ smsSdkAppId: "",
54
+ authType: LoginTypeEnum.MOBILE,
55
+ enabled: 0
56
+ }],
57
+ [LoginTypeEnum.DINGDING, {
58
+ appId: "",
59
+ authType: LoginTypeEnum.DINGDING,
60
+ secret: "",
61
+ redirectURL: "",
62
+ enabled: 0
63
+ }],
64
+ [LoginTypeEnum.FEISHU, {
65
+ appId: "",
66
+ authType: LoginTypeEnum.FEISHU,
67
+ secret: "",
68
+ redirectURL: "",
69
+ enabled: 0
70
+ }],
71
+ [LoginTypeEnum.QIYEWEIXIN, {
72
+ appId: "",
73
+ agentId: "",
74
+ authType: LoginTypeEnum.QIYEWEIXIN,
75
+ secret: "",
76
+ redirectURL: "",
77
+ enabled: 0,
78
+ certFileName: ""
79
+ }]
80
+ ]));
81
+ /**
82
+ * 登录设置 Composable 函数
83
+ * @returns 返回登录设置相关的响应式数据和方法
84
+ */
98
85
  function useLoginSetting() {
99
- const postLoginSetting = async () => {
100
- const enableTypes = [
101
- ...loginModeAuthTypes.value,
102
- ...openIDOAuthAuthTypes.value
103
- ];
104
- enableTypes.forEach((item) => {
105
- const config = loginModeConfig.get(item);
106
- if (config) {
107
- config.enabled = 1;
108
- }
109
- });
110
- loginSetting.loginModeConfigs = SYSTEM_LOGIN_KEYS.map((item) => {
111
- return loginModeConfig.get(item);
112
- }).filter((config) => config !== void 0);
113
- loginSetting.openIDOAuthConfigs = OTHER_LOGIN_KEYS.map((item) => {
114
- return loginModeConfig.get(item);
115
- }).filter((config) => config !== void 0);
116
- loginSetting.sortJson = JSON.stringify({
117
- [LoginSortTypeEnum.SYSTEM]: sysLoginSort.value.map((item) => item.id),
118
- [LoginSortTypeEnum.THIRD_PARTY]: openIDOAuthAuthSort.value.map(
119
- (item) => item.id
120
- )
121
- });
122
- await _api.platform.plat.postLogin(loginSetting);
123
- };
124
- const setLoginSetting = (config) => {
125
- if (config && config.value) {
126
- const value = JSON.parse(config.value);
127
- for (const k in value) {
128
- if (k in loginSetting) {
129
- loginSetting[k] = value[k];
130
- }
131
- }
132
- if (has(value, "sortJson") && !isEmpty(value.sortJson)) {
133
- const sortObj = JSON.parse(value.sortJson);
134
- if (has(sortObj, LoginSortTypeEnum.SYSTEM)) {
135
- sysLoginSort.value = getLoginTypeOptions(
136
- sortObj[LoginSortTypeEnum.SYSTEM]
137
- );
138
- }
139
- if (has(sortObj, LoginSortTypeEnum.THIRD_PARTY)) {
140
- openIDOAuthAuthSort.value = getLoginTypeOptions(
141
- sortObj[LoginSortTypeEnum.THIRD_PARTY]
142
- );
143
- }
144
- }
145
- loginSetting.loginModeConfigs?.forEach((item) => {
146
- loginModeConfig.set(item.authType, { ...item, enabled: 0 });
147
- });
148
- const loginModeConfigs = loginSetting.loginModeConfigs?.filter((item) => {
149
- return item.enabled;
150
- }).map((i) => {
151
- return i.authType;
152
- }) || [];
153
- loginModeConfigs.push(LoginTypeEnum.ACCOUNT);
154
- loginModeAuthTypes.value = [...new Set(loginModeConfigs)];
155
- loginSetting.openIDOAuthConfigs?.forEach((item) => {
156
- loginModeConfig.set(item.authType, { ...item, enabled: 0 });
157
- });
158
- openIDOAuthAuthTypes.value = loginSetting.openIDOAuthConfigs?.filter((item) => {
159
- return item.enabled;
160
- }).map((i) => {
161
- return i.authType;
162
- }) || [];
163
- }
164
- };
165
- return {
166
- loginSetting,
167
- postLoginSetting,
168
- setLoginSetting,
169
- loginModeAuthTypes,
170
- openIDOAuthAuthTypes,
171
- sysLoginSort,
172
- openIDOAuthAuthSort,
173
- loginModeConfig
174
- };
86
+ /** 发送登录配置信息到服务器 */
87
+ const postLoginSetting = async () => {
88
+ [...loginModeAuthTypes.value, ...openIDOAuthAuthTypes.value].forEach((item) => {
89
+ const config = loginModeConfig.get(item);
90
+ if (config) config.enabled = 1;
91
+ });
92
+ loginSetting.loginModeConfigs = SYSTEM_LOGIN_KEYS.map((item) => {
93
+ return loginModeConfig.get(item);
94
+ }).filter((config) => config !== void 0);
95
+ loginSetting.openIDOAuthConfigs = OTHER_LOGIN_KEYS.map((item) => {
96
+ return loginModeConfig.get(item);
97
+ }).filter((config) => config !== void 0);
98
+ loginSetting.sortJson = JSON.stringify({
99
+ [LoginSortTypeEnum.SYSTEM]: sysLoginSort.value.map((item) => item.id),
100
+ [LoginSortTypeEnum.THIRD_PARTY]: openIDOAuthAuthSort.value.map((item) => item.id)
101
+ });
102
+ await _api.platform.plat.postLogin(loginSetting);
103
+ };
104
+ /**
105
+ * 设置登录配置信息
106
+ * @param config - 系统配置响应数据
107
+ */
108
+ const setLoginSetting = (config) => {
109
+ if (config && config.value) {
110
+ const value = JSON.parse(config.value);
111
+ for (const k in value) if (k in loginSetting) loginSetting[k] = value[k];
112
+ if (has(value, "sortJson") && !isEmpty(value.sortJson)) {
113
+ const sortObj = JSON.parse(value.sortJson);
114
+ if (has(sortObj, LoginSortTypeEnum.SYSTEM)) sysLoginSort.value = getLoginTypeOptions(sortObj[LoginSortTypeEnum.SYSTEM]);
115
+ if (has(sortObj, LoginSortTypeEnum.THIRD_PARTY)) openIDOAuthAuthSort.value = getLoginTypeOptions(sortObj[LoginSortTypeEnum.THIRD_PARTY]);
116
+ }
117
+ loginSetting.loginModeConfigs?.forEach((item) => {
118
+ loginModeConfig.set(item.authType, {
119
+ ...item,
120
+ enabled: 0
121
+ });
122
+ });
123
+ const loginModeConfigs = loginSetting.loginModeConfigs?.filter((item) => {
124
+ return item.enabled;
125
+ }).map((i) => {
126
+ return i.authType;
127
+ }) || [];
128
+ loginModeConfigs.push(LoginTypeEnum.ACCOUNT);
129
+ loginModeAuthTypes.value = [...new Set(loginModeConfigs)];
130
+ loginSetting.openIDOAuthConfigs?.forEach((item) => {
131
+ loginModeConfig.set(item.authType, {
132
+ ...item,
133
+ enabled: 0
134
+ });
135
+ });
136
+ openIDOAuthAuthTypes.value = loginSetting.openIDOAuthConfigs?.filter((item) => {
137
+ return item.enabled;
138
+ }).map((i) => {
139
+ return i.authType;
140
+ }) || [];
141
+ }
142
+ };
143
+ return {
144
+ loginSetting,
145
+ postLoginSetting,
146
+ setLoginSetting,
147
+ loginModeAuthTypes,
148
+ openIDOAuthAuthTypes,
149
+ sysLoginSort,
150
+ openIDOAuthAuthSort,
151
+ loginModeConfig
152
+ };
175
153
  }
176
-
154
+ //#endregion
177
155
  export { useLoginSetting };