@ibiz-template/runtime 0.5.3-beta.4 → 0.5.3-beta.6
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 +1079 -284
- package/dist/index.system.min.js +1 -1
- package/out/app-hub.d.ts +12 -2
- package/out/app-hub.d.ts.map +1 -1
- package/out/app-hub.js +22 -2
- package/out/command/app/open-app-view/open-app-view.js +2 -2
- package/out/controller/constant/control/index.d.ts +1 -0
- package/out/controller/constant/control/index.d.ts.map +1 -1
- package/out/controller/constant/control/index.js +1 -0
- package/out/controller/constant/control/tree-grid-ex/tree-grid-ex-notify.state.d.ts +5 -0
- package/out/controller/constant/control/tree-grid-ex/tree-grid-ex-notify.state.d.ts.map +1 -0
- package/out/controller/constant/control/tree-grid-ex/tree-grid-ex-notify.state.js +6 -0
- package/out/controller/control/form/form/form.controller.d.ts.map +1 -1
- package/out/controller/control/form/form/form.controller.js +4 -1
- package/out/controller/control/tree-grid-ex/tree-grid-ex-column/index.d.ts +1 -0
- package/out/controller/control/tree-grid-ex/tree-grid-ex-column/index.d.ts.map +1 -1
- package/out/controller/control/tree-grid-ex/tree-grid-ex-column/index.js +1 -0
- package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-column/tree-grid-ex-column.controller.d.ts +10 -0
- package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-column/tree-grid-ex-column.controller.d.ts.map +1 -1
- package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-column/tree-grid-ex-column.controller.js +12 -0
- package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-field-column/tree-grid-ex-field-column.controller.d.ts +34 -0
- package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-field-column/tree-grid-ex-field-column.controller.d.ts.map +1 -1
- package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-field-column/tree-grid-ex-field-column.controller.js +68 -0
- package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-field-column/tree-grid-ex-node-column.controller.d.ts +205 -0
- package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-field-column/tree-grid-ex-node-column.controller.d.ts.map +1 -0
- package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-field-column/tree-grid-ex-node-column.controller.js +345 -0
- package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-ua-column/tree-grid-ex-ua-column.controller.d.ts +3 -0
- package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-ua-column/tree-grid-ex-ua-column.controller.d.ts.map +1 -1
- package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-ua-column/tree-grid-ex-ua-column.controller.js +14 -1
- package/out/controller/control/tree-grid-ex/tree-grid-ex-row.state.d.ts +16 -8
- package/out/controller/control/tree-grid-ex/tree-grid-ex-row.state.d.ts.map +1 -1
- package/out/controller/control/tree-grid-ex/tree-grid-ex-row.state.js +26 -12
- package/out/controller/control/tree-grid-ex/tree-grid-ex.controller.d.ts +59 -0
- package/out/controller/control/tree-grid-ex/tree-grid-ex.controller.d.ts.map +1 -1
- package/out/controller/control/tree-grid-ex/tree-grid-ex.controller.js +238 -1
- package/out/interface/common/i-app-hub-service/i-app-hub-service.d.ts +4 -3
- package/out/interface/common/i-app-hub-service/i-app-hub-service.d.ts.map +1 -1
- package/out/interface/controller/controller/control/i-tree-grid-ex.controller.d.ts +23 -1
- package/out/interface/controller/controller/control/i-tree-grid-ex.controller.d.ts.map +1 -1
- package/out/interface/controller/event/control/i-tree-grid-ex.event.d.ts +17 -0
- package/out/interface/controller/event/control/i-tree-grid-ex.event.d.ts.map +1 -1
- package/out/interface/controller/state/control/i-tree-grid-ex.state.d.ts +60 -2
- package/out/interface/controller/state/control/i-tree-grid-ex.state.d.ts.map +1 -1
- package/out/interface/provider/i-async-action.provider.d.ts +3 -2
- package/out/interface/provider/i-async-action.provider.d.ts.map +1 -1
- package/out/register/helper/app-menu-item-register.d.ts.map +1 -1
- package/out/register/helper/app-menu-item-register.js +1 -6
- package/out/register/helper/panel-item-register.d.ts.map +1 -1
- package/out/register/helper/panel-item-register.js +36 -30
- package/out/service/dto/method.dto.d.ts +0 -9
- package/out/service/dto/method.dto.d.ts.map +1 -1
- package/out/service/dto/method.dto.js +8 -13
- package/out/service/service/entity/method/fetch.d.ts.map +1 -1
- package/out/service/service/entity/method/fetch.js +22 -20
- package/out/service/utils/dynamic-code-list/dynamic-code-list.d.ts +1 -1
- package/out/service/utils/dynamic-code-list/dynamic-code-list.d.ts.map +1 -1
- package/out/service/utils/dynamic-code-list/dynamic-code-list.js +25 -26
- package/out/service/vo/tree-node-data/tree-data-set-node-data.d.ts +6 -0
- package/out/service/vo/tree-node-data/tree-data-set-node-data.d.ts.map +1 -1
- package/out/service/vo/tree-node-data/tree-data-set-node-data.js +93 -41
- package/out/utils/ui-domain/ui-domain.d.ts +32 -6
- package/out/utils/ui-domain/ui-domain.d.ts.map +1 -1
- package/out/utils/ui-domain/ui-domain.js +46 -9
- package/package.json +4 -4
- package/src/app-hub.ts +27 -2
- package/src/command/app/open-app-view/open-app-view.ts +2 -2
- package/src/controller/constant/control/index.ts +1 -0
- package/src/controller/constant/control/tree-grid-ex/tree-grid-ex-notify.state.ts +5 -0
- package/src/controller/control/form/form/form.controller.ts +11 -1
- package/src/controller/control/tree-grid-ex/tree-grid-ex-column/index.ts +1 -0
- package/src/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-column/tree-grid-ex-column.controller.ts +22 -0
- package/src/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-field-column/tree-grid-ex-field-column.controller.ts +88 -2
- package/src/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-field-column/tree-grid-ex-node-column.controller.ts +522 -0
- package/src/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-ua-column/tree-grid-ex-ua-column.controller.ts +18 -1
- package/src/controller/control/tree-grid-ex/tree-grid-ex-row.state.ts +43 -12
- package/src/controller/control/tree-grid-ex/tree-grid-ex.controller.ts +296 -1
- package/src/interface/common/i-app-hub-service/i-app-hub-service.ts +4 -3
- package/src/interface/controller/controller/control/i-tree-grid-ex.controller.ts +27 -2
- package/src/interface/controller/event/control/i-tree-grid-ex.event.ts +15 -1
- package/src/interface/controller/state/control/i-tree-grid-ex.state.ts +64 -2
- package/src/interface/provider/i-async-action.provider.ts +3 -2
- package/src/register/helper/app-menu-item-register.ts +1 -5
- package/src/register/helper/panel-item-register.ts +43 -37
- package/src/service/dto/method.dto.ts +8 -14
- package/src/service/service/entity/method/fetch.ts +26 -25
- package/src/service/utils/dynamic-code-list/dynamic-code-list.ts +24 -32
- package/src/service/vo/tree-node-data/tree-data-set-node-data.ts +111 -46
- package/src/utils/ui-domain/ui-domain.ts +49 -9
|
@@ -46,7 +46,8 @@ export async function getPanelItemProvider(
|
|
|
46
46
|
model: IPanelItem,
|
|
47
47
|
): Promise<IPanelItemProvider | undefined> {
|
|
48
48
|
let provider: IPanelItemProvider | undefined;
|
|
49
|
-
const { itemType, sysPFPluginId, appId } =
|
|
49
|
+
const { itemType, sysPFPluginId, appId, controlRenders } =
|
|
50
|
+
model as Required<IPanelItem>;
|
|
50
51
|
|
|
51
52
|
// 找插件适配器
|
|
52
53
|
if (sysPFPluginId) {
|
|
@@ -60,50 +61,55 @@ export async function getPanelItemProvider(
|
|
|
60
61
|
return provider;
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (itemType === 'RAWITEM') {
|
|
81
|
-
const predefinedType =
|
|
82
|
-
(model as IPanelRawItem).rawItem?.predefinedType || 'DEFAULT';
|
|
83
|
-
const key = `RAWITEM_${predefinedType}`;
|
|
84
|
-
provider = getProvider(key);
|
|
85
|
-
if (!provider) {
|
|
86
|
-
ibiz.log.error(
|
|
87
|
-
`找不到面板成员直接内容预置类型为${predefinedType}的适配器,注册key为${key}`,
|
|
88
|
-
);
|
|
89
|
-
} else {
|
|
90
|
-
return provider;
|
|
64
|
+
if (controlRenders && controlRenders.length > 0) {
|
|
65
|
+
// 默认预定义 绘制器
|
|
66
|
+
provider = getProvider('PREDEFINE_RENDER');
|
|
67
|
+
} else {
|
|
68
|
+
// 特殊容器类型
|
|
69
|
+
if (itemType === 'CONTAINER') {
|
|
70
|
+
const predefinedType =
|
|
71
|
+
(model as IPanelContainer).predefinedType || 'DEFAULT';
|
|
72
|
+
const key = `CONTAINER_${predefinedType}`;
|
|
73
|
+
provider = getProvider(key);
|
|
74
|
+
if (!provider) {
|
|
75
|
+
ibiz.log.error(
|
|
76
|
+
`找不到面板容器预置类型为${predefinedType}的适配器,注册key为${key}`,
|
|
77
|
+
);
|
|
78
|
+
} else {
|
|
79
|
+
return provider;
|
|
80
|
+
}
|
|
91
81
|
}
|
|
92
|
-
}
|
|
93
82
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
83
|
+
// 特殊直接内容类型
|
|
84
|
+
if (itemType === 'RAWITEM') {
|
|
85
|
+
const predefinedType =
|
|
86
|
+
(model as IPanelRawItem).rawItem?.predefinedType || 'DEFAULT';
|
|
87
|
+
const key = `RAWITEM_${predefinedType}`;
|
|
98
88
|
provider = getProvider(key);
|
|
99
|
-
if (provider) {
|
|
89
|
+
if (!provider) {
|
|
90
|
+
ibiz.log.error(
|
|
91
|
+
`找不到面板成员直接内容预置类型为${predefinedType}的适配器,注册key为${key}`,
|
|
92
|
+
);
|
|
93
|
+
} else {
|
|
100
94
|
return provider;
|
|
101
95
|
}
|
|
102
96
|
}
|
|
97
|
+
|
|
98
|
+
if (itemType === 'FIELD') {
|
|
99
|
+
const { editor } = model as IPanelField;
|
|
100
|
+
if (editor && editor.predefinedType) {
|
|
101
|
+
const key = `FIELD_${editor.predefinedType.toUpperCase()}`;
|
|
102
|
+
provider = getProvider(key);
|
|
103
|
+
if (provider) {
|
|
104
|
+
return provider;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// 找面板成员类型
|
|
110
|
+
provider = getProvider(itemType);
|
|
103
111
|
}
|
|
104
112
|
|
|
105
|
-
// 找面板成员类型
|
|
106
|
-
provider = getProvider(itemType);
|
|
107
113
|
if (!provider) {
|
|
108
114
|
ibiz.log.error(`找不到面板成员类型${itemType}对应的适配器`);
|
|
109
115
|
} else {
|
|
@@ -28,16 +28,6 @@ export class MethodDto {
|
|
|
28
28
|
|
|
29
29
|
protected dtoMap: Map<string, MethodDto> = new Map();
|
|
30
30
|
|
|
31
|
-
/**
|
|
32
|
-
* 当前 DTO 是否已经计算过关系相关逻辑
|
|
33
|
-
*
|
|
34
|
-
* @link this.calcRs
|
|
35
|
-
* @author chitanda
|
|
36
|
-
* @date 2023-12-26 16:12:18
|
|
37
|
-
* @protected
|
|
38
|
-
*/
|
|
39
|
-
protected isCalcRs = false;
|
|
40
|
-
|
|
41
31
|
/**
|
|
42
32
|
* Creates an instance of MethodDto.
|
|
43
33
|
* @author lxm
|
|
@@ -208,7 +198,12 @@ export class MethodDto {
|
|
|
208
198
|
if (this.isLocalMode && !this.inSelfLoop) {
|
|
209
199
|
this.service.local.clear();
|
|
210
200
|
}
|
|
211
|
-
|
|
201
|
+
const uiDomain = ibiz.uiDomainManager.get(context.srfsessionid);
|
|
202
|
+
if (uiDomain && uiDomain.state.rsInit !== true) {
|
|
203
|
+
await this.calcRs(context);
|
|
204
|
+
uiDomain.calcParentRs();
|
|
205
|
+
uiDomain.state.rsInit = true;
|
|
206
|
+
}
|
|
212
207
|
return Promise.all(
|
|
213
208
|
data.map(async datum => {
|
|
214
209
|
const all = this.fields
|
|
@@ -224,7 +219,7 @@ export class MethodDto {
|
|
|
224
219
|
}
|
|
225
220
|
const dto = await this.getFieldDto(context, field);
|
|
226
221
|
const items: IData[] = datum[key];
|
|
227
|
-
if (items) {
|
|
222
|
+
if (items && items.length > 0) {
|
|
228
223
|
const pKey = datum[this.entity.keyAppDEFieldId!];
|
|
229
224
|
if (field.refPickupAppDEFieldId) {
|
|
230
225
|
// 特殊处理,在子包内设置父对象标识
|
|
@@ -263,10 +258,9 @@ export class MethodDto {
|
|
|
263
258
|
* @return {*} {Promise<void>}
|
|
264
259
|
*/
|
|
265
260
|
protected async calcRs(context: IContext, depth: number = 0): Promise<void> {
|
|
266
|
-
if (
|
|
261
|
+
if (depth > 10) {
|
|
267
262
|
return;
|
|
268
263
|
}
|
|
269
|
-
this.isCalcRs = true;
|
|
270
264
|
depth += 1;
|
|
271
265
|
|
|
272
266
|
const uiDomain = ibiz.uiDomainManager.get(context.srfsessionid);
|
|
@@ -32,40 +32,41 @@ export class FetchMethod extends Method {
|
|
|
32
32
|
// 过滤参数,必须是对象
|
|
33
33
|
const searchParams = params && !isArray(params) ? params : params2 || {};
|
|
34
34
|
|
|
35
|
+
// 根据数据集合来源查询数据
|
|
36
|
+
let res: HttpResponse<IData[]>;
|
|
37
|
+
|
|
35
38
|
if (this.isLocalMode) {
|
|
36
39
|
const cond = DEDQCondUtil.getCond(this.method);
|
|
37
40
|
const items = await this.searchLocal(
|
|
38
41
|
cond,
|
|
39
42
|
new SearchFilter(context, searchParams),
|
|
40
43
|
);
|
|
41
|
-
|
|
42
|
-
}
|
|
44
|
+
res = new HttpResponse<IDataEntity[]>(items, 200);
|
|
45
|
+
} else {
|
|
46
|
+
switch (this.method.dataSetType) {
|
|
47
|
+
case 'INDEXDE':
|
|
48
|
+
case 'CODELIST':
|
|
49
|
+
case 'MULTIFORM':
|
|
50
|
+
res = await this.fetchCodeListSet(context, searchParams);
|
|
51
|
+
break;
|
|
52
|
+
case 'REMOTE':
|
|
53
|
+
{
|
|
54
|
+
const path = this.calcPath(context);
|
|
55
|
+
res = await this.request(path, context, params, params2);
|
|
56
|
+
}
|
|
57
|
+
break;
|
|
58
|
+
default:
|
|
59
|
+
throw new ModelError(
|
|
60
|
+
this.method,
|
|
61
|
+
`数据来源类型${this.method.dataSetType}暂未支持`,
|
|
62
|
+
);
|
|
63
|
+
}
|
|
43
64
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
case 'INDEXDE':
|
|
48
|
-
case 'CODELIST':
|
|
49
|
-
case 'MULTIFORM':
|
|
50
|
-
res = await this.fetchCodeListSet(context, searchParams);
|
|
51
|
-
break;
|
|
52
|
-
case 'REMOTE':
|
|
53
|
-
{
|
|
54
|
-
const path = this.calcPath(context);
|
|
55
|
-
res = await this.request(path, context, params, params2);
|
|
56
|
-
}
|
|
57
|
-
break;
|
|
58
|
-
default:
|
|
59
|
-
throw new ModelError(
|
|
60
|
-
this.method,
|
|
61
|
-
`数据来源类型${this.method.dataSetType}暂未支持`,
|
|
62
|
-
);
|
|
65
|
+
// 转换实体对象
|
|
66
|
+
const items: IData[] = res.data || [];
|
|
67
|
+
res.data = items.map(item => this.createEntity(item));
|
|
63
68
|
}
|
|
64
69
|
|
|
65
|
-
// 转换实体对象
|
|
66
|
-
const items: IData[] = res.data || [];
|
|
67
|
-
res.data = items.map(item => this.createEntity(item));
|
|
68
|
-
|
|
69
70
|
// 计算属性逻辑,每条数据走一遍
|
|
70
71
|
if (res.data) {
|
|
71
72
|
await execFieldLogics(
|
|
@@ -262,16 +262,16 @@ export class DynamicCodeListCache {
|
|
|
262
262
|
);
|
|
263
263
|
let resultItems: CodeListItem[] = [];
|
|
264
264
|
if (res.data.length) {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
resultItems = tempItems;
|
|
270
|
-
}
|
|
271
|
-
} else {
|
|
272
|
-
resultItems.push(this.convertData(item));
|
|
265
|
+
if (pvalueAppDEFieldId) {
|
|
266
|
+
const tempItems = this.prepareTreeData(res.data as IData[]);
|
|
267
|
+
if (tempItems) {
|
|
268
|
+
resultItems = tempItems;
|
|
273
269
|
}
|
|
274
|
-
}
|
|
270
|
+
} else {
|
|
271
|
+
res.data.forEach((item: IData) => {
|
|
272
|
+
resultItems.push(this.convertData(item));
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
275
|
}
|
|
276
276
|
return Object.freeze(resultItems) as CodeListItem[];
|
|
277
277
|
}
|
|
@@ -281,31 +281,23 @@ export class DynamicCodeListCache {
|
|
|
281
281
|
*
|
|
282
282
|
* @return {codeListItem[] | undefined}
|
|
283
283
|
*/
|
|
284
|
-
protected prepareTreeData(
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
filteredData = items.filter(item => {
|
|
291
|
-
if (pValue) {
|
|
292
|
-
// 有传父value去后台数据里找出来子项pValue等于父value的
|
|
293
|
-
return item[pvalueAppDEFieldId!] === pValue;
|
|
294
|
-
}
|
|
295
|
-
// 没有传父value,只需要找出来没有父值属性的
|
|
296
|
-
return !item[pvalueAppDEFieldId!];
|
|
284
|
+
protected prepareTreeData(items: IData[]): CodeListItem[] | undefined {
|
|
285
|
+
const { valueAppDEFieldId, pvalueAppDEFieldId } = this.codeList;
|
|
286
|
+
const map: { [id: string]: CodeListItem } = {};
|
|
287
|
+
const nestedList: CodeListItem[] = [];
|
|
288
|
+
items.forEach((data: IData) => {
|
|
289
|
+
map[data[valueAppDEFieldId as string]] = this.convertData(data);
|
|
297
290
|
});
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
);
|
|
307
|
-
return tempCodeListItem;
|
|
291
|
+
items.forEach((data: IData) => {
|
|
292
|
+
const parent = map[data[pvalueAppDEFieldId as string]];
|
|
293
|
+
if (parent) {
|
|
294
|
+
parent.children = parent.children || [];
|
|
295
|
+
parent.children.push(map[data[valueAppDEFieldId as string]]);
|
|
296
|
+
} else {
|
|
297
|
+
nestedList.push(map[data[valueAppDEFieldId as string]]);
|
|
298
|
+
}
|
|
308
299
|
});
|
|
300
|
+
return nestedList;
|
|
309
301
|
}
|
|
310
302
|
|
|
311
303
|
/**
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
/* eslint-disable no-constructor-return */
|
|
2
2
|
import { IDETreeDataSetNode, IDETreeNodeDataItem } from '@ibiz/model-core';
|
|
3
3
|
import { updateKeyDefine } from '@ibiz-template/core';
|
|
4
|
-
import { isNil } from 'ramda';
|
|
4
|
+
import { clone, isNil } from 'ramda';
|
|
5
5
|
import { IIcon, ITreeNodeData } from '../../../interface';
|
|
6
6
|
import { calcDeCodeNameById } from '../../../model';
|
|
7
7
|
import { ScriptFactory } from '../../../utils';
|
|
8
8
|
import { TreeNodeData } from './tree-node-data';
|
|
9
9
|
import { fieldValueToBoolean } from '../../utils';
|
|
10
10
|
|
|
11
|
+
/** 克隆时赋值排除的字段 */
|
|
12
|
+
const CloneExcludeKeys = ['_id', '_value', '_text', '_deData', 'clone'];
|
|
13
|
+
|
|
11
14
|
/**
|
|
12
15
|
* 实体数据集树节点数据
|
|
13
16
|
*
|
|
@@ -17,13 +20,20 @@ import { fieldValueToBoolean } from '../../utils';
|
|
|
17
20
|
* @implements {ITreeNodeData}
|
|
18
21
|
*/
|
|
19
22
|
export class TreeDataSetNodeData extends TreeNodeData implements ITreeNodeData {
|
|
20
|
-
_text: string;
|
|
23
|
+
declare _text: string;
|
|
24
|
+
|
|
25
|
+
declare _id: string;
|
|
21
26
|
|
|
22
|
-
|
|
27
|
+
declare _value: string;
|
|
23
28
|
|
|
24
|
-
|
|
29
|
+
declare _deData: IData;
|
|
25
30
|
|
|
26
|
-
|
|
31
|
+
/**
|
|
32
|
+
* 克隆方法
|
|
33
|
+
* @author lxm
|
|
34
|
+
* @date 2024-01-12 02:37:46
|
|
35
|
+
*/
|
|
36
|
+
declare clone: () => TreeDataSetNodeData;
|
|
27
37
|
|
|
28
38
|
constructor(
|
|
29
39
|
model: IDETreeDataSetNode,
|
|
@@ -38,12 +48,6 @@ export class TreeDataSetNodeData extends TreeNodeData implements ITreeNodeData {
|
|
|
38
48
|
super(model, parentNodeData, opts);
|
|
39
49
|
const { data } = opts;
|
|
40
50
|
this._deData = data;
|
|
41
|
-
this._text = model.textAppDEFieldId
|
|
42
|
-
? data[model.textAppDEFieldId]
|
|
43
|
-
: data.srfmajortext;
|
|
44
|
-
this._value = model.idAppDEFieldId
|
|
45
|
-
? data[model.idAppDEFieldId]
|
|
46
|
-
: data.srfkey;
|
|
47
51
|
|
|
48
52
|
// id小写
|
|
49
53
|
const selfId = `${model.id}@${data.srfkey}`.toLowerCase();
|
|
@@ -55,6 +59,26 @@ export class TreeDataSetNodeData extends TreeNodeData implements ITreeNodeData {
|
|
|
55
59
|
configurable: true,
|
|
56
60
|
});
|
|
57
61
|
|
|
62
|
+
// 文本值
|
|
63
|
+
Object.defineProperty(this, '_text', {
|
|
64
|
+
get() {
|
|
65
|
+
return model.textAppDEFieldId
|
|
66
|
+
? data[model.textAppDEFieldId]
|
|
67
|
+
: data.srfmajortext;
|
|
68
|
+
},
|
|
69
|
+
enumerable: true,
|
|
70
|
+
configurable: true,
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// value值
|
|
74
|
+
Object.defineProperty(this, '_value', {
|
|
75
|
+
get() {
|
|
76
|
+
return model.idAppDEFieldId ? data[model.idAppDEFieldId] : data.srfkey;
|
|
77
|
+
},
|
|
78
|
+
enumerable: true,
|
|
79
|
+
configurable: true,
|
|
80
|
+
});
|
|
81
|
+
|
|
58
82
|
// 实体节点额外添加上自己的实体上下文
|
|
59
83
|
if (model.appDataEntityId) {
|
|
60
84
|
const deName = calcDeCodeNameById(model.appDataEntityId);
|
|
@@ -73,22 +97,21 @@ export class TreeDataSetNodeData extends TreeNodeData implements ITreeNodeData {
|
|
|
73
97
|
|
|
74
98
|
/** 数据项和实体属性映射 */
|
|
75
99
|
const dataItemKeyMap = new Map<string | symbol, string | symbol>();
|
|
76
|
-
|
|
77
|
-
dataItemKeyMap.set('srfmajortext', 'srfmajortext');
|
|
78
|
-
|
|
100
|
+
const dataItemDefaultMap = new Map<string | symbol, unknown>();
|
|
79
101
|
model.detreeNodeDataItems?.forEach(dataItem => {
|
|
80
|
-
const
|
|
81
|
-
|
|
102
|
+
const dataItemKey = dataItem.id!.toLowerCase();
|
|
103
|
+
|
|
104
|
+
// *后台实体属性
|
|
82
105
|
const deFieldKey = dataItem.appDEFieldId!.toLowerCase();
|
|
83
|
-
dataItemKeyMap.set(
|
|
106
|
+
dataItemKeyMap.set(dataItemKey, deFieldKey);
|
|
84
107
|
|
|
85
108
|
// *设置默认值
|
|
86
|
-
if (dataItem.defaultValue
|
|
87
|
-
|
|
109
|
+
if (dataItem.defaultValue) {
|
|
110
|
+
dataItemDefaultMap.set(dataItemKey, dataItem.defaultValue);
|
|
88
111
|
}
|
|
89
112
|
});
|
|
90
113
|
|
|
91
|
-
/**
|
|
114
|
+
/** 表格列和数据项的映射 */
|
|
92
115
|
const nodeColumnKeyMap = new Map<string | symbol, string | symbol>();
|
|
93
116
|
model.detreeNodeColumns?.forEach(column => {
|
|
94
117
|
const columnKey = column.detreeColumnId!; // 不配树表格列不会有这个模型
|
|
@@ -96,45 +119,87 @@ export class TreeDataSetNodeData extends TreeNodeData implements ITreeNodeData {
|
|
|
96
119
|
if (!columnKey || !dataItemKey) {
|
|
97
120
|
ibiz.log.error('模型异常缺少detreeColumnId或者dataItemName', column);
|
|
98
121
|
} else {
|
|
99
|
-
nodeColumnKeyMap.set(columnKey,
|
|
122
|
+
nodeColumnKeyMap.set(columnKey, dataItemKey);
|
|
100
123
|
}
|
|
101
124
|
});
|
|
102
125
|
|
|
126
|
+
/**
|
|
127
|
+
* 获取对应key最终映射的实体属性字段,undefined就是没有映射实体属性
|
|
128
|
+
* @author lxm
|
|
129
|
+
* @date 2024-01-12 01:48:09
|
|
130
|
+
* @param {(string | symbol)} key
|
|
131
|
+
* @return {*} {(string | symbol | undefined)}
|
|
132
|
+
*/
|
|
133
|
+
const getDeKey = (key: string | symbol): string | symbol | undefined => {
|
|
134
|
+
// 表格列映射的实体数据属性名称
|
|
135
|
+
if (nodeColumnKeyMap.has(key)) {
|
|
136
|
+
return dataItemKeyMap.get(nodeColumnKeyMap.get(key)!);
|
|
137
|
+
}
|
|
138
|
+
// 数据项映射的实体数据属性名称
|
|
139
|
+
if (dataItemKeyMap.has(key)) {
|
|
140
|
+
return dataItemKeyMap.get(key);
|
|
141
|
+
}
|
|
142
|
+
// 实体属性上可枚举的属性,返回该属性名称
|
|
143
|
+
if (Object.prototype.hasOwnProperty.call(this._deData, key)) {
|
|
144
|
+
return key;
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* 获取对应属性的默认值,纯显示用的
|
|
150
|
+
* @author lxm
|
|
151
|
+
* @date 2024-01-12 02:36:53
|
|
152
|
+
* @param {(string | symbol)} key
|
|
153
|
+
* @return {*} {unknown}
|
|
154
|
+
*/
|
|
155
|
+
const getKeyDefault = (key: string | symbol): unknown => {
|
|
156
|
+
// 表格列映射的数据项的默认值
|
|
157
|
+
if (nodeColumnKeyMap.has(key)) {
|
|
158
|
+
return dataItemDefaultMap.get(nodeColumnKeyMap.get(key)!);
|
|
159
|
+
}
|
|
160
|
+
// 数据项映射的默认值
|
|
161
|
+
if (dataItemDefaultMap.has(key)) {
|
|
162
|
+
return dataItemDefaultMap.get(key);
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
this.clone = (): TreeDataSetNodeData => {
|
|
167
|
+
const cloneData = clone(this._deData);
|
|
168
|
+
const cloneNodeData = new TreeDataSetNodeData(model, this._parent, {
|
|
169
|
+
data: cloneData,
|
|
170
|
+
leaf: this._leaf,
|
|
171
|
+
navContext: this._context,
|
|
172
|
+
navParams: this._params,
|
|
173
|
+
});
|
|
174
|
+
Object.keys(this).forEach(key => {
|
|
175
|
+
const deKey = getDeKey(key);
|
|
176
|
+
// 非实体的映射属性,且不是排除的属性时,从原来那边赋值过来
|
|
177
|
+
if (isNil(deKey) && !CloneExcludeKeys.includes(key)) {
|
|
178
|
+
(cloneNodeData as IData)[key] = (this as IData)[key];
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
return cloneNodeData;
|
|
182
|
+
};
|
|
183
|
+
|
|
103
184
|
return new Proxy<TreeDataSetNodeData>(this, {
|
|
104
185
|
set(target, p, value): boolean {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
target._deData[
|
|
108
|
-
} else if (dataItemKeyMap.has(p)) {
|
|
109
|
-
// 通过树节点数据项标识设置
|
|
110
|
-
target._deData[dataItemKeyMap.get(p)!] = value;
|
|
111
|
-
} else if (Object.prototype.hasOwnProperty.call(target._deData, p)) {
|
|
112
|
-
// 通过实体数据属性标识设置
|
|
113
|
-
target._deData[p] = value;
|
|
186
|
+
const deKey = getDeKey(p);
|
|
187
|
+
if (!isNil(deKey)) {
|
|
188
|
+
target._deData[deKey] = value;
|
|
114
189
|
} else {
|
|
115
190
|
(target as IData)[p] = value;
|
|
116
191
|
}
|
|
117
192
|
return true;
|
|
118
193
|
},
|
|
119
|
-
|
|
120
194
|
get(target, p, _receiver): unknown {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
return target._deData[nodeColumnKeyMap.get(p)!];
|
|
127
|
-
}
|
|
128
|
-
// 通过树节点数据项标识获取
|
|
129
|
-
if (dataItemKeyMap.has(p)) {
|
|
130
|
-
return target._deData[dataItemKeyMap.get(p)!];
|
|
131
|
-
}
|
|
132
|
-
// 通过实体数据属性标识获取
|
|
133
|
-
if (target._deData[p] !== undefined) {
|
|
134
|
-
return target._deData[p];
|
|
195
|
+
const deKey = getDeKey(p);
|
|
196
|
+
if (!isNil(deKey)) {
|
|
197
|
+
return isNil(target._deData[deKey])
|
|
198
|
+
? getKeyDefault(p)
|
|
199
|
+
: target._deData[deKey];
|
|
135
200
|
}
|
|
201
|
+
return (target as IData)[p];
|
|
136
202
|
},
|
|
137
|
-
|
|
138
203
|
ownKeys(target): ArrayLike<string | symbol> {
|
|
139
204
|
// 整合所有并排除重复
|
|
140
205
|
const allKeys = [
|
|
@@ -20,15 +20,34 @@ export class UIDomain {
|
|
|
20
20
|
readonly id: string;
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* 状态
|
|
24
|
+
*
|
|
25
|
+
* @author chitanda
|
|
26
|
+
* @date 2024-01-15 19:01:51
|
|
27
|
+
* @type {{ rsInit: boolean }} 关系是否已经初始化
|
|
28
|
+
*/
|
|
29
|
+
readonly state: { rsInit: boolean } = { rsInit: false };
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* DTO 子父关系映射
|
|
24
33
|
*
|
|
25
34
|
* @author chitanda
|
|
26
35
|
* @date 2023-12-26 15:12:13
|
|
27
36
|
* @protected
|
|
28
|
-
* @type {Map<string, IAppDERS[]>}
|
|
37
|
+
* @type {Map<string, IAppDERS[]>} Map<子实体, 当前实体的父关系>
|
|
29
38
|
*/
|
|
30
39
|
protected rsMap: Map<string, IAppDERS[]> = new Map();
|
|
31
40
|
|
|
41
|
+
/**
|
|
42
|
+
* DTO 父子关系映射
|
|
43
|
+
*
|
|
44
|
+
* @author chitanda
|
|
45
|
+
* @date 2024-01-15 17:01:42
|
|
46
|
+
* @protected
|
|
47
|
+
* @type {Map<string, IAppDERS[]>}
|
|
48
|
+
*/
|
|
49
|
+
protected rs2Map: Map<string, IAppDERS[]> = new Map();
|
|
50
|
+
|
|
32
51
|
/**
|
|
33
52
|
* Creates an instance of UIDomain.
|
|
34
53
|
*
|
|
@@ -50,11 +69,11 @@ export class UIDomain {
|
|
|
50
69
|
*
|
|
51
70
|
* @author chitanda
|
|
52
71
|
* @date 2023-12-26 15:12:31
|
|
53
|
-
* @param {string}
|
|
72
|
+
* @param {string} appDataEntityId
|
|
54
73
|
* @param {IAppDERS} configs
|
|
55
74
|
*/
|
|
56
|
-
setDERConfig(
|
|
57
|
-
this.rsMap.set(
|
|
75
|
+
setDERConfig(appDataEntityId: string, configs: IAppDERS[]): void {
|
|
76
|
+
this.rsMap.set(appDataEntityId, configs);
|
|
58
77
|
}
|
|
59
78
|
|
|
60
79
|
/**
|
|
@@ -62,16 +81,37 @@ export class UIDomain {
|
|
|
62
81
|
*
|
|
63
82
|
* @author chitanda
|
|
64
83
|
* @date 2023-12-26 16:12:07
|
|
65
|
-
* @param {string}
|
|
84
|
+
* @param {string} appDataEntityId
|
|
66
85
|
* @return {*} {IAppDERS[]}
|
|
67
86
|
*/
|
|
68
|
-
getDERConfig(
|
|
69
|
-
if (this.rsMap.has(
|
|
70
|
-
return this.rsMap.get(
|
|
87
|
+
getDERConfig(appDataEntityId: string): IAppDERS[] {
|
|
88
|
+
if (this.rsMap.has(appDataEntityId)) {
|
|
89
|
+
return this.rsMap.get(appDataEntityId)!;
|
|
71
90
|
}
|
|
72
91
|
return [];
|
|
73
92
|
}
|
|
74
93
|
|
|
94
|
+
/**
|
|
95
|
+
* 根据模型给的子实体中的父关系模型,计算每个实体的子关系模型
|
|
96
|
+
*
|
|
97
|
+
* @author chitanda
|
|
98
|
+
* @date 2024-01-15 19:01:49
|
|
99
|
+
*/
|
|
100
|
+
calcParentRs(): void {
|
|
101
|
+
this.rs2Map.clear();
|
|
102
|
+
this.rsMap.forEach((configs, appDataEntityId) => {
|
|
103
|
+
configs.forEach(config => {
|
|
104
|
+
config.minorAppDataEntityId = appDataEntityId;
|
|
105
|
+
const major = config.majorAppDataEntityId!;
|
|
106
|
+
if (!this.rs2Map.has(major)) {
|
|
107
|
+
this.rs2Map.set(major, []);
|
|
108
|
+
}
|
|
109
|
+
this.rs2Map.get(major)!.push(config);
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
console.log(Array.from(this.rs2Map.values()));
|
|
113
|
+
}
|
|
114
|
+
|
|
75
115
|
/**
|
|
76
116
|
* 界面域销毁
|
|
77
117
|
*
|