@ibiz-template/runtime 0.0.1-alpha.2 → 0.0.1-alpha.20
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/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 +15 -8
- 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,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IBizContext } from '@ibiz-template/core';
|
|
2
|
+
import {
|
|
3
|
+
IPSAppDEUIAction,
|
|
4
|
+
IPSNavigateContext,
|
|
5
|
+
UnsupportedModelError,
|
|
6
|
+
} from '@ibiz-template/model';
|
|
2
7
|
import { notNilEmpty } from 'qx-util';
|
|
3
8
|
import { OpenAppViewCommand } from '../../command';
|
|
4
9
|
import { IUIActionResult } from '../../interface';
|
|
@@ -20,7 +25,7 @@ export class AppDEUIActionUtil {
|
|
|
20
25
|
* @date 2022-08-29 15:08:47
|
|
21
26
|
* @static
|
|
22
27
|
* @param {IPSAppDEUIAction} action
|
|
23
|
-
* @param {
|
|
28
|
+
* @param {IBizContext} context
|
|
24
29
|
* @param {(IData | null)} data
|
|
25
30
|
* @param {IParams} [params]
|
|
26
31
|
* @param {IData} [opts]
|
|
@@ -28,18 +33,17 @@ export class AppDEUIActionUtil {
|
|
|
28
33
|
*/
|
|
29
34
|
static async exec(
|
|
30
35
|
action: IPSAppDEUIAction,
|
|
31
|
-
context:
|
|
36
|
+
context: IBizContext,
|
|
32
37
|
data: IData[] | null,
|
|
33
38
|
params: IParams,
|
|
34
39
|
opts?: IData,
|
|
35
40
|
): Promise<IUIActionResult> {
|
|
36
|
-
console.log(action);
|
|
37
41
|
// **用户操作确认**
|
|
38
42
|
if (action.enableConfirm && action.confirmMsg) {
|
|
39
43
|
// todo 用户操作确认
|
|
40
44
|
}
|
|
41
45
|
|
|
42
|
-
const {
|
|
46
|
+
const { neuron } = opts!;
|
|
43
47
|
const result: IUIActionResult = {
|
|
44
48
|
refresh: action.reloadData,
|
|
45
49
|
closeView: action.closeEditView,
|
|
@@ -85,18 +89,18 @@ export class AppDEUIActionUtil {
|
|
|
85
89
|
|
|
86
90
|
// *刷新引用视图
|
|
87
91
|
if (result.refresh) {
|
|
88
|
-
if (!
|
|
92
|
+
if (!neuron.call.refresh) {
|
|
89
93
|
throw new Error(`该视图不存在刷新能力`);
|
|
90
94
|
}
|
|
91
|
-
await
|
|
95
|
+
await neuron.call.refresh();
|
|
92
96
|
}
|
|
93
97
|
|
|
94
98
|
// *关闭引用视图
|
|
95
99
|
if (result.closeView) {
|
|
96
|
-
if (!
|
|
100
|
+
if (!neuron.call.closeView) {
|
|
97
101
|
throw new Error(`该视图不存在关闭视图能力`);
|
|
98
102
|
}
|
|
99
|
-
await
|
|
103
|
+
await neuron.call.closeView();
|
|
100
104
|
}
|
|
101
105
|
|
|
102
106
|
return result;
|
|
@@ -110,22 +114,22 @@ export class AppDEUIActionUtil {
|
|
|
110
114
|
* @protected
|
|
111
115
|
* @static
|
|
112
116
|
* @param {IPSAppDEUIAction} action 界面行为
|
|
113
|
-
* @param {
|
|
117
|
+
* @param {IBizContext} context 上下文
|
|
114
118
|
* @param {(IData[] | null)} data 数据集合
|
|
115
119
|
* @param {IParams} params 视图参数
|
|
116
120
|
* @returns {*} {Promise<{
|
|
117
|
-
* resultContext:
|
|
121
|
+
* resultContext: IBizContext; 处理后的上下文
|
|
118
122
|
* resultData: IData[]; 处理后的数据集合
|
|
119
123
|
* resultParams: IParams; 处理后的视图参数
|
|
120
124
|
* }>}
|
|
121
125
|
*/
|
|
122
126
|
protected static async handleParams(
|
|
123
127
|
action: IPSAppDEUIAction,
|
|
124
|
-
context:
|
|
128
|
+
context: IBizContext,
|
|
125
129
|
data: IData[] | null,
|
|
126
130
|
params: IParams,
|
|
127
131
|
): Promise<{
|
|
128
|
-
resultContext:
|
|
132
|
+
resultContext: IBizContext;
|
|
129
133
|
resultData: IData[];
|
|
130
134
|
resultParams: IParams;
|
|
131
135
|
}> {
|
|
@@ -146,7 +150,7 @@ export class AppDEUIActionUtil {
|
|
|
146
150
|
}
|
|
147
151
|
|
|
148
152
|
// 处理上下文导航参数
|
|
149
|
-
let
|
|
153
|
+
let tempContext = {};
|
|
150
154
|
const navContexts = action.getPSNavigateContexts() || [];
|
|
151
155
|
|
|
152
156
|
// 单项数据主键时,在导航参数开头加一个主键的导航参数,可以被配置的同名导航参数覆盖。
|
|
@@ -163,13 +167,15 @@ export class AppDEUIActionUtil {
|
|
|
163
167
|
}
|
|
164
168
|
|
|
165
169
|
if (notNilEmpty(navContexts)) {
|
|
166
|
-
|
|
170
|
+
tempContext = convertNavData(
|
|
167
171
|
navContexts!,
|
|
168
172
|
context,
|
|
169
173
|
params,
|
|
170
174
|
data?.[0] || {},
|
|
171
175
|
);
|
|
172
176
|
}
|
|
177
|
+
const resultContext = new IBizContext(tempContext, context);
|
|
178
|
+
|
|
173
179
|
// 处理导航视图参数
|
|
174
180
|
let resultParams: IData = {};
|
|
175
181
|
const navParams = action.getPSNavigateParams();
|
|
@@ -198,7 +204,7 @@ export class AppDEUIActionUtil {
|
|
|
198
204
|
data: IData[] | null,
|
|
199
205
|
opts?: IData,
|
|
200
206
|
): Promise<IUIActionResult> {
|
|
201
|
-
const {
|
|
207
|
+
const { neuron, event } = opts!;
|
|
202
208
|
const { uIActionTag } = action;
|
|
203
209
|
const result: IUIActionResult = {};
|
|
204
210
|
|
|
@@ -213,64 +219,81 @@ export class AppDEUIActionUtil {
|
|
|
213
219
|
'Import',
|
|
214
220
|
].indexOf(uIActionTag) !== -1
|
|
215
221
|
) {
|
|
216
|
-
|
|
217
|
-
return result;
|
|
222
|
+
throw new UnsupportedModelError(action, `${uIActionTag}暂未支持`);
|
|
218
223
|
}
|
|
219
224
|
|
|
220
225
|
// 打开新建数据视图
|
|
221
226
|
if (uIActionTag === 'New') {
|
|
222
|
-
if (!
|
|
227
|
+
if (!neuron.call.newData) {
|
|
223
228
|
throw new Error(`该视图不存在newData能力`);
|
|
224
229
|
}
|
|
225
|
-
await
|
|
230
|
+
await neuron.call.newData(event);
|
|
226
231
|
}
|
|
227
|
-
//
|
|
232
|
+
// 打开编辑数据视图
|
|
228
233
|
if (uIActionTag === 'Edit') {
|
|
229
|
-
if (!
|
|
234
|
+
if (!neuron.call.openData) {
|
|
230
235
|
throw new Error(`该视图不存在openData能力`);
|
|
231
236
|
}
|
|
232
|
-
await
|
|
237
|
+
await neuron.call.openData(data?.[0], event);
|
|
233
238
|
}
|
|
234
239
|
|
|
235
240
|
// 保存能力
|
|
236
|
-
const saveTags = ['SaveAndExit', 'Save', '
|
|
241
|
+
const saveTags = ['SaveAndExit', 'Save', 'SaveRow'];
|
|
237
242
|
if (saveTags.indexOf(uIActionTag) !== -1) {
|
|
238
|
-
if (!
|
|
243
|
+
if (!neuron.call.save) {
|
|
239
244
|
throw new Error(`该视图不存在save能力`);
|
|
240
245
|
}
|
|
241
|
-
await
|
|
246
|
+
await neuron.call.save();
|
|
242
247
|
}
|
|
243
248
|
|
|
244
249
|
// 保存并新建
|
|
245
250
|
if (uIActionTag === 'SaveAndNew') {
|
|
246
|
-
if (!
|
|
251
|
+
if (!neuron.call.saveAndNew) {
|
|
247
252
|
throw new Error(`该视图不存在saveAndNew能力`);
|
|
248
253
|
}
|
|
249
|
-
await
|
|
254
|
+
await neuron.call.saveAndNew();
|
|
250
255
|
}
|
|
251
256
|
|
|
252
257
|
// 删除能力
|
|
253
258
|
if (uIActionTag === 'Remove' || uIActionTag === 'RemoveAndExit') {
|
|
254
|
-
if (!
|
|
259
|
+
if (!neuron.call.remove) {
|
|
255
260
|
throw new Error(`该视图不存在remove能力`);
|
|
256
261
|
}
|
|
257
|
-
await
|
|
262
|
+
await neuron.call.remove();
|
|
258
263
|
}
|
|
259
264
|
|
|
260
265
|
// 新建行能力
|
|
261
266
|
if (uIActionTag === 'NewRow') {
|
|
262
|
-
if (!
|
|
267
|
+
if (!neuron.call.newRow) {
|
|
263
268
|
throw new Error(`该视图不存在newRow能力`);
|
|
264
269
|
}
|
|
265
|
-
await
|
|
270
|
+
await neuron.call.newRow();
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// 切换搜索表单能力
|
|
274
|
+
if (uIActionTag === 'ToggleFilter') {
|
|
275
|
+
if (!neuron.call.toggleFilter) {
|
|
276
|
+
throw new Error(`该视图不存在ToggleFilter能力`);
|
|
277
|
+
}
|
|
278
|
+
neuron.call.toggleFilter();
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// 工作流相关
|
|
282
|
+
if (uIActionTag === 'SaveAndStart') {
|
|
283
|
+
if (!neuron.call.wfStart) {
|
|
284
|
+
throw new Error(`该视图不存在SaveAndStart能力`);
|
|
285
|
+
}
|
|
286
|
+
await neuron.call.wfStart();
|
|
287
|
+
}
|
|
288
|
+
if (uIActionTag === 'ViewWFStep') {
|
|
289
|
+
if (!neuron.call.wfSubmit) {
|
|
290
|
+
throw new Error(`该视图不存在ViewWFStep能力`);
|
|
291
|
+
}
|
|
292
|
+
await neuron.call.wfSubmit();
|
|
266
293
|
}
|
|
267
294
|
|
|
268
295
|
// 需要关闭视图的
|
|
269
|
-
if (
|
|
270
|
-
['SaveAndExit', 'Exit', 'SaveAndStart', 'RemoveAndExit'].indexOf(
|
|
271
|
-
uIActionTag,
|
|
272
|
-
) !== -1
|
|
273
|
-
) {
|
|
296
|
+
if (['SaveAndExit', 'Exit', 'RemoveAndExit'].indexOf(uIActionTag) !== -1) {
|
|
274
297
|
result.closeView = true;
|
|
275
298
|
}
|
|
276
299
|
|
|
@@ -288,7 +311,7 @@ export class AppDEUIActionUtil {
|
|
|
288
311
|
* @date 2022-08-29 15:08:51
|
|
289
312
|
* @static
|
|
290
313
|
* @param {IPSAppDEUIAction} action
|
|
291
|
-
* @param {
|
|
314
|
+
* @param {IBizContext} context
|
|
292
315
|
* @param {(IData[] | null)} data
|
|
293
316
|
* @param {IParams} params
|
|
294
317
|
* @param {IData} [opts]
|
|
@@ -296,7 +319,7 @@ export class AppDEUIActionUtil {
|
|
|
296
319
|
*/
|
|
297
320
|
static async executeFrontUIAction(
|
|
298
321
|
action: IPSAppDEUIAction,
|
|
299
|
-
context:
|
|
322
|
+
context: IBizContext,
|
|
300
323
|
_data: IData[] | null,
|
|
301
324
|
params: IParams,
|
|
302
325
|
opts?: IData,
|
|
@@ -324,14 +347,14 @@ export class AppDEUIActionUtil {
|
|
|
324
347
|
* @date 2022-08-28 20:08:35
|
|
325
348
|
* @export
|
|
326
349
|
* @param {IPSAppDEUIAction} action
|
|
327
|
-
* @param {
|
|
350
|
+
* @param {IBizContext} context
|
|
328
351
|
* @param {IData[]} data
|
|
329
352
|
* @param {IParams} params
|
|
330
353
|
* @returns {*} {Promise<IUIActionResult>}
|
|
331
354
|
*/
|
|
332
355
|
static async executeBackEndUIAction(
|
|
333
356
|
action: IPSAppDEUIAction,
|
|
334
|
-
context:
|
|
357
|
+
context: IBizContext,
|
|
335
358
|
_data: IData[],
|
|
336
359
|
params: IParams,
|
|
337
360
|
): Promise<IUIActionResult> {
|
package/src/utils/index.ts
CHANGED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { IBizContext } from '@ibiz-template/core';
|
|
2
|
+
import {
|
|
3
|
+
DefectModelError,
|
|
4
|
+
IPSAppDataEntity,
|
|
5
|
+
IPSAppDERedirectView,
|
|
6
|
+
IPSAppRedirectView,
|
|
7
|
+
UnsupportedModelError,
|
|
8
|
+
} from '@ibiz-template/model';
|
|
9
|
+
import { OpenAppViewCommand } from '../../command';
|
|
10
|
+
import { IModalData } from '../../interface';
|
|
11
|
+
import { convertNavData } from '../nav-params/nav-params';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* 打开重定向视图
|
|
15
|
+
*
|
|
16
|
+
* @author chitanda
|
|
17
|
+
* @date 2022-09-28 16:09:13
|
|
18
|
+
* @export
|
|
19
|
+
* @param {IPSAppRedirectView} appView 应用重定向视图
|
|
20
|
+
* @param {IBizContext} [context=new IBizContext()]
|
|
21
|
+
* @param {IParams} [params={}]
|
|
22
|
+
* @param {IData} [data={}]
|
|
23
|
+
* @return {*} {Promise<IModalData>}
|
|
24
|
+
*/
|
|
25
|
+
export async function openRedirectView(
|
|
26
|
+
appView: IPSAppRedirectView,
|
|
27
|
+
context: IBizContext = new IBizContext(),
|
|
28
|
+
params: IParams = {},
|
|
29
|
+
data: IData[] = [],
|
|
30
|
+
): Promise<IModalData> {
|
|
31
|
+
if (appView.instanceof('app.view.IPSAppDERedirectView')) {
|
|
32
|
+
return openDERedirectView(
|
|
33
|
+
appView as IPSAppDERedirectView,
|
|
34
|
+
context,
|
|
35
|
+
params,
|
|
36
|
+
data,
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
throw new UnsupportedModelError(
|
|
40
|
+
appView,
|
|
41
|
+
`未支持的重定向视图类型: ${appView.viewType}`,
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* 打开实体重定向视图
|
|
47
|
+
*
|
|
48
|
+
* @author chitanda
|
|
49
|
+
* @date 2022-09-28 16:09:15
|
|
50
|
+
* @export
|
|
51
|
+
* @param {IPSAppDERedirectView} appView
|
|
52
|
+
* @param {IBizContext} [context=new IBizContext()]
|
|
53
|
+
* @param {IParams} [params={}]
|
|
54
|
+
* @param {IData[]} [data=[]]
|
|
55
|
+
* @return {*} {Promise<IModalData>}
|
|
56
|
+
*/
|
|
57
|
+
export async function openDERedirectView(
|
|
58
|
+
appView: IPSAppDERedirectView,
|
|
59
|
+
context: IBizContext = new IBizContext(),
|
|
60
|
+
params: IParams = {},
|
|
61
|
+
data: IData[] = [],
|
|
62
|
+
): Promise<IModalData> {
|
|
63
|
+
// 计算重定向视图上下文参数转换
|
|
64
|
+
const navContext = appView.getPSAppViewNavContexts() || [];
|
|
65
|
+
const navContextData = convertNavData(navContext, context, params);
|
|
66
|
+
context = new IBizContext(navContextData, context);
|
|
67
|
+
// 计算重定向视图视图参数转换
|
|
68
|
+
const navParams = appView.getPSAppViewNavParams() || [];
|
|
69
|
+
const navParamsData = convertNavData(navParams, context, params);
|
|
70
|
+
Object.assign(params, navParamsData);
|
|
71
|
+
// 重定向视图对应应用实体
|
|
72
|
+
const entity = appView.getPSAppDataEntity()!;
|
|
73
|
+
await entity.fill(true);
|
|
74
|
+
const key = entity.codeName.toLowerCase();
|
|
75
|
+
let curData: IData = data[0] || {};
|
|
76
|
+
// 将数据主键转换到上下文当中
|
|
77
|
+
context[key] = curData[key] || context[key] || params[key];
|
|
78
|
+
// 实体重定向视图获取数据行为
|
|
79
|
+
const action = appView.getGetDataPSAppDEAction();
|
|
80
|
+
const service = await ibiz.entityService.getService(entity.codeName);
|
|
81
|
+
ibiz.loading.showRedirect();
|
|
82
|
+
// 获取数据,未配置行为时,默认走 Get 行为
|
|
83
|
+
const res = await service.exec(
|
|
84
|
+
action ? action.codeName : 'Get',
|
|
85
|
+
context,
|
|
86
|
+
params,
|
|
87
|
+
);
|
|
88
|
+
ibiz.loading.hideRedirect();
|
|
89
|
+
if (res.ok) {
|
|
90
|
+
curData = res.data;
|
|
91
|
+
const linkUrl: string = curData.linkurl;
|
|
92
|
+
if (linkUrl) {
|
|
93
|
+
if (linkUrl.startsWith('http://') || linkUrl.startsWith('https://')) {
|
|
94
|
+
window.open(linkUrl, '_blank');
|
|
95
|
+
return { ok: true, data: [] };
|
|
96
|
+
}
|
|
97
|
+
return { ok: false, data: [] };
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
// 根据参数中是否给了 srfwf 来判断是否为工作流
|
|
101
|
+
const isWf = !!params.srfwf;
|
|
102
|
+
const rdTag = await calcDERdTag(entity, appView, isWf, curData);
|
|
103
|
+
// 用于查找实际重定向视图的标识,根据不同重定向类型后续做不同处理
|
|
104
|
+
let findRdTag = rdTag;
|
|
105
|
+
if (isWf) {
|
|
106
|
+
findRdTag = `${rdTag.split(':')[0]}:${params.srfwf.toUpperCase()}`;
|
|
107
|
+
}
|
|
108
|
+
// 所有重定向引用视图
|
|
109
|
+
const allRefViews = appView.getRedirectPSAppViewRefs();
|
|
110
|
+
let refView = allRefViews?.find(view => {
|
|
111
|
+
return view.name === findRdTag;
|
|
112
|
+
});
|
|
113
|
+
if (!refView) {
|
|
114
|
+
findRdTag = `${rdTag.split(':')[0]}`;
|
|
115
|
+
refView = allRefViews?.find(view => {
|
|
116
|
+
return view.name === findRdTag;
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
if (refView) {
|
|
120
|
+
const view = refView.getRefPSAppView();
|
|
121
|
+
if (view) {
|
|
122
|
+
const result = await ibiz.commands.execute(
|
|
123
|
+
OpenAppViewCommand.TAG,
|
|
124
|
+
view,
|
|
125
|
+
context,
|
|
126
|
+
params,
|
|
127
|
+
{ data: [curData] },
|
|
128
|
+
);
|
|
129
|
+
if (result) {
|
|
130
|
+
return result;
|
|
131
|
+
}
|
|
132
|
+
} else {
|
|
133
|
+
throw new DefectModelError(refView, `未配置实际引用视图`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return { ok: true, data: [] };
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* 计算重定向标识
|
|
141
|
+
*
|
|
142
|
+
* @author chitanda
|
|
143
|
+
* @date 2022-09-28 16:09:47
|
|
144
|
+
* @export
|
|
145
|
+
* @param {IPSAppDERedirectView} rdView
|
|
146
|
+
* @param {boolean} isWf
|
|
147
|
+
* @param {IData} data
|
|
148
|
+
* @return {*} {Promise<string>}
|
|
149
|
+
*/
|
|
150
|
+
export async function calcDERdTag(
|
|
151
|
+
entity: IPSAppDataEntity,
|
|
152
|
+
rdView: IPSAppDERedirectView,
|
|
153
|
+
isWf: boolean,
|
|
154
|
+
data: IData,
|
|
155
|
+
): Promise<string> {
|
|
156
|
+
const multiFormField = entity.getFormTypePSAppDEField();
|
|
157
|
+
const indexTypeField = entity.getIndexTypePSAppDEField();
|
|
158
|
+
// 重定向视图标识
|
|
159
|
+
let rdTag = '';
|
|
160
|
+
// 重定向视图类别属性
|
|
161
|
+
const typeField = rdView.getTypePSAppDEField();
|
|
162
|
+
// 自定义重定向
|
|
163
|
+
if (typeField) {
|
|
164
|
+
const value = data[typeField.codeName.toLowerCase()];
|
|
165
|
+
if (value) {
|
|
166
|
+
return value;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
let typeValue = '';
|
|
170
|
+
if (multiFormField) {
|
|
171
|
+
typeValue = data[multiFormField.codeName.toLowerCase()];
|
|
172
|
+
} else if (indexTypeField) {
|
|
173
|
+
typeValue = data[indexTypeField.codeName.toLowerCase()];
|
|
174
|
+
}
|
|
175
|
+
if (typeValue) {
|
|
176
|
+
if (isWf) {
|
|
177
|
+
rdTag = `WFEDITVIEW:${typeValue}`;
|
|
178
|
+
} else {
|
|
179
|
+
rdTag = `EDITVIEW:${typeValue}`;
|
|
180
|
+
}
|
|
181
|
+
} else if (isWf) {
|
|
182
|
+
rdTag = `WFEDITVIEW:`;
|
|
183
|
+
} else {
|
|
184
|
+
rdTag = `EDITVIEW:`;
|
|
185
|
+
}
|
|
186
|
+
return rdTag;
|
|
187
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IBizContext } from '@ibiz-template/core';
|
|
1
2
|
import { notNilEmpty } from 'qx-util';
|
|
2
3
|
import {
|
|
3
4
|
AppEntityModel,
|
|
@@ -19,14 +20,14 @@ import { AppDEUIActionUtil, convertNavData } from '../utils';
|
|
|
19
20
|
* @date 2022-08-22 09:08:40
|
|
20
21
|
* @export
|
|
21
22
|
* @param {IPSAppViewLogic} viewLogic 视图逻辑模型对象
|
|
22
|
-
* @param {
|
|
23
|
+
* @param {IBizContext} context 上下文参数
|
|
23
24
|
* @param {IParams} params 视图参数
|
|
24
25
|
* @param {(IData | null)} data 数据集合
|
|
25
26
|
* @param {IData} [opts] 额外参数,event是js原生事件
|
|
26
27
|
*/
|
|
27
28
|
export async function executeViewLogic(
|
|
28
29
|
viewLogic: IPSAppViewLogic,
|
|
29
|
-
context:
|
|
30
|
+
context: IBizContext,
|
|
30
31
|
data: IData[] | null,
|
|
31
32
|
params: IParams,
|
|
32
33
|
opts: IData = {},
|
|
@@ -41,7 +42,7 @@ export async function executeViewLogic(
|
|
|
41
42
|
opts,
|
|
42
43
|
);
|
|
43
44
|
}
|
|
44
|
-
if (viewLogic.name === 'newdata') {
|
|
45
|
+
if (viewLogic.name === 'newdata' && viewLogic.getPSAppUILogic()) {
|
|
45
46
|
// 执行新建数据逻辑
|
|
46
47
|
return executeNewDataAppUILogic(
|
|
47
48
|
viewLogic.getPSAppUILogic() as IPSAppUINewDataLogic,
|
|
@@ -69,14 +70,14 @@ export async function executeViewLogic(
|
|
|
69
70
|
* @date 2022-08-22 14:08:03
|
|
70
71
|
* @export
|
|
71
72
|
* @param {IPSAppUIOpenDataLogic} appUILogic 应用预置界面逻辑opendata模型对象
|
|
72
|
-
* @param {
|
|
73
|
+
* @param {IBizContext} context 上下文参数
|
|
73
74
|
* @param {(IData | null)} data 数据集合
|
|
74
75
|
* @param {IParams} params 视图参数
|
|
75
76
|
* @param {IData} [opts] 额外参数,event是js原生事件
|
|
76
77
|
*/
|
|
77
78
|
export async function executeOpenDataAppUILogic(
|
|
78
79
|
appUILogic: IPSAppUIOpenDataLogic,
|
|
79
|
-
context:
|
|
80
|
+
context: IBizContext,
|
|
80
81
|
data: IData[] | null,
|
|
81
82
|
params: IParams,
|
|
82
83
|
opts: IData = {},
|
|
@@ -94,7 +95,6 @@ export async function executeOpenDataAppUILogic(
|
|
|
94
95
|
await appDataEntity.init();
|
|
95
96
|
|
|
96
97
|
// 处理导航参数
|
|
97
|
-
let tempContext: IData = {};
|
|
98
98
|
// 处理上下文导航参数
|
|
99
99
|
const navContexts: IPSNavigateParam[] =
|
|
100
100
|
openViewRef.getPSNavigateContexts() || [];
|
|
@@ -107,7 +107,10 @@ export async function executeOpenDataAppUILogic(
|
|
|
107
107
|
rawValue: false,
|
|
108
108
|
} as IPSNavigateParam);
|
|
109
109
|
}
|
|
110
|
-
tempContext =
|
|
110
|
+
const tempContext = new IBizContext(
|
|
111
|
+
convertNavData(navContexts!, context, params, data[0]),
|
|
112
|
+
context,
|
|
113
|
+
);
|
|
111
114
|
|
|
112
115
|
// 处理导航视图参数
|
|
113
116
|
let tempParams: IData = {};
|
|
@@ -117,13 +120,19 @@ export async function executeOpenDataAppUILogic(
|
|
|
117
120
|
}
|
|
118
121
|
|
|
119
122
|
// 打开视图
|
|
120
|
-
|
|
123
|
+
await ibiz.commands.execute(
|
|
121
124
|
OpenAppViewCommand.TAG,
|
|
122
125
|
openView,
|
|
123
126
|
tempContext,
|
|
124
127
|
tempParams,
|
|
125
128
|
opts,
|
|
126
129
|
);
|
|
130
|
+
|
|
131
|
+
// 刷新上一个视图
|
|
132
|
+
const { neuron } = opts!;
|
|
133
|
+
neuron.call.refresh();
|
|
134
|
+
|
|
135
|
+
return {};
|
|
127
136
|
}
|
|
128
137
|
|
|
129
138
|
/**
|
|
@@ -133,14 +142,14 @@ export async function executeOpenDataAppUILogic(
|
|
|
133
142
|
* @date 2022-08-22 14:08:03
|
|
134
143
|
* @export
|
|
135
144
|
* @param {IPSAppUINewDataLogic} appUILogic 应用预置界面逻辑newdata模型对象
|
|
136
|
-
* @param {
|
|
145
|
+
* @param {IBizContext} context 上下文参数
|
|
137
146
|
* @param {(IData | null)} data 数据集合
|
|
138
147
|
* @param {IParams} params 视图参数
|
|
139
148
|
* @param {IData} [opts] 额外参数,event是js原生事件
|
|
140
149
|
*/
|
|
141
150
|
export async function executeNewDataAppUILogic(
|
|
142
151
|
appUILogic: IPSAppUINewDataLogic,
|
|
143
|
-
context:
|
|
152
|
+
context: IBizContext,
|
|
144
153
|
data: IData[] | null,
|
|
145
154
|
params: IParams,
|
|
146
155
|
opts: IData = {},
|
|
@@ -162,14 +171,16 @@ export async function executeNewDataAppUILogic(
|
|
|
162
171
|
if (notNilEmpty(navContexts)) {
|
|
163
172
|
tempContext = convertNavData(navContexts!, context, params, _data);
|
|
164
173
|
}
|
|
174
|
+
tempContext = new IBizContext(tempContext, context);
|
|
175
|
+
// 删除上下文内的主键
|
|
176
|
+
delete tempContext[appDataEntity.deName.toLowerCase()];
|
|
177
|
+
tempContext[appDataEntity.deName.toLowerCase()] = undefined;
|
|
178
|
+
|
|
165
179
|
const navParams = newViewRef.getPSNavigateParams();
|
|
166
180
|
if (notNilEmpty(navParams)) {
|
|
167
181
|
tempParams = convertNavData(navParams!, params, context, _data);
|
|
168
182
|
}
|
|
169
183
|
|
|
170
|
-
// 删除上下文内的主键
|
|
171
|
-
delete tempContext[appDataEntity.deName.toLowerCase()];
|
|
172
|
-
|
|
173
184
|
// todo 拷贝
|
|
174
185
|
if (appUILogic.enableWizardAdd) {
|
|
175
186
|
// todo 向导添加
|
|
@@ -180,11 +191,17 @@ export async function executeNewDataAppUILogic(
|
|
|
180
191
|
}
|
|
181
192
|
|
|
182
193
|
// 打开视图
|
|
183
|
-
|
|
194
|
+
await ibiz.commands.execute(
|
|
184
195
|
OpenAppViewCommand.TAG,
|
|
185
196
|
newView,
|
|
186
197
|
tempContext,
|
|
187
198
|
tempParams,
|
|
188
199
|
opts,
|
|
189
200
|
);
|
|
201
|
+
|
|
202
|
+
// 刷新上一个视图
|
|
203
|
+
const { neuron } = opts!;
|
|
204
|
+
neuron.call.refresh();
|
|
205
|
+
|
|
206
|
+
return {};
|
|
190
207
|
}
|