@ibiz-template/runtime 0.1.35 → 0.1.37
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 +799 -130
- 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/value-op.d.ts +82 -0
- package/out/constant/value-op.d.ts.map +1 -0
- package/out/constant/value-op.js +83 -0
- package/out/constant/view-call-tag.d.ts +5 -1
- package/out/constant/view-call-tag.d.ts.map +1 -1
- package/out/constant/view-call-tag.js +4 -0
- package/out/controller/control/dashboard/portlet/portlet-part/portlet-part.controller.d.ts.map +1 -1
- package/out/controller/control/dashboard/portlet/portlet-part/portlet-part.controller.js +1 -0
- package/out/controller/control/form/form-detail/form-item/form-item.controller.d.ts +3 -3
- package/out/controller/control/form/form-detail/form-item/form-item.controller.d.ts.map +1 -1
- package/out/controller/control/form/form-detail/form-item/form-item.controller.js +13 -8
- package/out/controller/control/form/search-form/search-form.controller.d.ts +2 -2
- 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 -3
- package/out/controller/control/grid/grid-column/grid-field-edit-column/grid-field-edit-column.controller.d.ts +3 -3
- package/out/controller/control/grid/grid-column/grid-field-edit-column/grid-field-edit-column.controller.d.ts.map +1 -1
- package/out/controller/control/grid/grid-column/grid-field-edit-column/grid-field-edit-column.controller.js +13 -8
- package/out/controller/control/index.d.ts +1 -0
- package/out/controller/control/index.d.ts.map +1 -1
- package/out/controller/control/index.js +1 -0
- package/out/controller/control/md-ctrl/md-ctrl.controller.d.ts +38 -3
- package/out/controller/control/md-ctrl/md-ctrl.controller.d.ts.map +1 -1
- package/out/controller/control/md-ctrl/md-ctrl.controller.js +110 -3
- package/out/controller/control/medit-view-panel/index.d.ts +3 -0
- package/out/controller/control/medit-view-panel/index.d.ts.map +1 -0
- package/out/controller/control/medit-view-panel/index.js +2 -0
- package/out/controller/control/medit-view-panel/medit-view-panel.controller.d.ts +119 -0
- package/out/controller/control/medit-view-panel/medit-view-panel.controller.d.ts.map +1 -0
- package/out/controller/control/medit-view-panel/medit-view-panel.controller.js +320 -0
- package/out/controller/control/medit-view-panel/medit-view-panel.service.d.ts +11 -0
- package/out/controller/control/medit-view-panel/medit-view-panel.service.d.ts.map +1 -0
- package/out/controller/control/medit-view-panel/medit-view-panel.service.js +9 -0
- package/out/controller/control/search-bar/search-bar-filter.controller.d.ts +65 -0
- package/out/controller/control/search-bar/search-bar-filter.controller.d.ts.map +1 -0
- package/out/controller/control/search-bar/search-bar-filter.controller.js +48 -0
- package/out/controller/control/search-bar/search-bar.controller.d.ts +63 -4
- package/out/controller/control/search-bar/search-bar.controller.d.ts.map +1 -1
- package/out/controller/control/search-bar/search-bar.controller.js +143 -9
- package/out/controller/utils/value-rule/value-rule.d.ts +10 -1
- package/out/controller/utils/value-rule/value-rule.d.ts.map +1 -1
- package/out/controller/utils/value-rule/value-rule.js +64 -1
- package/out/engine/md-view.engine.d.ts.map +1 -1
- package/out/engine/md-view.engine.js +2 -23
- package/out/interface/controller/controller/control/i-medit-view-panel.controller.d.ts +14 -0
- package/out/interface/controller/controller/control/i-medit-view-panel.controller.d.ts.map +1 -0
- package/out/interface/controller/controller/control/i-medit-view-panel.controller.js +1 -0
- package/out/interface/controller/controller/control/i-search-bar.controller.d.ts +8 -0
- package/out/interface/controller/controller/control/i-search-bar.controller.d.ts.map +1 -1
- package/out/interface/controller/controller/control/i-search-form.controller.d.ts +2 -2
- package/out/interface/controller/controller/control/i-search-form.controller.d.ts.map +1 -1
- package/out/interface/controller/controller/control/index.d.ts +1 -0
- package/out/interface/controller/controller/control/index.d.ts.map +1 -1
- package/out/interface/controller/controller/control/index.js +1 -0
- package/out/interface/controller/event/control/i-medit-view-panel.event.d.ts +9 -0
- package/out/interface/controller/event/control/i-medit-view-panel.event.d.ts.map +1 -0
- package/out/interface/controller/event/control/i-medit-view-panel.event.js +1 -0
- package/out/interface/controller/event/control/index.d.ts +1 -0
- package/out/interface/controller/event/control/index.d.ts.map +1 -1
- package/out/interface/controller/event/control/index.js +1 -0
- package/out/interface/controller/event/view/i-medit-view9.event.d.ts +10 -0
- package/out/interface/controller/event/view/i-medit-view9.event.d.ts.map +1 -0
- package/out/interface/controller/event/view/i-medit-view9.event.js +1 -0
- package/out/interface/controller/event/view/index.d.ts +1 -0
- package/out/interface/controller/event/view/index.d.ts.map +1 -1
- package/out/interface/controller/event/view/index.js +1 -0
- package/out/interface/controller/state/control/i-medit-view-panel.state.d.ts +29 -0
- package/out/interface/controller/state/control/i-medit-view-panel.state.d.ts.map +1 -0
- package/out/interface/controller/state/control/i-medit-view-panel.state.js +1 -0
- package/out/interface/controller/state/control/i-search-bar.state.d.ts +75 -0
- package/out/interface/controller/state/control/i-search-bar.state.d.ts.map +1 -1
- package/out/interface/controller/state/control/index.d.ts +1 -0
- package/out/interface/controller/state/control/index.d.ts.map +1 -1
- package/out/interface/controller/state/control/index.js +1 -0
- package/out/interface/controller/state/view/i-medit-view9.state.d.ts +11 -0
- package/out/interface/controller/state/view/i-medit-view9.state.d.ts.map +1 -0
- package/out/interface/controller/state/view/i-medit-view9.state.js +1 -0
- package/out/interface/controller/state/view/index.d.ts +1 -0
- package/out/interface/controller/state/view/index.d.ts.map +1 -1
- package/out/interface/controller/state/view/index.js +1 -0
- package/out/service/service/entity/method/method.js +2 -2
- package/package.json +3 -3
- package/src/constant/index.ts +1 -0
- package/src/constant/value-op.ts +82 -0
- package/src/constant/view-call-tag.ts +4 -0
- package/src/controller/control/dashboard/portlet/portlet-part/portlet-part.controller.ts +2 -0
- package/src/controller/control/form/form-detail/form-item/form-item.controller.ts +22 -9
- package/src/controller/control/form/search-form/search-form.controller.ts +11 -3
- package/src/controller/control/grid/grid-column/grid-field-edit-column/grid-field-edit-column.controller.ts +18 -13
- package/src/controller/control/index.ts +1 -0
- package/src/controller/control/md-ctrl/md-ctrl.controller.ts +136 -3
- package/src/controller/control/medit-view-panel/index.ts +2 -0
- package/src/controller/control/medit-view-panel/medit-view-panel.controller.ts +375 -0
- package/src/controller/control/medit-view-panel/medit-view-panel.service.ts +10 -0
- package/src/controller/control/search-bar/search-bar-filter.controller.ts +112 -0
- package/src/controller/control/search-bar/search-bar.controller.ts +165 -9
- package/src/controller/utils/value-rule/value-rule.ts +97 -2
- package/src/engine/md-view.engine.ts +2 -27
- package/src/interface/controller/controller/control/i-medit-view-panel.controller.ts +17 -0
- package/src/interface/controller/controller/control/i-search-bar.controller.ts +10 -1
- package/src/interface/controller/controller/control/i-search-form.controller.ts +2 -2
- package/src/interface/controller/controller/control/index.ts +1 -0
- package/src/interface/controller/event/control/i-medit-view-panel.event.ts +9 -0
- package/src/interface/controller/event/control/index.ts +1 -0
- package/src/interface/controller/event/view/i-medit-view9.event.ts +10 -0
- package/src/interface/controller/event/view/index.ts +1 -0
- package/src/interface/controller/state/control/i-medit-view-panel.state.ts +36 -0
- package/src/interface/controller/state/control/i-search-bar.state.ts +86 -0
- package/src/interface/controller/state/control/index.ts +1 -0
- package/src/interface/controller/state/view/i-medit-view9.state.ts +10 -0
- package/src/interface/controller/state/view/index.ts +1 -0
- package/src/service/service/entity/method/method.ts +2 -2
|
@@ -3,12 +3,16 @@ import {
|
|
|
3
3
|
IUIActionGroup,
|
|
4
4
|
IUIActionGroupDetail,
|
|
5
5
|
} from '@ibiz/model-core';
|
|
6
|
+
import { RuntimeModelError } from '@ibiz-template/core';
|
|
7
|
+
import { isNil } from 'ramda';
|
|
6
8
|
import {
|
|
7
9
|
IMobMDCtrlEvent,
|
|
8
10
|
IMobMDCtrlController,
|
|
9
11
|
IMobMdCtrlState,
|
|
10
12
|
IMobMDCtrlRowState,
|
|
11
13
|
MDCtrlLoadParams,
|
|
14
|
+
IMDControlGroupState,
|
|
15
|
+
CodeListItem,
|
|
12
16
|
} from '../../../interface';
|
|
13
17
|
import { MDCtrlService } from './md-ctrl.service';
|
|
14
18
|
import { MobMDCtrlRowState } from './md-ctrl-row.state';
|
|
@@ -31,6 +35,16 @@ export class MDCtrlController
|
|
|
31
35
|
this.state.mdctrlActiveMode = 1;
|
|
32
36
|
}
|
|
33
37
|
|
|
38
|
+
/**
|
|
39
|
+
* 分组代码表项集合
|
|
40
|
+
*
|
|
41
|
+
* @author zk
|
|
42
|
+
* @date 2023-10-11 04:10:06
|
|
43
|
+
* @type {readonly}
|
|
44
|
+
* @memberof MDCtrlController
|
|
45
|
+
*/
|
|
46
|
+
groupCodeListItems?: readonly CodeListItem[];
|
|
47
|
+
|
|
34
48
|
protected async onCreated(): Promise<void> {
|
|
35
49
|
await super.onCreated();
|
|
36
50
|
this.service = new MDCtrlService(this.model);
|
|
@@ -86,7 +100,10 @@ export class MDCtrlController
|
|
|
86
100
|
await this.load({ isInitialLoad: true });
|
|
87
101
|
}
|
|
88
102
|
|
|
89
|
-
afterLoad(
|
|
103
|
+
async afterLoad(
|
|
104
|
+
args: MDCtrlLoadParams,
|
|
105
|
+
items: ControlVO[],
|
|
106
|
+
): Promise<IData[]> {
|
|
90
107
|
if (args.isInitialLoad) {
|
|
91
108
|
this.state.rows = [];
|
|
92
109
|
}
|
|
@@ -99,6 +116,8 @@ export class MDCtrlController
|
|
|
99
116
|
}),
|
|
100
117
|
);
|
|
101
118
|
}
|
|
119
|
+
await this.initGroupCodeListItems();
|
|
120
|
+
await this.handleDataGroup();
|
|
102
121
|
return super.afterLoad(args, items);
|
|
103
122
|
}
|
|
104
123
|
|
|
@@ -108,7 +127,7 @@ export class MDCtrlController
|
|
|
108
127
|
* @author zk
|
|
109
128
|
* @date 2023-05-26 02:05:46
|
|
110
129
|
* @param {IData[]} items
|
|
111
|
-
* @memberof
|
|
130
|
+
* @memberof MDCtrlController
|
|
112
131
|
*/
|
|
113
132
|
setData(items: IData[]): void {
|
|
114
133
|
const rows = items.map(item => {
|
|
@@ -124,7 +143,7 @@ export class MDCtrlController
|
|
|
124
143
|
* @author zk
|
|
125
144
|
* @date 2023-05-26 02:05:35
|
|
126
145
|
* @return {*} {IData[]}
|
|
127
|
-
* @memberof
|
|
146
|
+
* @memberof MDCtrlController
|
|
128
147
|
*/
|
|
129
148
|
getAllData(): IData[] {
|
|
130
149
|
return this.state.rows.map(row => row.data);
|
|
@@ -196,4 +215,118 @@ export class MDCtrlController
|
|
|
196
215
|
containerState.update(row.data.getOrigin());
|
|
197
216
|
row.uaColStates[group.id!] = containerState;
|
|
198
217
|
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* 处理数据分组
|
|
221
|
+
*
|
|
222
|
+
* @memberof MDCtrlController
|
|
223
|
+
*/
|
|
224
|
+
protected async handleDataGroup(): Promise<void> {
|
|
225
|
+
const { enableGroup, groupMode, groupAppDEFieldId } = this.model;
|
|
226
|
+
if (enableGroup && groupMode) {
|
|
227
|
+
if (!groupAppDEFieldId) {
|
|
228
|
+
throw new RuntimeModelError(this.model, '分组属性没有配置');
|
|
229
|
+
}
|
|
230
|
+
if (groupMode === 'AUTO') {
|
|
231
|
+
this.handleAutoGroup();
|
|
232
|
+
} else if (groupMode === 'CODELIST') {
|
|
233
|
+
await this.handleCodeListGroup();
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* 处理自动分组
|
|
240
|
+
*
|
|
241
|
+
* @memberof MDCtrlController
|
|
242
|
+
*/
|
|
243
|
+
protected handleAutoGroup(): void {
|
|
244
|
+
const { groupAppDEFieldId } = this.model;
|
|
245
|
+
if (groupAppDEFieldId) {
|
|
246
|
+
const { items } = this.state;
|
|
247
|
+
const groupMap: Map<string, MobMDCtrlRowState[]> = new Map();
|
|
248
|
+
items.forEach((item: IData) => {
|
|
249
|
+
const groupVal = item[groupAppDEFieldId];
|
|
250
|
+
if (isNil(groupVal)) {
|
|
251
|
+
// 分组无值的不显示
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
if (!groupMap.has(groupVal)) {
|
|
256
|
+
groupMap.set(groupVal, []);
|
|
257
|
+
}
|
|
258
|
+
groupMap
|
|
259
|
+
.get(groupVal)!
|
|
260
|
+
.push(new MobMDCtrlRowState(item as ControlVO, this));
|
|
261
|
+
});
|
|
262
|
+
const groups: IMDControlGroupState[] = [];
|
|
263
|
+
groupMap.forEach((value: IData[], key: string) => {
|
|
264
|
+
groups.push({
|
|
265
|
+
caption: key,
|
|
266
|
+
key,
|
|
267
|
+
children: [...value],
|
|
268
|
+
});
|
|
269
|
+
});
|
|
270
|
+
this.state.groups = groups;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* 加载并初始化分组代码表项集合
|
|
276
|
+
* @author lxm
|
|
277
|
+
* @date 2023-08-29 05:11:39
|
|
278
|
+
* @protected
|
|
279
|
+
* @return {*} {Promise<void>}
|
|
280
|
+
*/
|
|
281
|
+
protected async initGroupCodeListItems(): Promise<void> {
|
|
282
|
+
const { groupCodeListId } = this.model;
|
|
283
|
+
if (!groupCodeListId) {
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
const app = ibiz.hub.getApp(this.context.srfappid);
|
|
287
|
+
this.groupCodeListItems = await app.codeList.get(
|
|
288
|
+
groupCodeListId,
|
|
289
|
+
this.context,
|
|
290
|
+
this.params,
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* 处理代码表分组
|
|
296
|
+
*
|
|
297
|
+
* @memberof MDCtrlController
|
|
298
|
+
*/
|
|
299
|
+
protected async handleCodeListGroup(): Promise<void> {
|
|
300
|
+
const { groupAppDEFieldId, groupCodeListId } = this.model;
|
|
301
|
+
if (!groupCodeListId) {
|
|
302
|
+
throw new RuntimeModelError(this.model, '分组代码表没有配置');
|
|
303
|
+
}
|
|
304
|
+
const { items } = this.state;
|
|
305
|
+
const groupMap: Map<string | number, MobMDCtrlRowState[]> = new Map();
|
|
306
|
+
this.groupCodeListItems!.forEach(item => {
|
|
307
|
+
groupMap.set(item.value, []);
|
|
308
|
+
});
|
|
309
|
+
items.forEach((item: IData) => {
|
|
310
|
+
const groupVal = item[groupAppDEFieldId!];
|
|
311
|
+
const groupArr = groupMap.get(groupVal);
|
|
312
|
+
if (groupArr) {
|
|
313
|
+
groupArr.push(new MobMDCtrlRowState(item as ControlVO, this));
|
|
314
|
+
}
|
|
315
|
+
// 不在代码表里数据忽略
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
const groups: IMDControlGroupState[] = [];
|
|
319
|
+
groupMap.forEach((arr, key) => {
|
|
320
|
+
// 标题
|
|
321
|
+
const codeListItem = this.groupCodeListItems!.find(
|
|
322
|
+
item => item.value === key,
|
|
323
|
+
)!;
|
|
324
|
+
groups.push({
|
|
325
|
+
caption: codeListItem.text,
|
|
326
|
+
key: codeListItem.value,
|
|
327
|
+
children: arr,
|
|
328
|
+
});
|
|
329
|
+
});
|
|
330
|
+
this.state.groups = groups;
|
|
331
|
+
}
|
|
199
332
|
}
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
/* eslint-disable no-shadow */
|
|
2
|
+
import { RuntimeError } from '@ibiz-template/core';
|
|
3
|
+
import { IAppDERS, IAppDEView, IDEMultiEditViewPanel } from '@ibiz/model-core';
|
|
4
|
+
import { createUUID } from 'qx-util';
|
|
5
|
+
import {
|
|
6
|
+
IMEditViewPanelState,
|
|
7
|
+
IMEditViewPanelEvent,
|
|
8
|
+
IMEditViewPanelController,
|
|
9
|
+
MDCtrlLoadParams,
|
|
10
|
+
IPanelUiItem,
|
|
11
|
+
DataChangeEvent,
|
|
12
|
+
} from '../../../interface';
|
|
13
|
+
import { calcDeCodeNameById } from '../../../model';
|
|
14
|
+
import { ControlVO, Srfuf } from '../../../service';
|
|
15
|
+
import { MDControlController } from '../../common';
|
|
16
|
+
import { MEditViewPanelService } from './medit-view-panel.service';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 多编辑视图面板部件控制器
|
|
20
|
+
* @export
|
|
21
|
+
* @class MEditViewPanelController
|
|
22
|
+
* @extends {MDControlController<IDEMultiEditViewPanel, IMEditViewPanelState, IMEditViewPanelEvent>}
|
|
23
|
+
* @implements {IMEditViewPanelController}
|
|
24
|
+
*/
|
|
25
|
+
export class MEditViewPanelController
|
|
26
|
+
extends MDControlController<
|
|
27
|
+
IDEMultiEditViewPanel,
|
|
28
|
+
IMEditViewPanelState,
|
|
29
|
+
IMEditViewPanelEvent
|
|
30
|
+
>
|
|
31
|
+
implements IMEditViewPanelController
|
|
32
|
+
{
|
|
33
|
+
declare service: MEditViewPanelService;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 是否显示底部按钮
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
showButton: boolean = true;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* 关系实体参数对象
|
|
43
|
+
*
|
|
44
|
+
*/
|
|
45
|
+
deResParameters: IData[] = [];
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* 当前应用视图参数对象
|
|
49
|
+
*
|
|
50
|
+
*/
|
|
51
|
+
parameters: IData[] = [];
|
|
52
|
+
|
|
53
|
+
protected async onCreated(): Promise<void> {
|
|
54
|
+
await super.onCreated();
|
|
55
|
+
this.service = new MEditViewPanelService(this.model);
|
|
56
|
+
await this.service.init(this.context);
|
|
57
|
+
await this.initParameters();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
protected initState(): void {
|
|
61
|
+
super.initState();
|
|
62
|
+
this.state.panelUiItems = [];
|
|
63
|
+
this.state.activeTab = '';
|
|
64
|
+
this.state.size = 1000;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* 格式化视图关系参数
|
|
69
|
+
*
|
|
70
|
+
* @param {IContext} context 应用上下文数据
|
|
71
|
+
* @param {IAppDERS[][]} appDERSPaths 关系路径数据
|
|
72
|
+
*/
|
|
73
|
+
async formatAppDERSPath(
|
|
74
|
+
context: IContext,
|
|
75
|
+
appDERSPaths: IAppDERS[][],
|
|
76
|
+
): Promise<IData[]> {
|
|
77
|
+
if (!appDERSPaths || appDERSPaths.length === 0) {
|
|
78
|
+
return [];
|
|
79
|
+
}
|
|
80
|
+
let counter: number = 0;
|
|
81
|
+
for (const appDERSPath of appDERSPaths) {
|
|
82
|
+
const tempData: IData = { isInclude: true, data: [] };
|
|
83
|
+
for (const singleAppDERSPath of appDERSPath) {
|
|
84
|
+
// eslint-disable-next-line no-await-in-loop
|
|
85
|
+
const majorPSAppDataEntity = await ibiz.hub.getAppDataEntity(
|
|
86
|
+
singleAppDERSPath.majorAppDataEntityId!,
|
|
87
|
+
);
|
|
88
|
+
if (majorPSAppDataEntity && majorPSAppDataEntity.codeName) {
|
|
89
|
+
tempData.isInclude =
|
|
90
|
+
context[majorPSAppDataEntity.codeName.toLowerCase()] &&
|
|
91
|
+
tempData.isInclude;
|
|
92
|
+
tempData.data.push({
|
|
93
|
+
parameterName: majorPSAppDataEntity.keyAppDEFieldId?.toLowerCase(),
|
|
94
|
+
pathName: majorPSAppDataEntity.codeName?.toLowerCase(),
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
// eslint-disable-next-line no-plusplus
|
|
99
|
+
counter++;
|
|
100
|
+
if (tempData.isInclude) {
|
|
101
|
+
return tempData.data;
|
|
102
|
+
}
|
|
103
|
+
if (counter === appDERSPaths.length) {
|
|
104
|
+
return [];
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return [];
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* 初始化嵌入应用视图及实体参数对象
|
|
112
|
+
* @return {*}
|
|
113
|
+
* @author: zhujiamin
|
|
114
|
+
* @Date: 2023-10-16 13:56:56
|
|
115
|
+
*/
|
|
116
|
+
async initParameters(): Promise<void> {
|
|
117
|
+
if (this.controlParams.SHOWBUTTON) {
|
|
118
|
+
this.showButton = !Object.is(this.controlParams.SHOWBUTTON, 'false');
|
|
119
|
+
}
|
|
120
|
+
if (this.model.embeddedAppViewId) {
|
|
121
|
+
const embedView = await ibiz.hub.getAppView(this.model.embeddedAppViewId);
|
|
122
|
+
if (embedView.appDataEntityId) {
|
|
123
|
+
const embedViewEntity = await ibiz.hub.getAppDataEntity(
|
|
124
|
+
embedView.appDataEntityId,
|
|
125
|
+
);
|
|
126
|
+
if (embedView && embedViewEntity) {
|
|
127
|
+
this.deResParameters = await this.formatAppDERSPath(
|
|
128
|
+
this.context,
|
|
129
|
+
(embedView as IAppDEView).appDERSPaths,
|
|
130
|
+
);
|
|
131
|
+
this.parameters = [
|
|
132
|
+
{
|
|
133
|
+
parameterName: embedViewEntity.keyAppDEFieldId?.toLowerCase(),
|
|
134
|
+
pathName: embedViewEntity.codeName?.toLowerCase(),
|
|
135
|
+
},
|
|
136
|
+
];
|
|
137
|
+
} else {
|
|
138
|
+
this.deResParameters = [];
|
|
139
|
+
this.parameters = [];
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* 部件加载后处理
|
|
147
|
+
*
|
|
148
|
+
* @author chitanda
|
|
149
|
+
* @date 2023-06-21 15:06:44
|
|
150
|
+
* @param {MDCtrlLoadParams} args 本次请求参数
|
|
151
|
+
* @param {IData[]} items 上游处理的数据(默认是后台数据)
|
|
152
|
+
* @return {*} {Promise<IData[]>} 返回给后续处理的数据
|
|
153
|
+
*/
|
|
154
|
+
async afterLoad(
|
|
155
|
+
args: MDCtrlLoadParams,
|
|
156
|
+
items: ControlVO[],
|
|
157
|
+
): Promise<ControlVO[]> {
|
|
158
|
+
await super.afterLoad(args, items);
|
|
159
|
+
this.state.panelUiItems = [];
|
|
160
|
+
this.doItems(items);
|
|
161
|
+
// 设置默认激活
|
|
162
|
+
if (
|
|
163
|
+
this.model.panelStyle === 'TAB_TOP' &&
|
|
164
|
+
this.state.panelUiItems.length > 0
|
|
165
|
+
) {
|
|
166
|
+
this.state.activeTab = this.state.panelUiItems[0].id;
|
|
167
|
+
}
|
|
168
|
+
return items;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* 处理UI所需数据
|
|
173
|
+
* @param {ControlVO} arg
|
|
174
|
+
* @return {*}
|
|
175
|
+
* @author: zhujiamin
|
|
176
|
+
* @Date: 2023-10-16 17:55:31
|
|
177
|
+
*/
|
|
178
|
+
handlePanelItemParams(arg: ControlVO): IPanelUiItem {
|
|
179
|
+
const [{ parameterName }] = this.parameters;
|
|
180
|
+
const id: string = arg[parameterName]
|
|
181
|
+
? arg[parameterName]
|
|
182
|
+
: `mockId:${createUUID()}`;
|
|
183
|
+
const item = { id, context: {}, params: {}, data: arg, srfmajortext: '' };
|
|
184
|
+
Object.assign(item.context, this.context);
|
|
185
|
+
// 关系应用实体参数
|
|
186
|
+
this.deResParameters.forEach(deResParameter => {
|
|
187
|
+
const { parameterName, pathName } = deResParameter;
|
|
188
|
+
if (
|
|
189
|
+
this.context[parameterName] &&
|
|
190
|
+
!Object.is(this.context[parameterName], '')
|
|
191
|
+
) {
|
|
192
|
+
Object.assign(item.context, {
|
|
193
|
+
[pathName]: this.context[parameterName],
|
|
194
|
+
});
|
|
195
|
+
} else if (arg[parameterName] && !Object.is(arg[parameterName], '')) {
|
|
196
|
+
Object.assign(item.context, {
|
|
197
|
+
[pathName]: arg[parameterName],
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
// 当前视图参数(应用实体视图)
|
|
203
|
+
this.parameters.forEach(parameter => {
|
|
204
|
+
const { parameterName, pathName } = parameter;
|
|
205
|
+
if (arg[parameterName] && !Object.is(arg[parameterName], '')) {
|
|
206
|
+
Object.assign(item.context, {
|
|
207
|
+
[pathName]: arg[parameterName],
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// 当前页面实体主信息
|
|
212
|
+
if (arg.srfmajortext && !Object.is(arg.srfmajortext, '')) {
|
|
213
|
+
Object.assign(item, { srfmajortext: arg.srfmajortext });
|
|
214
|
+
} else if (arg.srfuf === 0) {
|
|
215
|
+
Object.assign(item, { srfmajortext: '草稿--新建' });
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
// 合并视图参数
|
|
220
|
+
Object.assign(item.params, this.params);
|
|
221
|
+
return item;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* 处理数据
|
|
226
|
+
* @param {ControlVO} datas
|
|
227
|
+
* @return {*}
|
|
228
|
+
* @author: zhujiamin
|
|
229
|
+
* @Date: 2023-10-16 15:00:02
|
|
230
|
+
*/
|
|
231
|
+
doItems(datas: ControlVO[]): void {
|
|
232
|
+
datas.forEach((arg: ControlVO) => {
|
|
233
|
+
const item = this.handlePanelItemParams(arg);
|
|
234
|
+
this.state.panelUiItems.push(item);
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* 处理添加
|
|
240
|
+
* @return {*}
|
|
241
|
+
* @author: zhujiamin
|
|
242
|
+
* @Date: 2023-10-16 15:18:01
|
|
243
|
+
*/
|
|
244
|
+
async handleAdd(): Promise<void> {
|
|
245
|
+
this.doItems([{ srfuf: 0 } as ControlVO]);
|
|
246
|
+
if (this.model.panelStyle === 'TAB_TOP') {
|
|
247
|
+
// 上分页添加后激活最后一个
|
|
248
|
+
this.state.activeTab =
|
|
249
|
+
this.state.panelUiItems[this.state.panelUiItems.length - 1].id;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* 处理删除
|
|
255
|
+
* @param {IPanelUiItem} item
|
|
256
|
+
* @return {*}
|
|
257
|
+
* @author: zhujiamin
|
|
258
|
+
* @Date: 2023-10-16 15:23:59
|
|
259
|
+
*/
|
|
260
|
+
async handleDelete(item: IPanelUiItem): Promise<void> {
|
|
261
|
+
// 新建的界面上删除即可
|
|
262
|
+
if (item.data.srfuf === 0) {
|
|
263
|
+
// 删除items中已删除的项
|
|
264
|
+
const index = this.state.panelUiItems.findIndex(value => {
|
|
265
|
+
return value === item;
|
|
266
|
+
});
|
|
267
|
+
this.state.panelUiItems.splice(index, 1);
|
|
268
|
+
} else {
|
|
269
|
+
await this.remove({ data: [item.data] });
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* 处理tab删除
|
|
275
|
+
* @param {IPanelUiItem} item
|
|
276
|
+
* @return {*}
|
|
277
|
+
* @author: zhujiamin
|
|
278
|
+
* @Date: 2023-10-17 14:21:57
|
|
279
|
+
*/
|
|
280
|
+
async handleTabDelete(item: IPanelUiItem, index: number): Promise<void> {
|
|
281
|
+
let isBackToEnd = false;
|
|
282
|
+
// 如果删除的是激活项,且为最后一项,设置激活项为前一项
|
|
283
|
+
if (
|
|
284
|
+
item.id === this.state.activeTab &&
|
|
285
|
+
index === this.state.panelUiItems.length - 1
|
|
286
|
+
) {
|
|
287
|
+
if (index > 0) {
|
|
288
|
+
isBackToEnd = true;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
await this.handleDelete(item);
|
|
292
|
+
if (isBackToEnd) {
|
|
293
|
+
this.state.activeTab =
|
|
294
|
+
this.state.panelUiItems[this.state.panelUiItems.length - 1].id;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* 后台删除结束后界面删除逻辑
|
|
300
|
+
*
|
|
301
|
+
* @author lxm
|
|
302
|
+
* @date 2022-09-06 19:09:10
|
|
303
|
+
* @param {IData} data
|
|
304
|
+
*/
|
|
305
|
+
afterRemove(data: IData): void {
|
|
306
|
+
super.afterRemove(data);
|
|
307
|
+
// 删除this.items里的数据
|
|
308
|
+
const index = this.state.panelUiItems.findIndex(
|
|
309
|
+
item => item.data.srfkey === data.srfkey,
|
|
310
|
+
);
|
|
311
|
+
if (index !== -1) {
|
|
312
|
+
this.state.panelUiItems.splice(index, 1);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* 视图数据变化
|
|
318
|
+
* @param {DataChangeEvent} args
|
|
319
|
+
* @return {*}
|
|
320
|
+
* @author: zhujiamin
|
|
321
|
+
* @Date: 2023-10-16 17:20:45
|
|
322
|
+
*/
|
|
323
|
+
onViewDataChange(args: DataChangeEvent, id: string): void {
|
|
324
|
+
// 新建的保存成功后该部件需要保存来更新数据
|
|
325
|
+
if (args.eventName === 'onSaveSuccess') {
|
|
326
|
+
this.save(args.data[0] as ControlVO, id);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* 保存
|
|
332
|
+
*
|
|
333
|
+
* @param {ControlVO} data
|
|
334
|
+
* @returns {*} {Promise<void>}
|
|
335
|
+
*/
|
|
336
|
+
async save(data: ControlVO, id: string): Promise<void> {
|
|
337
|
+
const panelUiItemIndex = this.state.panelUiItems.findIndex(
|
|
338
|
+
item => item.id === id,
|
|
339
|
+
);
|
|
340
|
+
if (!panelUiItemIndex) {
|
|
341
|
+
throw new RuntimeError('编辑视图面板部件UI数据不存在');
|
|
342
|
+
}
|
|
343
|
+
await this.startLoading();
|
|
344
|
+
let res;
|
|
345
|
+
const isCreate = data.srfuf === Srfuf.CREATE;
|
|
346
|
+
const deName = calcDeCodeNameById(this.model.appDataEntityId!);
|
|
347
|
+
const tempContext = this.context.clone();
|
|
348
|
+
tempContext[deName] = data.srfkey;
|
|
349
|
+
try {
|
|
350
|
+
res = isCreate
|
|
351
|
+
? await this.service.create(tempContext, data)
|
|
352
|
+
: await this.service.update(tempContext, data);
|
|
353
|
+
} catch (error) {
|
|
354
|
+
await this.evt.emit('onSaveError', undefined);
|
|
355
|
+
this.actionNotification(`${isCreate ? 'CREATE' : 'UPDATE'}ERROR`, {
|
|
356
|
+
error: error as Error,
|
|
357
|
+
data: this.state.panelUiItems[panelUiItemIndex].data,
|
|
358
|
+
});
|
|
359
|
+
throw error;
|
|
360
|
+
} finally {
|
|
361
|
+
await this.endLoading();
|
|
362
|
+
}
|
|
363
|
+
// 后续处理
|
|
364
|
+
const index = this.state.items.findIndex(
|
|
365
|
+
item => item.srfkey === data.srfkey,
|
|
366
|
+
);
|
|
367
|
+
this.state.items.splice(index, 1, res.data);
|
|
368
|
+
this.state.panelUiItems.splice(
|
|
369
|
+
panelUiItemIndex,
|
|
370
|
+
1,
|
|
371
|
+
this.handlePanelItemParams(res.data),
|
|
372
|
+
);
|
|
373
|
+
await this.evt.emit('onSaveSuccess', undefined);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IDEMultiEditViewPanel } from '@ibiz/model-core';
|
|
2
|
+
import { MDControlService } from '../../../service';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 多编辑视图面板部件服务
|
|
6
|
+
*
|
|
7
|
+
* @export
|
|
8
|
+
* @extends {MDControlService<IDEMultiEditViewPanel>}
|
|
9
|
+
*/
|
|
10
|
+
export class MEditViewPanelService extends MDControlService<IDEMultiEditViewPanel> {}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { RuntimeModelError } from '@ibiz-template/core';
|
|
2
|
+
import { IAppDEField, ISearchBarFilter } from '@ibiz/model-core';
|
|
3
|
+
import {
|
|
4
|
+
IEditorContainerController,
|
|
5
|
+
IEditorController,
|
|
6
|
+
IEditorProvider,
|
|
7
|
+
} from '../../../interface';
|
|
8
|
+
import { findFieldById } from '../../../model';
|
|
9
|
+
import { getEditorProvider } from '../../../register';
|
|
10
|
+
import { SearchBarController } from './search-bar.controller';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 搜索栏过滤项控制器
|
|
14
|
+
* @author lxm
|
|
15
|
+
* @date 2023-10-12 05:49:19
|
|
16
|
+
* @export
|
|
17
|
+
* @class SearchBarFilterController
|
|
18
|
+
* @implements {IEditorContainerController}
|
|
19
|
+
*/
|
|
20
|
+
export class SearchBarFilterController implements IEditorContainerController {
|
|
21
|
+
unitName: string | undefined;
|
|
22
|
+
|
|
23
|
+
valueFormat: string | undefined;
|
|
24
|
+
|
|
25
|
+
get context(): IContext {
|
|
26
|
+
return this.searchBar.context;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
get params(): IParams {
|
|
30
|
+
return this.searchBar.params;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
dataType: number | undefined;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 编辑器控制器
|
|
37
|
+
*
|
|
38
|
+
* @author lxm
|
|
39
|
+
* @date 2022-08-24 20:08:42
|
|
40
|
+
* @type {IEditorController}
|
|
41
|
+
*/
|
|
42
|
+
editor?: IEditorController;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 编辑器适配器
|
|
46
|
+
*
|
|
47
|
+
* @author lxm
|
|
48
|
+
* @date 2022-08-24 20:08:42
|
|
49
|
+
*/
|
|
50
|
+
editorProvider?: IEditorProvider;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* 过滤的属性名称(有实体属性的是属性codeName小写,没有就是项名称)
|
|
54
|
+
* @author lxm
|
|
55
|
+
* @date 2023-10-13 02:51:39
|
|
56
|
+
* @type {string}
|
|
57
|
+
*/
|
|
58
|
+
fieldName: string;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* 属性显示的标题
|
|
62
|
+
* @author lxm
|
|
63
|
+
* @date 2023-10-13 03:02:42
|
|
64
|
+
* @type {string}
|
|
65
|
+
*/
|
|
66
|
+
label: string;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* 配置的属性搜索模式对应的值操作
|
|
70
|
+
* @author lxm
|
|
71
|
+
* @date 2023-10-13 03:22:10
|
|
72
|
+
* @type {string}
|
|
73
|
+
*/
|
|
74
|
+
valueOP?: string;
|
|
75
|
+
|
|
76
|
+
constructor(
|
|
77
|
+
public model: ISearchBarFilter,
|
|
78
|
+
public searchBar: SearchBarController,
|
|
79
|
+
) {
|
|
80
|
+
// 实体属性
|
|
81
|
+
let field: IAppDEField | undefined;
|
|
82
|
+
if (model.appDEFieldId) {
|
|
83
|
+
field = findFieldById(searchBar.appDataEntity, model.appDEFieldId)!;
|
|
84
|
+
}
|
|
85
|
+
this.fieldName = field ? field.codeName!.toLowerCase() : model.id!;
|
|
86
|
+
|
|
87
|
+
// 属性标题
|
|
88
|
+
this.label = model.caption || field?.logicName || model.id!;
|
|
89
|
+
|
|
90
|
+
this.valueOP = model.defsearchMode?.valueOP;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* 初始化
|
|
95
|
+
* @author lxm
|
|
96
|
+
* @date 2023-10-12 05:47:19
|
|
97
|
+
* @return {*} {Promise<void>}
|
|
98
|
+
*/
|
|
99
|
+
async init(): Promise<void> {
|
|
100
|
+
if (!this.model.editor) {
|
|
101
|
+
throw new RuntimeModelError(this.model, '缺少编辑器模型');
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
this.editorProvider = await getEditorProvider(this.model.editor);
|
|
105
|
+
if (this.editorProvider) {
|
|
106
|
+
this.editor = await this.editorProvider.createController(
|
|
107
|
+
this.model.editor,
|
|
108
|
+
this,
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|