@gct-paas/render 0.1.4-dev.8 → 0.1.5-dev.0

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 (121) hide show
  1. package/dist/index.min.css +2 -0
  2. package/dist/loader.esm.min.js +1 -0
  3. package/es/Event/Dependency/controller.d.ts +13 -0
  4. package/es/Event/Dependency/controller.mjs +84 -0
  5. package/es/Event/Dependency/displayRule.d.ts +19 -0
  6. package/es/Event/Dependency/displayRule.mjs +138 -0
  7. package/es/Event/Dependency/useDependency.d.ts +7 -0
  8. package/es/Event/Dependency/useDependency.mjs +117 -0
  9. package/es/Event/Dependency/useDependencyToShow.d.ts +10 -0
  10. package/es/Event/Dependency/useDependencyToShow.mjs +113 -0
  11. package/es/Event/baseEvent.d.ts +156 -0
  12. package/es/Event/baseEvent.mjs +389 -0
  13. package/es/Event/bizServiceRequest.d.ts +26 -0
  14. package/es/Event/bizServiceRequest.mjs +35 -0
  15. package/es/Event/eventType.d.ts +20 -0
  16. package/es/Event/eventType.mjs +1 -0
  17. package/es/Event/index.d.ts +7 -0
  18. package/es/Event/index.mjs +7 -0
  19. package/es/Event/utils/appRedis.d.ts +29 -0
  20. package/es/Event/utils/appRedis.mjs +40 -0
  21. package/es/Event/utils/globalLoading.d.ts +13 -0
  22. package/es/Event/utils/globalLoading.mjs +104 -0
  23. package/es/Event/utils/processRovedInfo.d.ts +100 -0
  24. package/es/Event/utils/processRovedInfo.mjs +231 -0
  25. package/es/Event/utils/runGlobalByPage.d.ts +335 -0
  26. package/es/Event/utils/runGlobalByPage.mjs +302 -0
  27. package/es/Event/utils/verificationVar.d.ts +2 -0
  28. package/es/Event/utils/verificationVar.mjs +36 -0
  29. package/es/_virtual/_plugin-vue_export-helper.mjs +8 -0
  30. package/es/_virtual/_rolldown/runtime.mjs +13 -0
  31. package/es/components/HandwritingPad.vue.d.ts +27 -0
  32. package/es/components/HandwritingPad.vue.mjs +7 -0
  33. package/es/components/HandwritingPad.vue_vue_type_script_setup_true_name_HandwritingPad_lang.mjs +109 -0
  34. package/es/components/HandwritingPad.vue_vue_type_style_index_0_scoped_d5b980b7_lang.css +9 -0
  35. package/es/components/index.d.ts +2 -0
  36. package/es/components/index.mjs +1 -0
  37. package/es/constant/data-format.d.ts +52 -0
  38. package/es/constant/data-format.mjs +66 -0
  39. package/es/constant/date-time.d.ts +99 -0
  40. package/es/constant/date-time.mjs +187 -0
  41. package/es/constant/index.d.ts +94 -0
  42. package/es/constant/index.mjs +100 -0
  43. package/es/controller/design-render/design-render.controller.d.ts +18 -0
  44. package/es/controller/design-render/design-render.controller.mjs +78 -0
  45. package/es/controller/design-render-base/design-render-base.controller.d.ts +9 -0
  46. package/es/controller/design-render-base/design-render-base.controller.mjs +12 -0
  47. package/es/controller/design-render-container/design-render-container.controller.d.ts +4 -0
  48. package/es/controller/design-render-container/design-render-container.controller.mjs +5 -0
  49. package/es/controller/design-render-item/design-render-item.controller.d.ts +4 -0
  50. package/es/controller/design-render-item/design-render-item.controller.mjs +5 -0
  51. package/es/controller/index.d.ts +4 -0
  52. package/es/controller/index.mjs +4 -0
  53. package/es/enums/index.d.ts +14 -0
  54. package/es/enums/index.mjs +18 -0
  55. package/es/hooks/index.d.ts +2 -0
  56. package/es/hooks/index.mjs +2 -0
  57. package/es/hooks/use-design-render-controller/use-design-render-controller.d.ts +11 -0
  58. package/es/hooks/use-design-render-controller/use-design-render-controller.mjs +32 -0
  59. package/es/hooks/useStorageRef.d.ts +9 -0
  60. package/es/hooks/useStorageRef.mjs +37 -0
  61. package/es/index.d.ts +6 -0
  62. package/es/index.mjs +36 -1
  63. package/es/interface/controller/i-design-render-base.controller.d.ts +43 -0
  64. package/es/interface/controller/i-design-render-container.controller.d.ts +7 -0
  65. package/es/interface/controller/i-design-render-item.controller.d.ts +7 -0
  66. package/es/interface/controller/i-design-render.controller.d.ts +93 -0
  67. package/es/interface/index.d.ts +12 -0
  68. package/es/interface/provider/i-render-base-node.provider.d.ts +45 -0
  69. package/es/interface/provider/i-render-container-node.provider.d.ts +30 -0
  70. package/es/interface/provider/i-render-editor-node.provider.d.ts +29 -0
  71. package/es/interface/provider/i-render-item-node.provider.d.ts +30 -0
  72. package/es/interface/state/i-design-render-base.state.d.ts +19 -0
  73. package/es/interface/state/i-design-render-container.state.d.ts +11 -0
  74. package/es/interface/state/i-design-render-item.state.d.ts +11 -0
  75. package/es/interface/state/i-design-render.state.d.ts +18 -0
  76. package/es/loader.d.ts +1 -0
  77. package/es/register/index.d.ts +2 -0
  78. package/es/register/index.mjs +2 -0
  79. package/es/register/node/node.register.d.ts +92 -0
  80. package/es/register/node/node.register.mjs +116 -0
  81. package/es/register/render-register/render-register.d.ts +54 -0
  82. package/es/register/render-register/render-register.mjs +64 -0
  83. package/es/state/design-render/design-render.state.d.ts +13 -0
  84. package/es/state/design-render/design-render.state.mjs +15 -0
  85. package/es/state/design-render-base/design-render-base.state.d.ts +4 -0
  86. package/es/state/design-render-base/design-render-base.state.mjs +6 -0
  87. package/es/state/design-render-container/design-render-container.state.d.ts +4 -0
  88. package/es/state/design-render-item/design-render-item.state.d.ts +4 -0
  89. package/es/state/index.d.ts +4 -0
  90. package/es/types/index.d.ts +6 -0
  91. package/es/utils/cacheAdapter.d.ts +7 -0
  92. package/es/utils/cacheAdapter.mjs +65 -0
  93. package/es/utils/expression/index.d.ts +6 -0
  94. package/es/utils/expression/index.mjs +116 -0
  95. package/es/utils/expression/regularExpression/methods.d.ts +77 -0
  96. package/es/utils/expression/regularExpression/methods.mjs +588 -0
  97. package/es/utils/field-attrs/basicAttrs.mjs +56 -80
  98. package/es/utils/field-attrs/index.d.ts +1 -1
  99. package/es/utils/field-attrs/index.mjs +16 -13
  100. package/es/utils/get-ref-data.d.ts +1 -0
  101. package/es/utils/get-ref-data.mjs +44 -0
  102. package/es/utils/getFieldSchema.d.ts +1 -3
  103. package/es/utils/getFieldSchema.mjs +69 -0
  104. package/es/utils/index.d.ts +8 -0
  105. package/es/utils/index.mjs +11 -0
  106. package/es/utils/model-transformer.d.ts +46 -0
  107. package/es/utils/model-transformer.mjs +87 -0
  108. package/es/utils/render-plugin-pkg-util/render-plugin-pkg-util.d.ts +43 -0
  109. package/es/utils/render-plugin-pkg-util/render-plugin-pkg-util.mjs +65 -0
  110. package/es/utils/search/index.d.ts +2 -0
  111. package/es/utils/search/index.mjs +2 -0
  112. package/es/utils/search/search-default-value.d.ts +7 -0
  113. package/es/utils/search/search-default-value.mjs +244 -0
  114. package/es/utils/search/search-hooks.d.ts +6 -0
  115. package/es/utils/search/search-hooks.mjs +67 -0
  116. package/es/utils/useStyle.d.ts +21 -0
  117. package/es/utils/useStyle.mjs +22 -0
  118. package/package.json +33 -11
  119. package/dist/index.esm.min.mjs +0 -89
  120. package/dist/index.min.cjs +0 -1
  121. package/dist/index.system.min.js +0 -1
