@ibiz-template/runtime 0.1.37 → 0.2.0
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 +12431 -360
- package/dist/index.system.min.js +1 -1
- package/dist/index.system.min.js.map +1 -1
- package/out/application.d.ts +9 -1
- package/out/application.d.ts.map +1 -1
- package/out/application.js +9 -2
- package/out/controller/control/exp-bar/chart-exp-bar.controller.d.ts +24 -0
- package/out/controller/control/exp-bar/chart-exp-bar.controller.d.ts.map +1 -0
- package/out/controller/control/exp-bar/chart-exp-bar.controller.js +32 -0
- package/out/controller/control/exp-bar/index.d.ts +1 -0
- package/out/controller/control/exp-bar/index.d.ts.map +1 -1
- package/out/controller/control/exp-bar/index.js +1 -0
- package/out/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.d.ts +1 -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 +8 -0
- package/out/controller/control/medit-view-panel/medit-view-panel.controller.d.ts +1 -13
- package/out/controller/control/medit-view-panel/medit-view-panel.controller.d.ts.map +1 -1
- package/out/controller/control/medit-view-panel/medit-view-panel.controller.js +7 -67
- package/out/controller/control/search-bar/search-bar.controller.d.ts.map +1 -1
- package/out/controller/control/search-bar/search-bar.controller.js +3 -3
- package/out/de-logic/de-logic-context.d.ts +4 -4
- package/out/de-logic/de-logic-context.d.ts.map +1 -1
- package/out/de-logic/de-logic-context.js +2 -1
- package/out/de-logic/de-logic-link/de-logic-link.js +1 -1
- package/out/de-logic/de-logic-param/de-logic-param.d.ts.map +1 -1
- package/out/de-logic/de-logic-param/de-logic-param.js +7 -1
- package/out/de-logic/de-logic.d.ts +1 -1
- package/out/de-logic/de-logic.d.ts.map +1 -1
- package/out/de-logic/index.d.ts +5 -5
- package/out/de-logic/index.d.ts.map +1 -1
- package/out/de-logic/index.js +32 -5
- package/out/engine/md-view.engine.d.ts +3 -3
- package/out/engine/md-view.engine.d.ts.map +1 -1
- package/out/engine/md-view.engine.js +14 -12
- package/out/hub/config/app-view-config-service.d.ts +3 -1
- package/out/hub/config/app-view-config-service.d.ts.map +1 -1
- package/out/hub/config/app-view-config-service.js +9 -0
- package/out/interface/common/i-app-view-config-service/i-app-view-config-service.d.ts +20 -2
- package/out/interface/common/i-app-view-config-service/i-app-view-config-service.d.ts.map +1 -1
- package/out/interface/controller/controller/control/i-chart-exp-bar.controller.d.ts +15 -0
- package/out/interface/controller/controller/control/i-chart-exp-bar.controller.d.ts.map +1 -0
- package/out/interface/controller/controller/control/i-chart-exp-bar.controller.js +1 -0
- 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-chart-exp-bar.event.d.ts +11 -0
- package/out/interface/controller/event/control/i-chart-exp-bar.event.d.ts.map +1 -0
- package/out/interface/controller/event/control/i-chart-exp-bar.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-chart-exp-view.event.d.ts +11 -0
- package/out/interface/controller/event/view/i-chart-exp-view.event.d.ts.map +1 -0
- package/out/interface/controller/event/view/i-chart-exp-view.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-chart-exp-bar.state.d.ts +11 -0
- package/out/interface/controller/state/control/i-chart-exp-bar.state.d.ts.map +1 -0
- package/out/interface/controller/state/control/i-chart-exp-bar.state.js +1 -0
- 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-chart-exp-view.state.d.ts +11 -0
- package/out/interface/controller/state/view/i-chart-exp-view.state.d.ts.map +1 -0
- package/out/interface/controller/state/view/i-chart-exp-view.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/interface/service/code-list-item/code-list-item.d.ts +16 -0
- package/out/interface/service/code-list-item/code-list-item.d.ts.map +1 -1
- package/out/service/index.d.ts +1 -0
- package/out/service/index.d.ts.map +1 -1
- package/out/service/index.js +1 -0
- package/out/service/mqtt/mqtt.service.d.ts +66 -0
- package/out/service/mqtt/mqtt.service.d.ts.map +1 -0
- package/out/service/mqtt/mqtt.service.js +95 -0
- package/out/service/service/code-list/code-list.service.d.ts.map +1 -1
- package/out/service/service/code-list/code-list.service.js +12 -1
- package/out/service/service/entity/de.service.d.ts +2 -2
- package/out/service/service/entity/de.service.d.ts.map +1 -1
- package/out/service/service/entity/method/de-action.d.ts +14 -5
- package/out/service/service/entity/method/de-action.d.ts.map +1 -1
- package/out/service/service/entity/method/de-action.js +56 -15
- package/out/service/service/entity/method/fetch.d.ts +1 -1
- package/out/service/service/entity/method/fetch.d.ts.map +1 -1
- package/out/service/service/entity/method/fetch.js +9 -6
- package/out/service/service/entity/method/method.d.ts +13 -13
- package/out/service/service/entity/method/method.d.ts.map +1 -1
- package/out/service/service/entity/method/method.js +16 -11
- package/out/service/utils/dynamic-code-list/dynamic-code-list.d.ts +7 -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 +89 -13
- package/out/ui-action/uiaction-util.js +3 -3
- package/out/ui-logic/ui-logic-param/ui-logic-param.d.ts.map +1 -1
- package/out/ui-logic/ui-logic-param/ui-logic-param.js +7 -1
- package/out/utils/script/script-factory.d.ts +10 -0
- package/out/utils/script/script-factory.d.ts.map +1 -1
- package/out/utils/script/script-factory.js +15 -0
- package/package.json +5 -3
- package/src/application.ts +22 -1
- package/src/controller/control/exp-bar/chart-exp-bar.controller.ts +51 -0
- package/src/controller/control/exp-bar/index.ts +1 -0
- package/src/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.ts +14 -0
- package/src/controller/control/medit-view-panel/medit-view-panel.controller.ts +8 -78
- package/src/controller/control/search-bar/search-bar.controller.ts +6 -5
- package/src/de-logic/de-logic-context.ts +6 -5
- package/src/de-logic/de-logic-link/de-logic-link.ts +1 -1
- package/src/de-logic/de-logic-param/de-logic-param.ts +6 -1
- package/src/de-logic/de-logic.ts +5 -1
- package/src/de-logic/index.ts +49 -8
- package/src/engine/md-view.engine.ts +16 -13
- package/src/hub/config/app-view-config-service.ts +12 -1
- package/src/interface/common/i-app-view-config-service/i-app-view-config-service.ts +22 -4
- package/src/interface/controller/controller/control/i-chart-exp-bar.controller.ts +19 -0
- package/src/interface/controller/controller/control/index.ts +1 -0
- package/src/interface/controller/event/control/i-chart-exp-bar.event.ts +10 -0
- package/src/interface/controller/event/control/index.ts +1 -0
- package/src/interface/controller/event/view/i-chart-exp-view.event.ts +11 -0
- package/src/interface/controller/event/view/index.ts +1 -0
- package/src/interface/controller/state/control/i-chart-exp-bar.state.ts +10 -0
- package/src/interface/controller/state/control/index.ts +1 -0
- package/src/interface/controller/state/view/i-chart-exp-view.state.ts +10 -0
- package/src/interface/controller/state/view/index.ts +1 -0
- package/src/interface/service/code-list-item/code-list-item.ts +20 -0
- package/src/service/index.ts +1 -0
- package/src/service/mqtt/mqtt.service.ts +117 -0
- package/src/service/service/code-list/code-list.service.ts +15 -1
- package/src/service/service/entity/de.service.ts +2 -2
- package/src/service/service/entity/method/de-action.ts +74 -33
- package/src/service/service/entity/method/fetch.ts +12 -11
- package/src/service/service/entity/method/method.ts +28 -19
- package/src/service/utils/dynamic-code-list/dynamic-code-list.ts +121 -16
- package/src/ui-action/uiaction-util.ts +3 -3
- package/src/ui-logic/ui-logic-param/ui-logic-param.ts +6 -1
- package/src/utils/script/script-factory.ts +16 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"script-factory.d.ts","sourceRoot":"","sources":["../../../src/utils/script/script-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,qBAAa,aAAa;IACxB;;;;;;;;OAQG;IACH,MAAM,CAAC,cAAc,CACnB,OAAO,EAAE,MAAM,EAAE,EACjB,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,cAAc;IAIjB;;;;;;;;;OASG;IACH,MAAM,CAAC,YAAY,CACjB,IAAI,EAAE,OAAO,EACb,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO;
|
|
1
|
+
{"version":3,"file":"script-factory.d.ts","sourceRoot":"","sources":["../../../src/utils/script/script-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,qBAAa,aAAa;IACxB;;;;;;;;OAQG;IACH,MAAM,CAAC,cAAc,CACnB,OAAO,EAAE,MAAM,EAAE,EACjB,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,cAAc;IAIjB;;;;;;;;;OASG;IACH,MAAM,CAAC,YAAY,CACjB,IAAI,EAAE,OAAO,EACb,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO;IAMV;;;;;;;;OAQG;IACH,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,GAAE,OAAY,GAAG,OAAO;CAMvE"}
|
|
@@ -25,4 +25,19 @@ export class ScriptFactory {
|
|
|
25
25
|
static execScriptFn(args, scriptCode, options) {
|
|
26
26
|
return this.createScriptFn(Object.keys(args), scriptCode, options).exec(args);
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* 执行单行脚本
|
|
30
|
+
* @author lxm
|
|
31
|
+
* @date 2023-10-20 03:20:56
|
|
32
|
+
* @static
|
|
33
|
+
* @param {string} scriptCode 脚本字符串
|
|
34
|
+
* @param {IParams} [args={}] 作用域变量参数对象
|
|
35
|
+
* @return {*} {unknown}
|
|
36
|
+
*/
|
|
37
|
+
static execSingleLine(scriptCode, args = {}) {
|
|
38
|
+
return this.execScriptFn(args, scriptCode, {
|
|
39
|
+
singleRowReturn: true,
|
|
40
|
+
isAsync: false,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
28
43
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibiz-template/runtime",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "控制器包",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "out/index.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"author": "chitanda",
|
|
30
30
|
"license": "MIT",
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@ibiz-template/core": "^0.
|
|
32
|
+
"@ibiz-template/core": "^0.2.0",
|
|
33
33
|
"@ibiz/model-core": "^0.0.19",
|
|
34
34
|
"@types/path-browserify": "^1.0.0",
|
|
35
35
|
"@types/qs": "^6.9.8",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"echarts": "^5.4.3",
|
|
40
40
|
"handlebars": "^4.7.8",
|
|
41
41
|
"lodash-es": "^4.17.21",
|
|
42
|
+
"mqtt": "2.18.9",
|
|
42
43
|
"path-browserify": "^1.0.1",
|
|
43
44
|
"qs": "^6.11.2",
|
|
44
45
|
"qx-util": "^0.4.8",
|
|
@@ -52,10 +53,11 @@
|
|
|
52
53
|
"echarts": "^5.4.3",
|
|
53
54
|
"handlebars": "^4.7.8",
|
|
54
55
|
"lodash-es": "^4.17.21",
|
|
56
|
+
"mqtt": "2.18.9",
|
|
55
57
|
"path-browserify": "^1.0.1",
|
|
56
58
|
"qs": "^6.11.0",
|
|
57
59
|
"qx-util": "^0.4.8",
|
|
58
60
|
"ramda": "^0.29.0"
|
|
59
61
|
},
|
|
60
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "a4f9593ca7ea013a1a34c91f443dd25e1d7de251"
|
|
61
63
|
}
|
package/src/application.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Net } from '@ibiz-template/core';
|
|
1
|
+
import { Net, getToken } from '@ibiz-template/core';
|
|
2
2
|
import {
|
|
3
3
|
IAppDEUIAction,
|
|
4
4
|
IAppFunc,
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
CodeListService,
|
|
12
12
|
ConfigService,
|
|
13
13
|
DEServiceUtil,
|
|
14
|
+
MqttService,
|
|
14
15
|
} from './service';
|
|
15
16
|
import { IAppService } from './interface';
|
|
16
17
|
|
|
@@ -89,6 +90,15 @@ export class Application implements IAppService {
|
|
|
89
90
|
*/
|
|
90
91
|
readonly authority: AuthorityService;
|
|
91
92
|
|
|
93
|
+
/**
|
|
94
|
+
* mqtt 服务
|
|
95
|
+
*
|
|
96
|
+
* @author chitanda
|
|
97
|
+
* @date 2023-10-23 15:10:18
|
|
98
|
+
* @type {MqttService}
|
|
99
|
+
*/
|
|
100
|
+
mqtt?: MqttService;
|
|
101
|
+
|
|
92
102
|
/**
|
|
93
103
|
* Creates an instance of Application.
|
|
94
104
|
*
|
|
@@ -120,6 +130,17 @@ export class Application implements IAppService {
|
|
|
120
130
|
async init(): Promise<void> {
|
|
121
131
|
await this.authority.init();
|
|
122
132
|
await this.loadAppModelStyle();
|
|
133
|
+
if (ibiz.env.enableMqtt) {
|
|
134
|
+
this.mqtt = new MqttService(
|
|
135
|
+
ibiz.appData!.mqtttopic,
|
|
136
|
+
getToken()!,
|
|
137
|
+
this.model.appId!,
|
|
138
|
+
);
|
|
139
|
+
this.mqtt.evt.on('message', message => {
|
|
140
|
+
ibiz.mc.command.asyncAction.next(message);
|
|
141
|
+
});
|
|
142
|
+
await this.mqtt.connect();
|
|
143
|
+
}
|
|
123
144
|
}
|
|
124
145
|
|
|
125
146
|
/**
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { IChartExpBar, IDEChart } from '@ibiz/model-core';
|
|
2
|
+
import {
|
|
3
|
+
IChartExpBarState,
|
|
4
|
+
IChartExpBarEvent,
|
|
5
|
+
IChartExpBarController,
|
|
6
|
+
INavViewMsg,
|
|
7
|
+
} from '../../../interface';
|
|
8
|
+
import { ExpBarControlController } from './exp-bar.controller';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 图表导航栏控制器
|
|
12
|
+
*
|
|
13
|
+
* @export
|
|
14
|
+
* @class ChartExpBarController
|
|
15
|
+
* @extends {ExpBarControlController<IChartExpBar, IChartExpBarState, IChartExpBarEvent>}
|
|
16
|
+
* @implements {IChartExpBarController}
|
|
17
|
+
*/
|
|
18
|
+
export class ChartExpBarController
|
|
19
|
+
extends ExpBarControlController<
|
|
20
|
+
IChartExpBar,
|
|
21
|
+
IChartExpBarState,
|
|
22
|
+
IChartExpBarEvent
|
|
23
|
+
>
|
|
24
|
+
implements IChartExpBarController
|
|
25
|
+
{
|
|
26
|
+
/**
|
|
27
|
+
* 获取导航视图
|
|
28
|
+
*
|
|
29
|
+
* @author zk
|
|
30
|
+
* @date 2023-06-29 03:06:41
|
|
31
|
+
* @param {IDETabViewPanel} tabViewPanel
|
|
32
|
+
* @return {*} {Promise<INavViewMsg>}
|
|
33
|
+
* @memberof TabExpPanelController
|
|
34
|
+
*/
|
|
35
|
+
public getNavViewMsg(
|
|
36
|
+
data: IData,
|
|
37
|
+
context: IContext,
|
|
38
|
+
params: IParams,
|
|
39
|
+
): INavViewMsg {
|
|
40
|
+
const viewModelId = (this.XDataModel as IDEChart).dechartSerieses?.[0]
|
|
41
|
+
.navAppViewId;
|
|
42
|
+
const result = this.prepareParams(this.XDataModel!, data, context, params);
|
|
43
|
+
return {
|
|
44
|
+
key: data[this.navKeyName],
|
|
45
|
+
context: result.context,
|
|
46
|
+
params: result.params,
|
|
47
|
+
viewId: viewModelId,
|
|
48
|
+
isCache: this.isCache,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
package/src/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { DataTypes, ModelError } from '@ibiz-template/core';
|
|
3
3
|
import { IAppCodeList, IDEGridFieldColumn } from '@ibiz/model-core';
|
|
4
4
|
import dayjs from 'dayjs';
|
|
5
|
+
import { debounce } from 'lodash-es';
|
|
5
6
|
import { clone, isNil } from 'ramda';
|
|
6
7
|
import { OpenAppViewCommand } from '../../../../../command';
|
|
7
8
|
import { CodeListItem, IModalData } from '../../../../../interface';
|
|
@@ -59,6 +60,19 @@ export class GridFieldColumnController extends GridColumnController<IDEGridField
|
|
|
59
60
|
return !!this.model.deuiactionId;
|
|
60
61
|
}
|
|
61
62
|
|
|
63
|
+
protected async onInit(): Promise<void> {
|
|
64
|
+
await super.onInit();
|
|
65
|
+
|
|
66
|
+
// 加载代码表防抖
|
|
67
|
+
this.loadCodeList = debounce(
|
|
68
|
+
this.loadCodeList,
|
|
69
|
+
300,
|
|
70
|
+
) as typeof this.loadCodeList;
|
|
71
|
+
|
|
72
|
+
// 默认加载一次代码表
|
|
73
|
+
this.loadCodeList();
|
|
74
|
+
}
|
|
75
|
+
|
|
62
76
|
/**
|
|
63
77
|
* 行是否可点击(影响列的界面样式)
|
|
64
78
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-shadow */
|
|
2
2
|
import { RuntimeError } from '@ibiz-template/core';
|
|
3
|
-
import {
|
|
3
|
+
import { IDEMultiEditViewPanel } from '@ibiz/model-core';
|
|
4
4
|
import { createUUID } from 'qx-util';
|
|
5
5
|
import {
|
|
6
6
|
IMEditViewPanelState,
|
|
@@ -38,12 +38,6 @@ export class MEditViewPanelController
|
|
|
38
38
|
*/
|
|
39
39
|
showButton: boolean = true;
|
|
40
40
|
|
|
41
|
-
/**
|
|
42
|
-
* 关系实体参数对象
|
|
43
|
-
*
|
|
44
|
-
*/
|
|
45
|
-
deResParameters: IData[] = [];
|
|
46
|
-
|
|
47
41
|
/**
|
|
48
42
|
* 当前应用视图参数对象
|
|
49
43
|
*
|
|
@@ -64,49 +58,6 @@ export class MEditViewPanelController
|
|
|
64
58
|
this.state.size = 1000;
|
|
65
59
|
}
|
|
66
60
|
|
|
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
61
|
/**
|
|
111
62
|
* 初始化嵌入应用视图及实体参数对象
|
|
112
63
|
* @return {*}
|
|
@@ -114,9 +65,6 @@ export class MEditViewPanelController
|
|
|
114
65
|
* @Date: 2023-10-16 13:56:56
|
|
115
66
|
*/
|
|
116
67
|
async initParameters(): Promise<void> {
|
|
117
|
-
if (this.controlParams.SHOWBUTTON) {
|
|
118
|
-
this.showButton = !Object.is(this.controlParams.SHOWBUTTON, 'false');
|
|
119
|
-
}
|
|
120
68
|
if (this.model.embeddedAppViewId) {
|
|
121
69
|
const embedView = await ibiz.hub.getAppView(this.model.embeddedAppViewId);
|
|
122
70
|
if (embedView.appDataEntityId) {
|
|
@@ -124,10 +72,6 @@ export class MEditViewPanelController
|
|
|
124
72
|
embedView.appDataEntityId,
|
|
125
73
|
);
|
|
126
74
|
if (embedView && embedViewEntity) {
|
|
127
|
-
this.deResParameters = await this.formatAppDERSPath(
|
|
128
|
-
this.context,
|
|
129
|
-
(embedView as IAppDEView).appDERSPaths,
|
|
130
|
-
);
|
|
131
75
|
this.parameters = [
|
|
132
76
|
{
|
|
133
77
|
parameterName: embedViewEntity.keyAppDEFieldId?.toLowerCase(),
|
|
@@ -135,7 +79,6 @@ export class MEditViewPanelController
|
|
|
135
79
|
},
|
|
136
80
|
];
|
|
137
81
|
} else {
|
|
138
|
-
this.deResParameters = [];
|
|
139
82
|
this.parameters = [];
|
|
140
83
|
}
|
|
141
84
|
}
|
|
@@ -180,24 +123,13 @@ export class MEditViewPanelController
|
|
|
180
123
|
const id: string = arg[parameterName]
|
|
181
124
|
? arg[parameterName]
|
|
182
125
|
: `mockId:${createUUID()}`;
|
|
183
|
-
const item = {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
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
|
-
});
|
|
126
|
+
const item = {
|
|
127
|
+
id,
|
|
128
|
+
context: this.context.clone(),
|
|
129
|
+
params: {},
|
|
130
|
+
data: arg,
|
|
131
|
+
srfmajortext: '',
|
|
132
|
+
};
|
|
201
133
|
|
|
202
134
|
// 当前视图参数(应用实体视图)
|
|
203
135
|
this.parameters.forEach(parameter => {
|
|
@@ -216,8 +148,6 @@ export class MEditViewPanelController
|
|
|
216
148
|
}
|
|
217
149
|
});
|
|
218
150
|
|
|
219
|
-
// 合并视图参数
|
|
220
|
-
Object.assign(item.params, this.params);
|
|
221
151
|
return item;
|
|
222
152
|
}
|
|
223
153
|
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
ISearchBarController,
|
|
8
8
|
IFilterNode,
|
|
9
9
|
} from '../../../interface';
|
|
10
|
+
import { convertNavData, ScriptFactory } from '../../../utils';
|
|
10
11
|
import { ControlController } from '../../common';
|
|
11
12
|
import { SearchBarFilterController } from './search-bar-filter.controller';
|
|
12
13
|
|
|
@@ -144,11 +145,11 @@ export class SearchBarController
|
|
|
144
145
|
}
|
|
145
146
|
// 快速分组
|
|
146
147
|
if (this.state.selectedGroupItem?.data) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
const addParams =
|
|
148
|
+
const navParams = ScriptFactory.execSingleLine(
|
|
149
|
+
this.state.selectedGroupItem.data,
|
|
150
|
+
) as IData;
|
|
151
|
+
|
|
152
|
+
const addParams = convertNavData(navParams, this.params, this.context);
|
|
152
153
|
Object.assign(params, addParams);
|
|
153
154
|
}
|
|
154
155
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isArray } from 'lodash-es';
|
|
1
2
|
import { DELogicParam } from './de-logic-param/de-logic-param';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -21,9 +22,9 @@ export class DELogicContext {
|
|
|
21
22
|
* 实体逻辑执行参数
|
|
22
23
|
* @author lxm
|
|
23
24
|
* @date 2023-10-16 02:22:31
|
|
24
|
-
* @type {{ context: IParams; data: IData; params: IParams }}
|
|
25
|
+
* @type {{ context: IParams; data: IData[]; params: IParams }}
|
|
25
26
|
*/
|
|
26
|
-
parameters: { context: IParams; data: IData; params: IParams };
|
|
27
|
+
parameters: { context: IParams; data: IData[]; params: IParams };
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
30
|
* 上下文
|
|
@@ -38,7 +39,7 @@ export class DELogicContext {
|
|
|
38
39
|
/**
|
|
39
40
|
* 数据
|
|
40
41
|
*/
|
|
41
|
-
get data(): IData {
|
|
42
|
+
get data(): IData[] {
|
|
42
43
|
return this.parameters.data;
|
|
43
44
|
}
|
|
44
45
|
|
|
@@ -64,10 +65,10 @@ export class DELogicContext {
|
|
|
64
65
|
constructor(
|
|
65
66
|
private deLogicParams: Map<string, DELogicParam>,
|
|
66
67
|
context: IParams,
|
|
67
|
-
data: IData,
|
|
68
|
+
data: IData | IData[],
|
|
68
69
|
params: IParams,
|
|
69
70
|
) {
|
|
70
|
-
this.parameters = { context, data, params };
|
|
71
|
+
this.parameters = { context, data: isArray(data) ? data : [data], params };
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
/**
|
|
@@ -35,7 +35,12 @@ export class DELogicParam {
|
|
|
35
35
|
const tag = this.model.id!;
|
|
36
36
|
const m = this.model;
|
|
37
37
|
if (m.default) {
|
|
38
|
-
|
|
38
|
+
// 配置了列表的拿数组数据
|
|
39
|
+
if (m.entityListParam) {
|
|
40
|
+
ctx.params[tag] = ctx.data || [];
|
|
41
|
+
} else {
|
|
42
|
+
ctx.params[tag] = ctx.data[0] || {};
|
|
43
|
+
}
|
|
39
44
|
} else if (m.appGlobalParam) {
|
|
40
45
|
// 应用全局变量
|
|
41
46
|
ctx.params[tag] = clone(ibiz.env);
|
package/src/de-logic/de-logic.ts
CHANGED
|
@@ -168,7 +168,11 @@ export class DELogic {
|
|
|
168
168
|
* @param {IParams} [opt]
|
|
169
169
|
* @return {*} {Promise<IData>}
|
|
170
170
|
*/
|
|
171
|
-
async exec(
|
|
171
|
+
async exec(
|
|
172
|
+
context: IParams,
|
|
173
|
+
data: IData | IData[],
|
|
174
|
+
params: IParams,
|
|
175
|
+
): Promise<unknown> {
|
|
172
176
|
if (this.scriptFn) {
|
|
173
177
|
return this.scriptFn.exec({ context, data, params });
|
|
174
178
|
}
|
package/src/de-logic/index.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { HttpError, HttpResponse, RuntimeError } from '@ibiz-template/core';
|
|
2
2
|
import { IAppDataEntity, IAppDELogic } from '@ibiz/model-core';
|
|
3
|
+
import { isArray } from 'lodash-es';
|
|
4
|
+
import { clone } from 'ramda';
|
|
3
5
|
import { filterFieldLogics, findDELogic } from '../model';
|
|
4
6
|
import { DELogic } from './de-logic';
|
|
5
7
|
|
|
@@ -42,12 +44,13 @@ async function findDeLogic(
|
|
|
42
44
|
export async function execDELogic(
|
|
43
45
|
deDELogic: IAppDELogic,
|
|
44
46
|
context: IParams,
|
|
45
|
-
data: IData,
|
|
46
|
-
params: IParams,
|
|
47
|
+
data: IData | IData[] = {},
|
|
48
|
+
params: IParams = {},
|
|
47
49
|
): Promise<unknown> {
|
|
48
50
|
if (!deLogicMap.has(deDELogic)) {
|
|
49
51
|
deLogicMap.set(deDELogic, new DELogic(deDELogic));
|
|
50
52
|
}
|
|
53
|
+
|
|
51
54
|
const deLogic = deLogicMap.get(deDELogic)!;
|
|
52
55
|
return deLogic.exec(context, data, params);
|
|
53
56
|
}
|
|
@@ -97,11 +100,15 @@ export async function execDELogicById(
|
|
|
97
100
|
export async function execDELogicAction(
|
|
98
101
|
deDELogic: IAppDELogic,
|
|
99
102
|
context: IParams,
|
|
100
|
-
data
|
|
101
|
-
params
|
|
103
|
+
data?: IData | IData[],
|
|
104
|
+
params?: IParams,
|
|
102
105
|
): Promise<HttpResponse<IData>> {
|
|
106
|
+
const _context = clone(context);
|
|
107
|
+
const _data = data ? clone(data) : data;
|
|
108
|
+
const _params = params ? clone(params) : params;
|
|
109
|
+
|
|
103
110
|
try {
|
|
104
|
-
const result = await execDELogic(deDELogic,
|
|
111
|
+
const result = await execDELogic(deDELogic, _context, _data, _params);
|
|
105
112
|
return new HttpResponse(result);
|
|
106
113
|
} catch (err) {
|
|
107
114
|
if (err instanceof HttpError) {
|
|
@@ -112,9 +119,9 @@ export async function execDELogicAction(
|
|
|
112
119
|
}
|
|
113
120
|
|
|
114
121
|
/**
|
|
115
|
-
*
|
|
122
|
+
* 执行属性实体逻辑(单条数据)
|
|
116
123
|
* @author lxm
|
|
117
|
-
* @date 2023-
|
|
124
|
+
* @date 2023-10-19 04:00:15
|
|
118
125
|
* @export
|
|
119
126
|
* @param {IAppDataEntity} entity
|
|
120
127
|
* @param {('compute' | 'change' | 'default')} type
|
|
@@ -123,7 +130,7 @@ export async function execDELogicAction(
|
|
|
123
130
|
* @param {IParams} params
|
|
124
131
|
* @return {*} {Promise<void>}
|
|
125
132
|
*/
|
|
126
|
-
|
|
133
|
+
async function execSingleFieldLogics(
|
|
127
134
|
entity: IAppDataEntity,
|
|
128
135
|
type: 'compute' | 'change' | 'default',
|
|
129
136
|
context: IParams,
|
|
@@ -142,3 +149,37 @@ export async function execFieldLogics(
|
|
|
142
149
|
});
|
|
143
150
|
}
|
|
144
151
|
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* 执行属性实体逻辑(单条或者多条)
|
|
155
|
+
* @author lxm
|
|
156
|
+
* @date 2023-06-14 12:29:56
|
|
157
|
+
* @export
|
|
158
|
+
* @param {IAppDataEntity} entity
|
|
159
|
+
* @param {('compute' | 'change' | 'default')} type
|
|
160
|
+
* @param {IParams} context
|
|
161
|
+
* @param {IData | IData[]} data 单条或多条数据
|
|
162
|
+
* @param {IParams} params
|
|
163
|
+
* @return {*} {Promise<void>}
|
|
164
|
+
*/
|
|
165
|
+
export async function execFieldLogics(
|
|
166
|
+
entity: IAppDataEntity,
|
|
167
|
+
type: 'compute' | 'change' | 'default',
|
|
168
|
+
context: IParams,
|
|
169
|
+
data: IData | IData[],
|
|
170
|
+
params: IParams = {},
|
|
171
|
+
): Promise<void> {
|
|
172
|
+
if (!data) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (isArray(data)) {
|
|
177
|
+
await Promise.all(
|
|
178
|
+
data.map(item =>
|
|
179
|
+
execSingleFieldLogics(entity, type, context, item, params),
|
|
180
|
+
),
|
|
181
|
+
);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
return execSingleFieldLogics(entity, type, context, data, params);
|
|
185
|
+
}
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
ISearchBarController,
|
|
13
13
|
MDCtrlLoadParams,
|
|
14
14
|
EventBase,
|
|
15
|
+
IUIActionResult,
|
|
15
16
|
} from '../interface';
|
|
16
17
|
import { calcDeCodeNameById } from '../model';
|
|
17
18
|
import { ViewEngineBase } from './view-base.engine';
|
|
@@ -162,12 +163,10 @@ export class MDViewEngine extends ViewEngineBase {
|
|
|
162
163
|
return null;
|
|
163
164
|
}
|
|
164
165
|
if (key === SysUIActionTag.EDIT || key === SysUIActionTag.VIEW) {
|
|
165
|
-
|
|
166
|
-
return null;
|
|
166
|
+
return this.openData(args!);
|
|
167
167
|
}
|
|
168
168
|
if (key === SysUIActionTag.NEW) {
|
|
169
|
-
|
|
170
|
-
return null;
|
|
169
|
+
return this.newData(args!);
|
|
171
170
|
}
|
|
172
171
|
if (key === SysUIActionTag.REMOVE) {
|
|
173
172
|
await this.remove(args);
|
|
@@ -214,7 +213,7 @@ export class MDViewEngine extends ViewEngineBase {
|
|
|
214
213
|
event?: MouseEvent;
|
|
215
214
|
context?: IContext;
|
|
216
215
|
params?: IParams;
|
|
217
|
-
}): Promise<
|
|
216
|
+
}): Promise<IUIActionResult> {
|
|
218
217
|
const { data, event } = args;
|
|
219
218
|
|
|
220
219
|
// 添加选中数据的主键
|
|
@@ -233,10 +232,12 @@ export class MDViewEngine extends ViewEngineBase {
|
|
|
233
232
|
view: this.view,
|
|
234
233
|
});
|
|
235
234
|
|
|
236
|
-
if (result
|
|
237
|
-
this.
|
|
238
|
-
} else
|
|
239
|
-
|
|
235
|
+
if (result === -1) {
|
|
236
|
+
throw new RuntimeModelError(this.view.model, `缺少newdata的视图逻辑`);
|
|
237
|
+
} else {
|
|
238
|
+
return {
|
|
239
|
+
cancel: !result.ok,
|
|
240
|
+
};
|
|
240
241
|
}
|
|
241
242
|
}
|
|
242
243
|
|
|
@@ -253,7 +254,7 @@ export class MDViewEngine extends ViewEngineBase {
|
|
|
253
254
|
data: IData[];
|
|
254
255
|
event?: MouseEvent;
|
|
255
256
|
copyMode?: boolean;
|
|
256
|
-
}): Promise<
|
|
257
|
+
}): Promise<IUIActionResult> {
|
|
257
258
|
const { data, event, copyMode } = args;
|
|
258
259
|
const openAppViewLogic =
|
|
259
260
|
this.view.model.viewLayoutPanel?.appViewLogics?.find(
|
|
@@ -276,10 +277,12 @@ export class MDViewEngine extends ViewEngineBase {
|
|
|
276
277
|
view: this.view,
|
|
277
278
|
});
|
|
278
279
|
|
|
279
|
-
if (result
|
|
280
|
-
this.refresh();
|
|
281
|
-
} else if (result === -1) {
|
|
280
|
+
if (result === -1) {
|
|
282
281
|
throw new RuntimeModelError(this.view.model, `缺少newdata的视图逻辑`);
|
|
282
|
+
} else {
|
|
283
|
+
return {
|
|
284
|
+
cancel: !result.ok,
|
|
285
|
+
};
|
|
283
286
|
}
|
|
284
287
|
}
|
|
285
288
|
|
|
@@ -7,7 +7,11 @@ export class AppViewConfigService implements IAppViewConfigService {
|
|
|
7
7
|
* @author lxm
|
|
8
8
|
* @date 2023-07-03 07:08:33
|
|
9
9
|
*/
|
|
10
|
-
viewConfigs = new Map<string, IViewConfig>();
|
|
10
|
+
protected viewConfigs = new Map<string, IViewConfig>();
|
|
11
|
+
|
|
12
|
+
has(key: string): boolean {
|
|
13
|
+
return this.viewConfigs.has(key);
|
|
14
|
+
}
|
|
11
15
|
|
|
12
16
|
set(id: string, viewConfig: IViewConfig): void {
|
|
13
17
|
this.viewConfigs.set(id, viewConfig);
|
|
@@ -33,4 +37,11 @@ export class AppViewConfigService implements IAppViewConfigService {
|
|
|
33
37
|
}
|
|
34
38
|
return this.viewConfigs.get(key)!;
|
|
35
39
|
}
|
|
40
|
+
|
|
41
|
+
getSync(key: string): IViewConfig | null {
|
|
42
|
+
if (this.viewConfigs.has(key)) {
|
|
43
|
+
return this.viewConfigs.get(key)!;
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
36
47
|
}
|