@ibiz-template/runtime 0.5.3-beta.8 → 0.5.3
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 +832 -333
- package/dist/index.system.min.js +1 -1
- package/out/controller/common/view/view.controller.d.ts.map +1 -1
- package/out/controller/common/view/view.controller.js +2 -0
- package/out/controller/control/form/edit-form/edit-form.controller.js +1 -1
- package/out/controller/control/form/form-detail/form-detail/form-detail.controller.d.ts.map +1 -1
- package/out/controller/control/form/form-detail/form-detail/form-detail.controller.js +4 -0
- package/out/controller/control/form/form-detail/form-tab-page/form-tab-page.controller.d.ts +8 -0
- package/out/controller/control/form/form-detail/form-tab-page/form-tab-page.controller.d.ts.map +1 -1
- package/out/controller/control/form/form-detail/form-tab-page/form-tab-page.controller.js +10 -0
- package/out/controller/control/form/form-detail/form-tab-panel/form-tab-panel.controller.d.ts +8 -0
- package/out/controller/control/form/form-detail/form-tab-panel/form-tab-panel.controller.d.ts.map +1 -1
- package/out/controller/control/form/form-detail/form-tab-panel/form-tab-panel.controller.js +15 -0
- package/out/controller/control/form/form-detail/form-tab-panel/form-tab-panel.state.d.ts +7 -0
- package/out/controller/control/form/form-detail/form-tab-panel/form-tab-panel.state.d.ts.map +1 -1
- package/out/controller/control/form/form-detail/form-tab-panel/form-tab-panel.state.js +10 -0
- package/out/controller/control/grid/grid/grid.service.d.ts.map +1 -1
- package/out/controller/control/grid/grid/grid.service.js +1 -10
- package/out/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.d.ts +7 -0
- package/out/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.d.ts.map +1 -1
- package/out/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.js +11 -2
- package/out/controller/control/grid/grid-column/grid-field-edit-column/grid-field-edit-column.controller.d.ts +0 -7
- 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 +0 -9
- package/out/controller/control/tree/tree.controller.d.ts +17 -0
- package/out/controller/control/tree/tree.controller.d.ts.map +1 -1
- package/out/controller/control/tree/tree.controller.js +22 -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 +6 -4
- package/out/controller/utils/jsonschema/entity.d.ts.map +1 -1
- package/out/controller/utils/jsonschema/entity.js +4 -1
- package/out/global/global-util/global-util.d.ts +8 -1
- package/out/global/global-util/global-util.d.ts.map +1 -1
- package/out/global/global-util/global-util.js +8 -1
- package/out/interface/controller/common/i-icon/i-icon.d.ts +1 -0
- package/out/interface/controller/common/i-icon/i-icon.d.ts.map +1 -1
- package/out/interface/controller/state/control/i-drbar.state.d.ts +7 -0
- package/out/interface/controller/state/control/i-drbar.state.d.ts.map +1 -1
- package/out/interface/controller/state/control/i-drtab.state.d.ts +7 -0
- package/out/interface/controller/state/control/i-drtab.state.d.ts.map +1 -1
- package/out/interface/service/i-transaction/i-transaction.d.ts +83 -0
- package/out/interface/service/i-transaction/i-transaction.d.ts.map +1 -0
- package/out/interface/service/i-transaction/i-transaction.js +1 -0
- package/out/interface/service/index.d.ts +1 -0
- package/out/interface/service/index.d.ts.map +1 -1
- package/out/interface/service/service/i-app-de.service.d.ts +9 -1
- package/out/interface/service/service/i-app-de.service.d.ts.map +1 -1
- package/out/interface/util/i-view-stack/i-view-stack.d.ts +53 -0
- package/out/interface/util/i-view-stack/i-view-stack.d.ts.map +1 -0
- package/out/interface/util/i-view-stack/i-view-stack.js +1 -0
- package/out/interface/util/index.d.ts +1 -0
- package/out/interface/util/index.d.ts.map +1 -1
- package/out/register/helper/async-action-register.d.ts.map +1 -1
- package/out/register/helper/async-action-register.js +1 -1
- package/out/service/de-service-util.d.ts +11 -0
- package/out/service/de-service-util.d.ts.map +1 -1
- package/out/service/de-service-util.js +34 -0
- package/out/service/dto/method.dto.d.ts +1 -2
- package/out/service/dto/method.dto.d.ts.map +1 -1
- package/out/service/dto/method.dto.js +0 -7
- package/out/service/service/auth/v7-auth.service.d.ts +1 -2
- package/out/service/service/auth/v7-auth.service.d.ts.map +1 -1
- package/out/service/service/auth/v7-auth.service.js +27 -7
- package/out/service/service/entity/de.service.d.ts +1 -1
- package/out/service/service/entity/de.service.d.ts.map +1 -1
- package/out/service/service/entity/de.service.js +4 -1
- package/out/service/service/entity/method/de-action.d.ts +13 -1
- package/out/service/service/entity/method/de-action.d.ts.map +1 -1
- package/out/service/service/entity/method/de-action.js +163 -56
- package/out/service/service/entity/method/fetch.d.ts.map +1 -1
- package/out/service/service/entity/method/fetch.js +2 -1
- package/out/service/service/entity/method/method-renturn.d.ts.map +1 -1
- package/out/service/service/entity/method/method-renturn.js +9 -3
- package/out/service/utils/de-cache/de-cache.d.ts +11 -1
- package/out/service/utils/de-cache/de-cache.d.ts.map +1 -1
- package/out/service/utils/de-cache/de-cache.js +122 -18
- package/out/service/utils/de-dq-cond/ps-model-cond-engine-base.d.ts.map +1 -1
- package/out/service/utils/de-dq-cond/ps-model-cond-engine-base.js +4 -0
- 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 +9 -1
- package/out/service/vo/tree-node-data/tree-node-data.d.ts.map +1 -1
- package/out/service/vo/tree-node-data/tree-node-data.js +3 -0
- package/out/ui-action/provider/front-ui-action-provider.d.ts.map +1 -1
- package/out/ui-action/provider/front-ui-action-provider.js +2 -1
- 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/ui-domain/transaction.d.ts +66 -0
- package/out/utils/ui-domain/transaction.d.ts.map +1 -0
- package/out/utils/ui-domain/transaction.js +94 -0
- package/out/utils/ui-domain/ui-domain.d.ts +18 -0
- package/out/utils/ui-domain/ui-domain.d.ts.map +1 -1
- package/out/utils/ui-domain/ui-domain.js +23 -0
- package/out/utils/view-stack/view-stack.d.ts +29 -0
- package/out/utils/view-stack/view-stack.d.ts.map +1 -0
- package/out/utils/view-stack/view-stack.js +47 -0
- package/package.json +5 -5
- package/src/controller/common/view/view.controller.ts +4 -0
- package/src/controller/control/form/edit-form/edit-form.controller.ts +1 -1
- package/src/controller/control/form/form-detail/form-detail/form-detail.controller.ts +4 -0
- package/src/controller/control/form/form-detail/form-tab-page/form-tab-page.controller.ts +14 -0
- package/src/controller/control/form/form-detail/form-tab-panel/form-tab-panel.controller.ts +16 -0
- package/src/controller/control/form/form-detail/form-tab-panel/form-tab-panel.state.ts +9 -1
- package/src/controller/control/grid/grid/grid.service.ts +1 -11
- package/src/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.ts +12 -2
- package/src/controller/control/grid/grid-column/grid-field-edit-column/grid-field-edit-column.controller.ts +0 -10
- package/src/controller/control/tree/tree.controller.ts +35 -0
- package/src/controller/control/tree-grid-ex/tree-grid-ex.controller.ts +12 -4
- package/src/controller/utils/jsonschema/entity.ts +4 -1
- package/src/global/global-util/global-util.ts +9 -0
- package/src/interface/controller/common/i-icon/i-icon.ts +1 -0
- package/src/interface/controller/state/control/i-drbar.state.ts +8 -0
- package/src/interface/controller/state/control/i-drtab.state.ts +8 -0
- package/src/interface/service/i-transaction/i-transaction.ts +88 -0
- package/src/interface/service/index.ts +4 -0
- package/src/interface/service/service/i-app-de.service.ts +10 -1
- package/src/interface/util/i-view-stack/i-view-stack.ts +53 -0
- package/src/interface/util/index.ts +1 -0
- package/src/register/helper/async-action-register.ts +3 -1
- package/src/service/de-service-util.ts +43 -0
- package/src/service/dto/method.dto.ts +1 -8
- package/src/service/service/auth/v7-auth.service.ts +37 -19
- package/src/service/service/entity/de.service.ts +6 -1
- package/src/service/service/entity/method/de-action.ts +182 -61
- package/src/service/service/entity/method/fetch.ts +2 -4
- package/src/service/service/entity/method/method-renturn.ts +14 -5
- package/src/service/utils/de-cache/de-cache.ts +128 -19
- package/src/service/utils/de-dq-cond/ps-model-cond-engine-base.ts +4 -0
- package/src/service/utils/dynamic-code-list/dynamic-code-list.ts +11 -0
- package/src/service/vo/tree-node-data/tree-node-data.ts +3 -0
- package/src/ui-action/provider/front-ui-action-provider.ts +2 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/ui-domain/transaction.ts +100 -0
- package/src/utils/ui-domain/ui-domain.ts +25 -0
- package/src/utils/view-stack/view-stack.ts +64 -0
|
@@ -7,6 +7,8 @@ import {
|
|
|
7
7
|
} from '@ibiz-template/core';
|
|
8
8
|
import { IAppDEAction } from '@ibiz/model-core';
|
|
9
9
|
import { isArray, isNil } from 'lodash-es';
|
|
10
|
+
import { ascSort } from 'qx-util';
|
|
11
|
+
import { clone } from 'ramda';
|
|
10
12
|
import { Method } from './method';
|
|
11
13
|
import { IDataEntity } from '../../../../interface';
|
|
12
14
|
import { calcDeCodeNameById, findDELogic } from '../../../../model';
|
|
@@ -48,7 +50,10 @@ export class DEActionMethod extends Method {
|
|
|
48
50
|
data?: IData | IData[],
|
|
49
51
|
params?: IParams,
|
|
50
52
|
): Promise<HttpResponse<IData>> {
|
|
51
|
-
|
|
53
|
+
let result: IHttpResponse<IData>;
|
|
54
|
+
|
|
55
|
+
// 执行变更属性逻辑
|
|
56
|
+
if (data && !['READ', 'GETDRAFT'].includes(this.method.actionMode!)) {
|
|
52
57
|
await execFieldLogics(this.entity, 'change', context, data, params);
|
|
53
58
|
}
|
|
54
59
|
|
|
@@ -58,64 +63,57 @@ export class DEActionMethod extends Method {
|
|
|
58
63
|
if (!deLogic) {
|
|
59
64
|
throw new RuntimeModelError(this.method, '缺少实体处理逻辑');
|
|
60
65
|
}
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
if (this.method.needResourceKey) {
|
|
108
|
-
let srfkey = context[this.entity.codeName!.toLowerCase()];
|
|
109
|
-
if (isNil(srfkey)) {
|
|
110
|
-
srfkey = isArray(data)
|
|
111
|
-
? null
|
|
112
|
-
: data?.[this.entity.keyAppDEFieldId!];
|
|
66
|
+
result = await execDELogicAction(deLogic, context, data, params);
|
|
67
|
+
} else {
|
|
68
|
+
if (data && !this.isLocalMode) {
|
|
69
|
+
data = await this.inputHandle(context, data);
|
|
70
|
+
}
|
|
71
|
+
switch (this.method.codeName) {
|
|
72
|
+
case 'Create':
|
|
73
|
+
result = await this.create(context, data!, params || {});
|
|
74
|
+
break;
|
|
75
|
+
case 'Get':
|
|
76
|
+
result = await this.get(context, params);
|
|
77
|
+
break;
|
|
78
|
+
case 'GetDraft':
|
|
79
|
+
result = await this.getDraft(context, params);
|
|
80
|
+
break;
|
|
81
|
+
case 'Remove':
|
|
82
|
+
result = await this.remove(context, params);
|
|
83
|
+
break;
|
|
84
|
+
case 'Update':
|
|
85
|
+
result = await this.update(context, data!, params);
|
|
86
|
+
break;
|
|
87
|
+
case 'CreateTemp':
|
|
88
|
+
result = await this.createTemp(context, data!);
|
|
89
|
+
break;
|
|
90
|
+
case 'GetTemp':
|
|
91
|
+
result = await this.getTemp(context, data);
|
|
92
|
+
break;
|
|
93
|
+
case 'GetDraftTemp':
|
|
94
|
+
result = await this.getDraftTemp(context, params);
|
|
95
|
+
break;
|
|
96
|
+
case 'RemoveTemp':
|
|
97
|
+
result = await this.removeTemp(context, data);
|
|
98
|
+
break;
|
|
99
|
+
case 'UpdateTemp':
|
|
100
|
+
result = await this.updateTemp(context, data!);
|
|
101
|
+
break;
|
|
102
|
+
default: {
|
|
103
|
+
let path = this.calcPath(context);
|
|
104
|
+
if (this.method.needResourceKey) {
|
|
105
|
+
let srfkey = context[this.entity.codeName!.toLowerCase()];
|
|
106
|
+
if (isNil(srfkey)) {
|
|
107
|
+
srfkey = isArray(data)
|
|
108
|
+
? null
|
|
109
|
+
: data?.[this.entity.keyAppDEFieldId!];
|
|
110
|
+
}
|
|
111
|
+
path = `${path}/${srfkey}`;
|
|
113
112
|
}
|
|
114
|
-
|
|
113
|
+
const res = await this.request(path, context, data, params);
|
|
114
|
+
res.data = await this.result.handle(context, res.data);
|
|
115
|
+
result = res;
|
|
115
116
|
}
|
|
116
|
-
const res = await this.request(path, context, data, params);
|
|
117
|
-
res.data = await this.result.handle(context, res.data);
|
|
118
|
-
result = res;
|
|
119
117
|
}
|
|
120
118
|
}
|
|
121
119
|
|
|
@@ -342,6 +340,13 @@ export class DEActionMethod extends Method {
|
|
|
342
340
|
if (!key && context) {
|
|
343
341
|
key = context[this.entity.codeName!.toLowerCase()];
|
|
344
342
|
}
|
|
343
|
+
try {
|
|
344
|
+
await this.associationDeletion(key, context, params);
|
|
345
|
+
} catch (error) {
|
|
346
|
+
throw new HttpError({
|
|
347
|
+
response: new HttpResponse(null, 500, (error as IData).message),
|
|
348
|
+
} as unknown as Error);
|
|
349
|
+
}
|
|
345
350
|
const data = this.service.local.delete(context, key)!;
|
|
346
351
|
if (data) {
|
|
347
352
|
return new HttpResponse(data);
|
|
@@ -352,6 +357,124 @@ export class DEActionMethod extends Method {
|
|
|
352
357
|
}
|
|
353
358
|
}
|
|
354
359
|
|
|
360
|
+
/**
|
|
361
|
+
* 关联删除
|
|
362
|
+
*
|
|
363
|
+
* @author chitanda
|
|
364
|
+
* @date 2024-01-17 16:01:47
|
|
365
|
+
* @protected
|
|
366
|
+
* @param {string} key
|
|
367
|
+
* @param {IContext} context
|
|
368
|
+
* @param {IParams} [params]
|
|
369
|
+
* @return {*} {Promise<void>}
|
|
370
|
+
*/
|
|
371
|
+
protected async associationDeletion(
|
|
372
|
+
key: string,
|
|
373
|
+
context: IContext,
|
|
374
|
+
_params?: IParams,
|
|
375
|
+
): Promise<void> {
|
|
376
|
+
// 当前执行界面域
|
|
377
|
+
const uiDomain = ibiz.uiDomainManager.get(context.srfsessionid);
|
|
378
|
+
|
|
379
|
+
// 当前事务
|
|
380
|
+
const t = uiDomain.transaction;
|
|
381
|
+
let selfOpenTransaction = false;
|
|
382
|
+
// 由第一层触发关联删除的位置来打开事务,后续子的关联删除不需要再次打开事务
|
|
383
|
+
if (t.state.isOpen === false) {
|
|
384
|
+
t.open();
|
|
385
|
+
selfOpenTransaction = true;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
try {
|
|
389
|
+
let configs = uiDomain.getDERConfigByMajor(this.entity.id!);
|
|
390
|
+
if (configs.length > 0) {
|
|
391
|
+
// 当前主数据
|
|
392
|
+
const data = this.service.local.get(context, key)!;
|
|
393
|
+
|
|
394
|
+
// 根据删除顺序排序
|
|
395
|
+
configs = ascSort(configs, 'removeOrder');
|
|
396
|
+
|
|
397
|
+
// 根据关系进行关联删除
|
|
398
|
+
for (const config of configs) {
|
|
399
|
+
if (config.rstype !== 'DER1N') {
|
|
400
|
+
throw new RuntimeModelError(
|
|
401
|
+
config,
|
|
402
|
+
'目前只支持[DER1N]关系类型关联删除删除',
|
|
403
|
+
);
|
|
404
|
+
}
|
|
405
|
+
const {
|
|
406
|
+
removeActionType,
|
|
407
|
+
removeRejectMsg,
|
|
408
|
+
minorAppDataEntityId,
|
|
409
|
+
nestedAppDEDataSetId = 'FetchDefault',
|
|
410
|
+
} = config;
|
|
411
|
+
// 获取当前应用域下的子实体服务
|
|
412
|
+
const app = ibiz.hub.getApp(this.entity.appId!);
|
|
413
|
+
const minorService = await app.deService.getService(
|
|
414
|
+
context,
|
|
415
|
+
minorAppDataEntityId!,
|
|
416
|
+
);
|
|
417
|
+
// 克隆上下文,防止污染。并设置当前实体的主键上下文
|
|
418
|
+
const _context = clone(context);
|
|
419
|
+
_context[this.entity.codeName!.toLowerCase()] = key;
|
|
420
|
+
// 查询出关联的子实体数据
|
|
421
|
+
const res = await minorService.exec(nestedAppDEDataSetId, _context);
|
|
422
|
+
const items = (res.data || []) as IDataEntity[];
|
|
423
|
+
switch (removeActionType) {
|
|
424
|
+
// 同时删除
|
|
425
|
+
case 1: {
|
|
426
|
+
for (let i = 0; i < items.length; i++) {
|
|
427
|
+
const item = items[i];
|
|
428
|
+
_context[minorService.model.codeName!.toLowerCase()] =
|
|
429
|
+
item.srfkey;
|
|
430
|
+
const res2 = await minorService.remove(_context, item);
|
|
431
|
+
if (res2.ok === false) {
|
|
432
|
+
throw new Error(res2.statusText);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
break;
|
|
436
|
+
}
|
|
437
|
+
// 置空
|
|
438
|
+
case 2:
|
|
439
|
+
for (let i = 0; i < items.length; i++) {
|
|
440
|
+
const item = items[i];
|
|
441
|
+
_context[minorService.model.codeName!.toLowerCase()] =
|
|
442
|
+
item.srfkey;
|
|
443
|
+
item[config.parentAppDEFieldId!.toLowerCase()] = undefined;
|
|
444
|
+
const res2 = await minorService.updateTemp(_context, item);
|
|
445
|
+
if (res2.ok === false) {
|
|
446
|
+
throw new Error(res2.statusText);
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
break;
|
|
450
|
+
// 限制删除
|
|
451
|
+
case 3:
|
|
452
|
+
if (items.length > 0) {
|
|
453
|
+
const msg = items.map(item => item.srfmajortext).join('、');
|
|
454
|
+
const message = `无法删除[${this.entity.logicName}-${data.srfmajortext}], 数据被[${minorService.model.logicName}-${msg}]引用`;
|
|
455
|
+
throw new Error(removeRejectMsg || message);
|
|
456
|
+
}
|
|
457
|
+
break;
|
|
458
|
+
default:
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
// 谁打开的事务,由谁来提交和关闭
|
|
463
|
+
if (selfOpenTransaction && t.state.isOpen) {
|
|
464
|
+
t.commit();
|
|
465
|
+
}
|
|
466
|
+
} catch (error) {
|
|
467
|
+
if (selfOpenTransaction && t.state.isOpen) {
|
|
468
|
+
t.rollback();
|
|
469
|
+
}
|
|
470
|
+
throw error;
|
|
471
|
+
} finally {
|
|
472
|
+
if (selfOpenTransaction && t.state.isOpen) {
|
|
473
|
+
t.close();
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
355
478
|
/**
|
|
356
479
|
* 更新临时数据
|
|
357
480
|
*
|
|
@@ -412,7 +535,6 @@ export class DEActionMethod extends Method {
|
|
|
412
535
|
key = context[this.entity.codeName!.toLowerCase()];
|
|
413
536
|
}
|
|
414
537
|
const data = this.service.local.get(context, key);
|
|
415
|
-
// await this.executeDEFelidLogic(context, data);
|
|
416
538
|
if (data) {
|
|
417
539
|
return new HttpResponse(data);
|
|
418
540
|
}
|
|
@@ -430,15 +552,14 @@ export class DEActionMethod extends Method {
|
|
|
430
552
|
* @return {*} {Promise<IHttpResponse>}
|
|
431
553
|
*/
|
|
432
554
|
async removeBatchTemp(
|
|
433
|
-
_context:
|
|
555
|
+
_context: IContext,
|
|
434
556
|
_params?: IParams,
|
|
435
557
|
): Promise<IHttpResponse> {
|
|
436
558
|
// if (params) {
|
|
437
559
|
// const keys: string[] = params[this.entity.keyName];
|
|
438
560
|
// if (keys) {
|
|
439
561
|
// try {
|
|
440
|
-
//
|
|
441
|
-
// await s.local.deleteBatch(context, keys);
|
|
562
|
+
// await this.service.local.deleteBatch(context, keys);
|
|
442
563
|
// } catch (err) {
|
|
443
564
|
// return new HttpResponse(err, 500);
|
|
444
565
|
// }
|
|
@@ -37,10 +37,8 @@ export class FetchMethod extends Method {
|
|
|
37
37
|
|
|
38
38
|
if (this.isLocalMode) {
|
|
39
39
|
const cond = DEDQCondUtil.getCond(this.method);
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
new SearchFilter(context, searchParams),
|
|
43
|
-
);
|
|
40
|
+
const filter = new SearchFilter(context, searchParams);
|
|
41
|
+
const items = await this.searchLocal(cond, filter);
|
|
44
42
|
res = new HttpResponse<IDataEntity[]>(items, 200);
|
|
45
43
|
} else {
|
|
46
44
|
switch (this.method.dataSetType) {
|
|
@@ -58,11 +58,20 @@ export class MethodReturn {
|
|
|
58
58
|
async handle(context: IContext, data: IData): Promise<IDataEntity> {
|
|
59
59
|
if (this.dto) {
|
|
60
60
|
const app = ibiz.hub.getApp(this.entity.appId);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
const uiDomain = ibiz.uiDomainManager.get(context.srfsessionid);
|
|
62
|
+
if (uiDomain && uiDomain.state.rsInit !== true) {
|
|
63
|
+
await this.dto.calcRs(context);
|
|
64
|
+
uiDomain.calcParentRs();
|
|
65
|
+
uiDomain.state.rsInit = true;
|
|
66
|
+
}
|
|
67
|
+
// 设置之前,根据关系清理掉当前界面域下的数据缓存
|
|
68
|
+
app.deService.clearTempCacheByRs(
|
|
69
|
+
{
|
|
70
|
+
srfappid: app.appId,
|
|
71
|
+
srfsessionid: context.srfsessionid,
|
|
72
|
+
},
|
|
73
|
+
this.entity.id!,
|
|
74
|
+
);
|
|
66
75
|
const items = await this.dto.sets(context, [data]);
|
|
67
76
|
return items[0];
|
|
68
77
|
}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
isExistSessionId,
|
|
7
7
|
isExistSrfKey,
|
|
8
8
|
} from '../service-exist-util/service-exist-util';
|
|
9
|
-
import { IDataEntity } from '../../../interface';
|
|
9
|
+
import { IDataEntity, ITransaction } from '../../../interface';
|
|
10
10
|
import { findModelChild } from '../../../model';
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -114,8 +114,19 @@ export class DECache {
|
|
|
114
114
|
entity.srfkey = createUUID();
|
|
115
115
|
}
|
|
116
116
|
entity.srftempdate = new Date().getTime();
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
// 提交回调
|
|
118
|
+
const commit = (): void => {
|
|
119
|
+
this.cacheMap.set(entity.srfkey!, clone(entity));
|
|
120
|
+
ibiz.log.warn('add', entity.srfkey, entity);
|
|
121
|
+
};
|
|
122
|
+
const t = this.getTransaction(context);
|
|
123
|
+
if (t) {
|
|
124
|
+
t.change(entity.srfkey, () => {
|
|
125
|
+
commit();
|
|
126
|
+
});
|
|
127
|
+
} else {
|
|
128
|
+
commit();
|
|
129
|
+
}
|
|
119
130
|
return entity;
|
|
120
131
|
} catch (err) {
|
|
121
132
|
ibiz.log.error(err);
|
|
@@ -170,10 +181,26 @@ export class DECache {
|
|
|
170
181
|
entity.srftempdate = new Date().getTime();
|
|
171
182
|
const data = this.cacheMap.get(oldKey);
|
|
172
183
|
if (data) {
|
|
173
|
-
data
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
184
|
+
const _data = clone(data);
|
|
185
|
+
_data.assign!(entity);
|
|
186
|
+
// 提交回调
|
|
187
|
+
const commit = (): void => {
|
|
188
|
+
data.assign!(entity);
|
|
189
|
+
if (oldKey !== entity.srfkey) {
|
|
190
|
+
this.cacheMap.delete(oldKey);
|
|
191
|
+
}
|
|
192
|
+
this.cacheMap.set(entity.srfkey, data);
|
|
193
|
+
ibiz.log.warn('update', entity.srfkey, entity);
|
|
194
|
+
};
|
|
195
|
+
const t = this.getTransaction(context);
|
|
196
|
+
if (t) {
|
|
197
|
+
t.change(entity.srfkey, () => {
|
|
198
|
+
commit();
|
|
199
|
+
});
|
|
200
|
+
} else {
|
|
201
|
+
commit();
|
|
202
|
+
}
|
|
203
|
+
return _data;
|
|
177
204
|
}
|
|
178
205
|
throw new Error('数据不存在,无法更新!');
|
|
179
206
|
} catch (err) {
|
|
@@ -196,9 +223,18 @@ export class DECache {
|
|
|
196
223
|
const key = srfKey;
|
|
197
224
|
if (this.cacheMap.has(key)) {
|
|
198
225
|
const data = this.cacheMap.get(key)!;
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
226
|
+
const commit = (): void => {
|
|
227
|
+
this.cacheMap.delete(key);
|
|
228
|
+
ibiz.log.warn('delete', key);
|
|
229
|
+
};
|
|
230
|
+
const t = this.getTransaction(context);
|
|
231
|
+
if (t) {
|
|
232
|
+
t.change(key, () => {
|
|
233
|
+
commit();
|
|
234
|
+
});
|
|
235
|
+
} else {
|
|
236
|
+
commit();
|
|
237
|
+
}
|
|
202
238
|
return data;
|
|
203
239
|
}
|
|
204
240
|
return null;
|
|
@@ -220,6 +256,11 @@ export class DECache {
|
|
|
220
256
|
createBatch(context: IContext, entities: IDataEntity[]): IDataEntity[] {
|
|
221
257
|
try {
|
|
222
258
|
isExistSessionId('add', context);
|
|
259
|
+
const commit = (entity: IDataEntity): void => {
|
|
260
|
+
this.cacheMap.set(entity.srfkey, entity);
|
|
261
|
+
ibiz.log.warn('add', entity.srfkey, entity);
|
|
262
|
+
};
|
|
263
|
+
const t = this.getTransaction(context);
|
|
223
264
|
for (let i = 0; i < entities.length; i++) {
|
|
224
265
|
const entity = entities[i];
|
|
225
266
|
if (isNil(entity.srfkey) || isEmpty(entity.srfkey)) {
|
|
@@ -227,9 +268,13 @@ export class DECache {
|
|
|
227
268
|
}
|
|
228
269
|
entity.srftempdate = new Date().getTime();
|
|
229
270
|
const data = clone(entity);
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
271
|
+
if (t) {
|
|
272
|
+
t.change(data.srfkey, () => {
|
|
273
|
+
commit(data);
|
|
274
|
+
});
|
|
275
|
+
} else {
|
|
276
|
+
commit(data);
|
|
277
|
+
}
|
|
233
278
|
}
|
|
234
279
|
return entities;
|
|
235
280
|
} catch (err) {
|
|
@@ -250,16 +295,50 @@ export class DECache {
|
|
|
250
295
|
updateBatch(context: IContext, entities: IDataEntity[]): IDataEntity[] {
|
|
251
296
|
try {
|
|
252
297
|
isExistSessionId('update', context);
|
|
298
|
+
const commit = (entity: IDataEntity, oldKey: string): void => {
|
|
299
|
+
// 如果主键改变,删除旧的数据再设置新数据
|
|
300
|
+
if (oldKey !== entity.srfkey) {
|
|
301
|
+
this.cacheMap.delete(oldKey);
|
|
302
|
+
}
|
|
303
|
+
this.cacheMap.set(entity.srfkey!, entity);
|
|
304
|
+
ibiz.log.warn('update', entity.srfkey, entity);
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
const t = this.getTransaction(context);
|
|
308
|
+
|
|
253
309
|
for (let i = 0; i < entities.length; i++) {
|
|
254
310
|
const entity = entities[i];
|
|
255
311
|
isExistSrfKey('update', entity);
|
|
312
|
+
const oldKey = entity.srfkey!;
|
|
313
|
+
// 联合主键相关数据处理
|
|
314
|
+
if (this.isUnionKey) {
|
|
315
|
+
this.calcUnionKey(entity);
|
|
316
|
+
// 主键改变的时候,检测变更之后的主键是否已经存在
|
|
317
|
+
if (
|
|
318
|
+
oldKey !== entity.srfkey &&
|
|
319
|
+
this.checkData(context, entity.srfkey)
|
|
320
|
+
) {
|
|
321
|
+
throw new RuntimeError(
|
|
322
|
+
`更新联合主键数据失败,已有主键为${entity.srfkey}的数据`,
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
256
327
|
entity.srftempdate = new Date().getTime();
|
|
257
328
|
const data = this.cacheMap.get(entity.srfkey!);
|
|
258
329
|
if (data) {
|
|
259
|
-
data
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
330
|
+
const _data = clone(data);
|
|
331
|
+
_data.assign!(entity);
|
|
332
|
+
entities[i] = _data;
|
|
333
|
+
if (t) {
|
|
334
|
+
t.change(entity.srfkey!, () => {
|
|
335
|
+
data.assign!(entity);
|
|
336
|
+
commit(data, oldKey);
|
|
337
|
+
});
|
|
338
|
+
} else {
|
|
339
|
+
data.assign!(entity);
|
|
340
|
+
commit(data, oldKey);
|
|
341
|
+
}
|
|
263
342
|
} else {
|
|
264
343
|
throw new Error(
|
|
265
344
|
`数据[${entity.srfdename}-${entity.srfmajortext}(${entity.srfkey})]不存在,无法更新!`,
|
|
@@ -301,10 +380,23 @@ export class DECache {
|
|
|
301
380
|
`未找到以下数据「${notRemoveKeys.join('、')}」,无法删除!`,
|
|
302
381
|
);
|
|
303
382
|
}
|
|
304
|
-
|
|
305
|
-
|
|
383
|
+
|
|
384
|
+
const commit = (key: string): void => {
|
|
306
385
|
this.cacheMap.delete(key);
|
|
307
386
|
ibiz.log.warn('delete', key);
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
const t = this.getTransaction(context);
|
|
390
|
+
|
|
391
|
+
for (let i = 0; i < srfKeys.length; i++) {
|
|
392
|
+
const key = srfKeys[i];
|
|
393
|
+
if (t) {
|
|
394
|
+
t.change(key, () => {
|
|
395
|
+
commit(key);
|
|
396
|
+
});
|
|
397
|
+
} else {
|
|
398
|
+
commit(key);
|
|
399
|
+
}
|
|
308
400
|
}
|
|
309
401
|
return [];
|
|
310
402
|
}
|
|
@@ -392,4 +484,21 @@ export class DECache {
|
|
|
392
484
|
});
|
|
393
485
|
data.srfkey = unionValues.join('||');
|
|
394
486
|
}
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* 根据上下文,获取已经开启的事务
|
|
490
|
+
*
|
|
491
|
+
* @author chitanda
|
|
492
|
+
* @date 2024-01-17 15:01:28
|
|
493
|
+
* @protected
|
|
494
|
+
* @param {IContext} context
|
|
495
|
+
* @return {*} {(ITransaction | null)}
|
|
496
|
+
*/
|
|
497
|
+
protected getTransaction(context: IContext): ITransaction | null {
|
|
498
|
+
const uiDomain = ibiz.uiDomainManager.get(context.srfsessionid);
|
|
499
|
+
if (uiDomain && uiDomain.transaction.state.isOpen === true) {
|
|
500
|
+
return uiDomain.transaction;
|
|
501
|
+
}
|
|
502
|
+
return null;
|
|
503
|
+
}
|
|
395
504
|
}
|
|
@@ -67,6 +67,10 @@ export abstract class PSModelCondEngineBase {
|
|
|
67
67
|
CondType.CONDOP_LTANDEQ === strCondOp ||
|
|
68
68
|
CondType.CONDOP_NOTEQ === strCondOp
|
|
69
69
|
) {
|
|
70
|
+
// 特殊处理,如果值为空,直接返回false
|
|
71
|
+
if (objValue == null || objCondValue == null) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
70
74
|
// 大小比较
|
|
71
75
|
let nRet = -1;
|
|
72
76
|
// eslint-disable-next-line eqeqeq
|
|
@@ -133,6 +133,7 @@ export class DynamicCodeListCache {
|
|
|
133
133
|
*/
|
|
134
134
|
protected convertData(data: IData): CodeListItem {
|
|
135
135
|
const result = {} as CodeListItem;
|
|
136
|
+
|
|
136
137
|
const {
|
|
137
138
|
valueAppDEFieldId,
|
|
138
139
|
textAppDEFieldId,
|
|
@@ -142,6 +143,8 @@ export class DynamicCodeListCache {
|
|
|
142
143
|
iconPathXAppDEFieldId,
|
|
143
144
|
disableAppDEFieldId,
|
|
144
145
|
dataAppDEFieldId,
|
|
146
|
+
clsAppDEFieldId,
|
|
147
|
+
colorAppDEFieldId,
|
|
145
148
|
} = this.codeList;
|
|
146
149
|
// 值属性
|
|
147
150
|
const value = valueAppDEFieldId ? data[valueAppDEFieldId] : data.srfkey;
|
|
@@ -177,6 +180,14 @@ export class DynamicCodeListCache {
|
|
|
177
180
|
if (disableAppDEFieldId) {
|
|
178
181
|
result.disableSelect = fieldValueToBoolean(data[disableAppDEFieldId]);
|
|
179
182
|
}
|
|
183
|
+
// 样式表属性
|
|
184
|
+
if (clsAppDEFieldId) {
|
|
185
|
+
result.textCls = data[clsAppDEFieldId];
|
|
186
|
+
}
|
|
187
|
+
// 颜色值属性
|
|
188
|
+
if (colorAppDEFieldId) {
|
|
189
|
+
result.color = data[colorAppDEFieldId];
|
|
190
|
+
}
|
|
180
191
|
// 数据属性
|
|
181
192
|
if (dataAppDEFieldId && data[dataAppDEFieldId]) {
|
|
182
193
|
try {
|
|
@@ -86,6 +86,9 @@ export abstract class TreeNodeData implements ITreeNodeData {
|
|
|
86
86
|
if (sysImage.imagePath) {
|
|
87
87
|
icon.imagePath = sysImage.imagePath;
|
|
88
88
|
}
|
|
89
|
+
if (sysImage.rawContent) {
|
|
90
|
+
icon.htmlStr = sysImage.rawContent;
|
|
91
|
+
}
|
|
89
92
|
}
|
|
90
93
|
return Object.values(icon).length > 0 ? icon : undefined;
|
|
91
94
|
}
|
|
@@ -199,7 +199,7 @@ export class FrontUIActionProvider extends UIActionProviderBase {
|
|
|
199
199
|
args: IUILogicParams,
|
|
200
200
|
): Promise<IUIActionResult> {
|
|
201
201
|
// 处理参数
|
|
202
|
-
const { resultParams } = await this.handleParams(
|
|
202
|
+
const { resultContext, resultParams } = await this.handleParams(
|
|
203
203
|
action,
|
|
204
204
|
args.context,
|
|
205
205
|
args.data,
|
|
@@ -223,6 +223,7 @@ export class FrontUIActionProvider extends UIActionProviderBase {
|
|
|
223
223
|
dismiss: () => modal.dismiss(),
|
|
224
224
|
appDataEntity,
|
|
225
225
|
dataImport: appDEDataImport,
|
|
226
|
+
context: resultContext,
|
|
226
227
|
params: resultParams,
|
|
227
228
|
},
|
|
228
229
|
{
|
package/src/utils/index.ts
CHANGED
|
@@ -18,4 +18,5 @@ export { ThemeUtil } from './theme-util/theme-util';
|
|
|
18
18
|
export { UIDomain } from './ui-domain/ui-domain';
|
|
19
19
|
export { UIDomainManager } from './ui-domain-manager/ui-domain-manager';
|
|
20
20
|
export { RawValueUtil } from './raw-value-util/raw-value-util';
|
|
21
|
+
export { ViewStack } from './view-stack/view-stack';
|
|
21
22
|
export { handleAllSettled } from './promise/promise';
|