@ibiz-template/runtime 0.0.1-alpha.8 → 0.0.1-beta.1
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 -0
- package/out/command/app/app-func/app-func.js +3 -3
- package/out/command/app/open-app-view/open-app-view.d.ts +2 -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 -18
- package/out/index.d.ts +3 -1
- package/out/index.d.ts.map +1 -1
- package/out/index.js +3 -1
- package/out/install.d.ts.map +1 -1
- package/out/install.js +5 -2
- package/out/interface/i-drawer-options/i-drawer-options.d.ts +29 -0
- package/out/interface/i-drawer-options/i-drawer-options.d.ts.map +1 -0
- package/out/interface/{provider/i-editor-provider.js → i-drawer-options/i-drawer-options.js} +0 -0
- package/out/interface/i-modal-data/i-modal-data.d.ts +1 -1
- package/out/interface/i-modal-data/i-modal-data.d.ts.map +1 -1
- package/out/interface/i-modal-options/i-modal-options.d.ts +35 -0
- package/out/interface/i-modal-options/i-modal-options.d.ts.map +1 -0
- package/out/interface/{register/i-editor-register.js → i-modal-options/i-modal-options.js} +0 -0
- package/out/interface/i-plugin-factory/i-plugin-factory.d.ts +39 -0
- package/out/interface/i-plugin-factory/i-plugin-factory.d.ts.map +1 -0
- package/out/interface/i-plugin-factory/i-plugin-factory.js +1 -0
- package/out/interface/i-popover-options/i-popover-options.d.ts +84 -0
- package/out/interface/i-popover-options/i-popover-options.d.ts.map +1 -0
- package/out/interface/i-popover-options/i-popover-options.js +1 -0
- package/out/interface/i-ui-action-handler/i-ui-action-handler.d.ts +27 -0
- package/out/interface/i-ui-action-handler/i-ui-action-handler.d.ts.map +1 -0
- package/out/interface/i-ui-action-handler/i-ui-action-handler.js +1 -0
- package/out/interface/index.d.ts +7 -3
- package/out/interface/index.d.ts.map +1 -1
- package/out/interface/index.js +2 -3
- package/out/interface/provider/i-ui-action-provider.d.ts +20 -0
- package/out/interface/provider/i-ui-action-provider.d.ts.map +1 -0
- package/out/interface/provider/i-ui-action-provider.js +1 -0
- package/out/interface/provider/index.d.ts +2 -0
- package/out/interface/provider/index.d.ts.map +1 -0
- package/out/interface/provider/index.js +1 -0
- package/out/interface/register/i-register.d.ts +8 -1
- package/out/interface/register/i-register.d.ts.map +1 -1
- package/out/interface/register/i-ui-action-register.d.ts +15 -0
- package/out/interface/register/i-ui-action-register.d.ts.map +1 -0
- package/out/interface/register/i-ui-action-register.js +1 -0
- package/out/interface/register/index.d.ts +3 -0
- package/out/interface/register/index.d.ts.map +1 -0
- package/out/interface/register/index.js +2 -0
- package/out/interface/util/i-loading-util/i-loading-util.d.ts +14 -0
- package/out/interface/util/i-loading-util/i-loading-util.d.ts.map +1 -1
- package/out/interface/util/i-open-view-util/i-open-view-util.d.ts +1 -1
- package/out/interface/util/i-open-view-util/i-open-view-util.d.ts.map +1 -1
- package/out/interface/util/i-overlay-container/i-overlay-container.d.ts +37 -0
- package/out/interface/util/i-overlay-container/i-overlay-container.d.ts.map +1 -0
- package/out/interface/util/i-overlay-container/i-overlay-container.js +1 -0
- package/out/interface/util/i-overlay-controller/i-overlay-controller.d.ts +86 -0
- package/out/interface/util/i-overlay-controller/i-overlay-controller.d.ts.map +1 -0
- package/out/interface/util/i-overlay-controller/i-overlay-controller.js +1 -0
- package/out/interface/util/i-overlay-popover-container/i-overlay-popover-container.d.ts +23 -0
- package/out/interface/util/i-overlay-popover-container/i-overlay-popover-container.d.ts.map +1 -0
- package/out/interface/util/i-overlay-popover-container/i-overlay-popover-container.js +1 -0
- package/out/interface/util/index.d.ts +3 -0
- package/out/interface/util/index.d.ts.map +1 -1
- package/out/plugin/index.d.ts +3 -0
- package/out/plugin/index.d.ts.map +1 -0
- package/out/plugin/index.js +2 -0
- package/out/plugin/plugin-static-resource/plugin-static-resource.d.ts +37 -0
- package/out/plugin/plugin-static-resource/plugin-static-resource.d.ts.map +1 -0
- package/out/plugin/plugin-static-resource/plugin-static-resource.js +31 -0
- package/out/plugin/remote-plugin-item/remote-plugin-item.d.ts +102 -0
- package/out/plugin/remote-plugin-item/remote-plugin-item.d.ts.map +1 -0
- package/out/plugin/remote-plugin-item/remote-plugin-item.js +22 -0
- package/out/provider/index.d.ts +2 -0
- package/out/provider/index.d.ts.map +1 -0
- package/out/provider/index.js +1 -0
- package/out/provider/ui-action/backend-ui-action-provider.d.ts +15 -0
- package/out/provider/ui-action/backend-ui-action-provider.d.ts.map +1 -0
- package/out/provider/ui-action/backend-ui-action-provider.js +18 -0
- package/out/provider/ui-action/common-sys-ui-action-provider.d.ts +15 -0
- package/out/provider/ui-action/common-sys-ui-action-provider.d.ts.map +1 -0
- package/out/provider/ui-action/common-sys-ui-action-provider.js +18 -0
- package/out/provider/ui-action/front-ui-action-provider.d.ts +15 -0
- package/out/provider/ui-action/front-ui-action-provider.d.ts.map +1 -0
- package/out/provider/ui-action/front-ui-action-provider.js +18 -0
- package/out/provider/ui-action/index.d.ts +13 -0
- package/out/provider/ui-action/index.d.ts.map +1 -0
- package/out/provider/ui-action/index.js +44 -0
- package/out/register/index.d.ts +4 -0
- package/out/register/index.d.ts.map +1 -0
- package/out/register/index.js +3 -0
- package/out/register/register-base.d.ts +18 -0
- package/out/register/register-base.d.ts.map +1 -0
- package/out/register/register-base.js +24 -0
- package/out/register/register-center.d.ts +20 -0
- package/out/register/register-center.d.ts.map +1 -0
- package/out/register/register-center.js +21 -0
- package/out/register/ui-action-register.d.ts +17 -0
- package/out/register/ui-action-register.d.ts.map +1 -0
- package/out/register/ui-action-register.js +41 -0
- package/out/types.d.ts +19 -3
- package/out/types.d.ts.map +1 -1
- package/out/utils/app-de-ui-action-util/app-de-ui-action-util.d.ts +3 -61
- 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 +4 -241
- package/out/utils/app-de-ui-action-util/handler/backend-ui-action-handler.d.ts +17 -0
- package/out/utils/app-de-ui-action-util/handler/backend-ui-action-handler.d.ts.map +1 -0
- package/out/utils/app-de-ui-action-util/handler/backend-ui-action-handler.js +28 -0
- package/out/utils/app-de-ui-action-util/handler/common-sys-ui-action-handler.d.ts +17 -0
- package/out/utils/app-de-ui-action-util/handler/common-sys-ui-action-handler.d.ts.map +1 -0
- package/out/utils/app-de-ui-action-util/handler/common-sys-ui-action-handler.js +103 -0
- package/out/utils/app-de-ui-action-util/handler/front-ui-action-handler.d.ts +17 -0
- package/out/utils/app-de-ui-action-util/handler/front-ui-action-handler.d.ts.map +1 -0
- package/out/utils/app-de-ui-action-util/handler/front-ui-action-handler.js +24 -0
- package/out/utils/app-de-ui-action-util/handler/index.d.ts +5 -0
- package/out/utils/app-de-ui-action-util/handler/index.d.ts.map +1 -0
- package/out/utils/app-de-ui-action-util/handler/index.js +4 -0
- package/out/utils/app-de-ui-action-util/handler/ui-action-handler.d.ts +82 -0
- package/out/utils/app-de-ui-action-util/handler/ui-action-handler.d.ts.map +1 -0
- package/out/utils/app-de-ui-action-util/handler/ui-action-handler.js +143 -0
- package/out/utils/app-de-ui-action-util/index.d.ts +3 -0
- package/out/utils/app-de-ui-action-util/index.d.ts.map +1 -0
- package/out/utils/app-de-ui-action-util/index.js +2 -0
- package/out/utils/index.d.ts +2 -1
- package/out/utils/index.d.ts.map +1 -1
- package/out/utils/index.js +2 -1
- package/out/utils/open-redirect-view/open-redirect-view.d.ts +43 -0
- package/out/utils/open-redirect-view/open-redirect-view.d.ts.map +1 -0
- package/out/utils/open-redirect-view/open-redirect-view.js +139 -0
- package/out/view-logic/view-logic.d.ts +7 -6
- package/out/view-logic/view-logic.d.ts.map +1 -1
- package/out/view-logic/view-logic.js +19 -13
- package/package.json +22 -12
- package/src/command/app/app-func/app-func.ts +3 -3
- package/src/command/app/open-app-view/open-app-view.ts +12 -28
- package/src/index.ts +3 -1
- package/src/install.ts +5 -2
- package/src/interface/i-drawer-options/i-drawer-options.ts +28 -0
- package/src/interface/i-modal-data/i-modal-data.ts +1 -1
- package/src/interface/i-modal-options/i-modal-options.ts +35 -0
- package/src/interface/i-plugin-factory/i-plugin-factory.ts +39 -0
- package/src/interface/i-popover-options/i-popover-options.ts +85 -0
- package/src/interface/i-ui-action-handler/i-ui-action-handler.ts +33 -0
- package/src/interface/index.ts +10 -3
- package/src/interface/provider/i-ui-action-provider.ts +20 -0
- package/src/interface/provider/index.ts +1 -0
- package/src/interface/register/i-register.ts +8 -1
- package/src/interface/register/i-ui-action-register.ts +15 -0
- package/src/interface/register/index.ts +2 -0
- package/src/interface/util/i-loading-util/i-loading-util.ts +14 -0
- package/src/interface/util/i-open-view-util/i-open-view-util.ts +1 -0
- package/src/interface/util/i-overlay-container/i-overlay-container.ts +38 -0
- package/src/interface/util/i-overlay-controller/i-overlay-controller.ts +116 -0
- package/src/interface/util/i-overlay-popover-container/i-overlay-popover-container.ts +23 -0
- package/src/interface/util/index.ts +3 -0
- package/src/plugin/index.ts +5 -0
- package/src/plugin/plugin-static-resource/plugin-static-resource.ts +42 -0
- package/src/plugin/remote-plugin-item/remote-plugin-item.ts +107 -0
- package/src/provider/index.ts +1 -0
- package/src/provider/ui-action/backend-ui-action-provider.ts +22 -0
- package/src/provider/ui-action/common-sys-ui-action-provider.ts +22 -0
- package/src/provider/ui-action/front-ui-action-provider.ts +22 -0
- package/src/provider/ui-action/index.ts +50 -0
- package/src/register/index.ts +3 -0
- package/src/register/register-base.ts +27 -0
- package/src/register/register-center.ts +20 -0
- package/src/register/ui-action-register.ts +48 -0
- package/src/types.ts +20 -3
- package/src/utils/app-de-ui-action-util/app-de-ui-action-util.ts +6 -330
- package/src/utils/app-de-ui-action-util/handler/backend-ui-action-handler.ts +43 -0
- package/src/utils/app-de-ui-action-util/handler/common-sys-ui-action-handler.ts +125 -0
- package/src/utils/app-de-ui-action-util/handler/front-ui-action-handler.ts +46 -0
- package/src/utils/app-de-ui-action-util/handler/index.ts +4 -0
- package/src/utils/app-de-ui-action-util/handler/ui-action-handler.ts +215 -0
- package/src/utils/app-de-ui-action-util/index.ts +2 -0
- package/src/utils/index.ts +2 -1
- package/src/utils/open-redirect-view/open-redirect-view.ts +180 -0
- package/src/view-logic/view-logic.ts +30 -17
- package/out/interface/provider/i-editor-provider.d.ts +0 -38
- package/out/interface/provider/i-editor-provider.d.ts.map +0 -1
- package/out/interface/register/i-editor-register.d.ts +0 -23
- package/out/interface/register/i-editor-register.d.ts.map +0 -1
- package/out/register/register.d.ts +0 -20
- package/out/register/register.d.ts.map +0 -1
- package/out/register/register.js +0 -10
- package/src/interface/provider/i-editor-provider.ts +0 -44
- package/src/interface/register/i-editor-register.ts +0 -23
- package/src/register/register.ts +0 -20
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { UIActionHandler } from './ui-action-handler';
|
|
2
|
+
/**
|
|
3
|
+
* 常用的系统预置界面行为处理器
|
|
4
|
+
*
|
|
5
|
+
* @author lxm
|
|
6
|
+
* @date 2022-10-25 15:10:20
|
|
7
|
+
* @export
|
|
8
|
+
* @class CommonSysUIActionHandler
|
|
9
|
+
* @extends {UIActionHandler}
|
|
10
|
+
*/
|
|
11
|
+
export class CommonSysUIActionHandler extends UIActionHandler {
|
|
12
|
+
async execAction(action, context, data, params, opts) {
|
|
13
|
+
const { neuron, event } = opts;
|
|
14
|
+
const { uIActionTag } = action;
|
|
15
|
+
const result = {};
|
|
16
|
+
// 打开新建数据视图
|
|
17
|
+
if (uIActionTag === 'New') {
|
|
18
|
+
if (!neuron.call.newData) {
|
|
19
|
+
throw new Error(`该视图不存在newData能力`);
|
|
20
|
+
}
|
|
21
|
+
await neuron.call.newData(event);
|
|
22
|
+
}
|
|
23
|
+
// 打开编辑数据视图
|
|
24
|
+
if (uIActionTag === 'Edit') {
|
|
25
|
+
if (!neuron.call.openData) {
|
|
26
|
+
throw new Error(`该视图不存在openData能力`);
|
|
27
|
+
}
|
|
28
|
+
await neuron.call.openData(data === null || data === void 0 ? void 0 : data[0], event);
|
|
29
|
+
}
|
|
30
|
+
// 保存能力
|
|
31
|
+
const saveTags = ['SaveAndExit', 'Save', 'SaveRow'];
|
|
32
|
+
if (saveTags.indexOf(uIActionTag) !== -1) {
|
|
33
|
+
if (!neuron.call.save) {
|
|
34
|
+
throw new Error(`该视图不存在save能力`);
|
|
35
|
+
}
|
|
36
|
+
await neuron.call.save();
|
|
37
|
+
}
|
|
38
|
+
// 保存并新建
|
|
39
|
+
if (uIActionTag === 'SaveAndNew') {
|
|
40
|
+
if (!neuron.call.saveAndNew) {
|
|
41
|
+
throw new Error(`该视图不存在saveAndNew能力`);
|
|
42
|
+
}
|
|
43
|
+
await neuron.call.saveAndNew();
|
|
44
|
+
}
|
|
45
|
+
// 删除能力
|
|
46
|
+
if (uIActionTag === 'Remove' || uIActionTag === 'RemoveAndExit') {
|
|
47
|
+
if (!neuron.call.remove) {
|
|
48
|
+
throw new Error(`该视图不存在remove能力`);
|
|
49
|
+
}
|
|
50
|
+
await neuron.call.remove();
|
|
51
|
+
}
|
|
52
|
+
// 新建行能力
|
|
53
|
+
if (uIActionTag === 'NewRow') {
|
|
54
|
+
if (!neuron.call.newRow) {
|
|
55
|
+
throw new Error(`该视图不存在newRow能力`);
|
|
56
|
+
}
|
|
57
|
+
await neuron.call.newRow();
|
|
58
|
+
}
|
|
59
|
+
// 切换搜索表单能力
|
|
60
|
+
if (uIActionTag === 'ToggleFilter') {
|
|
61
|
+
if (!neuron.call.toggleFilter) {
|
|
62
|
+
throw new Error(`该视图不存在ToggleFilter能力`);
|
|
63
|
+
}
|
|
64
|
+
neuron.call.toggleFilter();
|
|
65
|
+
}
|
|
66
|
+
// 数据导入能力
|
|
67
|
+
if (uIActionTag === 'Import') {
|
|
68
|
+
if (!neuron.call.importData) {
|
|
69
|
+
throw new Error(`该视图不存在Import能力`);
|
|
70
|
+
}
|
|
71
|
+
neuron.call.importData();
|
|
72
|
+
}
|
|
73
|
+
// 数据导出能力
|
|
74
|
+
if (uIActionTag === 'ExportExcel') {
|
|
75
|
+
if (!neuron.call.exportData) {
|
|
76
|
+
throw new Error(`该视图不存在ExportExcel能力`);
|
|
77
|
+
}
|
|
78
|
+
neuron.call.exportData(event);
|
|
79
|
+
}
|
|
80
|
+
// 工作流相关
|
|
81
|
+
if (uIActionTag === 'SaveAndStart') {
|
|
82
|
+
if (!neuron.call.wfStart) {
|
|
83
|
+
throw new Error(`该视图不存在SaveAndStart能力`);
|
|
84
|
+
}
|
|
85
|
+
await neuron.call.wfStart();
|
|
86
|
+
}
|
|
87
|
+
if (uIActionTag === 'ViewWFStep') {
|
|
88
|
+
if (!neuron.call.wfSubmit) {
|
|
89
|
+
throw new Error(`该视图不存在ViewWFStep能力`);
|
|
90
|
+
}
|
|
91
|
+
await neuron.call.wfSubmit();
|
|
92
|
+
}
|
|
93
|
+
// 需要关闭视图的
|
|
94
|
+
if (['SaveAndExit', 'Exit', 'RemoveAndExit'].indexOf(uIActionTag) !== -1) {
|
|
95
|
+
result.closeView = true;
|
|
96
|
+
}
|
|
97
|
+
// 需要刷新界面的
|
|
98
|
+
if (['Refresh'].indexOf(uIActionTag) !== -1) {
|
|
99
|
+
result.refresh = true;
|
|
100
|
+
}
|
|
101
|
+
return result;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IBizContext } from '@ibiz-template/core';
|
|
2
|
+
import { IPSAppDEUIAction } from '@ibiz-template/model';
|
|
3
|
+
import { IUIActionResult } from '../../../interface';
|
|
4
|
+
import { UIActionHandler } from './ui-action-handler';
|
|
5
|
+
/**
|
|
6
|
+
* 前台调用界面行为处理器
|
|
7
|
+
*
|
|
8
|
+
* @author lxm
|
|
9
|
+
* @date 2022-10-25 15:10:20
|
|
10
|
+
* @export
|
|
11
|
+
* @class FrontUIActionHandler
|
|
12
|
+
* @extends {UIActionHandler}
|
|
13
|
+
*/
|
|
14
|
+
export declare class FrontUIActionHandler extends UIActionHandler {
|
|
15
|
+
execAction(action: IPSAppDEUIAction, context: IBizContext, data: IData[] | null, params: IParams, opts?: IData | undefined): Promise<IUIActionResult>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=front-ui-action-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"front-ui-action-handler.d.ts","sourceRoot":"","sources":["../../../../src/utils/app-de-ui-action-util/handler/front-ui-action-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD;;;;;;;;GAQG;AACH,qBAAa,oBAAqB,SAAQ,eAAe;IACjD,UAAU,CACd,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,EACpB,MAAM,EAAE,OAAO,EACf,IAAI,CAAC,EAAE,KAAK,GAAG,SAAS,GACvB,OAAO,CAAC,eAAe,CAAC;CAuB5B"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { OpenAppViewCommand } from '../../../command';
|
|
2
|
+
import { UIActionHandler } from './ui-action-handler';
|
|
3
|
+
/**
|
|
4
|
+
* 前台调用界面行为处理器
|
|
5
|
+
*
|
|
6
|
+
* @author lxm
|
|
7
|
+
* @date 2022-10-25 15:10:20
|
|
8
|
+
* @export
|
|
9
|
+
* @class FrontUIActionHandler
|
|
10
|
+
* @extends {UIActionHandler}
|
|
11
|
+
*/
|
|
12
|
+
export class FrontUIActionHandler extends UIActionHandler {
|
|
13
|
+
async execAction(action, context, data, params, opts) {
|
|
14
|
+
const frontPSAppView = action.getFrontPSAppView();
|
|
15
|
+
if (!frontPSAppView) {
|
|
16
|
+
throw new Error('未配置打开视图');
|
|
17
|
+
}
|
|
18
|
+
await frontPSAppView.fill(true);
|
|
19
|
+
// 处理参数
|
|
20
|
+
const { resultContext, resultParams } = await this.handleParams(action, context, data, params);
|
|
21
|
+
await ibiz.commands.execute(OpenAppViewCommand.TAG, frontPSAppView, resultContext, resultParams, opts);
|
|
22
|
+
return {};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/app-de-ui-action-util/handler/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { IBizContext } from '@ibiz-template/core';
|
|
2
|
+
import { IPSAppDEUIAction } from '@ibiz-template/model';
|
|
3
|
+
import { IUIActionHandler, IUIActionResult } from '../../../interface';
|
|
4
|
+
/**
|
|
5
|
+
* 界面行为处理器基类
|
|
6
|
+
*
|
|
7
|
+
* @author lxm
|
|
8
|
+
* @date 2022-10-25 14:10:31
|
|
9
|
+
* @export
|
|
10
|
+
* @class UIActionHandler
|
|
11
|
+
*/
|
|
12
|
+
export declare abstract class UIActionHandler implements IUIActionHandler {
|
|
13
|
+
exec(action: IPSAppDEUIAction, context: IBizContext, data: IData[] | null, params: IParams, opts?: IData | undefined): Promise<IUIActionResult>;
|
|
14
|
+
/**
|
|
15
|
+
* 用户操作确认
|
|
16
|
+
*
|
|
17
|
+
* @author lxm
|
|
18
|
+
* @date 2022-10-25 14:10:55
|
|
19
|
+
* @param {IPSAppDEUIAction} action 界面行为模型
|
|
20
|
+
* @returns {*} {Promise<boolean>}
|
|
21
|
+
*/
|
|
22
|
+
isConfirm(action: IPSAppDEUIAction): Promise<boolean>;
|
|
23
|
+
/**
|
|
24
|
+
* 执行具体界面行为的独有逻辑(子类重写)
|
|
25
|
+
*
|
|
26
|
+
* @author lxm
|
|
27
|
+
* @date 2022-10-25 15:10:03
|
|
28
|
+
* @abstract
|
|
29
|
+
* @param {IPSAppDEUIAction} action
|
|
30
|
+
* @param {IBizContext} context
|
|
31
|
+
* @param {(IData[] | null)} data
|
|
32
|
+
* @param {IParams} params
|
|
33
|
+
* @param {(IData | undefined)} [opts]
|
|
34
|
+
* @returns {*} {Promise<IUIActionResult>}
|
|
35
|
+
*/
|
|
36
|
+
abstract execAction(action: IPSAppDEUIAction, context: IBizContext, data: IData[] | null, params: IParams, opts?: IData | undefined): Promise<IUIActionResult>;
|
|
37
|
+
/**
|
|
38
|
+
* 执行后续界面行为
|
|
39
|
+
*
|
|
40
|
+
* @author lxm
|
|
41
|
+
* @date 2022-10-25 15:10:54
|
|
42
|
+
* @param {IPSAppDEUIAction} action
|
|
43
|
+
* @param {IBizContext} context
|
|
44
|
+
* @param {(IData[] | null)} data
|
|
45
|
+
* @param {IParams} params
|
|
46
|
+
* @param {(IData | undefined)} [opts]
|
|
47
|
+
* @returns {*} {Promise<void>}
|
|
48
|
+
*/
|
|
49
|
+
doNextAction(action: IPSAppDEUIAction, context: IBizContext, data: IData[] | null, params: IParams, opts?: IData | undefined): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* 处理结果(刷新和关闭视图)
|
|
52
|
+
*
|
|
53
|
+
* @author lxm
|
|
54
|
+
* @date 2022-10-25 14:10:11
|
|
55
|
+
* @param {IUIActionResult} result
|
|
56
|
+
* @param {IData} neuron
|
|
57
|
+
*/
|
|
58
|
+
handleResult(result: IUIActionResult, neuron: IData): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* 参数处理(根据数据目标和数据参数,导航参数)
|
|
61
|
+
*
|
|
62
|
+
* @author lxm
|
|
63
|
+
* @date 2022-08-29 17:08:00
|
|
64
|
+
* @protected
|
|
65
|
+
* @static
|
|
66
|
+
* @param {IPSAppDEUIAction} action 界面行为
|
|
67
|
+
* @param {IBizContext} context 上下文
|
|
68
|
+
* @param {(IData[] | null)} data 数据集合
|
|
69
|
+
* @param {IParams} params 视图参数
|
|
70
|
+
* @returns {*} {Promise<{
|
|
71
|
+
* resultContext: IBizContext; 处理后的上下文
|
|
72
|
+
* resultData: IData[]; 处理后的数据集合
|
|
73
|
+
* resultParams: IParams; 处理后的视图参数
|
|
74
|
+
* }>}
|
|
75
|
+
*/
|
|
76
|
+
protected handleParams(action: IPSAppDEUIAction, context: IBizContext, data: IData[] | null, params: IParams): Promise<{
|
|
77
|
+
resultContext: IBizContext;
|
|
78
|
+
resultData: IData[];
|
|
79
|
+
resultParams: IParams;
|
|
80
|
+
}>;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=ui-action-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui-action-handler.d.ts","sourceRoot":"","sources":["../../../../src/utils/app-de-ui-action-util/handler/ui-action-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAgB,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAsB,MAAM,sBAAsB,CAAC;AAE5E,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAIvE;;;;;;;GAOG;AACH,8BAAsB,eAAgB,YAAW,gBAAgB;IACzD,IAAI,CACR,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,EACpB,MAAM,EAAE,OAAO,EACf,IAAI,CAAC,EAAE,KAAK,GAAG,SAAS,GACvB,OAAO,CAAC,eAAe,CAAC;IAqB3B;;;;;;;OAOG;IACG,SAAS,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;IAO3D;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,UAAU,CACjB,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,EACpB,MAAM,EAAE,OAAO,EACf,IAAI,CAAC,EAAE,KAAK,GAAG,SAAS,GACvB,OAAO,CAAC,eAAe,CAAC;IAE3B;;;;;;;;;;;OAWG;IACG,YAAY,CAChB,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,EACpB,MAAM,EAAE,OAAO,EACf,IAAI,CAAC,EAAE,KAAK,GAAG,SAAS,GACvB,OAAO,CAAC,IAAI,CAAC;IAOhB;;;;;;;OAOG;IACG,YAAY,CAAC,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBzE;;;;;;;;;;;;;;;;OAgBG;cACa,YAAY,CAC1B,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,EACpB,MAAM,EAAE,OAAO,GACd,OAAO,CAAC;QACT,aAAa,EAAE,WAAW,CAAC;QAC3B,UAAU,EAAE,KAAK,EAAE,CAAC;QACpB,YAAY,EAAE,OAAO,CAAC;KACvB,CAAC;CAyDH"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { IBizContext, RuntimeError } from '@ibiz-template/core';
|
|
2
|
+
import { notNilEmpty } from 'qx-util';
|
|
3
|
+
import { convertNavData } from '../../nav-params/nav-params';
|
|
4
|
+
import { AppDEUIActionUtil } from '../app-de-ui-action-util';
|
|
5
|
+
/**
|
|
6
|
+
* 界面行为处理器基类
|
|
7
|
+
*
|
|
8
|
+
* @author lxm
|
|
9
|
+
* @date 2022-10-25 14:10:31
|
|
10
|
+
* @export
|
|
11
|
+
* @class UIActionHandler
|
|
12
|
+
*/
|
|
13
|
+
export class UIActionHandler {
|
|
14
|
+
async exec(action, context, data, params, opts) {
|
|
15
|
+
// **用户操作确认**
|
|
16
|
+
if (!(await this.isConfirm(action))) {
|
|
17
|
+
return {};
|
|
18
|
+
}
|
|
19
|
+
const { neuron } = opts;
|
|
20
|
+
const result = {
|
|
21
|
+
refresh: action.reloadData,
|
|
22
|
+
closeView: action.closeEditView,
|
|
23
|
+
};
|
|
24
|
+
// 执行不同类型的界面行为独有逻辑,并且合并result
|
|
25
|
+
const _result = await this.execAction(action, context, data, params, opts);
|
|
26
|
+
Object.assign(result, _result);
|
|
27
|
+
await this.doNextAction(action, context, data, params, opts);
|
|
28
|
+
await this.handleResult(result, neuron);
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* 用户操作确认
|
|
33
|
+
*
|
|
34
|
+
* @author lxm
|
|
35
|
+
* @date 2022-10-25 14:10:55
|
|
36
|
+
* @param {IPSAppDEUIAction} action 界面行为模型
|
|
37
|
+
* @returns {*} {Promise<boolean>}
|
|
38
|
+
*/
|
|
39
|
+
async isConfirm(action) {
|
|
40
|
+
if (action.enableConfirm && action.confirmMsg) {
|
|
41
|
+
return ibiz.modal.confirm({ title: action.confirmMsg });
|
|
42
|
+
}
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* 执行后续界面行为
|
|
47
|
+
*
|
|
48
|
+
* @author lxm
|
|
49
|
+
* @date 2022-10-25 15:10:54
|
|
50
|
+
* @param {IPSAppDEUIAction} action
|
|
51
|
+
* @param {IBizContext} context
|
|
52
|
+
* @param {(IData[] | null)} data
|
|
53
|
+
* @param {IParams} params
|
|
54
|
+
* @param {(IData | undefined)} [opts]
|
|
55
|
+
* @returns {*} {Promise<void>}
|
|
56
|
+
*/
|
|
57
|
+
async doNextAction(action, context, data, params, opts) {
|
|
58
|
+
const nextAction = action.getNextPSUIAction();
|
|
59
|
+
if (nextAction) {
|
|
60
|
+
await AppDEUIActionUtil.exec(nextAction, context, data, params, opts);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* 处理结果(刷新和关闭视图)
|
|
65
|
+
*
|
|
66
|
+
* @author lxm
|
|
67
|
+
* @date 2022-10-25 14:10:11
|
|
68
|
+
* @param {IUIActionResult} result
|
|
69
|
+
* @param {IData} neuron
|
|
70
|
+
*/
|
|
71
|
+
async handleResult(result, neuron) {
|
|
72
|
+
// *关闭引用视图,关闭后不再执行刷新
|
|
73
|
+
if (result.closeView) {
|
|
74
|
+
if (!neuron.call.closeView) {
|
|
75
|
+
throw new RuntimeError(`该视图不存在关闭视图能力`);
|
|
76
|
+
}
|
|
77
|
+
await neuron.call.closeView();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
// *刷新引用视图
|
|
81
|
+
if (result.refresh) {
|
|
82
|
+
if (!neuron.call.refresh) {
|
|
83
|
+
throw new RuntimeError(`该视图不存在刷新能力`);
|
|
84
|
+
}
|
|
85
|
+
await neuron.call.refresh();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* 参数处理(根据数据目标和数据参数,导航参数)
|
|
90
|
+
*
|
|
91
|
+
* @author lxm
|
|
92
|
+
* @date 2022-08-29 17:08:00
|
|
93
|
+
* @protected
|
|
94
|
+
* @static
|
|
95
|
+
* @param {IPSAppDEUIAction} action 界面行为
|
|
96
|
+
* @param {IBizContext} context 上下文
|
|
97
|
+
* @param {(IData[] | null)} data 数据集合
|
|
98
|
+
* @param {IParams} params 视图参数
|
|
99
|
+
* @returns {*} {Promise<{
|
|
100
|
+
* resultContext: IBizContext; 处理后的上下文
|
|
101
|
+
* resultData: IData[]; 处理后的数据集合
|
|
102
|
+
* resultParams: IParams; 处理后的视图参数
|
|
103
|
+
* }>}
|
|
104
|
+
*/
|
|
105
|
+
async handleParams(action, context, data, params) {
|
|
106
|
+
let resultData = data || [];
|
|
107
|
+
// 数据目标不支持提示
|
|
108
|
+
if (['SINGLEDATA', 'MULTIDATA', 'MULTIKEY'].indexOf(action.actionTarget) !==
|
|
109
|
+
-1) {
|
|
110
|
+
throw new Error(`数据类型${action.actionTarget}暂未支持,请配置无数据或单项数据主键`);
|
|
111
|
+
}
|
|
112
|
+
// 数据目标为无数据时,清空数据
|
|
113
|
+
if (action.actionTarget === 'NONE') {
|
|
114
|
+
resultData = [];
|
|
115
|
+
}
|
|
116
|
+
// 处理上下文导航参数
|
|
117
|
+
let tempContext = {};
|
|
118
|
+
const navContexts = action.getPSNavigateContexts() || [];
|
|
119
|
+
// 单项数据主键时,在导航参数开头加一个主键的导航参数,可以被配置的同名导航参数覆盖。
|
|
120
|
+
const appDataEntity = action.getPSAppDataEntity();
|
|
121
|
+
if (appDataEntity && action.actionTarget === 'SINGLEKEY') {
|
|
122
|
+
await (appDataEntity === null || appDataEntity === void 0 ? void 0 : appDataEntity.fill(true));
|
|
123
|
+
const appDeName = appDataEntity.codeName.toLowerCase();
|
|
124
|
+
const { valueItem } = action;
|
|
125
|
+
navContexts.unshift({
|
|
126
|
+
key: appDeName,
|
|
127
|
+
value: valueItem || 'srfkey',
|
|
128
|
+
rawValue: false,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
if (notNilEmpty(navContexts)) {
|
|
132
|
+
tempContext = convertNavData(navContexts, context, params, (data === null || data === void 0 ? void 0 : data[0]) || {});
|
|
133
|
+
}
|
|
134
|
+
const resultContext = new IBizContext(tempContext, context);
|
|
135
|
+
// 处理导航视图参数
|
|
136
|
+
let resultParams = {};
|
|
137
|
+
const navParams = action.getPSNavigateParams();
|
|
138
|
+
if (notNilEmpty(navParams)) {
|
|
139
|
+
resultParams = convertNavData(navParams, context, params, (data === null || data === void 0 ? void 0 : data[0]) || {});
|
|
140
|
+
}
|
|
141
|
+
return { resultContext, resultData, resultParams };
|
|
142
|
+
}
|
|
143
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/app-de-ui-action-util/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,yBAAyB,CAAC"}
|
package/out/utils/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { AppDEUIActionUtil } from './app-de-ui-action-util/app-de-ui-action-util';
|
|
2
1
|
export * from './nav-params/nav-params';
|
|
2
|
+
export * from './app-de-ui-action-util';
|
|
3
|
+
export { openRedirectView } from './open-redirect-view/open-redirect-view';
|
|
3
4
|
//# sourceMappingURL=index.d.ts.map
|
package/out/utils/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC"}
|
package/out/utils/index.js
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { IBizContext } from '@ibiz-template/core';
|
|
2
|
+
import { IPSAppDataEntity, IPSAppDERedirectView, IPSAppRedirectView } from '@ibiz-template/model';
|
|
3
|
+
import { IModalData } from '../../interface';
|
|
4
|
+
/**
|
|
5
|
+
* 打开重定向视图
|
|
6
|
+
*
|
|
7
|
+
* @author chitanda
|
|
8
|
+
* @date 2022-09-28 16:09:13
|
|
9
|
+
* @export
|
|
10
|
+
* @param {IPSAppRedirectView} appView 应用重定向视图
|
|
11
|
+
* @param {IBizContext} [context=new IBizContext()]
|
|
12
|
+
* @param {IParams} [params={}]
|
|
13
|
+
* @param {IData} [data={}]
|
|
14
|
+
* @return {*} {Promise<IModalData>}
|
|
15
|
+
*/
|
|
16
|
+
export declare function openRedirectView(appView: IPSAppRedirectView, context?: IBizContext, params?: IParams, data?: IData[]): Promise<IModalData>;
|
|
17
|
+
/**
|
|
18
|
+
* 打开实体重定向视图
|
|
19
|
+
*
|
|
20
|
+
* @author chitanda
|
|
21
|
+
* @date 2022-09-28 16:09:15
|
|
22
|
+
* @export
|
|
23
|
+
* @param {IPSAppDERedirectView} appView
|
|
24
|
+
* @param {IBizContext} [context=new IBizContext()]
|
|
25
|
+
* @param {IParams} [params={}]
|
|
26
|
+
* @param {IData[]} [data=[]]
|
|
27
|
+
* @return {*} {Promise<IModalData>}
|
|
28
|
+
*/
|
|
29
|
+
export declare function openDERedirectView(appView: IPSAppDERedirectView, context?: IBizContext, params?: IParams, data?: IData[]): Promise<IModalData>;
|
|
30
|
+
/**
|
|
31
|
+
* 计算重定向标识
|
|
32
|
+
*
|
|
33
|
+
* @author chitanda
|
|
34
|
+
* @date 2022-10-25 16:10:48
|
|
35
|
+
* @export
|
|
36
|
+
* @param {IPSAppDataEntity} entity 重定向视图所在应用实体
|
|
37
|
+
* @param {IPSAppDERedirectView} rdView 重定向视图
|
|
38
|
+
* @param {string} wfStep 流程步骤
|
|
39
|
+
* @param {IData} data 当前数据
|
|
40
|
+
* @return {*} {Promise<string>}
|
|
41
|
+
*/
|
|
42
|
+
export declare function calcDERdTag(entity: IPSAppDataEntity, rdView: IPSAppDERedirectView, wfStep: string, data: IData): Promise<string>;
|
|
43
|
+
//# sourceMappingURL=open-redirect-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open-redirect-view.d.ts","sourceRoot":"","sources":["../../../src/utils/open-redirect-view/open-redirect-view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAEL,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAEnB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG7C;;;;;;;;;;;GAWG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,kBAAkB,EAC3B,OAAO,GAAE,WAA+B,EACxC,MAAM,GAAE,OAAY,EACpB,IAAI,GAAE,KAAK,EAAO,GACjB,OAAO,CAAC,UAAU,CAAC,CAarB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,oBAAoB,EAC7B,OAAO,GAAE,WAA+B,EACxC,MAAM,GAAE,OAAY,EACpB,IAAI,GAAE,KAAK,EAAO,GACjB,OAAO,CAAC,UAAU,CAAC,CAgErB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,oBAAoB,EAC5B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,KAAK,GACV,OAAO,CAAC,MAAM,CAAC,CAkCjB"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { IBizContext } from '@ibiz-template/core';
|
|
2
|
+
import { DefectModelError, UnsupportedModelError, } from '@ibiz-template/model';
|
|
3
|
+
import { isNilOrEmpty, notNilEmpty } from 'qx-util';
|
|
4
|
+
import { OpenAppViewCommand } from '../../command';
|
|
5
|
+
import { convertNavData } from '../nav-params/nav-params';
|
|
6
|
+
/**
|
|
7
|
+
* 打开重定向视图
|
|
8
|
+
*
|
|
9
|
+
* @author chitanda
|
|
10
|
+
* @date 2022-09-28 16:09:13
|
|
11
|
+
* @export
|
|
12
|
+
* @param {IPSAppRedirectView} appView 应用重定向视图
|
|
13
|
+
* @param {IBizContext} [context=new IBizContext()]
|
|
14
|
+
* @param {IParams} [params={}]
|
|
15
|
+
* @param {IData} [data={}]
|
|
16
|
+
* @return {*} {Promise<IModalData>}
|
|
17
|
+
*/
|
|
18
|
+
export async function openRedirectView(appView, context = new IBizContext(), params = {}, data = []) {
|
|
19
|
+
if (appView.instanceof('app.view.IPSAppDERedirectView')) {
|
|
20
|
+
return openDERedirectView(appView, context, params, data);
|
|
21
|
+
}
|
|
22
|
+
throw new UnsupportedModelError(appView, `未支持的重定向视图类型: ${appView.viewType}`);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* 打开实体重定向视图
|
|
26
|
+
*
|
|
27
|
+
* @author chitanda
|
|
28
|
+
* @date 2022-09-28 16:09:15
|
|
29
|
+
* @export
|
|
30
|
+
* @param {IPSAppDERedirectView} appView
|
|
31
|
+
* @param {IBizContext} [context=new IBizContext()]
|
|
32
|
+
* @param {IParams} [params={}]
|
|
33
|
+
* @param {IData[]} [data=[]]
|
|
34
|
+
* @return {*} {Promise<IModalData>}
|
|
35
|
+
*/
|
|
36
|
+
export async function openDERedirectView(appView, context = new IBizContext(), params = {}, data = []) {
|
|
37
|
+
// 计算重定向视图上下文参数转换
|
|
38
|
+
const navContext = appView.getPSAppViewNavContexts() || [];
|
|
39
|
+
const navContextData = convertNavData(navContext, context, params);
|
|
40
|
+
context = new IBizContext(navContextData, context);
|
|
41
|
+
// 计算重定向视图视图参数转换
|
|
42
|
+
const navParams = appView.getPSAppViewNavParams() || [];
|
|
43
|
+
const navParamsData = convertNavData(navParams, context, params);
|
|
44
|
+
Object.assign(params, navParamsData);
|
|
45
|
+
// 重定向视图对应应用实体
|
|
46
|
+
const entity = appView.getPSAppDataEntity();
|
|
47
|
+
await entity.fill(true);
|
|
48
|
+
const key = entity.codeName.toLowerCase();
|
|
49
|
+
let curData = data[0] || {};
|
|
50
|
+
// 将数据主键转换到上下文当中
|
|
51
|
+
context[key] = curData[key] || context[key] || params[key];
|
|
52
|
+
// 实体重定向视图获取数据行为
|
|
53
|
+
const action = appView.getGetDataPSAppDEAction();
|
|
54
|
+
const service = await ibiz.entityService.getService(entity.codeName);
|
|
55
|
+
ibiz.loading.showRedirect();
|
|
56
|
+
// 获取数据,未配置行为时,默认走 Get 行为
|
|
57
|
+
const res = await service.exec(action ? action.codeName : 'Get', context, params);
|
|
58
|
+
ibiz.loading.hideRedirect();
|
|
59
|
+
if (res.ok) {
|
|
60
|
+
curData = res.data;
|
|
61
|
+
const linkUrl = curData.linkurl;
|
|
62
|
+
if (linkUrl) {
|
|
63
|
+
if (linkUrl.startsWith('http://') || linkUrl.startsWith('https://')) {
|
|
64
|
+
window.open(linkUrl, '_blank');
|
|
65
|
+
return { ok: true, data: [] };
|
|
66
|
+
}
|
|
67
|
+
return { ok: false, data: [] };
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const rdTag = await calcDERdTag(entity, appView, params.srfwf, curData);
|
|
71
|
+
// 拼接当前重定向视图所在应用实体名称为前缀
|
|
72
|
+
const deRdTag = `${entity.name.toUpperCase()}:${rdTag}`;
|
|
73
|
+
// 所有重定向引用视图
|
|
74
|
+
const allRefViews = appView.getRedirectPSAppViewRefs();
|
|
75
|
+
const refView = allRefViews === null || allRefViews === void 0 ? void 0 : allRefViews.find(view => {
|
|
76
|
+
return view.name === deRdTag || view.name === rdTag;
|
|
77
|
+
});
|
|
78
|
+
if (refView) {
|
|
79
|
+
const view = refView.getRefPSAppView();
|
|
80
|
+
if (view) {
|
|
81
|
+
const result = await ibiz.commands.execute(OpenAppViewCommand.TAG, view, context, params, { data: [curData] });
|
|
82
|
+
if (result) {
|
|
83
|
+
return result;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
throw new DefectModelError(refView, `未配置实际引用视图`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return { ok: true, data: [] };
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* 计算重定向标识
|
|
94
|
+
*
|
|
95
|
+
* @author chitanda
|
|
96
|
+
* @date 2022-10-25 16:10:48
|
|
97
|
+
* @export
|
|
98
|
+
* @param {IPSAppDataEntity} entity 重定向视图所在应用实体
|
|
99
|
+
* @param {IPSAppDERedirectView} rdView 重定向视图
|
|
100
|
+
* @param {string} wfStep 流程步骤
|
|
101
|
+
* @param {IData} data 当前数据
|
|
102
|
+
* @return {*} {Promise<string>}
|
|
103
|
+
*/
|
|
104
|
+
export async function calcDERdTag(entity, rdView, wfStep, data) {
|
|
105
|
+
let rdTag = '';
|
|
106
|
+
// 重定向视图自定义类别属性
|
|
107
|
+
const typeField = rdView.getTypePSAppDEField();
|
|
108
|
+
// 自定义重定向
|
|
109
|
+
if (typeField) {
|
|
110
|
+
const value = data[typeField.codeName.toLowerCase()];
|
|
111
|
+
if (notNilEmpty(value)) {
|
|
112
|
+
return value;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
// 如果流程步骤存在,按照工作流优先
|
|
116
|
+
if (notNilEmpty(wfStep)) {
|
|
117
|
+
return `EDITVIEW:${wfStep.toUpperCase()}`;
|
|
118
|
+
}
|
|
119
|
+
let typeValue = '';
|
|
120
|
+
// 从索引属性获取重定向视图类型
|
|
121
|
+
const indexTypeField = entity.getIndexTypePSAppDEField();
|
|
122
|
+
if (indexTypeField) {
|
|
123
|
+
typeValue = data[indexTypeField.codeName.toLowerCase()];
|
|
124
|
+
}
|
|
125
|
+
if (isNilOrEmpty(typeValue)) {
|
|
126
|
+
// 从多表单属性判断重定向视图类型
|
|
127
|
+
const multiFormField = entity.getFormTypePSAppDEField();
|
|
128
|
+
if (multiFormField) {
|
|
129
|
+
typeValue = data[multiFormField.codeName.toLowerCase()];
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (notNilEmpty(typeValue)) {
|
|
133
|
+
rdTag = `EDITVIEW:${typeValue}`;
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
rdTag = `EDITVIEW`;
|
|
137
|
+
}
|
|
138
|
+
return rdTag;
|
|
139
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IBizContext } from '@ibiz-template/core';
|
|
1
2
|
import { IPSAppUINewDataLogic, IPSAppUIOpenDataLogic, IPSAppViewLogic } from '@ibiz-template/model';
|
|
2
3
|
import { IUIActionResult } from '../interface';
|
|
3
4
|
/**
|
|
@@ -7,12 +8,12 @@ import { IUIActionResult } from '../interface';
|
|
|
7
8
|
* @date 2022-08-22 09:08:40
|
|
8
9
|
* @export
|
|
9
10
|
* @param {IPSAppViewLogic} viewLogic 视图逻辑模型对象
|
|
10
|
-
* @param {
|
|
11
|
+
* @param {IBizContext} context 上下文参数
|
|
11
12
|
* @param {IParams} params 视图参数
|
|
12
13
|
* @param {(IData | null)} data 数据集合
|
|
13
14
|
* @param {IData} [opts] 额外参数,event是js原生事件
|
|
14
15
|
*/
|
|
15
|
-
export declare function executeViewLogic(viewLogic: IPSAppViewLogic, context:
|
|
16
|
+
export declare function executeViewLogic(viewLogic: IPSAppViewLogic, context: IBizContext, data: IData[] | null, params: IParams, opts?: IData): Promise<IUIActionResult>;
|
|
16
17
|
/**
|
|
17
18
|
* 执行应用预置界面逻辑opendata
|
|
18
19
|
*
|
|
@@ -20,12 +21,12 @@ export declare function executeViewLogic(viewLogic: IPSAppViewLogic, context: IC
|
|
|
20
21
|
* @date 2022-08-22 14:08:03
|
|
21
22
|
* @export
|
|
22
23
|
* @param {IPSAppUIOpenDataLogic} appUILogic 应用预置界面逻辑opendata模型对象
|
|
23
|
-
* @param {
|
|
24
|
+
* @param {IBizContext} context 上下文参数
|
|
24
25
|
* @param {(IData | null)} data 数据集合
|
|
25
26
|
* @param {IParams} params 视图参数
|
|
26
27
|
* @param {IData} [opts] 额外参数,event是js原生事件
|
|
27
28
|
*/
|
|
28
|
-
export declare function executeOpenDataAppUILogic(appUILogic: IPSAppUIOpenDataLogic, context:
|
|
29
|
+
export declare function executeOpenDataAppUILogic(appUILogic: IPSAppUIOpenDataLogic, context: IBizContext, data: IData[] | null, params: IParams, opts?: IData): Promise<IUIActionResult>;
|
|
29
30
|
/**
|
|
30
31
|
* 执行应用预置界面逻辑newdata
|
|
31
32
|
*
|
|
@@ -33,10 +34,10 @@ export declare function executeOpenDataAppUILogic(appUILogic: IPSAppUIOpenDataLo
|
|
|
33
34
|
* @date 2022-08-22 14:08:03
|
|
34
35
|
* @export
|
|
35
36
|
* @param {IPSAppUINewDataLogic} appUILogic 应用预置界面逻辑newdata模型对象
|
|
36
|
-
* @param {
|
|
37
|
+
* @param {IBizContext} context 上下文参数
|
|
37
38
|
* @param {(IData | null)} data 数据集合
|
|
38
39
|
* @param {IParams} params 视图参数
|
|
39
40
|
* @param {IData} [opts] 额外参数,event是js原生事件
|
|
40
41
|
*/
|
|
41
|
-
export declare function executeNewDataAppUILogic(appUILogic: IPSAppUINewDataLogic, context:
|
|
42
|
+
export declare function executeNewDataAppUILogic(appUILogic: IPSAppUINewDataLogic, context: IBizContext, data: IData[] | null, params: IParams, opts?: IData): Promise<IUIActionResult>;
|
|
42
43
|
//# sourceMappingURL=view-logic.d.ts.map
|