@ibiz-template/runtime 0.1.32 → 0.1.34
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 +448 -235
- package/dist/index.system.min.js +1 -1
- package/dist/index.system.min.js.map +1 -1
- package/out/controller/common/control/control.controller.d.ts +1 -0
- package/out/controller/common/control/control.controller.d.ts.map +1 -1
- package/out/controller/common/control/control.controller.js +21 -1
- package/out/controller/common/control/md-control.controller.js +2 -2
- package/out/controller/common/editor/code-list-editor.controller.d.ts.map +1 -1
- package/out/controller/common/editor/code-list-editor.controller.js +1 -1
- package/out/controller/common/editor/editor.controller.d.ts.map +1 -1
- package/out/controller/common/editor/editor.controller.js +1 -2
- package/out/controller/common/view/view.controller.d.ts.map +1 -1
- package/out/controller/common/view/view.controller.js +2 -1
- package/out/controller/control/calendar/calendar.controller.js +1 -1
- package/out/controller/control/data-view/data-view.controller.js +5 -3
- package/out/controller/control/form/edit-form/edit-form.controller.d.ts +7 -7
- package/out/controller/control/form/edit-form/edit-form.controller.d.ts.map +1 -1
- package/out/controller/control/form/edit-form/edit-form.controller.js +22 -16
- package/out/controller/control/form/search-form/search-form.service.d.ts +8 -0
- package/out/controller/control/form/search-form/search-form.service.d.ts.map +1 -1
- package/out/controller/control/form/search-form/search-form.service.js +19 -2
- package/out/controller/control/grid/grid/grid.controller.js +2 -2
- package/out/controller/control/panel/panel/panel-item.controller.d.ts +6 -0
- package/out/controller/control/panel/panel/panel-item.controller.d.ts.map +1 -1
- package/out/controller/control/panel/panel/panel-item.controller.js +11 -0
- package/out/controller/control/panel/panel/panel.controller.d.ts +3 -0
- package/out/controller/control/panel/panel/panel.controller.d.ts.map +1 -1
- package/out/controller/control/panel/panel/panel.controller.js +13 -0
- package/out/controller/control/panel/view-layout-panel/view-layout-panel.controller.d.ts.map +1 -1
- package/out/controller/control/panel/view-layout-panel/view-layout-panel.controller.js +7 -0
- package/out/controller/control/tree/tree.controller.d.ts.map +1 -1
- package/out/controller/control/tree/tree.controller.js +15 -7
- package/out/interface/common/i-data-ability-params/i-data-ability-params.d.ts +4 -4
- package/out/interface/common/i-data-ability-params/i-data-ability-params.d.ts.map +1 -1
- package/out/interface/common/i-float-window-options/i-float-window-options.d.ts +75 -0
- package/out/interface/common/i-float-window-options/i-float-window-options.d.ts.map +1 -0
- package/out/interface/common/i-float-window-options/i-float-window-options.js +1 -0
- package/out/interface/common/index.d.ts +1 -0
- package/out/interface/common/index.d.ts.map +1 -1
- package/out/interface/controller/controller/control/i-control.controller.d.ts +1 -1
- package/out/interface/controller/controller/control/i-edit-form.controller.d.ts +6 -5
- package/out/interface/controller/controller/control/i-edit-form.controller.d.ts.map +1 -1
- package/out/interface/controller/controller/i.controller.d.ts +1 -1
- package/out/interface/controller/event/argument/index.d.ts +1 -0
- package/out/interface/controller/event/argument/index.d.ts.map +1 -1
- package/out/interface/controller/event/argument/panel-item.event.d.ts +26 -0
- package/out/interface/controller/event/argument/panel-item.event.d.ts.map +1 -0
- package/out/interface/controller/event/argument/panel-item.event.js +1 -0
- package/out/interface/controller/event/control/i-panel.event.d.ts +12 -1
- package/out/interface/controller/event/control/i-panel.event.d.ts.map +1 -1
- package/out/interface/logic-scheduler/i-scheduler-logic.d.ts +7 -0
- package/out/interface/logic-scheduler/i-scheduler-logic.d.ts.map +1 -1
- package/out/interface/service/service/i-app-de.service.d.ts +24 -0
- package/out/interface/service/service/i-app-de.service.d.ts.map +1 -1
- package/out/interface/util/i-overlay-controller/i-overlay-controller.d.ts +24 -1
- package/out/interface/util/i-overlay-controller/i-overlay-controller.d.ts.map +1 -1
- package/out/logic-scheduler/executor/app-ui-action-executor.d.ts +15 -0
- package/out/logic-scheduler/executor/app-ui-action-executor.d.ts.map +1 -0
- package/out/logic-scheduler/executor/app-ui-action-executor.js +16 -0
- package/out/logic-scheduler/index.d.ts.map +1 -1
- package/out/logic-scheduler/index.js +6 -0
- package/out/logic-scheduler/scheduler/control-logic-scheduler.d.ts.map +1 -1
- package/out/logic-scheduler/scheduler/control-logic-scheduler.js +6 -0
- package/out/logic-scheduler/scheduler/logic-scheduler.d.ts +2 -2
- package/out/logic-scheduler/scheduler/logic-scheduler.d.ts.map +1 -1
- package/out/logic-scheduler/scheduler/logic-scheduler.js +3 -3
- package/out/logic-scheduler/trigger/control-event-trigger.d.ts.map +1 -1
- package/out/logic-scheduler/trigger/control-event-trigger.js +3 -1
- package/out/service/service/entity/de.service.d.ts +36 -2
- package/out/service/service/entity/de.service.d.ts.map +1 -1
- package/out/service/service/entity/de.service.js +79 -7
- package/out/service/service/entity/method/ac-fetch.d.ts +14 -0
- package/out/service/service/entity/method/ac-fetch.d.ts.map +1 -0
- package/out/service/service/entity/method/ac-fetch.js +15 -0
- package/out/service/service/entity/method/de-action.d.ts.map +1 -1
- package/out/service/service/entity/method/de-action.js +2 -1
- package/out/service/service/entity/method/method.d.ts +1 -0
- package/out/service/service/entity/method/method.d.ts.map +1 -1
- package/out/service/service/entity/method/method.js +7 -4
- package/out/ui-logic/ui-logic-link/ui-logic-link-single-cond/ui-logic-link-single-cond.d.ts.map +1 -1
- package/out/ui-logic/ui-logic-link/ui-logic-link-single-cond/ui-logic-link-single-cond.js +12 -5
- package/out/ui-logic/ui-logic-node/prepare-js-param-node/prepare-js-param-node.d.ts.map +1 -1
- package/out/ui-logic/ui-logic-node/prepare-js-param-node/prepare-js-param-node.js +16 -2
- 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 +5 -0
- package/package.json +5 -5
- package/src/controller/common/control/control.controller.ts +25 -1
- package/src/controller/common/control/md-control.controller.ts +2 -2
- package/src/controller/common/editor/code-list-editor.controller.ts +4 -1
- package/src/controller/common/editor/editor.controller.ts +1 -2
- package/src/controller/common/view/view.controller.ts +2 -0
- package/src/controller/control/calendar/calendar.controller.ts +1 -1
- package/src/controller/control/data-view/data-view.controller.ts +3 -3
- package/src/controller/control/form/edit-form/edit-form.controller.ts +27 -30
- package/src/controller/control/form/search-form/search-form.service.ts +20 -2
- package/src/controller/control/grid/grid/grid.controller.ts +2 -2
- package/src/controller/control/panel/panel/panel-item.controller.ts +12 -0
- package/src/controller/control/panel/panel/panel.controller.ts +20 -0
- package/src/controller/control/panel/view-layout-panel/view-layout-panel.controller.ts +11 -0
- package/src/controller/control/tree/tree.controller.ts +15 -8
- package/src/interface/common/i-data-ability-params/i-data-ability-params.ts +4 -4
- package/src/interface/common/i-float-window-options/i-float-window-options.ts +74 -0
- package/src/interface/common/index.ts +1 -0
- package/src/interface/controller/controller/control/i-control.controller.ts +1 -1
- package/src/interface/controller/controller/control/i-edit-form.controller.ts +6 -5
- package/src/interface/controller/controller/i.controller.ts +1 -1
- package/src/interface/controller/event/argument/index.ts +1 -0
- package/src/interface/controller/event/argument/panel-item.event.ts +27 -0
- package/src/interface/controller/event/control/i-panel.event.ts +13 -1
- package/src/interface/logic-scheduler/i-scheduler-logic.ts +8 -0
- package/src/interface/service/service/i-app-de.service.ts +36 -0
- package/src/interface/util/i-overlay-controller/i-overlay-controller.ts +39 -1
- package/src/logic-scheduler/executor/app-ui-action-executor.ts +20 -0
- package/src/logic-scheduler/index.ts +12 -0
- package/src/logic-scheduler/scheduler/control-logic-scheduler.ts +6 -0
- package/src/logic-scheduler/scheduler/logic-scheduler.ts +7 -4
- package/src/logic-scheduler/trigger/control-event-trigger.ts +3 -1
- package/src/service/service/entity/de.service.ts +97 -7
- package/src/service/service/entity/method/ac-fetch.ts +16 -0
- package/src/service/service/entity/method/de-action.ts +7 -1
- package/src/service/service/entity/method/method.ts +11 -4
- package/src/ui-logic/ui-logic-link/ui-logic-link-single-cond/ui-logic-link-single-cond.ts +12 -5
- package/src/ui-logic/ui-logic-node/prepare-js-param-node/prepare-js-param-node.ts +24 -2
- package/src/ui-logic/ui-logic-param/ui-logic-param.ts +7 -0
|
@@ -13,6 +13,7 @@ import { TimerTrigger } from './trigger/timer-trigger';
|
|
|
13
13
|
import { AppUILogicExecutor } from './executor/app-ui-logic-executor';
|
|
14
14
|
import { ViewEventTrigger } from './trigger/view-event-trigger';
|
|
15
15
|
import { ControlEventTrigger } from './trigger/control-event-trigger';
|
|
16
|
+
import { AppDEUIActionExecutor } from './executor/app-ui-action-executor';
|
|
16
17
|
|
|
17
18
|
export {
|
|
18
19
|
LogicSchedulerCenter,
|
|
@@ -61,10 +62,13 @@ export function installLogicSchedule(): void {
|
|
|
61
62
|
);
|
|
62
63
|
|
|
63
64
|
// 执行器
|
|
65
|
+
// 脚本
|
|
64
66
|
ibiz.scheduler.executorFactory.register(
|
|
65
67
|
'SCRIPT',
|
|
66
68
|
(logic, scheduler) => new ScriptExecutor(logic, scheduler),
|
|
67
69
|
);
|
|
70
|
+
|
|
71
|
+
// 实体逻辑
|
|
68
72
|
ibiz.scheduler.executorFactory.register(
|
|
69
73
|
'APPDEUILOGIC',
|
|
70
74
|
(logic, scheduler) => new AppDEUILogicExecutor(logic, scheduler),
|
|
@@ -73,8 +77,16 @@ export function installLogicSchedule(): void {
|
|
|
73
77
|
'DEUILOGIC',
|
|
74
78
|
(logic, scheduler) => new AppDEUILogicExecutor(logic, scheduler),
|
|
75
79
|
);
|
|
80
|
+
|
|
81
|
+
// 界面逻辑
|
|
76
82
|
ibiz.scheduler.executorFactory.register(
|
|
77
83
|
'APPUILOGIC',
|
|
78
84
|
(logic, scheduler) => new AppUILogicExecutor(logic, scheduler),
|
|
79
85
|
);
|
|
86
|
+
|
|
87
|
+
// 界面行为
|
|
88
|
+
ibiz.scheduler.executorFactory.register(
|
|
89
|
+
'APPDEUIACTION',
|
|
90
|
+
(logic, scheduler) => new AppDEUIActionExecutor(logic, scheduler),
|
|
91
|
+
);
|
|
80
92
|
}
|
|
@@ -16,6 +16,12 @@ export class ControlLogicScheduler extends LogicScheduler {
|
|
|
16
16
|
const filterLogics = logics.filter(
|
|
17
17
|
item => item.triggerType !== 'APPVIEWENGINE',
|
|
18
18
|
);
|
|
19
|
+
filterLogics.forEach(logic => {
|
|
20
|
+
// 部件事件的部件名称在itemName上,统一写到ctrlName,与视图逻辑保持一致。
|
|
21
|
+
if (logic.triggerType === 'CTRLEVENT') {
|
|
22
|
+
(logic as IData).ctrlName = logic.itemName;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
19
25
|
super(filterLogics as ISchedulerLogic[]);
|
|
20
26
|
}
|
|
21
27
|
}
|
|
@@ -3,7 +3,6 @@ import type {
|
|
|
3
3
|
IUILogicParams,
|
|
4
4
|
ISchedulerLogic,
|
|
5
5
|
ITriggerMatchParams,
|
|
6
|
-
EventBase,
|
|
7
6
|
} from '../../interface';
|
|
8
7
|
import { LogicExecutor } from '../executor/logic-executor';
|
|
9
8
|
import { LogicTrigger } from '../trigger/logic-trigger';
|
|
@@ -263,12 +262,16 @@ export class LogicScheduler {
|
|
|
263
262
|
* @param {Partial<IUILogicParams>} executeParams 执行参数
|
|
264
263
|
* @return {*} {(boolean | undefined)}
|
|
265
264
|
*/
|
|
266
|
-
triggerControlEvent(
|
|
265
|
+
triggerControlEvent(
|
|
266
|
+
ctrlName: string,
|
|
267
|
+
eventName: string,
|
|
268
|
+
executeParams?: Partial<IUILogicParams>,
|
|
269
|
+
): void {
|
|
267
270
|
const matchParams = {
|
|
268
271
|
ctrlName,
|
|
269
|
-
eventName
|
|
272
|
+
eventName,
|
|
270
273
|
triggerType: 'CTRLEVENT',
|
|
271
274
|
} as const;
|
|
272
|
-
this.triggerAndExecute(matchParams,
|
|
275
|
+
this.triggerAndExecute(matchParams, executeParams);
|
|
273
276
|
}
|
|
274
277
|
}
|
|
@@ -38,7 +38,9 @@ export class ControlEventTrigger extends LogicTrigger {
|
|
|
38
38
|
const superResult = super.match(matchParams);
|
|
39
39
|
return (
|
|
40
40
|
superResult &&
|
|
41
|
-
|
|
41
|
+
// 忽略大小写匹配
|
|
42
|
+
matchParams.ctrlName!.toLowerCase() ===
|
|
43
|
+
this.logic.ctrlName!.toLowerCase() &&
|
|
42
44
|
this.listenEventNames.includes(matchParams.eventName!)
|
|
43
45
|
);
|
|
44
46
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IAppDEMethod, IAppDataEntity } from '@ibiz/model-core';
|
|
2
2
|
import { IHttpResponse, ModelError, RuntimeError } from '@ibiz-template/core';
|
|
3
|
-
import { DECache } from '../../utils';
|
|
3
|
+
import { DECache, calcResPath } from '../../utils';
|
|
4
4
|
import { WorkFlowService } from '../work-flow/work-flow.service';
|
|
5
5
|
import { Method } from './method/method';
|
|
6
6
|
import { FileService } from '../file/file.service';
|
|
@@ -9,6 +9,7 @@ import { DEActionMethod } from './method/de-action';
|
|
|
9
9
|
import { FetchMethod } from './method/fetch';
|
|
10
10
|
import { IAppDEService } from '../../../interface';
|
|
11
11
|
import { ConfigService } from '../config/config.service';
|
|
12
|
+
import { AcFetchMethod } from './method/ac-fetch';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* 实体服务
|
|
@@ -86,14 +87,16 @@ export class DEService implements IAppDEService {
|
|
|
86
87
|
* 获取实体服务方法实例
|
|
87
88
|
*
|
|
88
89
|
* @author chitanda
|
|
89
|
-
* @date
|
|
90
|
+
* @date 2023-10-12 17:10:10
|
|
90
91
|
* @protected
|
|
91
92
|
* @param {string} id
|
|
93
|
+
* @param {boolean} [acMode=false]
|
|
92
94
|
* @return {*} {Method}
|
|
93
95
|
*/
|
|
94
|
-
protected getMethod(id: string): Method {
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
protected getMethod(id: string, acMode: boolean = false): Method {
|
|
97
|
+
const cacheId = acMode ? `ac-${id}` : id;
|
|
98
|
+
if (this.methodMap.has(cacheId)) {
|
|
99
|
+
return this.methodMap.get(cacheId)!;
|
|
97
100
|
}
|
|
98
101
|
const model = findModelChild(this.model.appDEMethods!, id) as IAppDEMethod;
|
|
99
102
|
let method: Method | null = null;
|
|
@@ -103,7 +106,11 @@ export class DEService implements IAppDEService {
|
|
|
103
106
|
break;
|
|
104
107
|
case 'FETCH':
|
|
105
108
|
case 'FETCHTEMP':
|
|
106
|
-
|
|
109
|
+
if (acMode) {
|
|
110
|
+
method = new AcFetchMethod(this.model, model);
|
|
111
|
+
} else {
|
|
112
|
+
method = new FetchMethod(this.model, model);
|
|
113
|
+
}
|
|
107
114
|
break;
|
|
108
115
|
default:
|
|
109
116
|
throw new ModelError(
|
|
@@ -111,7 +118,7 @@ export class DEService implements IAppDEService {
|
|
|
111
118
|
`未支持的服务方法类型: ${model.methodType}`,
|
|
112
119
|
);
|
|
113
120
|
}
|
|
114
|
-
this.methodMap.set(
|
|
121
|
+
this.methodMap.set(cacheId, method);
|
|
115
122
|
return method;
|
|
116
123
|
}
|
|
117
124
|
|
|
@@ -138,4 +145,87 @@ export class DEService implements IAppDEService {
|
|
|
138
145
|
}
|
|
139
146
|
throw new RuntimeError(`${this.model.codeName}未支持「${id}」方法`);
|
|
140
147
|
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* 执行服务方法 ac 模式
|
|
151
|
+
*
|
|
152
|
+
* @author chitanda
|
|
153
|
+
* @date 2022-09-13 19:09:55
|
|
154
|
+
* @param {string} id 执行服务方法标识
|
|
155
|
+
* @param {IParams} context
|
|
156
|
+
* @param {IData} [params={}] 请求参数
|
|
157
|
+
* @param {IParams} [params2={}] 查询参数
|
|
158
|
+
* @return {*} {Promise<IHttpResponse>}
|
|
159
|
+
*/
|
|
160
|
+
execAc(
|
|
161
|
+
id: string,
|
|
162
|
+
context: IParams,
|
|
163
|
+
params?: IData,
|
|
164
|
+
params2: IParams = {},
|
|
165
|
+
): Promise<IHttpResponse> {
|
|
166
|
+
const method = this.getMethod(id, true);
|
|
167
|
+
if (method) {
|
|
168
|
+
return method.exec(context, params, params2);
|
|
169
|
+
}
|
|
170
|
+
throw new RuntimeError(`${this.model.codeName}未支持「${id}」方法`);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* 实体级别 AI 聊天会话
|
|
175
|
+
*
|
|
176
|
+
* @author chitanda
|
|
177
|
+
* @date 2023-10-12 11:10:00
|
|
178
|
+
* @param {IParams} context
|
|
179
|
+
* @param {IParams} [params={}]
|
|
180
|
+
* @param {FetchEventSourceInit} [options={}]
|
|
181
|
+
* @return {*} {Promise<void>}
|
|
182
|
+
*/
|
|
183
|
+
aiChatSse(
|
|
184
|
+
onmessage: (data: unknown) => void,
|
|
185
|
+
context: IParams,
|
|
186
|
+
params: IParams = {},
|
|
187
|
+
data: IData = {},
|
|
188
|
+
): Promise<void> {
|
|
189
|
+
const app = ibiz.hub.getApp(this.model.appId);
|
|
190
|
+
const path = this.calcSsePath(context);
|
|
191
|
+
return new Promise((resolve, reject) => {
|
|
192
|
+
app.net.sse(
|
|
193
|
+
`/${path}`,
|
|
194
|
+
{ srfactag: 'AIChat', ...params },
|
|
195
|
+
{
|
|
196
|
+
headers: {
|
|
197
|
+
'Content-Type': 'application/json',
|
|
198
|
+
},
|
|
199
|
+
body: JSON.stringify(data),
|
|
200
|
+
onmessage: (e: unknown) => {
|
|
201
|
+
onmessage(e);
|
|
202
|
+
},
|
|
203
|
+
onclose: () => {
|
|
204
|
+
resolve();
|
|
205
|
+
},
|
|
206
|
+
onerror: (e: unknown) => {
|
|
207
|
+
reject(e);
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
);
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* 计算请求路径
|
|
216
|
+
*
|
|
217
|
+
* @author chitanda
|
|
218
|
+
* @date 2023-10-12 11:10:56
|
|
219
|
+
* @protected
|
|
220
|
+
* @param {IParams} context
|
|
221
|
+
* @return {*} {string}
|
|
222
|
+
*/
|
|
223
|
+
protected calcSsePath(context: IParams): string {
|
|
224
|
+
const srfkey = context[this.model.codeName!.toLowerCase()];
|
|
225
|
+
const curPath = `/${this.model.codeName2!.toLowerCase()}/ssechatcompletion${
|
|
226
|
+
srfkey ? `/${srfkey}` : ''
|
|
227
|
+
}`;
|
|
228
|
+
const resPath = calcResPath(context, this.model);
|
|
229
|
+
return resPath + curPath;
|
|
230
|
+
}
|
|
141
231
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FetchMethod } from './fetch';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ac 模式下的数据集获取请求
|
|
5
|
+
*
|
|
6
|
+
* @author chitanda
|
|
7
|
+
* @date 2023-10-12 17:10:03
|
|
8
|
+
* @export
|
|
9
|
+
* @class AcFetchMethod
|
|
10
|
+
* @extends {FetchMethod}
|
|
11
|
+
*/
|
|
12
|
+
export class AcFetchMethod extends FetchMethod {
|
|
13
|
+
protected mergeRequestPath(path: string, methodName: string): string {
|
|
14
|
+
return `${path}/ac/${methodName}?srfac=ac`;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
RuntimeModelError,
|
|
5
5
|
} from '@ibiz-template/core';
|
|
6
6
|
import { IAppDEAction } from '@ibiz/model-core';
|
|
7
|
+
import { clone } from 'ramda';
|
|
7
8
|
import { Method } from './method';
|
|
8
9
|
import { IDataEntity } from '../../../../interface';
|
|
9
10
|
import { findDELogic } from '../../../../model';
|
|
@@ -47,7 +48,12 @@ export class DEActionMethod extends Method {
|
|
|
47
48
|
if (!deLogic) {
|
|
48
49
|
throw new RuntimeModelError(this.method, '缺少实体处理逻辑');
|
|
49
50
|
}
|
|
50
|
-
return execDELogicAction(
|
|
51
|
+
return execDELogicAction(
|
|
52
|
+
deLogic,
|
|
53
|
+
clone(context),
|
|
54
|
+
data ? clone(data) : {},
|
|
55
|
+
params ? clone(params) : {},
|
|
56
|
+
);
|
|
51
57
|
}
|
|
52
58
|
|
|
53
59
|
if (data && !this.isLocalMode) {
|
|
@@ -110,23 +110,26 @@ export abstract class Method {
|
|
|
110
110
|
switch (requestMethod) {
|
|
111
111
|
case 'POST':
|
|
112
112
|
res = await this.app.net.post(
|
|
113
|
-
|
|
113
|
+
this.mergeRequestPath(path, methodName),
|
|
114
114
|
notNilEmpty(data) ? data! : params!,
|
|
115
115
|
);
|
|
116
116
|
break;
|
|
117
117
|
case 'GET':
|
|
118
|
-
res = await this.app.net.get(
|
|
118
|
+
res = await this.app.net.get(
|
|
119
|
+
this.mergeRequestPath(path, methodName),
|
|
120
|
+
data || params,
|
|
121
|
+
);
|
|
119
122
|
break;
|
|
120
123
|
case 'PUT': {
|
|
121
124
|
res = await this.app.net.put(
|
|
122
|
-
|
|
125
|
+
this.mergeRequestPath(path, methodName),
|
|
123
126
|
notNilEmpty(data) ? data! : params!,
|
|
124
127
|
);
|
|
125
128
|
break;
|
|
126
129
|
}
|
|
127
130
|
case 'DELETE':
|
|
128
131
|
res = await this.app.net.delete(
|
|
129
|
-
|
|
132
|
+
this.mergeRequestPath(path, methodName),
|
|
130
133
|
data || params,
|
|
131
134
|
);
|
|
132
135
|
break;
|
|
@@ -145,6 +148,10 @@ export abstract class Method {
|
|
|
145
148
|
throw new RuntimeModelError(this.method, `未支持的行为类型[${actionType}]`);
|
|
146
149
|
}
|
|
147
150
|
|
|
151
|
+
protected mergeRequestPath(path: string, methodName: string): string {
|
|
152
|
+
return `${path}/${methodName}`;
|
|
153
|
+
}
|
|
154
|
+
|
|
148
155
|
/**
|
|
149
156
|
* 根据上下文计算当前请求路径
|
|
150
157
|
*
|
|
@@ -2,6 +2,7 @@ import { ModelError, RuntimeModelError } from '@ibiz-template/core';
|
|
|
2
2
|
import { IDELogicLinkSingleCond } from '@ibiz/model-core';
|
|
3
3
|
import { testCond } from '../../../utils';
|
|
4
4
|
import { UILogicContext } from '../../ui-logic-context';
|
|
5
|
+
import { handleSrcVal } from '../../utils';
|
|
5
6
|
import { UILogicLinkCond } from '../ui-logic-link-cond/ui-logic-link-cond';
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -65,7 +66,10 @@ export class UILogicLinkSingleCond extends UILogicLinkCond {
|
|
|
65
66
|
* @return {*} {boolean}
|
|
66
67
|
*/
|
|
67
68
|
test(ctx: UILogicContext, context: IContext, data: IData): boolean {
|
|
68
|
-
const
|
|
69
|
+
const dstVal = handleSrcVal(ctx, {
|
|
70
|
+
srcDEUILogicParamId: this.dstParam,
|
|
71
|
+
srcFieldName: this.dstField,
|
|
72
|
+
}) as string;
|
|
69
73
|
switch (this.type) {
|
|
70
74
|
case 'ENTITYFIELD': {
|
|
71
75
|
if (!this.value) {
|
|
@@ -77,7 +81,7 @@ export class UILogicLinkSingleCond extends UILogicLinkCond {
|
|
|
77
81
|
// 数据对象属性
|
|
78
82
|
const value =
|
|
79
83
|
data[this.value] != null ? data[this.value] : context[this.value];
|
|
80
|
-
return testCond(
|
|
84
|
+
return testCond(dstVal, this.op, value);
|
|
81
85
|
}
|
|
82
86
|
case 'SRCENTITYFIELD': {
|
|
83
87
|
if (!this.value) {
|
|
@@ -87,13 +91,16 @@ export class UILogicLinkSingleCond extends UILogicLinkCond {
|
|
|
87
91
|
);
|
|
88
92
|
}
|
|
89
93
|
// 源数据对象属性
|
|
90
|
-
const
|
|
91
|
-
|
|
94
|
+
const srcVal = handleSrcVal(ctx, {
|
|
95
|
+
srcDEUILogicParamId: this.srcParam,
|
|
96
|
+
srcFieldName: this.value,
|
|
97
|
+
}) as string;
|
|
98
|
+
return testCond(dstVal, this.op, srcVal);
|
|
92
99
|
}
|
|
93
100
|
case 'CURTIME': // 当前时间
|
|
94
101
|
throw new ModelError(this.model, `暂未支持条件值类型为[当前时间]`);
|
|
95
102
|
default: // 直接使用目标对象参数属性和值做对比
|
|
96
|
-
return testCond(
|
|
103
|
+
return testCond(dstVal, this.op, this.value);
|
|
97
104
|
}
|
|
98
105
|
}
|
|
99
106
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/* eslint-disable no-await-in-loop */
|
|
2
|
-
import { ModelError } from '@ibiz-template/core';
|
|
2
|
+
import { ModelError, RuntimeError } from '@ibiz-template/core';
|
|
3
3
|
import { IDEUILogicNodeParam } from '@ibiz/model-core';
|
|
4
4
|
import { clone } from 'ramda';
|
|
5
|
+
import { ScriptFactory } from '../../../utils';
|
|
5
6
|
import { UILogicContext } from '../../ui-logic-context';
|
|
6
7
|
import { handleSrcVal } from '../../utils';
|
|
7
8
|
import { UILogicNode } from '../ui-logic-node';
|
|
@@ -73,6 +74,11 @@ export class PrepareJSParamNode extends UILogicNode {
|
|
|
73
74
|
ctx: UILogicContext,
|
|
74
75
|
): void {
|
|
75
76
|
const { dstFieldName, dstDEUILogicParamId } = nodeParam;
|
|
77
|
+
|
|
78
|
+
if (!dstDEUILogicParamId) {
|
|
79
|
+
throw new RuntimeError('没有目标参数对象id');
|
|
80
|
+
}
|
|
81
|
+
|
|
76
82
|
// 目标参数
|
|
77
83
|
let dstField = dstFieldName;
|
|
78
84
|
|
|
@@ -84,7 +90,23 @@ export class PrepareJSParamNode extends UILogicNode {
|
|
|
84
90
|
// 源参数
|
|
85
91
|
const srcVal = handleSrcVal(ctx, nodeParam);
|
|
86
92
|
if (dstField) {
|
|
87
|
-
|
|
93
|
+
// 赋值属性的时候支持脚本写法
|
|
94
|
+
try {
|
|
95
|
+
ScriptFactory.execScriptFn(
|
|
96
|
+
{ srcVal, dstParam: ctx.params[dstDEUILogicParamId] },
|
|
97
|
+
`dstParam.${dstFieldName} = srcVal`,
|
|
98
|
+
{
|
|
99
|
+
singleRowReturn: false,
|
|
100
|
+
isAsync: false,
|
|
101
|
+
},
|
|
102
|
+
);
|
|
103
|
+
} catch (error) {
|
|
104
|
+
ibiz.log.error(
|
|
105
|
+
`给目标参数属性${dstFieldName}赋值报错,目标参数:`,
|
|
106
|
+
ctx.params[dstDEUILogicParamId],
|
|
107
|
+
);
|
|
108
|
+
throw error;
|
|
109
|
+
}
|
|
88
110
|
} else {
|
|
89
111
|
ctx.params[dstDEUILogicParamId!] = srcVal;
|
|
90
112
|
}
|
|
@@ -32,6 +32,13 @@ export class UILogicParam {
|
|
|
32
32
|
const m = this.model;
|
|
33
33
|
const { context, viewParams, data, parameters } = ctx;
|
|
34
34
|
const app = ibiz.hub.getApp(context.srfappid);
|
|
35
|
+
|
|
36
|
+
// 特殊变量的特殊处理
|
|
37
|
+
if (m.codeName === 'layoutPanel') {
|
|
38
|
+
ctx.params[tag] = parameters.view.layoutPanel!.panelItems;
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
35
42
|
if (m.default) {
|
|
36
43
|
ctx.params[tag] = data && data.length > 0 ? data[0] : {};
|
|
37
44
|
} else if (m.activeContainerParam) {
|