@ibiz-template/runtime 0.1.19 → 0.1.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/index.esm.js +252 -31
- package/dist/index.system.min.js +1 -1
- package/dist/index.system.min.js.map +1 -1
- package/out/constant/index.d.ts +1 -0
- package/out/constant/index.d.ts.map +1 -1
- package/out/constant/index.js +1 -0
- package/out/constant/view-call-tag.d.ts +14 -0
- package/out/constant/view-call-tag.d.ts.map +1 -0
- package/out/constant/view-call-tag.js +15 -0
- package/out/controller/common/control/control.controller.d.ts +13 -0
- package/out/controller/common/control/control.controller.d.ts.map +1 -1
- package/out/controller/common/control/control.controller.js +58 -0
- package/out/controller/common/control/md-control.controller.d.ts +7 -0
- package/out/controller/common/control/md-control.controller.d.ts.map +1 -1
- package/out/controller/common/control/md-control.controller.js +27 -2
- package/out/controller/control/data-view/data-view.controller.d.ts.map +1 -1
- package/out/controller/control/data-view/data-view.controller.js +2 -1
- package/out/controller/control/form/edit-form/edit-form.controller.d.ts.map +1 -1
- package/out/controller/control/form/edit-form/edit-form.controller.js +36 -7
- package/out/controller/control/form/form/form.controller.d.ts +4 -0
- package/out/controller/control/form/form/form.controller.d.ts.map +1 -1
- package/out/controller/control/form/form/form.controller.js +3 -0
- package/out/controller/control/form/search-form/search-form.controller.d.ts.map +1 -1
- package/out/controller/control/form/search-form/search-form.controller.js +11 -1
- package/out/controller/control/grid/grid/grid.controller.d.ts +1 -1
- package/out/controller/control/grid/grid/grid.controller.d.ts.map +1 -1
- package/out/controller/control/grid/grid/grid.controller.js +29 -5
- package/out/controller/control/list/list.controller.d.ts.map +1 -1
- package/out/controller/control/list/list.controller.js +2 -1
- package/out/engine/md-view.engine.js +2 -2
- package/out/global/global-util/global-util.d.ts +14 -0
- package/out/global/global-util/global-util.d.ts.map +1 -1
- package/out/global/global-util/global-util.js +26 -0
- package/out/logic-scheduler/executor/app-ui-logic-executor.d.ts +1 -0
- package/out/logic-scheduler/executor/app-ui-logic-executor.d.ts.map +1 -1
- package/out/logic-scheduler/executor/app-ui-logic-executor.js +33 -4
- package/out/logic-scheduler/trigger/control-event-trigger.js +1 -1
- package/out/logic-scheduler/trigger/view-event-trigger.js +1 -1
- package/out/model/data-entity/data-entity.d.ts +11 -0
- package/out/model/data-entity/data-entity.d.ts.map +1 -1
- package/out/model/data-entity/data-entity.js +14 -0
- package/out/model/index.d.ts +1 -0
- package/out/model/index.d.ts.map +1 -1
- package/out/model/index.js +1 -0
- package/out/model/panel/data-container.d.ts +11 -0
- package/out/model/panel/data-container.d.ts.map +1 -0
- package/out/model/panel/data-container.js +12 -0
- package/out/model/panel/index.d.ts +2 -0
- package/out/model/panel/index.d.ts.map +1 -0
- package/out/model/panel/index.js +1 -0
- package/out/service/app-data-entity/app-data-entity.d.ts.map +1 -1
- package/out/service/app-data-entity/app-data-entity.js +3 -1
- package/out/service/dto/method.dto.js +1 -1
- package/out/service/service/entity/method/method.d.ts.map +1 -1
- package/out/service/service/entity/method/method.js +3 -0
- package/out/service/vo/control.vo.js +2 -2
- package/out/ui-logic/ui-logic-node/msg-box-node/msg-box-node.d.ts.map +1 -1
- package/out/ui-logic/ui-logic-node/msg-box-node/msg-box-node.js +0 -1
- package/package.json +3 -3
- package/src/constant/index.ts +1 -0
- package/src/constant/view-call-tag.ts +14 -0
- package/src/controller/common/control/control.controller.ts +67 -0
- package/src/controller/common/control/md-control.controller.ts +28 -2
- package/src/controller/control/data-view/data-view.controller.ts +2 -1
- package/src/controller/control/form/edit-form/edit-form.controller.ts +34 -7
- package/src/controller/control/form/form/form.controller.ts +7 -0
- package/src/controller/control/form/search-form/search-form.controller.ts +10 -1
- package/src/controller/control/grid/grid/grid.controller.ts +28 -5
- package/src/controller/control/list/list.controller.ts +2 -1
- package/src/engine/md-view.engine.ts +2 -2
- package/src/global/global-util/global-util.ts +28 -0
- package/src/logic-scheduler/executor/app-ui-logic-executor.ts +44 -7
- package/src/logic-scheduler/trigger/control-event-trigger.ts +1 -1
- package/src/logic-scheduler/trigger/view-event-trigger.ts +1 -1
- package/src/model/data-entity/data-entity.ts +17 -0
- package/src/model/index.ts +1 -0
- package/src/model/panel/data-container.ts +18 -0
- package/src/model/panel/index.ts +1 -0
- package/src/service/app-data-entity/app-data-entity.ts +3 -1
- package/src/service/dto/method.dto.ts +1 -1
- package/src/service/service/entity/method/method.ts +3 -0
- package/src/service/vo/control.vo.ts +2 -2
- package/src/ui-logic/ui-logic-node/msg-box-node/msg-box-node.ts +0 -1
|
@@ -55,11 +55,20 @@ export class SearchFormController
|
|
|
55
55
|
const params = await this.getDraftParams();
|
|
56
56
|
Object.assign(queryParams, params);
|
|
57
57
|
await this.evt.emit('onBeforeLoadDraft', { params: queryParams });
|
|
58
|
-
|
|
58
|
+
let res;
|
|
59
|
+
try {
|
|
60
|
+
res = await this.service.getDraft(this.context, queryParams);
|
|
61
|
+
} catch (error) {
|
|
62
|
+
this.actionNotification('GETDRAFTERROR', {
|
|
63
|
+
error: error as Error,
|
|
64
|
+
});
|
|
65
|
+
throw error;
|
|
66
|
+
}
|
|
59
67
|
this.state.data = res.data;
|
|
60
68
|
mergeDefaultInLeft(this.data, params);
|
|
61
69
|
this.state.isLoaded = true;
|
|
62
70
|
this.formStateNotify(FormNotifyState.DRAFT);
|
|
71
|
+
this.actionNotification('GETDRAFTSUCCESS');
|
|
63
72
|
return this.data;
|
|
64
73
|
}
|
|
65
74
|
|
|
@@ -430,13 +430,23 @@ export class GridController
|
|
|
430
430
|
throw new RuntimeError('请先完成当前行编辑中的行的操作');
|
|
431
431
|
}
|
|
432
432
|
|
|
433
|
-
|
|
433
|
+
let res;
|
|
434
|
+
try {
|
|
435
|
+
res = await this.service.getDraft(this.context, this.params);
|
|
436
|
+
} catch (error) {
|
|
437
|
+
this.actionNotification('GETDRAFTERROR', {
|
|
438
|
+
error: error as Error,
|
|
439
|
+
});
|
|
440
|
+
throw error;
|
|
441
|
+
}
|
|
442
|
+
|
|
434
443
|
// 加载完后续处理
|
|
435
444
|
this.state.items.unshift(res.data);
|
|
436
445
|
const newRow = new GridRowState(res.data, this);
|
|
437
446
|
this.state.rows.unshift(newRow);
|
|
438
447
|
this.gridStateNotify(newRow, GridNotifyState.DRAFT);
|
|
439
448
|
this.switchRowEdit(this.state.rows[0], true);
|
|
449
|
+
this.actionNotification('GETDRAFTSUCCESS', { data: res.data });
|
|
440
450
|
}
|
|
441
451
|
|
|
442
452
|
/**
|
|
@@ -482,6 +492,13 @@ export class GridController
|
|
|
482
492
|
res = isCreate
|
|
483
493
|
? await this.service.create(tempContext, data)
|
|
484
494
|
: await this.service.update(tempContext, data);
|
|
495
|
+
} catch (error) {
|
|
496
|
+
await this.evt.emit('onSaveError', undefined);
|
|
497
|
+
this.actionNotification(`${isCreate ? 'CREATE' : 'UPDATE'}ERROR`, {
|
|
498
|
+
error: error as Error,
|
|
499
|
+
data: rowState.data,
|
|
500
|
+
});
|
|
501
|
+
throw error;
|
|
485
502
|
} finally {
|
|
486
503
|
await this.endLoading();
|
|
487
504
|
}
|
|
@@ -494,6 +511,10 @@ export class GridController
|
|
|
494
511
|
rowState.modified = false;
|
|
495
512
|
|
|
496
513
|
ibiz.message.success(`${res.data.srfmajortext || ''}保存成功`);
|
|
514
|
+
this.actionNotification(`${isCreate ? 'CREATE' : 'UPDATE'}SUCCESS`, {
|
|
515
|
+
default: `${res.data.srfmajortext || ''}保存成功`,
|
|
516
|
+
data: res.data,
|
|
517
|
+
});
|
|
497
518
|
this.gridStateNotify(rowState, GridNotifyState.SAVE);
|
|
498
519
|
await this.evt.emit('onSaveSuccess', undefined);
|
|
499
520
|
}
|
|
@@ -774,14 +795,16 @@ export class GridController
|
|
|
774
795
|
* @param {string} key 排序字段
|
|
775
796
|
* @param {string} order 排序顺序
|
|
776
797
|
*/
|
|
777
|
-
setSort(
|
|
778
|
-
if (
|
|
779
|
-
|
|
798
|
+
setSort(fieldId?: string, order?: 'asc' | 'desc'): void {
|
|
799
|
+
if (fieldId && order) {
|
|
800
|
+
const fieldName = this.fieldIdNameMap.get(fieldId)!.toLowerCase();
|
|
801
|
+
super.setSort(fieldName, order);
|
|
780
802
|
} else {
|
|
781
803
|
// 设置默认排序或者置空
|
|
782
804
|
const { minorSortAppDEFieldId, minorSortDir } = this.model;
|
|
783
805
|
if (minorSortAppDEFieldId && minorSortDir) {
|
|
784
|
-
|
|
806
|
+
const fieldName = this.fieldIdNameMap.get(minorSortAppDEFieldId)!;
|
|
807
|
+
this.state.sortQuery = `${fieldName.toLowerCase()},${minorSortDir.toLowerCase()}`;
|
|
785
808
|
} else {
|
|
786
809
|
this.state.sortQuery = '';
|
|
787
810
|
}
|
|
@@ -44,7 +44,8 @@ export class ListController
|
|
|
44
44
|
// 设置默认排序或者置空
|
|
45
45
|
const { minorSortAppDEFieldId, minorSortDir } = this.model;
|
|
46
46
|
if (minorSortAppDEFieldId && minorSortDir) {
|
|
47
|
-
|
|
47
|
+
const fieldName = this.fieldIdNameMap.get(minorSortAppDEFieldId)!;
|
|
48
|
+
this.state.sortQuery = `${fieldName.toLowerCase()},${minorSortDir.toLowerCase()}`;
|
|
48
49
|
} else {
|
|
49
50
|
this.state.sortQuery = '';
|
|
50
51
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RuntimeModelError } from '@ibiz-template/core';
|
|
2
2
|
import { IAppDEMultiDataView } from '@ibiz/model-core';
|
|
3
|
-
import { SysUIActionTag } from '../constant';
|
|
3
|
+
import { SysUIActionTag, ViewCallTag } from '../constant';
|
|
4
4
|
import { ViewController } from '../controller';
|
|
5
5
|
import {
|
|
6
6
|
IMDViewEvent,
|
|
@@ -180,7 +180,7 @@ export class MDViewEngine extends ViewEngineBase {
|
|
|
180
180
|
this.copy(args);
|
|
181
181
|
return null;
|
|
182
182
|
}
|
|
183
|
-
if (key ===
|
|
183
|
+
if (key === ViewCallTag.LOAD) {
|
|
184
184
|
this.load(args);
|
|
185
185
|
return null;
|
|
186
186
|
}
|
|
@@ -40,4 +40,32 @@ export class GlobalUtil {
|
|
|
40
40
|
* @date 2023-08-24 10:47:06
|
|
41
41
|
*/
|
|
42
42
|
getExportExcel?: () => Promise<IExportExcelUtil>;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 显示应用级别的加载提示
|
|
46
|
+
*
|
|
47
|
+
* @author chitanda
|
|
48
|
+
* @date 2023-09-08 10:09:43
|
|
49
|
+
*/
|
|
50
|
+
showAppLoading(): void {
|
|
51
|
+
const el = document.getElementById('app-loading-x') as HTMLDivElement;
|
|
52
|
+
if (el) {
|
|
53
|
+
el.style.display = 'none';
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* 隐藏应用级别的加载提示
|
|
59
|
+
*
|
|
60
|
+
* @author chitanda
|
|
61
|
+
* @date 2023-09-08 10:09:15
|
|
62
|
+
*/
|
|
63
|
+
hiddenAppLoading(): void {
|
|
64
|
+
setTimeout(() => {
|
|
65
|
+
const el = document.getElementById('app-loading-x') as HTMLDivElement;
|
|
66
|
+
if (el) {
|
|
67
|
+
el.style.display = 'none';
|
|
68
|
+
}
|
|
69
|
+
}, 300);
|
|
70
|
+
}
|
|
43
71
|
}
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
import { notNilEmpty } from 'qx-util';
|
|
13
13
|
import { OpenAppViewCommand } from '../../command';
|
|
14
14
|
import { IModalData, IUILogicParams } from '../../interface';
|
|
15
|
+
import { getFormTypeFieldName } from '../../model';
|
|
15
16
|
import { convertNavData } from '../../utils';
|
|
16
17
|
import { LogicExecutor } from './logic-executor';
|
|
17
18
|
|
|
@@ -65,13 +66,19 @@ export class AppUILogicExecutor extends LogicExecutor {
|
|
|
65
66
|
if (!data?.[0]) {
|
|
66
67
|
throw new RuntimeError('opendata没有可操作数据!');
|
|
67
68
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
if (
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
const openViewRefs = appUILogic.openDataAppViews;
|
|
70
|
+
let openViewRef: IAppUILogicRefViewBase | undefined;
|
|
71
|
+
if (openViewRefs) {
|
|
72
|
+
openViewRef = await this.calcOpenViewRef(appUILogic, parameters);
|
|
73
|
+
} else {
|
|
74
|
+
// 准备需要的模型
|
|
75
|
+
openViewRef = appUILogic.openDataAppView;
|
|
76
|
+
if (!openViewRef) {
|
|
77
|
+
throw new RuntimeModelError(
|
|
78
|
+
appUILogic,
|
|
79
|
+
'opendata视图逻辑没有配置默认打开视图',
|
|
80
|
+
);
|
|
81
|
+
}
|
|
75
82
|
}
|
|
76
83
|
const openView = openViewRef.refAppViewId;
|
|
77
84
|
if (!openView) {
|
|
@@ -231,4 +238,34 @@ export class AppUILogicExecutor extends LogicExecutor {
|
|
|
231
238
|
}
|
|
232
239
|
return findView;
|
|
233
240
|
}
|
|
241
|
+
|
|
242
|
+
protected async calcOpenViewRef(
|
|
243
|
+
appUILogic: IAppUIOpenDataLogic,
|
|
244
|
+
parameters: IUILogicParams,
|
|
245
|
+
): Promise<IAppUILogicRefViewBase> {
|
|
246
|
+
const appDataEntityId = parameters.view.model.appDataEntityId!;
|
|
247
|
+
// 表单类型属性
|
|
248
|
+
const formTypeName = await getFormTypeFieldName(appDataEntityId);
|
|
249
|
+
if (!formTypeName) {
|
|
250
|
+
throw new RuntimeModelError(
|
|
251
|
+
appUILogic,
|
|
252
|
+
`${appDataEntityId}实体缺少表单类型应用实体属性`,
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
const { data } = parameters;
|
|
256
|
+
// 表单类型值
|
|
257
|
+
const formTypeValue = data[0][formTypeName];
|
|
258
|
+
if (!formTypeValue) {
|
|
259
|
+
throw new RuntimeModelError(appUILogic, '数据源无表单类型应用实体属性值');
|
|
260
|
+
}
|
|
261
|
+
const openViewRefs = appUILogic.openDataAppViews;
|
|
262
|
+
// 根据表单类型值找到实际打开的视图
|
|
263
|
+
const findView = openViewRefs?.find(item => item.refMode === formTypeValue);
|
|
264
|
+
if (!findView) {
|
|
265
|
+
throw new RuntimeError(
|
|
266
|
+
`没有找到与表单类型${formTypeValue}相关的实体的编辑视图`,
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
return findView;
|
|
270
|
+
}
|
|
234
271
|
}
|
|
@@ -28,7 +28,7 @@ export class ControlEventTrigger extends LogicTrigger {
|
|
|
28
28
|
protected scheduler: LogicScheduler,
|
|
29
29
|
) {
|
|
30
30
|
super(logic, scheduler);
|
|
31
|
-
const names = logic.eventNames!.split('
|
|
31
|
+
const names = logic.eventNames!.split(';');
|
|
32
32
|
this.listenEventNames = names.map(
|
|
33
33
|
name => StudioControlEvents[name as keyof StudioControlEvents] || name,
|
|
34
34
|
);
|
|
@@ -28,7 +28,7 @@ export class ViewEventTrigger extends LogicTrigger {
|
|
|
28
28
|
protected scheduler: LogicScheduler,
|
|
29
29
|
) {
|
|
30
30
|
super(logic, scheduler);
|
|
31
|
-
const names = logic.eventNames!.split('
|
|
31
|
+
const names = logic.eventNames!.split(';');
|
|
32
32
|
this.listenEventNames = names.map(
|
|
33
33
|
name => StudioViewEvents[name as keyof StudioViewEvents] || name,
|
|
34
34
|
);
|
|
@@ -52,6 +52,23 @@ export async function getDeACMode(
|
|
|
52
52
|
return deACMode;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
/**
|
|
56
|
+
* 从实体里找到表单类型应用实体属性
|
|
57
|
+
*
|
|
58
|
+
* @author zk
|
|
59
|
+
* @date 2023-09-07 05:09:41
|
|
60
|
+
* @export
|
|
61
|
+
* @param {string} entityId
|
|
62
|
+
* @param {string} [srfappid]
|
|
63
|
+
* @return {*} {(Promise<string | undefined>)}
|
|
64
|
+
*/
|
|
65
|
+
export async function getFormTypeFieldName(
|
|
66
|
+
entityId: string,
|
|
67
|
+
): Promise<string | undefined> {
|
|
68
|
+
const appDataEntity = await ibiz.hub.getAppDataEntity(entityId)!;
|
|
69
|
+
return appDataEntity.formTypeAppDEFieldId;
|
|
70
|
+
}
|
|
71
|
+
|
|
55
72
|
/**
|
|
56
73
|
* 从实体里找到实体逻辑
|
|
57
74
|
* @author lxm
|
package/src/model/index.ts
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IPanelContainer, IPanelItem } from '@ibiz/model-core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 判断面板成员模型是否是数据容器
|
|
5
|
+
* @author lxm
|
|
6
|
+
* @date 2023-09-06 04:56:01
|
|
7
|
+
* @export
|
|
8
|
+
* @param {IPanelItem} panelItem
|
|
9
|
+
* @return {*} {boolean}
|
|
10
|
+
*/
|
|
11
|
+
export function isDataContainer(panelItem: IPanelItem): boolean {
|
|
12
|
+
return (
|
|
13
|
+
panelItem.itemType === 'CONTAINER' &&
|
|
14
|
+
['CONTAINER_MULTIDATA', 'CONTAINER_SINGLEDATA'].includes(
|
|
15
|
+
(panelItem as IPanelContainer).predefinedType!,
|
|
16
|
+
)
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './data-container';
|
|
@@ -172,7 +172,9 @@ export class AppDataEntity implements IDataEntity {
|
|
|
172
172
|
* @return {*} {AppDataEntity}
|
|
173
173
|
*/
|
|
174
174
|
clone(): AppDataEntity {
|
|
175
|
-
|
|
175
|
+
const entity = new AppDataEntity(this._entity, this._data);
|
|
176
|
+
entity.srfkey = this.srfkey;
|
|
177
|
+
return entity;
|
|
176
178
|
}
|
|
177
179
|
|
|
178
180
|
/**
|
|
@@ -155,7 +155,7 @@ export class MethodDto {
|
|
|
155
155
|
entity.appDEMethodDTOs || [],
|
|
156
156
|
field.refAppDEMethodDTOId!,
|
|
157
157
|
)!;
|
|
158
|
-
const dto = new MethodDto(entity,
|
|
158
|
+
const dto = new MethodDto(entity, true, methodDto);
|
|
159
159
|
this.dtoMap.set(field.codeName!, dto);
|
|
160
160
|
return dto;
|
|
161
161
|
}
|
|
@@ -181,6 +181,9 @@ export abstract class Method {
|
|
|
181
181
|
* @return {*} {IDataEntity}
|
|
182
182
|
*/
|
|
183
183
|
protected createEntity(data: IData | IDataEntity): IDataEntity {
|
|
184
|
+
if (data instanceof AppDataEntity) {
|
|
185
|
+
return data.clone();
|
|
186
|
+
}
|
|
184
187
|
return new AppDataEntity(this.entity, data);
|
|
185
188
|
}
|
|
186
189
|
}
|
|
@@ -80,7 +80,6 @@ export class MsgBoxNode extends UILogicNode {
|
|
|
80
80
|
default:
|
|
81
81
|
throw new ModelError(this.model, `${buttonsType}暂未支持`);
|
|
82
82
|
}
|
|
83
|
-
console.log(this.model, modalParams);
|
|
84
83
|
const result = await ibiz.modal.confirm(modalParams);
|
|
85
84
|
ctx.setLastReturn(resultTags[result ? 0 : 1]);
|
|
86
85
|
}
|