@ibiz-template/runtime 0.0.1-beta.1 → 0.0.1-beta.141
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.
- package/dist/system/index.system.js +1 -1
- package/out/command/app/app-func/app-func.d.ts +10 -11
- package/out/command/app/app-func/app-func.d.ts.map +1 -1
- package/out/command/app/app-func/app-func.js +19 -20
- package/out/command/app/open-app-view/open-app-view.d.ts +12 -13
- package/out/command/app/open-app-view/open-app-view.d.ts.map +1 -1
- package/out/command/app/open-app-view/open-app-view.js +6 -6
- package/out/config/global-config.d.ts +18 -0
- package/out/config/global-config.d.ts.map +1 -0
- package/out/config/global-config.js +18 -0
- package/out/global/global-util/global-util.d.ts +19 -0
- package/out/global/global-util/global-util.d.ts.map +1 -0
- package/out/global/global-util/global-util.js +20 -0
- package/out/global/index.d.ts +2 -0
- package/out/global/index.d.ts.map +1 -0
- package/out/global/index.js +1 -0
- package/out/index.d.ts +1 -0
- package/out/index.d.ts.map +1 -1
- package/out/index.js +1 -0
- package/out/install.d.ts.map +1 -1
- package/out/install.js +9 -0
- package/out/interface/i-global-config/i-global-config.d.ts +62 -0
- package/out/interface/i-global-config/i-global-config.d.ts.map +1 -0
- package/out/interface/i-global-config/i-global-config.js +1 -0
- package/out/interface/i-modal/i-modal.d.ts +7 -0
- package/out/interface/i-modal/i-modal.d.ts.map +1 -1
- package/out/interface/i-modal-options/i-modal-options.d.ts +8 -0
- package/out/interface/i-modal-options/i-modal-options.d.ts.map +1 -1
- package/out/interface/i-plugin-factory/i-plugin-factory.d.ts +32 -5
- package/out/interface/i-plugin-factory/i-plugin-factory.d.ts.map +1 -1
- package/out/interface/i-plugin-item/i-plugin-item.d.ts +28 -0
- package/out/interface/i-plugin-item/i-plugin-item.d.ts.map +1 -0
- package/out/interface/i-plugin-item/i-plugin-item.js +1 -0
- package/out/interface/i-ui-action-handler/i-ui-action-handler.d.ts +2 -3
- package/out/interface/i-ui-action-handler/i-ui-action-handler.d.ts.map +1 -1
- package/out/interface/i-ui-action-result/i-ui-action-result.d.ts +17 -0
- package/out/interface/i-ui-action-result/i-ui-action-result.d.ts.map +1 -1
- package/out/interface/i-ui-logic-params/i-ui-logic-params.d.ts +31 -0
- package/out/interface/i-ui-logic-params/i-ui-logic-params.d.ts.map +1 -0
- package/out/interface/i-ui-logic-params/i-ui-logic-params.js +1 -0
- package/out/interface/index.d.ts +4 -0
- package/out/interface/index.d.ts.map +1 -1
- package/out/interface/index.js +1 -0
- package/out/interface/logic-scheduler/i-scheduler-logic.d.ts +35 -0
- package/out/interface/logic-scheduler/i-scheduler-logic.d.ts.map +1 -0
- package/out/interface/logic-scheduler/i-scheduler-logic.js +1 -0
- package/out/interface/logic-scheduler/i-trigger-match-params.d.ts +17 -0
- package/out/interface/logic-scheduler/i-trigger-match-params.d.ts.map +1 -0
- package/out/interface/logic-scheduler/i-trigger-match-params.js +1 -0
- package/out/interface/logic-scheduler/index.d.ts +3 -0
- package/out/interface/logic-scheduler/index.d.ts.map +1 -0
- package/out/interface/logic-scheduler/index.js +1 -0
- package/out/interface/util/i-modal-util/i-modal-util.d.ts +8 -0
- package/out/interface/util/i-modal-util/i-modal-util.d.ts.map +1 -1
- package/out/interface/util/i-open-view-util/i-open-view-util.d.ts +10 -11
- package/out/interface/util/i-open-view-util/i-open-view-util.d.ts.map +1 -1
- package/out/logic-scheduler/executor/logic-executor-factory.d.ts +34 -0
- package/out/logic-scheduler/executor/logic-executor-factory.d.ts.map +1 -0
- package/out/logic-scheduler/executor/logic-executor-factory.js +42 -0
- package/out/logic-scheduler/executor/logic-executor.d.ts +32 -0
- package/out/logic-scheduler/executor/logic-executor.d.ts.map +1 -0
- package/out/logic-scheduler/executor/logic-executor.js +30 -0
- package/out/logic-scheduler/executor/script-executor.d.ts +39 -0
- package/out/logic-scheduler/executor/script-executor.d.ts.map +1 -0
- package/out/logic-scheduler/executor/script-executor.js +53 -0
- package/out/logic-scheduler/index.d.ts +12 -0
- package/out/logic-scheduler/index.d.ts.map +1 -0
- package/out/logic-scheduler/index.js +17 -0
- package/out/logic-scheduler/logic-scheduler-center.d.ts +45 -0
- package/out/logic-scheduler/logic-scheduler-center.d.ts.map +1 -0
- package/out/logic-scheduler/logic-scheduler-center.js +49 -0
- package/out/logic-scheduler/scheduler/control-logic-scheduler.d.ts +14 -0
- package/out/logic-scheduler/scheduler/control-logic-scheduler.d.ts.map +1 -0
- package/out/logic-scheduler/scheduler/control-logic-scheduler.js +16 -0
- package/out/logic-scheduler/scheduler/logic-scheduler.d.ts +105 -0
- package/out/logic-scheduler/scheduler/logic-scheduler.d.ts.map +1 -0
- package/out/logic-scheduler/scheduler/logic-scheduler.js +148 -0
- package/out/logic-scheduler/scheduler/view-logic-scheduler.d.ts +14 -0
- package/out/logic-scheduler/scheduler/view-logic-scheduler.d.ts.map +1 -0
- package/out/logic-scheduler/scheduler/view-logic-scheduler.js +14 -0
- package/out/logic-scheduler/trigger/item-dyna-logic-trigger.d.ts +12 -0
- package/out/logic-scheduler/trigger/item-dyna-logic-trigger.d.ts.map +1 -0
- package/out/logic-scheduler/trigger/item-dyna-logic-trigger.js +26 -0
- package/out/logic-scheduler/trigger/logic-trigger-factory.d.ts +34 -0
- package/out/logic-scheduler/trigger/logic-trigger-factory.d.ts.map +1 -0
- package/out/logic-scheduler/trigger/logic-trigger-factory.js +42 -0
- package/out/logic-scheduler/trigger/logic-trigger.d.ts +55 -0
- package/out/logic-scheduler/trigger/logic-trigger.d.ts.map +1 -0
- package/out/logic-scheduler/trigger/logic-trigger.js +52 -0
- package/out/plugin/plugin-static-resource/plugin-static-resource.d.ts +18 -0
- package/out/plugin/plugin-static-resource/plugin-static-resource.d.ts.map +1 -1
- package/out/plugin/plugin-static-resource/plugin-static-resource.js +36 -0
- package/out/plugin/remote-plugin-item/remote-plugin-item.d.ts +12 -3
- package/out/plugin/remote-plugin-item/remote-plugin-item.d.ts.map +1 -1
- package/out/plugin/remote-plugin-item/remote-plugin-item.js +5 -3
- package/out/provider/ui-action/index.d.ts +2 -1
- package/out/provider/ui-action/index.d.ts.map +1 -1
- package/out/provider/ui-action/index.js +5 -1
- package/out/provider/ui-action/wf-withdraw-ui-action-provider.d.ts +15 -0
- package/out/provider/ui-action/wf-withdraw-ui-action-provider.d.ts.map +1 -0
- package/out/provider/ui-action/wf-withdraw-ui-action-provider.js +18 -0
- package/out/types.d.ts +26 -1
- package/out/types.d.ts.map +1 -1
- package/out/utils/app-de-ui-action-util/app-de-ui-action-util.d.ts +2 -3
- package/out/utils/app-de-ui-action-util/app-de-ui-action-util.d.ts.map +1 -1
- package/out/utils/app-de-ui-action-util/app-de-ui-action-util.js +1 -1
- package/out/utils/app-de-ui-action-util/handler/backend-ui-action-handler.d.ts +1 -2
- package/out/utils/app-de-ui-action-util/handler/backend-ui-action-handler.d.ts.map +1 -1
- package/out/utils/app-de-ui-action-util/handler/backend-ui-action-handler.js +7 -4
- package/out/utils/app-de-ui-action-util/handler/common-sys-ui-action-handler.d.ts +1 -2
- package/out/utils/app-de-ui-action-util/handler/common-sys-ui-action-handler.d.ts.map +1 -1
- package/out/utils/app-de-ui-action-util/handler/common-sys-ui-action-handler.js +1 -1
- package/out/utils/app-de-ui-action-util/handler/front-ui-action-handler.d.ts +1 -2
- package/out/utils/app-de-ui-action-util/handler/front-ui-action-handler.d.ts.map +1 -1
- package/out/utils/app-de-ui-action-util/handler/front-ui-action-handler.js +31 -8
- package/out/utils/app-de-ui-action-util/handler/index.d.ts +1 -0
- package/out/utils/app-de-ui-action-util/handler/index.d.ts.map +1 -1
- package/out/utils/app-de-ui-action-util/handler/index.js +1 -0
- package/out/utils/app-de-ui-action-util/handler/ui-action-handler.d.ts +10 -20
- package/out/utils/app-de-ui-action-util/handler/ui-action-handler.d.ts.map +1 -1
- package/out/utils/app-de-ui-action-util/handler/ui-action-handler.js +82 -59
- package/out/utils/app-de-ui-action-util/handler/wf-withdraw-handler.d.ts +16 -0
- package/out/utils/app-de-ui-action-util/handler/wf-withdraw-handler.d.ts.map +1 -0
- package/out/utils/app-de-ui-action-util/handler/wf-withdraw-handler.js +27 -0
- package/out/utils/index.d.ts +4 -1
- package/out/utils/index.d.ts.map +1 -1
- package/out/utils/index.js +4 -1
- package/out/utils/nav-params/calc-nav-params.d.ts +29 -0
- package/out/utils/nav-params/calc-nav-params.d.ts.map +1 -0
- package/out/utils/nav-params/calc-nav-params.js +34 -0
- package/out/utils/nav-params/nav-params.d.ts +20 -1
- package/out/utils/nav-params/nav-params.d.ts.map +1 -1
- package/out/utils/nav-params/nav-params.js +58 -4
- package/out/utils/open-redirect-view/open-redirect-view.d.ts +19 -8
- package/out/utils/open-redirect-view/open-redirect-view.d.ts.map +1 -1
- package/out/utils/open-redirect-view/open-redirect-view.js +107 -14
- package/out/utils/text-util/text-util.d.ts +21 -0
- package/out/utils/text-util/text-util.d.ts.map +1 -0
- package/out/utils/text-util/text-util.js +22 -0
- package/out/utils/wf-helper/wf-helper.d.ts +9 -0
- package/out/utils/wf-helper/wf-helper.d.ts.map +1 -0
- package/out/utils/wf-helper/wf-helper.js +14 -0
- package/out/view-logic/view-logic.d.ts +6 -7
- package/out/view-logic/view-logic.d.ts.map +1 -1
- package/out/view-logic/view-logic.js +102 -29
- package/package.json +15 -14
- package/src/command/app/app-func/app-func.ts +24 -24
- package/src/command/app/open-app-view/open-app-view.ts +12 -13
- package/src/config/global-config.ts +22 -0
- package/src/global/global-util/global-util.ts +19 -0
- package/src/global/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/install.ts +9 -0
- package/src/interface/i-global-config/i-global-config.ts +65 -0
- package/src/interface/i-modal/i-modal.ts +8 -0
- package/src/interface/i-modal-options/i-modal-options.ts +9 -0
- package/src/interface/i-plugin-factory/i-plugin-factory.ts +32 -5
- package/src/interface/i-plugin-item/i-plugin-item.ts +27 -0
- package/src/interface/i-ui-action-handler/i-ui-action-handler.ts +2 -3
- package/src/interface/i-ui-action-result/i-ui-action-result.ts +20 -0
- package/src/interface/i-ui-logic-params/i-ui-logic-params.ts +31 -0
- package/src/interface/index.ts +5 -0
- package/src/interface/logic-scheduler/i-scheduler-logic.ts +58 -0
- package/src/interface/logic-scheduler/i-trigger-match-params.ts +18 -0
- package/src/interface/logic-scheduler/index.ts +7 -0
- package/src/interface/util/i-modal-util/i-modal-util.ts +8 -0
- package/src/interface/util/i-open-view-util/i-open-view-util.ts +10 -11
- package/src/logic-scheduler/executor/logic-executor-factory.ts +48 -0
- package/src/logic-scheduler/executor/logic-executor.ts +43 -0
- package/src/logic-scheduler/executor/script-executor.ts +63 -0
- package/src/logic-scheduler/index.ts +41 -0
- package/src/logic-scheduler/logic-scheduler-center.ts +52 -0
- package/src/logic-scheduler/scheduler/control-logic-scheduler.ts +21 -0
- package/src/logic-scheduler/scheduler/logic-scheduler.ts +192 -0
- package/src/logic-scheduler/scheduler/view-logic-scheduler.ts +17 -0
- package/src/logic-scheduler/trigger/item-dyna-logic-trigger.ts +41 -0
- package/src/logic-scheduler/trigger/logic-trigger-factory.ts +48 -0
- package/src/logic-scheduler/trigger/logic-trigger.ts +77 -0
- package/src/plugin/plugin-static-resource/plugin-static-resource.ts +38 -0
- package/src/plugin/remote-plugin-item/remote-plugin-item.ts +14 -3
- package/src/provider/ui-action/index.ts +6 -0
- package/src/provider/ui-action/wf-withdraw-ui-action-provider.ts +22 -0
- package/src/types.ts +29 -0
- package/src/utils/app-de-ui-action-util/app-de-ui-action-util.ts +2 -3
- package/src/utils/app-de-ui-action-util/handler/backend-ui-action-handler.ts +13 -5
- package/src/utils/app-de-ui-action-util/handler/common-sys-ui-action-handler.ts +2 -3
- package/src/utils/app-de-ui-action-util/handler/front-ui-action-handler.ts +46 -23
- package/src/utils/app-de-ui-action-util/handler/index.ts +1 -0
- package/src/utils/app-de-ui-action-util/handler/ui-action-handler.ts +113 -75
- package/src/utils/app-de-ui-action-util/handler/wf-withdraw-handler.ts +36 -0
- package/src/utils/index.ts +7 -1
- package/src/utils/nav-params/calc-nav-params.ts +59 -0
- package/src/utils/nav-params/nav-params.ts +66 -5
- package/src/utils/open-redirect-view/open-redirect-view.ts +142 -14
- package/src/utils/text-util/text-util.ts +22 -0
- package/src/utils/wf-helper/wf-helper.ts +14 -0
- package/src/view-logic/view-logic.ts +111 -31
- package/LICENSE +0 -21
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RuntimeError } from '@ibiz-template/core';
|
|
2
2
|
import {
|
|
3
3
|
DefectModelError,
|
|
4
4
|
IPSAppDataEntity,
|
|
5
5
|
IPSAppDERedirectView,
|
|
6
6
|
IPSAppRedirectView,
|
|
7
|
+
IPSModelService,
|
|
7
8
|
UnsupportedModelError,
|
|
8
9
|
} from '@ibiz-template/model';
|
|
9
10
|
import { isNilOrEmpty, notNilEmpty } from 'qx-util';
|
|
11
|
+
import qs from 'qs';
|
|
10
12
|
import { OpenAppViewCommand } from '../../command';
|
|
11
13
|
import { IModalData } from '../../interface';
|
|
12
14
|
import { convertNavData } from '../nav-params/nav-params';
|
|
@@ -18,14 +20,14 @@ import { convertNavData } from '../nav-params/nav-params';
|
|
|
18
20
|
* @date 2022-09-28 16:09:13
|
|
19
21
|
* @export
|
|
20
22
|
* @param {IPSAppRedirectView} appView 应用重定向视图
|
|
21
|
-
* @param {
|
|
23
|
+
* @param {IContext}
|
|
22
24
|
* @param {IParams} [params={}]
|
|
23
25
|
* @param {IData} [data={}]
|
|
24
26
|
* @return {*} {Promise<IModalData>}
|
|
25
27
|
*/
|
|
26
28
|
export async function openRedirectView(
|
|
27
29
|
appView: IPSAppRedirectView,
|
|
28
|
-
context:
|
|
30
|
+
context: IContext,
|
|
29
31
|
params: IParams = {},
|
|
30
32
|
data: IData[] = [],
|
|
31
33
|
): Promise<IModalData> {
|
|
@@ -43,6 +45,91 @@ export async function openRedirectView(
|
|
|
43
45
|
);
|
|
44
46
|
}
|
|
45
47
|
|
|
48
|
+
/**
|
|
49
|
+
* 本地打开工作流重定向视图
|
|
50
|
+
*
|
|
51
|
+
* @description 工作流 appredirectview 特殊处理,全局通过 appredirectview 跳转工作流重定向,均使用此方法
|
|
52
|
+
* @author chitanda
|
|
53
|
+
* @date 2023-01-12 11:01:40
|
|
54
|
+
* @export
|
|
55
|
+
* @param {IPSAppDERedirectView} appView
|
|
56
|
+
* @param {IContext} context
|
|
57
|
+
* @param {string} linkUrl
|
|
58
|
+
*/
|
|
59
|
+
export async function toLocalOpenWFRedirectView(
|
|
60
|
+
modelService: IPSModelService,
|
|
61
|
+
context: IContext,
|
|
62
|
+
linkUrl: string,
|
|
63
|
+
) {
|
|
64
|
+
const i = linkUrl.lastIndexOf('?');
|
|
65
|
+
|
|
66
|
+
const queryStr: string = decodeURIComponent(
|
|
67
|
+
linkUrl.substring(i + 1, linkUrl.length),
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
const params = qs.parse(queryStr, { delimiter: ';' }) as IData;
|
|
71
|
+
|
|
72
|
+
const deName: string = params.srfdename || '';
|
|
73
|
+
|
|
74
|
+
if (!deName) {
|
|
75
|
+
throw new RuntimeError('重定向参数缺少实体名称');
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const upperDeName = deName.toUpperCase();
|
|
79
|
+
|
|
80
|
+
const { app } = modelService;
|
|
81
|
+
|
|
82
|
+
const entity = app.getAllPSAppDataEntities()!.find(item => {
|
|
83
|
+
return (item.name || item.refM.name) === upperDeName;
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
if (!entity) {
|
|
87
|
+
throw new RuntimeError(`未找到指定实体: ${deName}`);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const deCodeName: string = entity.codeName || entity.refM.codeName;
|
|
91
|
+
|
|
92
|
+
params[deCodeName.toLowerCase()] = params[deName.toLowerCase()];
|
|
93
|
+
|
|
94
|
+
const deRdView = app.getAllPSAppViews()?.find(view => {
|
|
95
|
+
const { refM } = view;
|
|
96
|
+
if (refM.resource === deCodeName && refM.view === 'RedirectView') {
|
|
97
|
+
return view;
|
|
98
|
+
}
|
|
99
|
+
return null;
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
if (!deRdView) {
|
|
103
|
+
throw new Error(`未找到实体[${deName}]默认重定向视图[RedirectView]`);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// 删除跳转用参数
|
|
107
|
+
delete params.srfdename;
|
|
108
|
+
|
|
109
|
+
// 转换 processDefinitionKey 中的工作流流程以及版本到参数中
|
|
110
|
+
if (params.srfwf !== 'undo') {
|
|
111
|
+
const tags = params.processDefinitionKey.split('-');
|
|
112
|
+
const wfTag = tags[3] as string;
|
|
113
|
+
const wf = wfTag.substring(0, wfTag.lastIndexOf('v'));
|
|
114
|
+
const wfVersion = wfTag.substring(wfTag.lastIndexOf('v'));
|
|
115
|
+
params.wf = wf;
|
|
116
|
+
params.wfVersion = wfVersion;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// 工作流附加参数转到上下文里
|
|
120
|
+
if (params.srfprocessinstanceid) {
|
|
121
|
+
context.srfprocessinstanceid = params.srfprocessinstanceid;
|
|
122
|
+
delete params.srfprocessinstanceid;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
await ibiz.commands.execute(
|
|
126
|
+
OpenAppViewCommand.TAG,
|
|
127
|
+
deRdView,
|
|
128
|
+
context,
|
|
129
|
+
params,
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
46
133
|
/**
|
|
47
134
|
* 打开实体重定向视图
|
|
48
135
|
*
|
|
@@ -50,21 +137,21 @@ export async function openRedirectView(
|
|
|
50
137
|
* @date 2022-09-28 16:09:15
|
|
51
138
|
* @export
|
|
52
139
|
* @param {IPSAppDERedirectView} appView
|
|
53
|
-
* @param {
|
|
140
|
+
* @param {IContext}
|
|
54
141
|
* @param {IParams} [params={}]
|
|
55
142
|
* @param {IData[]} [data=[]]
|
|
56
143
|
* @return {*} {Promise<IModalData>}
|
|
57
144
|
*/
|
|
58
145
|
export async function openDERedirectView(
|
|
59
146
|
appView: IPSAppDERedirectView,
|
|
60
|
-
context:
|
|
147
|
+
context: IContext,
|
|
61
148
|
params: IParams = {},
|
|
62
149
|
data: IData[] = [],
|
|
63
150
|
): Promise<IModalData> {
|
|
64
151
|
// 计算重定向视图上下文参数转换
|
|
65
152
|
const navContext = appView.getPSAppViewNavContexts() || [];
|
|
66
153
|
const navContextData = convertNavData(navContext, context, params);
|
|
67
|
-
context =
|
|
154
|
+
context = Object.assign(context.clone(), navContextData);
|
|
68
155
|
// 计算重定向视图视图参数转换
|
|
69
156
|
const navParams = appView.getPSAppViewNavParams() || [];
|
|
70
157
|
const navParamsData = convertNavData(navParams, context, params);
|
|
@@ -89,26 +176,58 @@ export async function openDERedirectView(
|
|
|
89
176
|
ibiz.loading.hideRedirect();
|
|
90
177
|
if (res.ok) {
|
|
91
178
|
curData = res.data;
|
|
92
|
-
|
|
179
|
+
let linkUrl: string = curData.linkurl;
|
|
93
180
|
if (linkUrl) {
|
|
181
|
+
// 工作流param09转的srfprocessinstanceid传递
|
|
182
|
+
if (context.srfprocessinstanceid) {
|
|
183
|
+
linkUrl += `;srfprocessinstanceid=${context.srfprocessinstanceid}`;
|
|
184
|
+
}
|
|
94
185
|
if (linkUrl.startsWith('http://') || linkUrl.startsWith('https://')) {
|
|
95
|
-
|
|
186
|
+
return new Promise(resolve => {
|
|
187
|
+
const newWindow = window.open(linkUrl, '_blank');
|
|
188
|
+
if (newWindow) {
|
|
189
|
+
(newWindow as IData).callback = () => {
|
|
190
|
+
resolve({ ok: true, data: [] });
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
if (linkUrl.startsWith('appredirectview?')) {
|
|
196
|
+
await toLocalOpenWFRedirectView(
|
|
197
|
+
appView.getPSModelService(),
|
|
198
|
+
context,
|
|
199
|
+
linkUrl,
|
|
200
|
+
);
|
|
96
201
|
return { ok: true, data: [] };
|
|
97
202
|
}
|
|
98
203
|
return { ok: false, data: [] };
|
|
99
204
|
}
|
|
100
205
|
}
|
|
101
|
-
const rdTag = await calcDERdTag(entity, appView, params
|
|
206
|
+
const rdTag = await calcDERdTag(entity, appView, params, curData);
|
|
207
|
+
// !!!工作流临时补充特殊处理标识, 避免补充了工作流流程匹配不上, 再从默认tag匹配!!!
|
|
208
|
+
const rdTagItems = rdTag.split(':');
|
|
209
|
+
const wfRdTag =
|
|
210
|
+
rdTagItems.length === 2 ? rdTag : rdTagItems.slice(0, 2).join(':');
|
|
102
211
|
// 拼接当前重定向视图所在应用实体名称为前缀
|
|
103
212
|
const deRdTag = `${entity.name.toUpperCase()}:${rdTag}`;
|
|
104
213
|
// 所有重定向引用视图
|
|
105
214
|
const allRefViews = appView.getRedirectPSAppViewRefs();
|
|
106
|
-
|
|
215
|
+
let refView = allRefViews?.find(view => {
|
|
107
216
|
return view.name === deRdTag || view.name === rdTag;
|
|
108
217
|
});
|
|
218
|
+
if (!refView) {
|
|
219
|
+
// 特殊补充匹配,子流程应用特殊模式在没有配置具体流程的视图时,匹配不包含流程标识的
|
|
220
|
+
refView = allRefViews?.find(view => {
|
|
221
|
+
return view.name === wfRdTag;
|
|
222
|
+
});
|
|
223
|
+
}
|
|
109
224
|
if (refView) {
|
|
110
225
|
const view = refView.getRefPSAppView();
|
|
111
226
|
if (view) {
|
|
227
|
+
// 工作流param09转的srfprocessinstanceid传递
|
|
228
|
+
if (context.srfprocessinstanceid) {
|
|
229
|
+
params.srfprocessinstanceid = context.srfprocessinstanceid;
|
|
230
|
+
}
|
|
112
231
|
const result = await ibiz.commands.execute(
|
|
113
232
|
OpenAppViewCommand.TAG,
|
|
114
233
|
view,
|
|
@@ -122,6 +241,11 @@ export async function openDERedirectView(
|
|
|
122
241
|
} else {
|
|
123
242
|
throw new DefectModelError(refView, `未配置实际引用视图`);
|
|
124
243
|
}
|
|
244
|
+
} else {
|
|
245
|
+
throw new DefectModelError(
|
|
246
|
+
appView,
|
|
247
|
+
`未找到重定向标识[${rdTag}]或[${deRdTag}]对应视图`,
|
|
248
|
+
);
|
|
125
249
|
}
|
|
126
250
|
return { ok: true, data: [] };
|
|
127
251
|
}
|
|
@@ -134,14 +258,14 @@ export async function openDERedirectView(
|
|
|
134
258
|
* @export
|
|
135
259
|
* @param {IPSAppDataEntity} entity 重定向视图所在应用实体
|
|
136
260
|
* @param {IPSAppDERedirectView} rdView 重定向视图
|
|
137
|
-
* @param {string}
|
|
261
|
+
* @param {string} srfWf
|
|
138
262
|
* @param {IData} data 当前数据
|
|
139
263
|
* @return {*} {Promise<string>}
|
|
140
264
|
*/
|
|
141
265
|
export async function calcDERdTag(
|
|
142
266
|
entity: IPSAppDataEntity,
|
|
143
267
|
rdView: IPSAppDERedirectView,
|
|
144
|
-
|
|
268
|
+
params: IParams,
|
|
145
269
|
data: IData,
|
|
146
270
|
): Promise<string> {
|
|
147
271
|
let rdTag = '';
|
|
@@ -155,8 +279,12 @@ export async function calcDERdTag(
|
|
|
155
279
|
}
|
|
156
280
|
}
|
|
157
281
|
// 如果流程步骤存在,按照工作流优先
|
|
158
|
-
|
|
159
|
-
|
|
282
|
+
const srfWf = params.srfwf;
|
|
283
|
+
if (notNilEmpty(srfWf)) {
|
|
284
|
+
if (notNilEmpty(params.wf)) {
|
|
285
|
+
return `EDITVIEW:${srfWf.toUpperCase()}:${params.wf.toUpperCase()}`;
|
|
286
|
+
}
|
|
287
|
+
return `EDITVIEW:${srfWf.toUpperCase()}`;
|
|
160
288
|
}
|
|
161
289
|
let typeValue = '';
|
|
162
290
|
// 从索引属性获取重定向视图类型
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 文本工具类
|
|
3
|
+
*
|
|
4
|
+
* @author zhanghengfeng
|
|
5
|
+
* @date 2023-08-24 14:08:27
|
|
6
|
+
* @export
|
|
7
|
+
* @class TextUtil
|
|
8
|
+
*/
|
|
9
|
+
export class TextUtil {
|
|
10
|
+
/**
|
|
11
|
+
* 值格式化
|
|
12
|
+
*
|
|
13
|
+
* @author zhanghengfeng
|
|
14
|
+
* @date 2023-08-24 14:08:27
|
|
15
|
+
* @param {string} value
|
|
16
|
+
* @param {string} _code
|
|
17
|
+
* @return {*} {string}
|
|
18
|
+
*/
|
|
19
|
+
format(value: string, _code: string): string {
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 预置工作流相关数据处理并生成需要的上下文参数
|
|
3
|
+
*
|
|
4
|
+
* @export
|
|
5
|
+
* @param {IData} data
|
|
6
|
+
* @returns {*}
|
|
7
|
+
*/
|
|
8
|
+
export function getWFContext(data: IData) {
|
|
9
|
+
const tempContext: IData = {};
|
|
10
|
+
if (data.param09) {
|
|
11
|
+
tempContext.srfprocessinstanceid = data.param09;
|
|
12
|
+
}
|
|
13
|
+
return tempContext;
|
|
14
|
+
}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { IBizContext } from '@ibiz-template/core';
|
|
2
1
|
import { notNilEmpty } from 'qx-util';
|
|
3
2
|
import {
|
|
4
3
|
AppEntityModel,
|
|
4
|
+
DefectModelError,
|
|
5
5
|
getPSUIActionByModelObject,
|
|
6
6
|
IPSAppDEUIAction,
|
|
7
|
+
IPSAppUILogicRefView,
|
|
7
8
|
IPSAppUINewDataLogic,
|
|
8
9
|
IPSAppUIOpenDataLogic,
|
|
9
10
|
IPSAppViewLogic,
|
|
10
11
|
IPSNavigateParam,
|
|
11
12
|
} from '@ibiz-template/model';
|
|
13
|
+
import { RuntimeError } from '@ibiz-template/core';
|
|
12
14
|
import { OpenAppViewCommand } from '../command';
|
|
13
|
-
import { IUIActionResult } from '../interface';
|
|
15
|
+
import { IModalData, IUIActionResult } from '../interface';
|
|
14
16
|
import { AppDEUIActionUtil, convertNavData } from '../utils';
|
|
15
17
|
|
|
16
18
|
/**
|
|
@@ -20,14 +22,14 @@ import { AppDEUIActionUtil, convertNavData } from '../utils';
|
|
|
20
22
|
* @date 2022-08-22 09:08:40
|
|
21
23
|
* @export
|
|
22
24
|
* @param {IPSAppViewLogic} viewLogic 视图逻辑模型对象
|
|
23
|
-
* @param {
|
|
25
|
+
* @param {IContext} context 上下文参数
|
|
24
26
|
* @param {IParams} params 视图参数
|
|
25
27
|
* @param {(IData | null)} data 数据集合
|
|
26
28
|
* @param {IData} [opts] 额外参数,event是js原生事件
|
|
27
29
|
*/
|
|
28
30
|
export async function executeViewLogic(
|
|
29
31
|
viewLogic: IPSAppViewLogic,
|
|
30
|
-
context:
|
|
32
|
+
context: IContext,
|
|
31
33
|
data: IData[] | null,
|
|
32
34
|
params: IParams,
|
|
33
35
|
opts: IData = {},
|
|
@@ -70,14 +72,14 @@ export async function executeViewLogic(
|
|
|
70
72
|
* @date 2022-08-22 14:08:03
|
|
71
73
|
* @export
|
|
72
74
|
* @param {IPSAppUIOpenDataLogic} appUILogic 应用预置界面逻辑opendata模型对象
|
|
73
|
-
* @param {
|
|
75
|
+
* @param {IContext} context 上下文参数
|
|
74
76
|
* @param {(IData | null)} data 数据集合
|
|
75
77
|
* @param {IParams} params 视图参数
|
|
76
78
|
* @param {IData} [opts] 额外参数,event是js原生事件
|
|
77
79
|
*/
|
|
78
80
|
export async function executeOpenDataAppUILogic(
|
|
79
81
|
appUILogic: IPSAppUIOpenDataLogic,
|
|
80
|
-
context:
|
|
82
|
+
context: IContext,
|
|
81
83
|
data: IData[] | null,
|
|
82
84
|
params: IParams,
|
|
83
85
|
opts: IData = {},
|
|
@@ -107,9 +109,10 @@ export async function executeOpenDataAppUILogic(
|
|
|
107
109
|
rawValue: false,
|
|
108
110
|
} as IPSNavigateParam);
|
|
109
111
|
}
|
|
110
|
-
const
|
|
112
|
+
const newContext = context.clone();
|
|
113
|
+
const tempContext = Object.assign(
|
|
114
|
+
newContext,
|
|
111
115
|
convertNavData(navContexts!, context, params, data[0]),
|
|
112
|
-
context,
|
|
113
116
|
);
|
|
114
117
|
|
|
115
118
|
// 处理导航视图参数
|
|
@@ -142,63 +145,140 @@ export async function executeOpenDataAppUILogic(
|
|
|
142
145
|
* @date 2022-08-22 14:08:03
|
|
143
146
|
* @export
|
|
144
147
|
* @param {IPSAppUINewDataLogic} appUILogic 应用预置界面逻辑newdata模型对象
|
|
145
|
-
* @param {
|
|
148
|
+
* @param {IContext} context 上下文参数
|
|
146
149
|
* @param {(IData | null)} data 数据集合
|
|
147
150
|
* @param {IParams} params 视图参数
|
|
148
151
|
* @param {IData} [opts] 额外参数,event是js原生事件
|
|
149
152
|
*/
|
|
150
153
|
export async function executeNewDataAppUILogic(
|
|
151
154
|
appUILogic: IPSAppUINewDataLogic,
|
|
152
|
-
context:
|
|
155
|
+
context: IContext,
|
|
153
156
|
data: IData[] | null,
|
|
154
157
|
params: IParams,
|
|
155
158
|
opts: IData = {},
|
|
156
159
|
): Promise<IUIActionResult> {
|
|
160
|
+
const { enableWizardAdd, enableBatchAdd, batchAddOnly } = appUILogic;
|
|
161
|
+
let openViewRef: IPSAppUILogicRefView | null | undefined = null;
|
|
162
|
+
let doBatchAdd = false;
|
|
157
163
|
// 准备需要的模型
|
|
158
|
-
|
|
159
|
-
if (
|
|
160
|
-
|
|
161
|
-
if (
|
|
162
|
-
|
|
163
|
-
|
|
164
|
+
// todo 拷贝
|
|
165
|
+
if (enableWizardAdd) {
|
|
166
|
+
// todo 向导添加
|
|
167
|
+
} else if (enableBatchAdd) {
|
|
168
|
+
// 批添加
|
|
169
|
+
const batchViews = appUILogic.getBatchAddPSAppViews();
|
|
170
|
+
openViewRef = batchViews?.find(view => {
|
|
171
|
+
const openDeName = view.refMode.toLowerCase();
|
|
172
|
+
return openDeName !== context.srfparentdename;
|
|
173
|
+
});
|
|
174
|
+
doBatchAdd = true;
|
|
175
|
+
} else if (batchAddOnly) {
|
|
176
|
+
// todo 只支持批添加
|
|
177
|
+
} else {
|
|
178
|
+
// 普通新建视图打开
|
|
179
|
+
openViewRef = appUILogic.getNewDataPSAppView();
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const openView = openViewRef?.getRefPSAppView();
|
|
183
|
+
if (!openViewRef || !openView) throw new RuntimeError('找不到新建视图');
|
|
184
|
+
await openView.fill(true);
|
|
185
|
+
const appDataEntity = new AppEntityModel(openView.getPSAppDataEntity()!);
|
|
164
186
|
await appDataEntity.init();
|
|
165
187
|
|
|
166
188
|
// 处理导航参数
|
|
167
189
|
let tempContext: IData = {};
|
|
168
190
|
let tempParams: IData = {};
|
|
169
191
|
const _data = data?.[0] || {};
|
|
170
|
-
const navContexts =
|
|
192
|
+
const navContexts = openViewRef.getPSNavigateContexts();
|
|
171
193
|
if (notNilEmpty(navContexts)) {
|
|
172
194
|
tempContext = convertNavData(navContexts!, context, params, _data);
|
|
173
195
|
}
|
|
174
|
-
tempContext =
|
|
196
|
+
tempContext = Object.assign(context.clone(), tempContext);
|
|
175
197
|
// 删除上下文内的主键
|
|
176
|
-
delete tempContext[appDataEntity.deName.toLowerCase()];
|
|
177
198
|
tempContext[appDataEntity.deName.toLowerCase()] = undefined;
|
|
178
199
|
|
|
179
|
-
const navParams =
|
|
200
|
+
const navParams = openViewRef.getPSNavigateParams();
|
|
180
201
|
if (notNilEmpty(navParams)) {
|
|
181
202
|
tempParams = convertNavData(navParams!, params, context, _data);
|
|
182
203
|
}
|
|
183
204
|
|
|
184
|
-
// todo 拷贝
|
|
185
|
-
if (appUILogic.enableWizardAdd) {
|
|
186
|
-
// todo 向导添加
|
|
187
|
-
} else if (appUILogic.enableBatchAdd) {
|
|
188
|
-
// todo 批添加
|
|
189
|
-
} else if (appUILogic.batchAddOnly) {
|
|
190
|
-
// todo 只支持批添加
|
|
191
|
-
}
|
|
192
|
-
|
|
193
205
|
// 打开视图
|
|
194
|
-
await ibiz.commands.execute(
|
|
206
|
+
const result: IModalData | undefined = await ibiz.commands.execute(
|
|
195
207
|
OpenAppViewCommand.TAG,
|
|
196
|
-
|
|
208
|
+
openView,
|
|
197
209
|
tempContext,
|
|
198
210
|
tempParams,
|
|
199
211
|
opts,
|
|
200
212
|
);
|
|
201
213
|
|
|
214
|
+
// 批添加新建选中数据后
|
|
215
|
+
if (doBatchAdd && result?.data?.length) {
|
|
216
|
+
const newView = appUILogic.getNewDataPSAppView()!.getRefPSAppView()!;
|
|
217
|
+
await newView.fill(true);
|
|
218
|
+
const selfDe = newView.getPSAppDataEntity()!;
|
|
219
|
+
const minorDERs = selfDe.getMinorPSAppDERSs();
|
|
220
|
+
const pickParentDeName = openViewRef.refMode.toLowerCase();
|
|
221
|
+
if (!minorDERs) {
|
|
222
|
+
throw new DefectModelError(selfDe, '实体没有从关系集合!');
|
|
223
|
+
}
|
|
224
|
+
let pickParentFieldName: string;
|
|
225
|
+
minorDERs?.forEach(item => {
|
|
226
|
+
const majorDeName = item
|
|
227
|
+
.getMajorPSAppDataEntity()!
|
|
228
|
+
.codeName.toLowerCase();
|
|
229
|
+
if (pickParentDeName === majorDeName) {
|
|
230
|
+
pickParentFieldName = item
|
|
231
|
+
.getParentPSAppDEField()!
|
|
232
|
+
.codeName.toLowerCase();
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
// 获取key为keymapping的特殊视图参数
|
|
237
|
+
const openViewKeyParam = openView
|
|
238
|
+
.getPSAppViewNavParams()
|
|
239
|
+
?.find(navParam => {
|
|
240
|
+
return navParam.key === 'keymapping';
|
|
241
|
+
});
|
|
242
|
+
let addData: IData[] = [];
|
|
243
|
+
if (openViewKeyParam) {
|
|
244
|
+
const keyValuePairs = openViewKeyParam.value.split(';');
|
|
245
|
+
const keyMapping: IData = {};
|
|
246
|
+
// 遍历键值对数组并添加到 keyMapping 映射对象中
|
|
247
|
+
for (const pair of keyValuePairs) {
|
|
248
|
+
const [sourceKey, targetKey] = pair.split(':');
|
|
249
|
+
if (sourceKey && targetKey) {
|
|
250
|
+
keyMapping[sourceKey] = targetKey;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
addData = result.data.map(item => {
|
|
254
|
+
const tempData: IData = {
|
|
255
|
+
[pickParentFieldName]: item.srfkey,
|
|
256
|
+
};
|
|
257
|
+
// 遍历映射对象,将属性从 item 复制到 tempData
|
|
258
|
+
for (const key in keyMapping) {
|
|
259
|
+
if (Object.prototype.hasOwnProperty.call(keyMapping, key)) {
|
|
260
|
+
const targetKey = keyMapping[key];
|
|
261
|
+
if (Object.prototype.hasOwnProperty.call(item, key)) {
|
|
262
|
+
tempData[targetKey] = item[key];
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return tempData;
|
|
267
|
+
});
|
|
268
|
+
} else {
|
|
269
|
+
addData = result.data.map(item => ({
|
|
270
|
+
[pickParentFieldName]: item.srfkey,
|
|
271
|
+
}));
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// 获取实体服务并调用创建接口
|
|
275
|
+
const service = await ibiz.entityService.getService(
|
|
276
|
+
selfDe.codeName,
|
|
277
|
+
context,
|
|
278
|
+
);
|
|
279
|
+
await service.exec('Create', context, addData);
|
|
280
|
+
}
|
|
281
|
+
|
|
202
282
|
// 刷新上一个视图
|
|
203
283
|
const { neuron } = opts!;
|
|
204
284
|
neuron.call.refresh();
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 千反田丷
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|