@ibiz-template/runtime 0.0.1-alpha.2 → 0.0.1-alpha.21
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-de65cfae.system.js +1 -0
- package/out/command/app/open-app-view/open-app-view.d.ts +0 -11
- 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 -15
- 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 +3 -0
- package/out/interface/index.d.ts +3 -0
- package/out/interface/index.d.ts.map +1 -1
- package/out/interface/index.js +3 -0
- package/out/interface/provider/i-editor-provider.d.ts +38 -0
- package/out/interface/provider/i-editor-provider.d.ts.map +1 -0
- package/out/interface/provider/i-editor-provider.js +1 -0
- package/out/interface/register/i-editor-register.d.ts +23 -0
- package/out/interface/register/i-editor-register.d.ts.map +1 -0
- package/out/interface/register/i-editor-register.js +1 -0
- package/out/interface/register/i-register.d.ts +38 -0
- package/out/interface/register/i-register.d.ts.map +1 -0
- package/out/interface/register/i-register.js +1 -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/register/register.d.ts +20 -0
- package/out/register/register.d.ts.map +1 -0
- package/out/register/register.js +10 -0
- package/out/types.d.ts +9 -0
- package/out/types.d.ts.map +1 -1
- package/out/utils/app-de-ui-action-util/app-de-ui-action-util.d.ts +11 -10
- 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 +52 -31
- package/out/utils/index.d.ts +1 -0
- package/out/utils/index.d.ts.map +1 -1
- package/out/utils/index.js +1 -0
- package/out/utils/open-redirect-view/open-redirect-view.d.ts +42 -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 +149 -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 +20 -10
- package/package.json +20 -10
- package/src/command/app/open-app-view/open-app-view.ts +12 -26
- package/src/index.ts +1 -0
- package/src/install.ts +3 -0
- package/src/interface/index.ts +3 -0
- package/src/interface/provider/i-editor-provider.ts +44 -0
- package/src/interface/register/i-editor-register.ts +23 -0
- package/src/interface/register/i-register.ts +40 -0
- package/src/interface/util/i-loading-util/i-loading-util.ts +14 -0
- package/src/register/register.ts +20 -0
- package/src/types.ts +10 -0
- package/src/utils/app-de-ui-action-util/app-de-ui-action-util.ts +64 -41
- package/src/utils/index.ts +1 -0
- package/src/utils/open-redirect-view/open-redirect-view.ts +187 -0
- package/src/view-logic/view-logic.ts +31 -14
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { IBizContext } from '@ibiz-template/core';
|
|
2
|
+
import { UnsupportedModelError, } from '@ibiz-template/model';
|
|
1
3
|
import { notNilEmpty } from 'qx-util';
|
|
2
4
|
import { OpenAppViewCommand } from '../../command';
|
|
3
5
|
import { convertNavData } from '../nav-params/nav-params';
|
|
@@ -17,19 +19,18 @@ export class AppDEUIActionUtil {
|
|
|
17
19
|
* @date 2022-08-29 15:08:47
|
|
18
20
|
* @static
|
|
19
21
|
* @param {IPSAppDEUIAction} action
|
|
20
|
-
* @param {
|
|
22
|
+
* @param {IBizContext} context
|
|
21
23
|
* @param {(IData | null)} data
|
|
22
24
|
* @param {IParams} [params]
|
|
23
25
|
* @param {IData} [opts]
|
|
24
26
|
* @return {*} {Promise<IUIActionResult>}
|
|
25
27
|
*/
|
|
26
28
|
static async exec(action, context, data, params, opts) {
|
|
27
|
-
console.log(action);
|
|
28
29
|
// **用户操作确认**
|
|
29
30
|
if (action.enableConfirm && action.confirmMsg) {
|
|
30
31
|
// todo 用户操作确认
|
|
31
32
|
}
|
|
32
|
-
const {
|
|
33
|
+
const { neuron } = opts;
|
|
33
34
|
const result = {
|
|
34
35
|
refresh: action.reloadData,
|
|
35
36
|
closeView: action.closeEditView,
|
|
@@ -61,17 +62,17 @@ export class AppDEUIActionUtil {
|
|
|
61
62
|
}
|
|
62
63
|
// *刷新引用视图
|
|
63
64
|
if (result.refresh) {
|
|
64
|
-
if (!
|
|
65
|
+
if (!neuron.call.refresh) {
|
|
65
66
|
throw new Error(`该视图不存在刷新能力`);
|
|
66
67
|
}
|
|
67
|
-
await
|
|
68
|
+
await neuron.call.refresh();
|
|
68
69
|
}
|
|
69
70
|
// *关闭引用视图
|
|
70
71
|
if (result.closeView) {
|
|
71
|
-
if (!
|
|
72
|
+
if (!neuron.call.closeView) {
|
|
72
73
|
throw new Error(`该视图不存在关闭视图能力`);
|
|
73
74
|
}
|
|
74
|
-
await
|
|
75
|
+
await neuron.call.closeView();
|
|
75
76
|
}
|
|
76
77
|
return result;
|
|
77
78
|
}
|
|
@@ -83,11 +84,11 @@ export class AppDEUIActionUtil {
|
|
|
83
84
|
* @protected
|
|
84
85
|
* @static
|
|
85
86
|
* @param {IPSAppDEUIAction} action 界面行为
|
|
86
|
-
* @param {
|
|
87
|
+
* @param {IBizContext} context 上下文
|
|
87
88
|
* @param {(IData[] | null)} data 数据集合
|
|
88
89
|
* @param {IParams} params 视图参数
|
|
89
90
|
* @returns {*} {Promise<{
|
|
90
|
-
* resultContext:
|
|
91
|
+
* resultContext: IBizContext; 处理后的上下文
|
|
91
92
|
* resultData: IData[]; 处理后的数据集合
|
|
92
93
|
* resultParams: IParams; 处理后的视图参数
|
|
93
94
|
* }>}
|
|
@@ -104,7 +105,7 @@ export class AppDEUIActionUtil {
|
|
|
104
105
|
resultData = [];
|
|
105
106
|
}
|
|
106
107
|
// 处理上下文导航参数
|
|
107
|
-
let
|
|
108
|
+
let tempContext = {};
|
|
108
109
|
const navContexts = action.getPSNavigateContexts() || [];
|
|
109
110
|
// 单项数据主键时,在导航参数开头加一个主键的导航参数,可以被配置的同名导航参数覆盖。
|
|
110
111
|
const appDataEntity = action.getPSAppDataEntity();
|
|
@@ -119,8 +120,9 @@ export class AppDEUIActionUtil {
|
|
|
119
120
|
});
|
|
120
121
|
}
|
|
121
122
|
if (notNilEmpty(navContexts)) {
|
|
122
|
-
|
|
123
|
+
tempContext = convertNavData(navContexts, context, params, (data === null || data === void 0 ? void 0 : data[0]) || {});
|
|
123
124
|
}
|
|
125
|
+
const resultContext = new IBizContext(tempContext, context);
|
|
124
126
|
// 处理导航视图参数
|
|
125
127
|
let resultParams = {};
|
|
126
128
|
const navParams = action.getPSNavigateParams();
|
|
@@ -139,7 +141,7 @@ export class AppDEUIActionUtil {
|
|
|
139
141
|
* @returns {*} {Promise<IUIActionResult>}
|
|
140
142
|
*/
|
|
141
143
|
static async executeSysUIAction(action, data, opts) {
|
|
142
|
-
const {
|
|
144
|
+
const { neuron, event } = opts;
|
|
143
145
|
const { uIActionTag } = action;
|
|
144
146
|
const result = {};
|
|
145
147
|
// todo 暂未支持部分
|
|
@@ -151,54 +153,73 @@ export class AppDEUIActionUtil {
|
|
|
151
153
|
'RefreshAll',
|
|
152
154
|
'Import',
|
|
153
155
|
].indexOf(uIActionTag) !== -1) {
|
|
154
|
-
|
|
155
|
-
return result;
|
|
156
|
+
throw new UnsupportedModelError(action, `${uIActionTag}暂未支持`);
|
|
156
157
|
}
|
|
157
158
|
// 打开新建数据视图
|
|
158
159
|
if (uIActionTag === 'New') {
|
|
159
|
-
if (!
|
|
160
|
+
if (!neuron.call.newData) {
|
|
160
161
|
throw new Error(`该视图不存在newData能力`);
|
|
161
162
|
}
|
|
162
|
-
await
|
|
163
|
+
await neuron.call.newData(event);
|
|
163
164
|
}
|
|
164
|
-
//
|
|
165
|
+
// 打开编辑数据视图
|
|
165
166
|
if (uIActionTag === 'Edit') {
|
|
166
|
-
if (!
|
|
167
|
+
if (!neuron.call.openData) {
|
|
167
168
|
throw new Error(`该视图不存在openData能力`);
|
|
168
169
|
}
|
|
169
|
-
await
|
|
170
|
+
await neuron.call.openData(data === null || data === void 0 ? void 0 : data[0], event);
|
|
170
171
|
}
|
|
171
172
|
// 保存能力
|
|
172
|
-
const saveTags = ['SaveAndExit', 'Save', '
|
|
173
|
+
const saveTags = ['SaveAndExit', 'Save', 'SaveRow'];
|
|
173
174
|
if (saveTags.indexOf(uIActionTag) !== -1) {
|
|
174
|
-
if (!
|
|
175
|
+
if (!neuron.call.save) {
|
|
175
176
|
throw new Error(`该视图不存在save能力`);
|
|
176
177
|
}
|
|
177
|
-
await
|
|
178
|
+
await neuron.call.save();
|
|
178
179
|
}
|
|
179
180
|
// 保存并新建
|
|
180
181
|
if (uIActionTag === 'SaveAndNew') {
|
|
181
|
-
if (!
|
|
182
|
+
if (!neuron.call.saveAndNew) {
|
|
182
183
|
throw new Error(`该视图不存在saveAndNew能力`);
|
|
183
184
|
}
|
|
184
|
-
await
|
|
185
|
+
await neuron.call.saveAndNew();
|
|
185
186
|
}
|
|
186
187
|
// 删除能力
|
|
187
188
|
if (uIActionTag === 'Remove' || uIActionTag === 'RemoveAndExit') {
|
|
188
|
-
if (!
|
|
189
|
+
if (!neuron.call.remove) {
|
|
189
190
|
throw new Error(`该视图不存在remove能力`);
|
|
190
191
|
}
|
|
191
|
-
await
|
|
192
|
+
await neuron.call.remove();
|
|
192
193
|
}
|
|
193
194
|
// 新建行能力
|
|
194
195
|
if (uIActionTag === 'NewRow') {
|
|
195
|
-
if (!
|
|
196
|
+
if (!neuron.call.newRow) {
|
|
196
197
|
throw new Error(`该视图不存在newRow能力`);
|
|
197
198
|
}
|
|
198
|
-
await
|
|
199
|
+
await neuron.call.newRow();
|
|
200
|
+
}
|
|
201
|
+
// 切换搜索表单能力
|
|
202
|
+
if (uIActionTag === 'ToggleFilter') {
|
|
203
|
+
if (!neuron.call.toggleFilter) {
|
|
204
|
+
throw new Error(`该视图不存在ToggleFilter能力`);
|
|
205
|
+
}
|
|
206
|
+
neuron.call.toggleFilter();
|
|
207
|
+
}
|
|
208
|
+
// 工作流相关
|
|
209
|
+
if (uIActionTag === 'SaveAndStart') {
|
|
210
|
+
if (!neuron.call.wfStart) {
|
|
211
|
+
throw new Error(`该视图不存在SaveAndStart能力`);
|
|
212
|
+
}
|
|
213
|
+
await neuron.call.wfStart();
|
|
214
|
+
}
|
|
215
|
+
if (uIActionTag === 'ViewWFStep') {
|
|
216
|
+
if (!neuron.call.wfSubmit) {
|
|
217
|
+
throw new Error(`该视图不存在ViewWFStep能力`);
|
|
218
|
+
}
|
|
219
|
+
await neuron.call.wfSubmit();
|
|
199
220
|
}
|
|
200
221
|
// 需要关闭视图的
|
|
201
|
-
if (['SaveAndExit', 'Exit', '
|
|
222
|
+
if (['SaveAndExit', 'Exit', 'RemoveAndExit'].indexOf(uIActionTag) !== -1) {
|
|
202
223
|
result.closeView = true;
|
|
203
224
|
}
|
|
204
225
|
// 需要刷新界面的
|
|
@@ -214,7 +235,7 @@ export class AppDEUIActionUtil {
|
|
|
214
235
|
* @date 2022-08-29 15:08:51
|
|
215
236
|
* @static
|
|
216
237
|
* @param {IPSAppDEUIAction} action
|
|
217
|
-
* @param {
|
|
238
|
+
* @param {IBizContext} context
|
|
218
239
|
* @param {(IData[] | null)} data
|
|
219
240
|
* @param {IParams} params
|
|
220
241
|
* @param {IData} [opts]
|
|
@@ -236,7 +257,7 @@ export class AppDEUIActionUtil {
|
|
|
236
257
|
* @date 2022-08-28 20:08:35
|
|
237
258
|
* @export
|
|
238
259
|
* @param {IPSAppDEUIAction} action
|
|
239
|
-
* @param {
|
|
260
|
+
* @param {IBizContext} context
|
|
240
261
|
* @param {IData[]} data
|
|
241
262
|
* @param {IParams} params
|
|
242
263
|
* @returns {*} {Promise<IUIActionResult>}
|
package/out/utils/index.d.ts
CHANGED
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,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,cAAc,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAClF,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC"}
|
package/out/utils/index.js
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
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-09-28 16:09:47
|
|
35
|
+
* @export
|
|
36
|
+
* @param {IPSAppDERedirectView} rdView
|
|
37
|
+
* @param {boolean} isWf
|
|
38
|
+
* @param {IData} data
|
|
39
|
+
* @return {*} {Promise<string>}
|
|
40
|
+
*/
|
|
41
|
+
export declare function calcDERdTag(entity: IPSAppDataEntity, rdView: IPSAppDERedirectView, isWf: boolean, data: IData): Promise<string>;
|
|
42
|
+
//# 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;AAE9B,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,CA2ErB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,oBAAoB,EAC5B,IAAI,EAAE,OAAO,EACb,IAAI,EAAE,KAAK,GACV,OAAO,CAAC,MAAM,CAAC,CAgCjB"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { IBizContext } from '@ibiz-template/core';
|
|
2
|
+
import { DefectModelError, UnsupportedModelError, } from '@ibiz-template/model';
|
|
3
|
+
import { OpenAppViewCommand } from '../../command';
|
|
4
|
+
import { convertNavData } from '../nav-params/nav-params';
|
|
5
|
+
/**
|
|
6
|
+
* 打开重定向视图
|
|
7
|
+
*
|
|
8
|
+
* @author chitanda
|
|
9
|
+
* @date 2022-09-28 16:09:13
|
|
10
|
+
* @export
|
|
11
|
+
* @param {IPSAppRedirectView} appView 应用重定向视图
|
|
12
|
+
* @param {IBizContext} [context=new IBizContext()]
|
|
13
|
+
* @param {IParams} [params={}]
|
|
14
|
+
* @param {IData} [data={}]
|
|
15
|
+
* @return {*} {Promise<IModalData>}
|
|
16
|
+
*/
|
|
17
|
+
export async function openRedirectView(appView, context = new IBizContext(), params = {}, data = []) {
|
|
18
|
+
if (appView.instanceof('app.view.IPSAppDERedirectView')) {
|
|
19
|
+
return openDERedirectView(appView, context, params, data);
|
|
20
|
+
}
|
|
21
|
+
throw new UnsupportedModelError(appView, `未支持的重定向视图类型: ${appView.viewType}`);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* 打开实体重定向视图
|
|
25
|
+
*
|
|
26
|
+
* @author chitanda
|
|
27
|
+
* @date 2022-09-28 16:09:15
|
|
28
|
+
* @export
|
|
29
|
+
* @param {IPSAppDERedirectView} appView
|
|
30
|
+
* @param {IBizContext} [context=new IBizContext()]
|
|
31
|
+
* @param {IParams} [params={}]
|
|
32
|
+
* @param {IData[]} [data=[]]
|
|
33
|
+
* @return {*} {Promise<IModalData>}
|
|
34
|
+
*/
|
|
35
|
+
export async function openDERedirectView(appView, context = new IBizContext(), params = {}, data = []) {
|
|
36
|
+
// 计算重定向视图上下文参数转换
|
|
37
|
+
const navContext = appView.getPSAppViewNavContexts() || [];
|
|
38
|
+
const navContextData = convertNavData(navContext, context, params);
|
|
39
|
+
context = new IBizContext(navContextData, context);
|
|
40
|
+
// 计算重定向视图视图参数转换
|
|
41
|
+
const navParams = appView.getPSAppViewNavParams() || [];
|
|
42
|
+
const navParamsData = convertNavData(navParams, context, params);
|
|
43
|
+
Object.assign(params, navParamsData);
|
|
44
|
+
// 重定向视图对应应用实体
|
|
45
|
+
const entity = appView.getPSAppDataEntity();
|
|
46
|
+
await entity.fill(true);
|
|
47
|
+
const key = entity.codeName.toLowerCase();
|
|
48
|
+
let curData = data[0] || {};
|
|
49
|
+
// 将数据主键转换到上下文当中
|
|
50
|
+
context[key] = curData[key] || context[key] || params[key];
|
|
51
|
+
// 实体重定向视图获取数据行为
|
|
52
|
+
const action = appView.getGetDataPSAppDEAction();
|
|
53
|
+
const service = await ibiz.entityService.getService(entity.codeName);
|
|
54
|
+
ibiz.loading.showRedirect();
|
|
55
|
+
// 获取数据,未配置行为时,默认走 Get 行为
|
|
56
|
+
const res = await service.exec(action ? action.codeName : 'Get', context, params);
|
|
57
|
+
ibiz.loading.hideRedirect();
|
|
58
|
+
if (res.ok) {
|
|
59
|
+
curData = res.data;
|
|
60
|
+
const linkUrl = curData.linkurl;
|
|
61
|
+
if (linkUrl) {
|
|
62
|
+
if (linkUrl.startsWith('http://') || linkUrl.startsWith('https://')) {
|
|
63
|
+
window.open(linkUrl, '_blank');
|
|
64
|
+
return { ok: true, data: [] };
|
|
65
|
+
}
|
|
66
|
+
return { ok: false, data: [] };
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// 根据参数中是否给了 srfwf 来判断是否为工作流
|
|
70
|
+
const isWf = !!params.srfwf;
|
|
71
|
+
const rdTag = await calcDERdTag(entity, appView, isWf, curData);
|
|
72
|
+
// 用于查找实际重定向视图的标识,根据不同重定向类型后续做不同处理
|
|
73
|
+
let findRdTag = rdTag;
|
|
74
|
+
if (isWf) {
|
|
75
|
+
findRdTag = `${rdTag.split(':')[0]}:${params.srfwf.toUpperCase()}`;
|
|
76
|
+
}
|
|
77
|
+
// 所有重定向引用视图
|
|
78
|
+
const allRefViews = appView.getRedirectPSAppViewRefs();
|
|
79
|
+
let refView = allRefViews === null || allRefViews === void 0 ? void 0 : allRefViews.find(view => {
|
|
80
|
+
return view.name === findRdTag;
|
|
81
|
+
});
|
|
82
|
+
if (!refView) {
|
|
83
|
+
findRdTag = `${rdTag.split(':')[0]}`;
|
|
84
|
+
refView = allRefViews === null || allRefViews === void 0 ? void 0 : allRefViews.find(view => {
|
|
85
|
+
return view.name === findRdTag;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
if (refView) {
|
|
89
|
+
const view = refView.getRefPSAppView();
|
|
90
|
+
if (view) {
|
|
91
|
+
const result = await ibiz.commands.execute(OpenAppViewCommand.TAG, view, context, params, { data: [curData] });
|
|
92
|
+
if (result) {
|
|
93
|
+
return result;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
throw new DefectModelError(refView, `未配置实际引用视图`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return { ok: true, data: [] };
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* 计算重定向标识
|
|
104
|
+
*
|
|
105
|
+
* @author chitanda
|
|
106
|
+
* @date 2022-09-28 16:09:47
|
|
107
|
+
* @export
|
|
108
|
+
* @param {IPSAppDERedirectView} rdView
|
|
109
|
+
* @param {boolean} isWf
|
|
110
|
+
* @param {IData} data
|
|
111
|
+
* @return {*} {Promise<string>}
|
|
112
|
+
*/
|
|
113
|
+
export async function calcDERdTag(entity, rdView, isWf, data) {
|
|
114
|
+
const multiFormField = entity.getFormTypePSAppDEField();
|
|
115
|
+
const indexTypeField = entity.getIndexTypePSAppDEField();
|
|
116
|
+
// 重定向视图标识
|
|
117
|
+
let rdTag = '';
|
|
118
|
+
// 重定向视图类别属性
|
|
119
|
+
const typeField = rdView.getTypePSAppDEField();
|
|
120
|
+
// 自定义重定向
|
|
121
|
+
if (typeField) {
|
|
122
|
+
const value = data[typeField.codeName.toLowerCase()];
|
|
123
|
+
if (value) {
|
|
124
|
+
return value;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
let typeValue = '';
|
|
128
|
+
if (multiFormField) {
|
|
129
|
+
typeValue = data[multiFormField.codeName.toLowerCase()];
|
|
130
|
+
}
|
|
131
|
+
else if (indexTypeField) {
|
|
132
|
+
typeValue = data[indexTypeField.codeName.toLowerCase()];
|
|
133
|
+
}
|
|
134
|
+
if (typeValue) {
|
|
135
|
+
if (isWf) {
|
|
136
|
+
rdTag = `WFEDITVIEW:${typeValue}`;
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
rdTag = `EDITVIEW:${typeValue}`;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
else if (isWf) {
|
|
143
|
+
rdTag = `WFEDITVIEW:`;
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
rdTag = `EDITVIEW:`;
|
|
147
|
+
}
|
|
148
|
+
return rdTag;
|
|
149
|
+
}
|
|
@@ -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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view-logic.d.ts","sourceRoot":"","sources":["../../src/view-logic/view-logic.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"view-logic.d.ts","sourceRoot":"","sources":["../../src/view-logic/view-logic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAIL,oBAAoB,EACpB,qBAAqB,EACrB,eAAe,EAEhB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/C;;;;;;;;;;;GAWG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,eAAe,EAC1B,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,EACpB,MAAM,EAAE,OAAO,EACf,IAAI,GAAE,KAAU,GACf,OAAO,CAAC,eAAe,CAAC,CA8B1B;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,yBAAyB,CAC7C,UAAU,EAAE,qBAAqB,EACjC,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,EACpB,MAAM,EAAE,OAAO,EACf,IAAI,GAAE,KAAU,GACf,OAAO,CAAC,eAAe,CAAC,CAoD1B;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,wBAAwB,CAC5C,UAAU,EAAE,oBAAoB,EAChC,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,EACpB,MAAM,EAAE,OAAO,EACf,IAAI,GAAE,KAAU,GACf,OAAO,CAAC,eAAe,CAAC,CAmD1B"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IBizContext } from '@ibiz-template/core';
|
|
1
2
|
import { notNilEmpty } from 'qx-util';
|
|
2
3
|
import { AppEntityModel, getPSUIActionByModelObject, } from '@ibiz-template/model';
|
|
3
4
|
import { OpenAppViewCommand } from '../command';
|
|
@@ -9,7 +10,7 @@ import { AppDEUIActionUtil, convertNavData } from '../utils';
|
|
|
9
10
|
* @date 2022-08-22 09:08:40
|
|
10
11
|
* @export
|
|
11
12
|
* @param {IPSAppViewLogic} viewLogic 视图逻辑模型对象
|
|
12
|
-
* @param {
|
|
13
|
+
* @param {IBizContext} context 上下文参数
|
|
13
14
|
* @param {IParams} params 视图参数
|
|
14
15
|
* @param {(IData | null)} data 数据集合
|
|
15
16
|
* @param {IData} [opts] 额外参数,event是js原生事件
|
|
@@ -19,7 +20,7 @@ export async function executeViewLogic(viewLogic, context, data, params, opts =
|
|
|
19
20
|
// 执行打开数据界面逻辑
|
|
20
21
|
return executeOpenDataAppUILogic(viewLogic.getPSAppUILogic(), context, data, params, opts);
|
|
21
22
|
}
|
|
22
|
-
if (viewLogic.name === 'newdata') {
|
|
23
|
+
if (viewLogic.name === 'newdata' && viewLogic.getPSAppUILogic()) {
|
|
23
24
|
// 执行新建数据逻辑
|
|
24
25
|
return executeNewDataAppUILogic(viewLogic.getPSAppUILogic(), context, data, params, opts);
|
|
25
26
|
}
|
|
@@ -37,7 +38,7 @@ export async function executeViewLogic(viewLogic, context, data, params, opts =
|
|
|
37
38
|
* @date 2022-08-22 14:08:03
|
|
38
39
|
* @export
|
|
39
40
|
* @param {IPSAppUIOpenDataLogic} appUILogic 应用预置界面逻辑opendata模型对象
|
|
40
|
-
* @param {
|
|
41
|
+
* @param {IBizContext} context 上下文参数
|
|
41
42
|
* @param {(IData | null)} data 数据集合
|
|
42
43
|
* @param {IParams} params 视图参数
|
|
43
44
|
* @param {IData} [opts] 额外参数,event是js原生事件
|
|
@@ -57,7 +58,6 @@ export async function executeOpenDataAppUILogic(appUILogic, context, data, param
|
|
|
57
58
|
const appDataEntity = new AppEntityModel(openView.getPSAppDataEntity());
|
|
58
59
|
await appDataEntity.init();
|
|
59
60
|
// 处理导航参数
|
|
60
|
-
let tempContext = {};
|
|
61
61
|
// 处理上下文导航参数
|
|
62
62
|
const navContexts = openViewRef.getPSNavigateContexts() || [];
|
|
63
63
|
// 默认添加主键的上下文导航参数
|
|
@@ -69,7 +69,7 @@ export async function executeOpenDataAppUILogic(appUILogic, context, data, param
|
|
|
69
69
|
rawValue: false,
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
|
-
tempContext = convertNavData(navContexts, context, params, data[0]);
|
|
72
|
+
const tempContext = new IBizContext(convertNavData(navContexts, context, params, data[0]), context);
|
|
73
73
|
// 处理导航视图参数
|
|
74
74
|
let tempParams = {};
|
|
75
75
|
const navParams = openViewRef.getPSNavigateParams();
|
|
@@ -77,7 +77,11 @@ export async function executeOpenDataAppUILogic(appUILogic, context, data, param
|
|
|
77
77
|
tempParams = convertNavData(navParams, params, context, data[0]);
|
|
78
78
|
}
|
|
79
79
|
// 打开视图
|
|
80
|
-
|
|
80
|
+
await ibiz.commands.execute(OpenAppViewCommand.TAG, openView, tempContext, tempParams, opts);
|
|
81
|
+
// 刷新上一个视图
|
|
82
|
+
const { neuron } = opts;
|
|
83
|
+
neuron.call.refresh();
|
|
84
|
+
return {};
|
|
81
85
|
}
|
|
82
86
|
/**
|
|
83
87
|
* 执行应用预置界面逻辑newdata
|
|
@@ -86,7 +90,7 @@ export async function executeOpenDataAppUILogic(appUILogic, context, data, param
|
|
|
86
90
|
* @date 2022-08-22 14:08:03
|
|
87
91
|
* @export
|
|
88
92
|
* @param {IPSAppUINewDataLogic} appUILogic 应用预置界面逻辑newdata模型对象
|
|
89
|
-
* @param {
|
|
93
|
+
* @param {IBizContext} context 上下文参数
|
|
90
94
|
* @param {(IData | null)} data 数据集合
|
|
91
95
|
* @param {IParams} params 视图参数
|
|
92
96
|
* @param {IData} [opts] 额外参数,event是js原生事件
|
|
@@ -110,12 +114,14 @@ export async function executeNewDataAppUILogic(appUILogic, context, data, params
|
|
|
110
114
|
if (notNilEmpty(navContexts)) {
|
|
111
115
|
tempContext = convertNavData(navContexts, context, params, _data);
|
|
112
116
|
}
|
|
117
|
+
tempContext = new IBizContext(tempContext, context);
|
|
118
|
+
// 删除上下文内的主键
|
|
119
|
+
delete tempContext[appDataEntity.deName.toLowerCase()];
|
|
120
|
+
tempContext[appDataEntity.deName.toLowerCase()] = undefined;
|
|
113
121
|
const navParams = newViewRef.getPSNavigateParams();
|
|
114
122
|
if (notNilEmpty(navParams)) {
|
|
115
123
|
tempParams = convertNavData(navParams, params, context, _data);
|
|
116
124
|
}
|
|
117
|
-
// 删除上下文内的主键
|
|
118
|
-
delete tempContext[appDataEntity.deName.toLowerCase()];
|
|
119
125
|
// todo 拷贝
|
|
120
126
|
if (appUILogic.enableWizardAdd) {
|
|
121
127
|
// todo 向导添加
|
|
@@ -127,5 +133,9 @@ export async function executeNewDataAppUILogic(appUILogic, context, data, params
|
|
|
127
133
|
// todo 只支持批添加
|
|
128
134
|
}
|
|
129
135
|
// 打开视图
|
|
130
|
-
|
|
136
|
+
await ibiz.commands.execute(OpenAppViewCommand.TAG, newView, tempContext, tempParams, opts);
|
|
137
|
+
// 刷新上一个视图
|
|
138
|
+
const { neuron } = opts;
|
|
139
|
+
neuron.call.refresh();
|
|
140
|
+
return {};
|
|
131
141
|
}
|
package/package.json
CHANGED
|
@@ -1,35 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibiz-template/runtime",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.21",
|
|
4
4
|
"description": "控制器包",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"main": "out/index.js",
|
|
6
7
|
"types": "out/index.d.ts",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://gitee.com/iBizModeling/ibiz-template.git"
|
|
11
|
+
},
|
|
7
12
|
"files": [
|
|
13
|
+
"dist",
|
|
8
14
|
"out",
|
|
9
15
|
"src"
|
|
10
16
|
],
|
|
11
17
|
"scripts": {
|
|
12
18
|
"dev": "tsc --watch",
|
|
13
|
-
"build": "npm run lint && npm run clean && tsc --build",
|
|
19
|
+
"build": "npm run lint && npm run clean && npm run build:rollup && tsc --build",
|
|
20
|
+
"build:rollup": "rollup -c",
|
|
14
21
|
"lint": "eslint 'src/**/*.ts'",
|
|
15
22
|
"lint:fix": "eslint --fix 'src/**/*.ts'",
|
|
16
|
-
"clean": "rimraf out",
|
|
23
|
+
"clean": "rimraf out dist",
|
|
17
24
|
"publish:next": "npm run build && npm publish --access public --tag next",
|
|
18
25
|
"publish:npm": "npm run build && npm publish --access public"
|
|
19
26
|
},
|
|
20
27
|
"author": "chitanda",
|
|
21
28
|
"license": "MIT",
|
|
22
29
|
"dependencies": {
|
|
23
|
-
"@ibiz-template/command": "^0.0.1-alpha.
|
|
24
|
-
"@ibiz-template/core": "^0.0.1-alpha.2",
|
|
25
|
-
"@ibiz-template/model": "^0.0.1-alpha.2",
|
|
26
|
-
"@ibiz-template/service": "^0.0.1-alpha.2"
|
|
30
|
+
"@ibiz-template/command": "^0.0.1-alpha.21"
|
|
27
31
|
},
|
|
28
32
|
"devDependencies": {
|
|
29
|
-
"
|
|
33
|
+
"@ibiz-template/core": "^0.0.1-alpha.21",
|
|
34
|
+
"@ibiz-template/model": "^0.0.1-alpha.21",
|
|
35
|
+
"@ibiz-template/service": "^0.0.1-alpha.21",
|
|
36
|
+
"qx-util": "^0.4.1"
|
|
30
37
|
},
|
|
31
38
|
"peerDependencies": {
|
|
32
|
-
"
|
|
39
|
+
"@ibiz-template/core": "^0.0.1-alpha.2",
|
|
40
|
+
"@ibiz-template/model": "^0.0.1-alpha.2",
|
|
41
|
+
"@ibiz-template/service": "^0.0.1-alpha.2",
|
|
42
|
+
"qx-util": "^0.4.1"
|
|
33
43
|
},
|
|
34
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "f4c1b8725d21f05789f7763d0065dad9e753f523"
|
|
35
45
|
}
|