@ibiz-template/runtime 0.1.33 → 0.1.35
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 +404 -218
- 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 +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/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/de-logic/de-logic-context.d.ts +25 -5
- package/out/de-logic/de-logic-context.d.ts.map +1 -1
- package/out/de-logic/de-logic-context.js +27 -5
- package/out/de-logic/de-logic-node/data-set-node/data-set-node.d.ts.map +1 -1
- package/out/de-logic/de-logic-node/data-set-node/data-set-node.js +2 -2
- package/out/de-logic/de-logic-node/de-action-node/de-action-node.js +1 -1
- package/out/de-logic/de-logic-param/de-logic-param.js +1 -1
- package/out/de-logic/utils/handle-src-val.js +2 -2
- 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 +25 -1
- 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 +38 -3
- package/out/service/service/entity/de.service.d.ts.map +1 -1
- package/out/service/service/entity/de.service.js +84 -8
- 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/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-context.d.ts +1 -11
- package/out/ui-logic/ui-logic-context.d.ts.map +1 -1
- package/out/ui-logic/ui-logic-context.js +7 -11
- 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/data-set-node/data-set-node.d.ts.map +1 -1
- package/out/ui-logic/ui-logic-node/data-set-node/data-set-node.js +6 -2
- package/out/ui-logic/ui-logic-node/de-action-node/de-action-node.js +1 -1
- package/out/ui-logic/ui-logic-node/de-ui-action-node/de-ui-action-node.d.ts.map +1 -1
- package/out/ui-logic/ui-logic-node/de-ui-action-node/de-ui-action-node.js +1 -1
- package/out/ui-logic/ui-logic-node/execute-de-logic-node/execute-de-logic-node.d.ts.map +1 -1
- package/out/ui-logic/ui-logic-node/execute-de-logic-node/execute-de-logic-node.js +1 -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 +3 -2
- package/out/ui-logic/utils/handle-src-val.d.ts.map +1 -1
- package/out/ui-logic/utils/handle-src-val.js +3 -7
- package/package.json +3 -3
- package/src/controller/common/control/control.controller.ts +25 -1
- package/src/controller/common/control/md-control.controller.ts +1 -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/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/de-logic/de-logic-context.ts +42 -5
- package/src/de-logic/de-logic-node/data-set-node/data-set-node.ts +2 -3
- package/src/de-logic/de-logic-node/de-action-node/de-action-node.ts +1 -1
- package/src/de-logic/de-logic-param/de-logic-param.ts +1 -1
- package/src/de-logic/utils/handle-src-val.ts +2 -2
- 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 +37 -1
- 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 +107 -8
- package/src/service/service/entity/method/ac-fetch.ts +16 -0
- package/src/service/service/entity/method/method.ts +11 -4
- package/src/ui-logic/ui-logic-context.ts +7 -11
- 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/data-set-node/data-set-node.ts +6 -3
- package/src/ui-logic/ui-logic-node/de-action-node/de-action-node.ts +1 -1
- package/src/ui-logic/ui-logic-node/de-ui-action-node/de-ui-action-node.ts +2 -0
- package/src/ui-logic/ui-logic-node/execute-de-logic-node/execute-de-logic-node.ts +3 -4
- package/src/ui-logic/ui-logic-param/ui-logic-param.ts +3 -2
- package/src/ui-logic/utils/handle-src-val.ts +3 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IHttpResponse } from '@ibiz-template/core';
|
|
1
|
+
import { IHttpResponse, IPortalAsyncAction } from '@ibiz-template/core';
|
|
2
2
|
import { DECache } from '../../../service/utils';
|
|
3
3
|
import { IFileService } from './i-file.service';
|
|
4
4
|
import { IWorkFlowService } from './i-wf.service';
|
|
@@ -66,4 +66,40 @@ export interface IAppDEService {
|
|
|
66
66
|
params?: IData | IData[],
|
|
67
67
|
params2?: IParams,
|
|
68
68
|
): Promise<IHttpResponse>;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* 触发实体服务方法 ac 模式
|
|
72
|
+
*
|
|
73
|
+
* @author chitanda
|
|
74
|
+
* @date 2023-10-12 17:10:27
|
|
75
|
+
* @param {string} id
|
|
76
|
+
* @param {IParams} context
|
|
77
|
+
* @param {(IData | IData[])} [params]
|
|
78
|
+
* @param {IParams} [params2]
|
|
79
|
+
* @return {*} {Promise<IHttpResponse>}
|
|
80
|
+
*/
|
|
81
|
+
execAc(
|
|
82
|
+
id: string,
|
|
83
|
+
context: IParams,
|
|
84
|
+
params?: IData | IData[],
|
|
85
|
+
params2?: IParams,
|
|
86
|
+
): Promise<IHttpResponse>;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* 实体级别 AI 聊天单次会话
|
|
90
|
+
*
|
|
91
|
+
* @author chitanda
|
|
92
|
+
* @date 2023-10-12 16:10:03
|
|
93
|
+
* @param {(data: IPortalAsyncAction) => void} onmessage
|
|
94
|
+
* @param {IParams} context
|
|
95
|
+
* @param {IParams} [params]
|
|
96
|
+
* @param {IData} [data]
|
|
97
|
+
* @return {*} {Promise<void>}
|
|
98
|
+
*/
|
|
99
|
+
aiChatSse(
|
|
100
|
+
onmessage: (data: IPortalAsyncAction) => void,
|
|
101
|
+
context: IParams,
|
|
102
|
+
params?: IParams,
|
|
103
|
+
data?: IData,
|
|
104
|
+
): Promise<void>;
|
|
69
105
|
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
IPopoverOptions,
|
|
3
|
+
IDrawerOptions,
|
|
4
|
+
IModalOptions,
|
|
5
|
+
IFloatWindowOptions,
|
|
6
|
+
} from '../../common';
|
|
2
7
|
import { IOverlayContainer } from '../i-overlay-container/i-overlay-container';
|
|
3
8
|
import { IOverlayPopoverContainer } from '../i-overlay-popover-container/i-overlay-popover-container';
|
|
4
9
|
|
|
@@ -111,4 +116,37 @@ export interface IOverlayController {
|
|
|
111
116
|
props?: IParams,
|
|
112
117
|
opts?: IModalOptions,
|
|
113
118
|
): IOverlayContainer;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* 模态
|
|
122
|
+
*
|
|
123
|
+
* @author chitanda
|
|
124
|
+
* @date 2022-11-08 15:11:40
|
|
125
|
+
* @template T
|
|
126
|
+
* @param {unknown} component 组件名称,组件对象,或者绘制函数
|
|
127
|
+
* @param {IParams} [props] 组件props
|
|
128
|
+
* @param {IFloatWindowOptions} [opts]
|
|
129
|
+
* @return {*} {Promise<T>}
|
|
130
|
+
*/
|
|
131
|
+
floatWindow<T = void>(
|
|
132
|
+
component: unknown,
|
|
133
|
+
props?: IParams,
|
|
134
|
+
opts?: IFloatWindowOptions,
|
|
135
|
+
): Promise<T>;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* 创建全局模态容器
|
|
139
|
+
*
|
|
140
|
+
* @author chitanda
|
|
141
|
+
* @date 2022-11-09 15:11:58
|
|
142
|
+
* @param {unknown} component 组件名称,组件对象,或者绘制函数
|
|
143
|
+
* @param {IParams} [props] 组件props
|
|
144
|
+
* @param {IFloatWindowOptions} [opts]
|
|
145
|
+
* @return {*} {IOverlayContainer}
|
|
146
|
+
*/
|
|
147
|
+
createFloatWindow(
|
|
148
|
+
component: unknown,
|
|
149
|
+
props?: IParams,
|
|
150
|
+
opts?: IFloatWindowOptions,
|
|
151
|
+
): IOverlayContainer;
|
|
114
152
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IUILogicParams } from '../../interface';
|
|
2
|
+
import { UIActionUtil } from '../../ui-action';
|
|
3
|
+
import { LogicExecutor } from './logic-executor';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 应用界面行为执行
|
|
7
|
+
* @author lxm
|
|
8
|
+
* @date 2023-07-17 01:57:27
|
|
9
|
+
* @export
|
|
10
|
+
* @class AppUILogicExecutor
|
|
11
|
+
* @extends {LogicExecutor}
|
|
12
|
+
*/
|
|
13
|
+
export class AppDEUIActionExecutor extends LogicExecutor {
|
|
14
|
+
declare type: 'APPDEUIACTION';
|
|
15
|
+
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
|
+
execute(executeParams: IUILogicParams): any {
|
|
18
|
+
UIActionUtil.execAndResolved(this.logic.appDEUIActionId!, executeParams);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -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,11 @@
|
|
|
1
1
|
import { IAppDEMethod, IAppDataEntity } from '@ibiz/model-core';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
IHttpResponse,
|
|
4
|
+
IPortalAsyncAction,
|
|
5
|
+
ModelError,
|
|
6
|
+
RuntimeError,
|
|
7
|
+
} from '@ibiz-template/core';
|
|
8
|
+
import { DECache, calcResPath } from '../../utils';
|
|
4
9
|
import { WorkFlowService } from '../work-flow/work-flow.service';
|
|
5
10
|
import { Method } from './method/method';
|
|
6
11
|
import { FileService } from '../file/file.service';
|
|
@@ -9,6 +14,7 @@ import { DEActionMethod } from './method/de-action';
|
|
|
9
14
|
import { FetchMethod } from './method/fetch';
|
|
10
15
|
import { IAppDEService } from '../../../interface';
|
|
11
16
|
import { ConfigService } from '../config/config.service';
|
|
17
|
+
import { AcFetchMethod } from './method/ac-fetch';
|
|
12
18
|
|
|
13
19
|
/**
|
|
14
20
|
* 实体服务
|
|
@@ -86,14 +92,16 @@ export class DEService implements IAppDEService {
|
|
|
86
92
|
* 获取实体服务方法实例
|
|
87
93
|
*
|
|
88
94
|
* @author chitanda
|
|
89
|
-
* @date
|
|
95
|
+
* @date 2023-10-12 17:10:10
|
|
90
96
|
* @protected
|
|
91
97
|
* @param {string} id
|
|
98
|
+
* @param {boolean} [acMode=false]
|
|
92
99
|
* @return {*} {Method}
|
|
93
100
|
*/
|
|
94
|
-
protected getMethod(id: string): Method {
|
|
95
|
-
|
|
96
|
-
|
|
101
|
+
protected getMethod(id: string, acMode: boolean = false): Method {
|
|
102
|
+
const cacheId = acMode ? `ac-${id}` : id;
|
|
103
|
+
if (this.methodMap.has(cacheId)) {
|
|
104
|
+
return this.methodMap.get(cacheId)!;
|
|
97
105
|
}
|
|
98
106
|
const model = findModelChild(this.model.appDEMethods!, id) as IAppDEMethod;
|
|
99
107
|
let method: Method | null = null;
|
|
@@ -103,7 +111,11 @@ export class DEService implements IAppDEService {
|
|
|
103
111
|
break;
|
|
104
112
|
case 'FETCH':
|
|
105
113
|
case 'FETCHTEMP':
|
|
106
|
-
|
|
114
|
+
if (acMode) {
|
|
115
|
+
method = new AcFetchMethod(this.model, model);
|
|
116
|
+
} else {
|
|
117
|
+
method = new FetchMethod(this.model, model);
|
|
118
|
+
}
|
|
107
119
|
break;
|
|
108
120
|
default:
|
|
109
121
|
throw new ModelError(
|
|
@@ -111,7 +123,7 @@ export class DEService implements IAppDEService {
|
|
|
111
123
|
`未支持的服务方法类型: ${model.methodType}`,
|
|
112
124
|
);
|
|
113
125
|
}
|
|
114
|
-
this.methodMap.set(
|
|
126
|
+
this.methodMap.set(cacheId, method);
|
|
115
127
|
return method;
|
|
116
128
|
}
|
|
117
129
|
|
|
@@ -138,4 +150,91 @@ export class DEService implements IAppDEService {
|
|
|
138
150
|
}
|
|
139
151
|
throw new RuntimeError(`${this.model.codeName}未支持「${id}」方法`);
|
|
140
152
|
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* 执行服务方法 ac 模式
|
|
156
|
+
*
|
|
157
|
+
* @author chitanda
|
|
158
|
+
* @date 2022-09-13 19:09:55
|
|
159
|
+
* @param {string} id 执行服务方法标识
|
|
160
|
+
* @param {IParams} context
|
|
161
|
+
* @param {IData} [params={}] 请求参数
|
|
162
|
+
* @param {IParams} [params2={}] 查询参数
|
|
163
|
+
* @return {*} {Promise<IHttpResponse>}
|
|
164
|
+
*/
|
|
165
|
+
execAc(
|
|
166
|
+
id: string,
|
|
167
|
+
context: IParams,
|
|
168
|
+
params?: IData,
|
|
169
|
+
params2: IParams = {},
|
|
170
|
+
): Promise<IHttpResponse> {
|
|
171
|
+
const method = this.getMethod(id, true);
|
|
172
|
+
if (method) {
|
|
173
|
+
return method.exec(context, params, params2);
|
|
174
|
+
}
|
|
175
|
+
throw new RuntimeError(`${this.model.codeName}未支持「${id}」方法`);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* 实体级别 AI 聊天会话
|
|
180
|
+
*
|
|
181
|
+
* @author chitanda
|
|
182
|
+
* @date 2023-10-16 16:10:16
|
|
183
|
+
* @param {(data: IPortalAsyncAction) => void} onmessage
|
|
184
|
+
* @param {IParams} context
|
|
185
|
+
* @param {IParams} [params={}]
|
|
186
|
+
* @param {IData} [data={}]
|
|
187
|
+
* @return {*} {Promise<void>}
|
|
188
|
+
*/
|
|
189
|
+
aiChatSse(
|
|
190
|
+
onmessage: (data: IPortalAsyncAction) => void,
|
|
191
|
+
context: IParams,
|
|
192
|
+
params: IParams = {},
|
|
193
|
+
data: IData = {},
|
|
194
|
+
): Promise<void> {
|
|
195
|
+
const app = ibiz.hub.getApp(this.model.appId);
|
|
196
|
+
const path = this.calcSsePath(context);
|
|
197
|
+
return new Promise((resolve, reject) => {
|
|
198
|
+
app.net.sse(
|
|
199
|
+
`/${path}`,
|
|
200
|
+
{ srfactag: 'AIChat', ...params },
|
|
201
|
+
{
|
|
202
|
+
headers: {
|
|
203
|
+
'Content-Type': 'application/json',
|
|
204
|
+
},
|
|
205
|
+
body: JSON.stringify(data),
|
|
206
|
+
onmessage: e => {
|
|
207
|
+
if (e.data) {
|
|
208
|
+
const json = JSON.parse(e.data);
|
|
209
|
+
onmessage(json as IPortalAsyncAction);
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
onclose: () => {
|
|
213
|
+
resolve();
|
|
214
|
+
},
|
|
215
|
+
onerror: (e: unknown) => {
|
|
216
|
+
reject(e);
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
);
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* 计算请求路径
|
|
225
|
+
*
|
|
226
|
+
* @author chitanda
|
|
227
|
+
* @date 2023-10-12 11:10:56
|
|
228
|
+
* @protected
|
|
229
|
+
* @param {IParams} context
|
|
230
|
+
* @return {*} {string}
|
|
231
|
+
*/
|
|
232
|
+
protected calcSsePath(context: IParams): string {
|
|
233
|
+
const srfkey = context[this.model.codeName!.toLowerCase()];
|
|
234
|
+
const curPath = `/${this.model.codeName2!.toLowerCase()}/ssechatcompletion${
|
|
235
|
+
srfkey ? `/${srfkey}` : ''
|
|
236
|
+
}`;
|
|
237
|
+
const resPath = calcResPath(context, this.model);
|
|
238
|
+
return resPath + curPath;
|
|
239
|
+
}
|
|
141
240
|
}
|
|
@@ -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
|
+
}
|
|
@@ -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
|
*
|
|
@@ -22,6 +22,9 @@ export class UILogicContext {
|
|
|
22
22
|
* 上下文
|
|
23
23
|
*/
|
|
24
24
|
get context(): IContext {
|
|
25
|
+
if (Object.prototype.hasOwnProperty.call(this.params, 'context')) {
|
|
26
|
+
return this.params.context;
|
|
27
|
+
}
|
|
25
28
|
return this.parameters.context;
|
|
26
29
|
}
|
|
27
30
|
|
|
@@ -35,20 +38,13 @@ export class UILogicContext {
|
|
|
35
38
|
/**
|
|
36
39
|
* 视图参数
|
|
37
40
|
*/
|
|
38
|
-
get
|
|
41
|
+
get viewParam(): IParams {
|
|
42
|
+
if (Object.prototype.hasOwnProperty.call(this.params, 'viewParam')) {
|
|
43
|
+
return this.params.viewParam;
|
|
44
|
+
}
|
|
39
45
|
return this.parameters.params;
|
|
40
46
|
}
|
|
41
47
|
|
|
42
|
-
/**
|
|
43
|
-
* Creates an instance of DELogicContext.
|
|
44
|
-
* @author lxm
|
|
45
|
-
* @date 2023-03-24 09:15:14
|
|
46
|
-
* @param {Map<string, DELogicParam>} deLogicParams 实体逻辑参数集合
|
|
47
|
-
* @param {IParams} context 上下文
|
|
48
|
-
* @param {IData} data 数据对象
|
|
49
|
-
* @param {IParams} viewParams 视图参数
|
|
50
|
-
* @param {IParams} [opt] 额外参数
|
|
51
|
-
*/
|
|
52
48
|
/**
|
|
53
49
|
* Creates an instance of UILogicContext.
|
|
54
50
|
* @author lxm
|
|
@@ -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,3 +1,4 @@
|
|
|
1
|
+
import { RuntimeModelError } from '@ibiz-template/core';
|
|
1
2
|
import { IDEUIDEDataSetLogic } from '@ibiz/model-core';
|
|
2
3
|
import { UILogicContext } from '../../ui-logic-context';
|
|
3
4
|
import { UILogicNode } from '../ui-logic-node';
|
|
@@ -21,14 +22,16 @@ export class DataSetNode extends UILogicNode {
|
|
|
21
22
|
dstDEUILogicParamId,
|
|
22
23
|
retDEUILogicParamId,
|
|
23
24
|
} = this.model;
|
|
24
|
-
|
|
25
|
+
if (!dstDEUILogicParamId) {
|
|
26
|
+
throw new RuntimeModelError(this.model, '缺少配置过滤参数');
|
|
27
|
+
}
|
|
28
|
+
const queryParams = ctx.params[dstDEUILogicParamId!];
|
|
25
29
|
const app = ibiz.hub.getApp(ctx.context.srfappid);
|
|
26
30
|
const res = await app.deService.exec(
|
|
27
31
|
dstAppDataEntityId!,
|
|
28
32
|
dstAppDEDataSetId!,
|
|
29
33
|
ctx.context,
|
|
30
|
-
|
|
31
|
-
ctx.viewParams,
|
|
34
|
+
queryParams,
|
|
32
35
|
);
|
|
33
36
|
if (res.ok) {
|
|
34
37
|
ctx.params[retDEUILogicParamId!] = res.data;
|
|
@@ -40,13 +40,12 @@ export class ExecuteDELogicNode extends UILogicNode {
|
|
|
40
40
|
throw new RuntimeError(`没有找到传入参数${dstDEUILogicParamId}`);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
// todo 需要传入参数格式约束
|
|
44
43
|
const result = await execDELogicById(
|
|
45
44
|
dstAppDELogicId,
|
|
46
45
|
dstAppDataEntityId,
|
|
47
|
-
|
|
48
|
-
dstParam
|
|
49
|
-
|
|
46
|
+
ctx.context,
|
|
47
|
+
dstParam,
|
|
48
|
+
ctx.params,
|
|
50
49
|
);
|
|
51
50
|
|
|
52
51
|
// 如果有返回值参数返回值填入。
|
|
@@ -30,7 +30,8 @@ export class UILogicParam {
|
|
|
30
30
|
calc(ctx: UILogicContext): void {
|
|
31
31
|
const tag = this.model.id!;
|
|
32
32
|
const m = this.model;
|
|
33
|
-
const {
|
|
33
|
+
const { parameters } = ctx;
|
|
34
|
+
const { context, params, data } = parameters;
|
|
34
35
|
const app = ibiz.hub.getApp(context.srfappid);
|
|
35
36
|
|
|
36
37
|
// 特殊变量的特殊处理
|
|
@@ -90,7 +91,7 @@ export class UILogicParam {
|
|
|
90
91
|
ctx.params[tag] = {};
|
|
91
92
|
} else if (m.viewNavDataParam) {
|
|
92
93
|
// 视图导航数据
|
|
93
|
-
ctx.params[tag] =
|
|
94
|
+
ctx.params[tag] = params;
|
|
94
95
|
} else if (m.viewSessionParam) {
|
|
95
96
|
throw new ModelError(m, `未支持的逻辑参数类型: 当前视图会话`);
|
|
96
97
|
}
|
|
@@ -39,17 +39,13 @@ export function handleSrcVal(
|
|
|
39
39
|
// 没有源值类型就是逻辑参数
|
|
40
40
|
const srcValueType = srcValParams.srcValueType || 'SRCDLPARAM';
|
|
41
41
|
// 取属性值
|
|
42
|
-
|
|
42
|
+
const srcField = srcFieldName;
|
|
43
43
|
|
|
44
44
|
let value: unknown;
|
|
45
45
|
switch (srcValueType) {
|
|
46
46
|
// 源逻辑参数
|
|
47
47
|
case 'SRCDLPARAM':
|
|
48
48
|
value = ctx.params[srcDEUILogicParamId!];
|
|
49
|
-
// 如果是实体参数对象则转换成小写。
|
|
50
|
-
if (ctx.isEntityParam(srcDEUILogicParamId!)) {
|
|
51
|
-
srcField = srcField?.toLowerCase();
|
|
52
|
-
}
|
|
53
49
|
break;
|
|
54
50
|
// 空值类型
|
|
55
51
|
case 'NULLVALUE':
|
|
@@ -62,13 +58,13 @@ export function handleSrcVal(
|
|
|
62
58
|
return ibiz.util.rawValue.format(srcValue);
|
|
63
59
|
case 'WEBCONTEXT': // 网页请求上下文
|
|
64
60
|
case 'VIEWPARAM': // 视图参数
|
|
65
|
-
value = ctx.
|
|
61
|
+
value = ctx.parameters.params;
|
|
66
62
|
break;
|
|
67
63
|
case 'APPLICATION': // 系统全局对象
|
|
68
64
|
case 'SESSION': // 用户全局对象
|
|
69
65
|
case 'APPDATA': // 应用上下文
|
|
70
66
|
case 'DATACONTEXT': // 数据上下文
|
|
71
|
-
value = ctx.context;
|
|
67
|
+
value = ctx.parameters.context;
|
|
72
68
|
break;
|
|
73
69
|
// 当前环境参数
|
|
74
70
|
case 'ENVPARAM':
|