@ibiz-template/runtime 0.1.33 → 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 +285 -126
- 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/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/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/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/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/method.ts +11 -4
- package/src/ui-logic/ui-logic-link/ui-logic-link-single-cond/ui-logic-link-single-cond.ts +12 -5
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IDEEditForm } from '@ibiz/model-core';
|
|
2
|
+
import { IDataAbilityParams } from '../../../common';
|
|
2
3
|
import { IEditFormEvent } from '../../event';
|
|
3
4
|
import { IEditFormState } from '../../state';
|
|
4
5
|
import { IFormController } from './i-form.controller';
|
|
@@ -19,7 +20,7 @@ export interface IEditFormController
|
|
|
19
20
|
* @date 2023-05-16 11:08:45
|
|
20
21
|
* @return {*} {Promise<IData>}
|
|
21
22
|
*/
|
|
22
|
-
load(): Promise<IData>;
|
|
23
|
+
load(args?: IDataAbilityParams): Promise<IData>;
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
26
|
* 保存表单数据
|
|
@@ -27,7 +28,7 @@ export interface IEditFormController
|
|
|
27
28
|
* @date 2023-05-16 12:59:03
|
|
28
29
|
* @return {*} {Promise<IData>}
|
|
29
30
|
*/
|
|
30
|
-
save(): Promise<IData>;
|
|
31
|
+
save(args?: IDataAbilityParams): Promise<IData>;
|
|
31
32
|
|
|
32
33
|
/**
|
|
33
34
|
* 删除表单数据
|
|
@@ -37,7 +38,7 @@ export interface IEditFormController
|
|
|
37
38
|
* @return {*} {Promise<boolean>}
|
|
38
39
|
* @memberof IEditFormController
|
|
39
40
|
*/
|
|
40
|
-
remove(): Promise<boolean>;
|
|
41
|
+
remove(args?: IDataAbilityParams): Promise<boolean>;
|
|
41
42
|
|
|
42
43
|
/**
|
|
43
44
|
* 工作流提交(调用前先确保调用保存)
|
|
@@ -47,7 +48,7 @@ export interface IEditFormController
|
|
|
47
48
|
* @param {IParams} [extraParams={}] 不走工作流操作视图时使用
|
|
48
49
|
* @returns {*} {Promise<void>}
|
|
49
50
|
*/
|
|
50
|
-
wfSubmit(
|
|
51
|
+
wfSubmit(args?: IDataAbilityParams): Promise<void>;
|
|
51
52
|
|
|
52
53
|
/**
|
|
53
54
|
* 工作流启动(调用前先确保调用保存)
|
|
@@ -57,5 +58,5 @@ export interface IEditFormController
|
|
|
57
58
|
* @param {IParams} [extraParams={}] 不走工作流启动视图时使用
|
|
58
59
|
* @returns {*} {Promise<void>}
|
|
59
60
|
*/
|
|
60
|
-
wfStart(
|
|
61
|
+
wfStart(args?: IDataAbilityParams): Promise<void>;
|
|
61
62
|
}
|
|
@@ -7,3 +7,4 @@ export { UIActionEvent } from './uiaction.event';
|
|
|
7
7
|
export { ControlTriggerEvent } from './control-trigger.event';
|
|
8
8
|
export { NavViewChangeEvent } from './nav-view-change.event';
|
|
9
9
|
export { RowEditChangeEvent } from './row-edit-change.event';
|
|
10
|
+
export { PanelItemEvent } from './panel-item.event';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { EventBase } from './base.event';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 面板成员事件
|
|
5
|
+
* @author lxm
|
|
6
|
+
* @date 2023-08-09 10:52:48
|
|
7
|
+
* @export
|
|
8
|
+
* @interface PanelItemEvent
|
|
9
|
+
* @extends {EventBase}
|
|
10
|
+
*/
|
|
11
|
+
export interface PanelItemEvent extends EventBase {
|
|
12
|
+
/**
|
|
13
|
+
* 触发的面板成员名称
|
|
14
|
+
* @author lxm
|
|
15
|
+
* @date 2023-03-26 02:02:16
|
|
16
|
+
* @type {string}
|
|
17
|
+
*/
|
|
18
|
+
panelItemName: string;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 触发的面板成员事件的名称
|
|
22
|
+
* @author lxm
|
|
23
|
+
* @date 2023-07-26 11:00:37
|
|
24
|
+
* @type {string}
|
|
25
|
+
*/
|
|
26
|
+
panelItemEventName: string;
|
|
27
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PartialWithObject } from '@ibiz-template/core';
|
|
2
|
-
import { ControlTriggerEvent, EventBase } from '../argument';
|
|
2
|
+
import { ControlTriggerEvent, EventBase, PanelItemEvent } from '../argument';
|
|
3
3
|
import { IControlEvent } from './i-control.event';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -22,4 +22,16 @@ export interface IPanelEvent extends IControlEvent {
|
|
|
22
22
|
event: ControlTriggerEvent;
|
|
23
23
|
emitArgs: PartialWithObject<ControlTriggerEvent, EventBase>;
|
|
24
24
|
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 面板里的面板成员事件监听
|
|
28
|
+
* @author lxm
|
|
29
|
+
* @date 2023-03-26 06:15:06
|
|
30
|
+
* @param {EventBase} event
|
|
31
|
+
* @return {*} {Promise<void>}
|
|
32
|
+
*/
|
|
33
|
+
onPanelItemEvent: {
|
|
34
|
+
event: PanelItemEvent;
|
|
35
|
+
emitArgs: PartialWithObject<PanelItemEvent, EventBase>;
|
|
36
|
+
};
|
|
25
37
|
}
|
|
@@ -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: unknown) => void} onmessage
|
|
94
|
+
* @param {IParams} context
|
|
95
|
+
* @param {IParams} [params]
|
|
96
|
+
* @param {IData} [data]
|
|
97
|
+
* @return {*} {Promise<void>}
|
|
98
|
+
*/
|
|
99
|
+
aiChatSse(
|
|
100
|
+
onmessage: (data: unknown) => 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,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
|
+
}
|
|
@@ -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
|
}
|