@@ -0,0 +1,35 @@
1
+ import { BizServiceEnum, EntityModelCategoryEnum } from "@gct-paas/core";
2
+ //#region src/Event/bizServiceRequest.ts
3
+ var bizServiceRequestHook = (api) => (path, query = {}, data = {}, config = {}) => {
4
+ return api({
5
+ modelKey: path.key,
6
+ bsKey: path.action,
7
+ modelCategory: path.modelCategory ?? EntityModelCategoryEnum.ENTITY
8
+ }, query, data, config);
9
+ };
10
+ var BizService = {
11
+ post: bizServiceRequestHook(_gct.api.apaas.modelComprehensive.postBizServiceModelCategoryModelKeyBsKey),
12
+ get: bizServiceRequestHook(_gct.api.apaas.modelComprehensive.getBizServiceModelCategoryModelKeyBsKey),
13
+ put: bizServiceRequestHook(_gct.api.apaas.modelComprehensive.putBizServiceModelCategoryModelKeyBsKey),
14
+ delete: bizServiceRequestHook(_gct.api.apaas.modelComprehensive.deleteBizServiceModelCategoryModelKeyBsKey)
15
+ };
16
+ /**
17
+ * 系统内置业务服务请求
18
+ * @param path
19
+ * @param params
20
+ * @param config
21
+ * @returns
22
+ */
23
+ async function $httpBizService(path, params, ...config) {
24
+ return BizService[BizServiceEnum[path.action]](path, params, ...config);
25
+ }
26
+ /**post 业务服务请求 */
27
+ async function $request(modelKey, action, { body = {}, query = {} } = {}, config = {}) {
28
+ return await _gct.api.apaas.modelComprehensive.postBizServiceGeneralModelCategoryModelKeyBsKey({
29
+ bsKey: action,
30
+ modelKey,
31
+ modelCategory: EntityModelCategoryEnum.ENTITY
32
+ }, query, body, config);
33
+ }
34
+ //#endregion
35
+ export { $httpBizService, $request, BizService };
@@ -0,0 +1,20 @@
1
+ import { FormComponents, ButtonTypeEnum } from '@gct-paas/core';
2
+ export interface InitNodeOptions {
3
+ /**组件方法 */
4
+ elRef: Record<string, FunctionType> | null;
5
+ /**组件类型 */
6
+ type: string | FormComponents;
7
+ }
8
+ export interface EventsConstructor {
9
+ js: string;
10
+ css: string;
11
+ pageKey?: string;
12
+ }
13
+ export interface processDateValue {
14
+ bizServiceKey: string;
15
+ button: ButtonTypeEnum;
16
+ message?: string;
17
+ processInstanceId?: string;
18
+ processKey: string;
19
+ }
20
+ export type FunctionType = (...arg: unknown[]) => unknown;
@@ -0,0 +1 @@
1
+ import "@gct-paas/core";
@@ -0,0 +1,7 @@
1
+ export { Globals, pageGlobaVariables, globalVarCaches, formMap, setFormData, pageDataforJson, getPageTitle, getPremission, PageTypeEnum, } from './utils/runGlobalByPage';
2
+ export { Events, Context, GctComponent, type ModalInstance } from './baseEvent';
3
+ export * from './eventType';
4
+ export * from './Dependency/useDependencyToShow';
5
+ export * from './Dependency/useDependency';
6
+ export * from './Dependency/controller';
7
+ export * from './Dependency/displayRule';
@@ -0,0 +1,7 @@
1
+ import "./utils/runGlobalByPage.mjs";
2
+ import "./baseEvent.mjs";
3
+ import "./eventType.mjs";
4
+ import "./Dependency/controller.mjs";
5
+ import "./Dependency/displayRule.mjs";
6
+ import "./Dependency/useDependencyToShow.mjs";
7
+ import "./Dependency/useDependency.mjs";
@@ -0,0 +1,29 @@
1
+ import { UserLoginResp } from '@gct-paas/api/platform';
2
+ export declare class GlobaAppInfo {
3
+ /**环境变量 */
4
+ static ENV: string;
5
+ /**应用标识 */
6
+ static AID: string;
7
+ /**用户信息 */
8
+ static userInfo: UserLoginResp;
9
+ /**app初始化变量 */
10
+ static runApp({ userInfo, env, aid }: RunAppParams): void;
11
+ }
12
+ /**获取缓存变量 */
13
+ export declare const useCreateAppredis: <T = unknown>({ value: defaultValue, appredis, key: varKey, type, }: UseCreateAppredisOptions<T>) => GlobalVar<T>;
14
+ interface RunAppParams {
15
+ env: string;
16
+ aid: string;
17
+ userInfo: UserLoginResp;
18
+ }
19
+ interface GlobalVar<T = unknown> {
20
+ value: T;
21
+ type: unknown;
22
+ }
23
+ export interface UseCreateAppredisOptions<T = unknown> {
24
+ value: T;
25
+ appredis: boolean;
26
+ key: string;
27
+ type: unknown;
28
+ }
29
+ export {};
@@ -0,0 +1,40 @@
1
+ import { useGctSelect } from "../../hooks/useStorageRef.mjs";
2
+ //#region src/Event/utils/appRedis.ts
3
+ var GlobaAppInfo = class {
4
+ /**环境变量 */
5
+ static ENV;
6
+ /**应用标识 */
7
+ static AID;
8
+ /**用户信息 */
9
+ static userInfo;
10
+ /**app初始化变量 */
11
+ static runApp({ userInfo, env, aid }) {
12
+ this.ENV = env;
13
+ this.AID = aid;
14
+ this.userInfo = userInfo;
15
+ }
16
+ };
17
+ /**获取缓存变量 */
18
+ var useCreateAppredis = ({ value: defaultValue, appredis, key: varKey, type }) => {
19
+ const isredis = GlobaAppInfo.ENV !== "dev" ? appredis : false;
20
+ const { cacheMap } = useGctSelect(`${GlobaAppInfo.AID}_${GlobaAppInfo.userInfo?.userId}`);
21
+ return new Proxy({
22
+ value: defaultValue,
23
+ type
24
+ }, {
25
+ get(target, name) {
26
+ if (isredis && name === "value") return cacheMap.value[varKey];
27
+ return Reflect.get(target, name);
28
+ },
29
+ set(target, name, value, receiver) {
30
+ if (isredis && name === "value") if (cacheMap.value[varKey]) cacheMap.value[varKey] = value;
31
+ else cacheMap.value = {
32
+ ...cacheMap.value,
33
+ [varKey]: value
34
+ };
35
+ return Reflect.set(target, name, value, receiver);
36
+ }
37
+ });
38
+ };
39
+ //#endregion
40
+ export { useCreateAppredis };
@@ -0,0 +1,13 @@
1
+ declare class GlobalLoading {
2
+ static instance: GlobalLoading;
3
+ mask: HTMLDivElement;
4
+ container: HTMLDivElement;
5
+ spinner: HTMLDivElement;
6
+ constructor();
7
+ createLoadingElement(): void;
8
+ initStyle(): void;
9
+ show(): void;
10
+ hide(): void;
11
+ }
12
+ export declare const globalLoading: GlobalLoading;
13
+ export {};
@@ -0,0 +1,104 @@
1
+ var globalLoading = new class GlobalLoading {
2
+ static instance;
3
+ mask;
4
+ container;
5
+ spinner;
6
+ constructor() {
7
+ if (GlobalLoading.instance) return GlobalLoading.instance;
8
+ GlobalLoading.instance = this;
9
+ this.createLoadingElement();
10
+ this.initStyle();
11
+ }
12
+ createLoadingElement() {
13
+ this.mask = document.createElement("div");
14
+ this.mask.id = "gct-global-loading-mask";
15
+ this.container = document.createElement("div");
16
+ this.container.id = "gct-global-loading-container";
17
+ this.spinner = document.createElement("div");
18
+ this.spinner.id = "gct-global-loading-spinner";
19
+ this.container.appendChild(this.spinner);
20
+ this.mask.appendChild(this.container);
21
+ document.body.appendChild(this.mask);
22
+ }
23
+ initStyle() {
24
+ Object.assign(this.mask.style, {
25
+ position: "fixed",
26
+ top: 0,
27
+ left: 0,
28
+ width: "100vw",
29
+ height: "100vh",
30
+ backgroundColor: "rgba(255, 255, 255, 0.5)",
31
+ zIndex: 9999,
32
+ display: "none",
33
+ justifyContent: "center",
34
+ alignItems: "center"
35
+ });
36
+ Object.assign(this.container.style, {
37
+ display: "flex",
38
+ flexDirection: "column",
39
+ alignItems: "center",
40
+ width: "43px",
41
+ height: "43px",
42
+ backgroundColor: "transparent",
43
+ boxShadow: "0 2px 12px rgba(0, 0, 0, 0.15)"
44
+ });
45
+ Object.assign(this.spinner.style, {
46
+ display: "grid",
47
+ width: "43px",
48
+ height: "43px",
49
+ gridTemplateColumns: "repeat(2, 1fr)",
50
+ gridTemplateRows: "repeat(2, 1fr)",
51
+ gap: "3px"
52
+ });
53
+ const elPrimary = getComputedStyle(document.documentElement).getPropertyValue("--gct-color-primary").trim();
54
+ [
55
+ {
56
+ id: "gct-global-loading-item_1",
57
+ delay: "0s"
58
+ },
59
+ {
60
+ id: "gct-global-loading-item_2",
61
+ delay: "0.25s"
62
+ },
63
+ {
64
+ id: "gct-global-loading-item_3",
65
+ delay: "0.75s"
66
+ },
67
+ {
68
+ id: "gct-global-loading-item_4",
69
+ delay: "0.5s"
70
+ }
71
+ ].forEach((config) => {
72
+ const block = document.createElement("div");
73
+ block.id = config.id;
74
+ Object.assign(block.style, {
75
+ backgroundColor: elPrimary,
76
+ opacity: .2,
77
+ animation: "globalLoading 1s infinite",
78
+ animationDelay: config.delay
79
+ });
80
+ this.spinner.appendChild(block);
81
+ });
82
+ const styleTag = document.createElement("style");
83
+ styleTag.textContent = `
84
+ @keyframes globalLoading {
85
+ 0% {
86
+ opacity: 1;
87
+ }
88
+ 100% {
89
+ opacity: 0.2;
90
+ }
91
+ }`;
92
+ document.head.appendChild(styleTag);
93
+ }
94
+ show() {
95
+ this.mask.style.display = "flex";
96
+ document.body.style.overflow = "hidden";
97
+ }
98
+ hide() {
99
+ this.mask.style.display = "none";
100
+ document.body.style.overflow = "";
101
+ }
102
+ }();
103
+ //#endregion
104
+ export { globalLoading };
@@ -0,0 +1,100 @@
1
+ import { LowCodeWidget, approveButton } from '@gct-paas/schema';
2
+ import { ExamineAndApproveStateEnum, ButtonTypeEnum } from '@gct-paas/core';
3
+ export { ExamineAndApproveStateEnum };
4
+ /**流程审批信息 */
5
+ export declare class ProcessAppRovedData {
6
+ /**是否当前处理人 */
7
+ isHandle: boolean;
8
+ /**需要显示的审批按钮 */
9
+ buttonConfig: ButtonConfig;
10
+ /**字段信息 */
11
+ fieldConfig: FieldConfig;
12
+ /**流程id */
13
+ processId: string;
14
+ /**数据id */
15
+ dataId: string;
16
+ /**taskId */
17
+ taskId: string;
18
+ /**流程实例id */
19
+ processInstanceId: string;
20
+ /**模态框模式下绑定的流程表单id */
21
+ refFormId?: string;
22
+ /**审批状态 我发起的,我的代办,我的已办*/
23
+ examineAndApproveState: ExamineAndApproveStateEnum;
24
+ fieldStatus: string;
25
+ /**查看页面 */
26
+ viewPageKey?: string;
27
+ /**当前是否是查看页面 */
28
+ isviewPage?: boolean;
29
+ /**当前是否是APP查看页面 */
30
+ isAPPviewPage?: boolean;
31
+ /**非流程相关人 */
32
+ nonRelatedPerson?: boolean;
33
+ constructor({ taskId, processInstanceId, examineAndApproveState, refFormId, }: ProcessAppRovedDataOptions);
34
+ /**初始化流程信息 */
35
+ readyProcess(): Promise<void>;
36
+ /**审批人,发起人 时候撤回按钮特殊逻辑 */
37
+ withdrawByNode(node?: {
38
+ buttonConfig?: string;
39
+ }): void;
40
+ /**节点按钮状态数据转化 */
41
+ transformByNode(node?: {
42
+ opinionConfig?: string;
43
+ buttonConfig?: string;
44
+ fieldConfig?: string;
45
+ }): void;
46
+ /**获取流程数据信息 */
47
+ getDataInfo(): Promise<void>;
48
+ /**过滤按钮 */
49
+ filterButton(list: approveButton[]): approveButton[];
50
+ /**修改字段状态 */
51
+ useFieldWidget(widget: LowCodeWidget.BasicSchema): void;
52
+ /**修改字段显示隐藏状态 */
53
+ useFieldToShow(widget: LowCodeWidget.BasicSchema): void;
54
+ }
55
+ type ButtonConfig = Partial<Record<ButtonTypeEnum, {
56
+ /**成功的消息 */
57
+ success: string;
58
+ /**是否需要弹框 */
59
+ showModel: boolean;
60
+ /**模态框标题 */
61
+ title: string;
62
+ /**是否显示按钮 */
63
+ show: boolean;
64
+ /** 别名 */
65
+ alias: string;
66
+ /**需要签名 */
67
+ signature: boolean;
68
+ /**审批意见 */
69
+ opinion: {
70
+ /**是否需要 */
71
+ show?: boolean;
72
+ /**是否必填 */
73
+ required?: boolean;
74
+ };
75
+ /**人员选择 */
76
+ user: {
77
+ /**是否显示 */
78
+ show?: boolean;
79
+ /**是否多选 */
80
+ multiple?: boolean;
81
+ label?: string;
82
+ };
83
+ }>>;
84
+ type FieldConfig = Record<string, {
85
+ permission: string;
86
+ children?: FieldConfig[];
87
+ }>;
88
+ /** */
89
+ export declare enum FieldsPermissionEnum {
90
+ hidden = "hidden",
91
+ readonly = "readonly",
92
+ disabled = "disabled",
93
+ editable = "editable"
94
+ }
95
+ interface ProcessAppRovedDataOptions {
96
+ taskId: string;
97
+ processInstanceId: string;
98
+ examineAndApproveState?: ExamineAndApproveStateEnum;
99
+ refFormId?: string;
100
+ }
@@ -0,0 +1,231 @@
1
+ import { ButtonTypeEnum, ExamineAndApproveStateEnum, FormComponents, OpinionTypeEnum, t } from "@gct-paas/core";
2
+ //#region src/Event/utils/processRovedInfo.ts
3
+ /**流程审批信息 */
4
+ var ProcessAppRovedData = class {
5
+ /**是否当前处理人 */
6
+ isHandle = false;
7
+ /**需要显示的审批按钮 */
8
+ buttonConfig = {};
9
+ /**字段信息 */
10
+ fieldConfig = {};
11
+ /**流程id */
12
+ processId = "";
13
+ /**数据id */
14
+ dataId = "";
15
+ /**taskId */
16
+ taskId;
17
+ /**流程实例id */
18
+ processInstanceId;
19
+ /**模态框模式下绑定的流程表单id */
20
+ refFormId;
21
+ /**审批状态 我发起的,我的代办,我的已办*/
22
+ examineAndApproveState = ExamineAndApproveStateEnum.MY_CUSTOM;
23
+ fieldStatus = "";
24
+ /**查看页面 */
25
+ viewPageKey;
26
+ /**当前是否是查看页面 */
27
+ isviewPage;
28
+ /**当前是否是APP查看页面 */
29
+ isAPPviewPage;
30
+ /**非流程相关人 */
31
+ nonRelatedPerson = false;
32
+ constructor({ taskId, processInstanceId, examineAndApproveState = ExamineAndApproveStateEnum.MY_CUSTOM, refFormId }) {
33
+ this.taskId = taskId;
34
+ this.processInstanceId = processInstanceId;
35
+ this.examineAndApproveState = examineAndApproveState;
36
+ this.refFormId = refFormId;
37
+ }
38
+ /**初始化流程信息 */
39
+ async readyProcess() {
40
+ const { taskId, processInstanceId } = this;
41
+ if (this.examineAndApproveState === ExamineAndApproveStateEnum.MY_AGENT) {
42
+ await this.getDataInfo();
43
+ const { node, processDefId, webViewPageKey, mobileViewPageKey } = await _gct.api.apaas.pmProcessEngine.getTaskExtension({ taskId });
44
+ this.transformByNode(node);
45
+ this.processId = processDefId;
46
+ for (const k in this.buttonConfig)
47
+ /**我的*/
48
+ if (k === ButtonTypeEnum.Withdraw) this.buttonConfig[k].show = false;
49
+ this.viewPageKey = node?.webViewPageKey || webViewPageKey;
50
+ this.isAPPviewPage = !!node?.mobileViewPageKey || !!mobileViewPageKey;
51
+ }
52
+ if (this.examineAndApproveState === ExamineAndApproveStateEnum.MY_APPLICATION) {
53
+ await this.getDataInfo();
54
+ const { node, processDefId, withdrawOp } = await _gct.api.apaas.pmProcessEngine.getInitialTaskExtension({ processInstanceId }) || {};
55
+ this.transformByNode(node);
56
+ this.processId = processDefId;
57
+ for (const k in this.buttonConfig) {
58
+ if (k === ButtonTypeEnum.End) this.buttonConfig[k].show = false;
59
+ if (k === ButtonTypeEnum.Withdraw) this.buttonConfig[k].show = !!withdrawOp;
60
+ if (k === ButtonTypeEnum.Resubmit) this.buttonConfig[k].show = false;
61
+ }
62
+ }
63
+ if (this.examineAndApproveState === ExamineAndApproveStateEnum.MY_DONE) {
64
+ await this.getDataInfo();
65
+ const { node, processDefId } = await _gct.api.apaas.pmProcessEngine.getHiTaskExtension({ taskId });
66
+ this.transformByNode(node);
67
+ this.processId = processDefId;
68
+ }
69
+ if (this.examineAndApproveState === ExamineAndApproveStateEnum.MY_CUSTOM) {
70
+ await this.getDataInfo();
71
+ const { node, processDefId, btnList, webViewPageKey, taskId, initiatorNode } = await _gct.api.apaas.pmProcessEngine.getProcInstExtension({ procInstId: processInstanceId });
72
+ const btnkeys = btnList || [];
73
+ this.withdrawByNode(initiatorNode);
74
+ this.transformByNode(node);
75
+ this.processId = processDefId;
76
+ for (const k in this.buttonConfig) {
77
+ const key = k;
78
+ if (this.buttonConfig[key].show) this.buttonConfig[key].show = btnkeys.includes(k);
79
+ }
80
+ if (!node) {
81
+ this.nonRelatedPerson = true;
82
+ return;
83
+ }
84
+ if (!btnkeys.length || node?.key === "__initiator__" && !taskId) this.isviewPage = true;
85
+ else this.viewPageKey = node?.webViewPageKey || webViewPageKey;
86
+ }
87
+ if (this.examineAndApproveState === ExamineAndApproveStateEnum.MY_CUSTOM_Modal) {
88
+ await this.getDataInfo();
89
+ const { node, btnList, taskId, processDefId, initiatorNode } = await _gct.api.apaas.pmProcessEngine.getProcInstExtension({ procInstId: processInstanceId });
90
+ const btnkeys = btnList || [];
91
+ this.withdrawByNode(initiatorNode);
92
+ this.transformByNode(node);
93
+ this.processId = processDefId;
94
+ for (const k in this.buttonConfig) {
95
+ const key = k;
96
+ if (this.buttonConfig[key].show) this.buttonConfig[key].show = btnkeys.includes(k);
97
+ }
98
+ if (!node) {
99
+ this.nonRelatedPerson = true;
100
+ return;
101
+ }
102
+ if (!btnkeys.length || node?.key === "__initiator__" && !taskId) this.isviewPage = true;
103
+ }
104
+ }
105
+ /**审批人,发起人 时候撤回按钮特殊逻辑 */
106
+ withdrawByNode(node) {
107
+ if (!node) return;
108
+ const { buttonConfig } = node;
109
+ JSON.parse(buttonConfig + "").forEach((i) => {
110
+ const actionTitle = t(`sys.process.paasBpmnButtonEvent.${i.type}`);
111
+ this.buttonConfig[i.type] = {
112
+ showModel: false,
113
+ title: t("sys.process.element.approval") + actionTitle,
114
+ success: actionTitle + t("sys.success") + "!",
115
+ show: i.enable,
116
+ alias: i.alias,
117
+ signature: !!i.signature,
118
+ opinion: {},
119
+ user: {}
120
+ };
121
+ });
122
+ }
123
+ /**节点按钮状态数据转化 */
124
+ transformByNode(node) {
125
+ if (!node) return;
126
+ try {
127
+ const { opinionConfig, buttonConfig, fieldConfig } = node;
128
+ const button = JSON.parse(buttonConfig || "[]");
129
+ const options = JSON.parse(opinionConfig || "{\"enabled\":false,\"opinionType\":[]}");
130
+ button.forEach((i) => {
131
+ const actionTitle = t(`sys.process.paasBpmnButtonEvent.${i.type}`);
132
+ this.buttonConfig[i.type] = {
133
+ showModel: ![
134
+ ButtonTypeEnum.Resubmit,
135
+ ButtonTypeEnum.Withdraw,
136
+ ButtonTypeEnum.End
137
+ ].includes(i.type),
138
+ title: t("sys.process.element.approval") + actionTitle,
139
+ success: actionTitle + t("sys.success") + "!",
140
+ show: i.enable,
141
+ alias: i.alias,
142
+ signature: !!i.signature,
143
+ opinion: {
144
+ show: options.enabled,
145
+ required: transformOption(options.opinionType, i.type)
146
+ },
147
+ user: {
148
+ show: [ButtonTypeEnum.Reassign, ButtonTypeEnum.Countersign].includes(i.type),
149
+ multiple: ButtonTypeEnum.Countersign === i.type,
150
+ label: t(`sys.process.user.${i.type}`)
151
+ }
152
+ };
153
+ });
154
+ this.fieldConfig = JSON.parse(fieldConfig + "");
155
+ } catch (error) {
156
+ console.error("流程信息解析失败", error);
157
+ }
158
+ }
159
+ /**获取流程数据信息 */
160
+ async getDataInfo() {
161
+ const { dataId } = await _gct.api.apaas.pmProcessEngine.getModel({ processInstanceId: this.processInstanceId });
162
+ this.dataId = dataId;
163
+ }
164
+ /**过滤按钮 */
165
+ filterButton(list) {
166
+ if (this.nonRelatedPerson) return [];
167
+ if (this.examineAndApproveState === ExamineAndApproveStateEnum.MY_DONE) return [];
168
+ return list.filter((i) => {
169
+ if (i.type === FormComponents.ProcessApproveButton) {
170
+ const status = this.buttonConfig[i.props.action];
171
+ const show = !!status?.show;
172
+ if (show) i.props.title = status.alias;
173
+ return show;
174
+ }
175
+ return true;
176
+ });
177
+ }
178
+ /**修改字段状态 */
179
+ useFieldWidget(widget) {
180
+ if (this.nonRelatedPerson) return;
181
+ const field = widget.props.field;
182
+ const { fieldConfig, examineAndApproveState } = this;
183
+ if (fieldConfig && fieldConfig[field]) {
184
+ const { permission } = fieldConfig[field];
185
+ switch (permission) {
186
+ case FieldsPermissionEnum.disabled:
187
+ widget.props.disabled = true;
188
+ widget.props.readonly = false;
189
+ break;
190
+ case FieldsPermissionEnum.editable:
191
+ widget.props.disabled = false;
192
+ widget.props.readonly = false;
193
+ break;
194
+ case FieldsPermissionEnum.readonly:
195
+ widget.props.readonly = true;
196
+ break;
197
+ default: break;
198
+ }
199
+ } else widget.props.readonly = true;
200
+ if (!widget.props.disabled && ([ExamineAndApproveStateEnum.MY_APPLICATION, ExamineAndApproveStateEnum.MY_DONE].includes(examineAndApproveState) || this.isviewPage)) widget.props.readonly = true;
201
+ }
202
+ /**修改字段显示隐藏状态 */
203
+ useFieldToShow(widget) {
204
+ const field = widget.props.field;
205
+ const { fieldConfig } = this;
206
+ if (fieldConfig && fieldConfig[field]) {
207
+ const { permission } = fieldConfig[field];
208
+ if (permission === FieldsPermissionEnum.hidden) widget.props.hidden = true;
209
+ }
210
+ }
211
+ };
212
+ function transformOption(opinionType, action) {
213
+ if (opinionType.includes(OpinionTypeEnum.Required)) return true;
214
+ if (opinionType.includes(OpinionTypeEnum.Optional)) return false;
215
+ if (opinionType.includes(OpinionTypeEnum.ApproveRequired)) return action === ButtonTypeEnum.Approve;
216
+ if (opinionType.includes(OpinionTypeEnum.ApproveRequired)) return action === ButtonTypeEnum.Approve;
217
+ if (opinionType.includes(OpinionTypeEnum.CountersignRequired)) return action === ButtonTypeEnum.Countersign;
218
+ if (opinionType.includes(OpinionTypeEnum.ReassignRequired)) return action === ButtonTypeEnum.Reassign;
219
+ if (opinionType.includes(OpinionTypeEnum.RejectRequired)) return action === ButtonTypeEnum.Reject;
220
+ if (opinionType.includes(OpinionTypeEnum.RefuseRequired)) return action === ButtonTypeEnum.Refuse;
221
+ }
222
+ /** */
223
+ var FieldsPermissionEnum = /* @__PURE__ */ function(FieldsPermissionEnum) {
224
+ FieldsPermissionEnum["hidden"] = "hidden";
225
+ FieldsPermissionEnum["readonly"] = "readonly";
226
+ FieldsPermissionEnum["disabled"] = "disabled";
227
+ FieldsPermissionEnum["editable"] = "editable";
228
+ return FieldsPermissionEnum;
229
+ }({});
230
+ //#endregion
231
+ export { ProcessAppRovedData };