@ibiz-template/runtime 0.1.34 → 0.1.36
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 +472 -152
- package/dist/index.system.min.js +1 -1
- package/dist/index.system.min.js.map +1 -1
- package/out/constant/index.d.ts +1 -0
- package/out/constant/index.d.ts.map +1 -1
- package/out/constant/index.js +1 -0
- package/out/constant/value-op.d.ts +82 -0
- package/out/constant/value-op.d.ts.map +1 -0
- package/out/constant/value-op.js +83 -0
- package/out/controller/control/form/search-form/search-form.controller.d.ts +2 -2
- package/out/controller/control/form/search-form/search-form.controller.d.ts.map +1 -1
- package/out/controller/control/form/search-form/search-form.controller.js +11 -3
- package/out/controller/control/md-ctrl/md-ctrl.controller.d.ts +38 -3
- package/out/controller/control/md-ctrl/md-ctrl.controller.d.ts.map +1 -1
- package/out/controller/control/md-ctrl/md-ctrl.controller.js +110 -3
- package/out/controller/control/search-bar/search-bar-filter.controller.d.ts +65 -0
- package/out/controller/control/search-bar/search-bar-filter.controller.d.ts.map +1 -0
- package/out/controller/control/search-bar/search-bar-filter.controller.js +48 -0
- package/out/controller/control/search-bar/search-bar.controller.d.ts +63 -4
- package/out/controller/control/search-bar/search-bar.controller.d.ts.map +1 -1
- package/out/controller/control/search-bar/search-bar.controller.js +143 -9
- 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/engine/md-view.engine.d.ts.map +1 -1
- package/out/engine/md-view.engine.js +2 -23
- package/out/interface/controller/controller/control/i-search-bar.controller.d.ts +8 -0
- package/out/interface/controller/controller/control/i-search-bar.controller.d.ts.map +1 -1
- package/out/interface/controller/controller/control/i-search-form.controller.d.ts +2 -2
- package/out/interface/controller/controller/control/i-search-form.controller.d.ts.map +1 -1
- package/out/interface/controller/state/control/i-search-bar.state.d.ts +75 -0
- package/out/interface/controller/state/control/i-search-bar.state.d.ts.map +1 -1
- package/out/interface/service/service/i-app-de.service.d.ts +3 -3
- package/out/interface/service/service/i-app-de.service.d.ts.map +1 -1
- package/out/service/service/entity/de.service.d.ts +5 -4
- package/out/service/service/entity/de.service.d.ts.map +1 -1
- package/out/service/service/entity/de.service.js +9 -5
- package/out/service/service/entity/method/method.js +2 -2
- 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-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/constant/index.ts +1 -0
- package/src/constant/value-op.ts +82 -0
- package/src/controller/control/form/search-form/search-form.controller.ts +11 -3
- package/src/controller/control/md-ctrl/md-ctrl.controller.ts +136 -3
- package/src/controller/control/search-bar/search-bar-filter.controller.ts +112 -0
- package/src/controller/control/search-bar/search-bar.controller.ts +165 -9
- 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/engine/md-view.engine.ts +2 -27
- package/src/interface/controller/controller/control/i-search-bar.controller.ts +10 -1
- package/src/interface/controller/controller/control/i-search-form.controller.ts +2 -2
- package/src/interface/controller/state/control/i-search-bar.state.ts +86 -0
- package/src/interface/service/service/i-app-de.service.ts +3 -3
- package/src/service/service/entity/de.service.ts +15 -6
- package/src/service/service/entity/method/method.ts +2 -2
- package/src/ui-logic/ui-logic-context.ts +7 -11
- 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,10 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { recursiveIterate } from '@ibiz-template/core';
|
|
2
|
+
import { IAppDataEntity, ISearchBar } from '@ibiz/model-core';
|
|
3
|
+
import { isNil } from 'ramda';
|
|
2
4
|
import {
|
|
3
5
|
ISearchBarState,
|
|
4
6
|
ISearchBarEvent,
|
|
5
7
|
ISearchBarController,
|
|
8
|
+
IFilterNode,
|
|
6
9
|
} from '../../../interface';
|
|
7
10
|
import { ControlController } from '../../common';
|
|
11
|
+
import { SearchBarFilterController } from './search-bar-filter.controller';
|
|
8
12
|
|
|
9
13
|
/**
|
|
10
14
|
* 搜索栏控制器
|
|
@@ -20,13 +24,29 @@ export class SearchBarController
|
|
|
20
24
|
implements ISearchBarController
|
|
21
25
|
{
|
|
22
26
|
/**
|
|
23
|
-
*
|
|
27
|
+
* 快速搜索占位符
|
|
24
28
|
* @return {*}
|
|
25
29
|
* @author: zhujiamin
|
|
26
30
|
* @Date: 2023-08-11 14:13:10
|
|
27
31
|
*/
|
|
28
32
|
placeHolder = '';
|
|
29
33
|
|
|
34
|
+
/**
|
|
35
|
+
* 过滤项控制器集合
|
|
36
|
+
* @author lxm
|
|
37
|
+
* @date 2023-10-13 03:31:26
|
|
38
|
+
* @type {SearchBarFilterController[]}
|
|
39
|
+
*/
|
|
40
|
+
filterControllers: SearchBarFilterController[] = [];
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* 实体模型
|
|
44
|
+
* @author lxm
|
|
45
|
+
* @date 2023-10-13 02:49:59
|
|
46
|
+
* @type {IAppDataEntity}
|
|
47
|
+
*/
|
|
48
|
+
appDataEntity!: IAppDataEntity;
|
|
49
|
+
|
|
30
50
|
protected initState(): void {
|
|
31
51
|
super.initState();
|
|
32
52
|
this.state.query = '';
|
|
@@ -36,6 +56,9 @@ export class SearchBarController
|
|
|
36
56
|
this.model.enableGroup ||
|
|
37
57
|
this.model.enableFilter
|
|
38
58
|
);
|
|
59
|
+
if (this.model.enableFilter) {
|
|
60
|
+
this.resetFilter();
|
|
61
|
+
}
|
|
39
62
|
}
|
|
40
63
|
|
|
41
64
|
protected async onCreated(): Promise<void> {
|
|
@@ -45,19 +68,38 @@ export class SearchBarController
|
|
|
45
68
|
this.context.srfappid,
|
|
46
69
|
)!;
|
|
47
70
|
if (appDataEntity) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
71
|
+
this.appDataEntity = appDataEntity;
|
|
72
|
+
this.calcQuickSearchPlaceholder();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
await this.initSearchBarFilters();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* 计算快速搜索的占位
|
|
80
|
+
* @author lxm
|
|
81
|
+
* @date 2023-10-16 03:49:47
|
|
82
|
+
* @protected
|
|
83
|
+
* @return {*} {void}
|
|
84
|
+
*/
|
|
85
|
+
protected calcQuickSearchPlaceholder(): void {
|
|
86
|
+
if (!this.appDataEntity) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const searchFields = this.appDataEntity.appDEFields!.filter(field => {
|
|
90
|
+
return field.enableQuickSearch;
|
|
91
|
+
});
|
|
92
|
+
if (searchFields.length) {
|
|
51
93
|
const placeHolders: string[] = [];
|
|
52
|
-
searchFields
|
|
53
|
-
if (searchField
|
|
94
|
+
searchFields.forEach(searchField => {
|
|
95
|
+
if (searchField.lnlanguageRes && searchField.lnlanguageRes.lanResTag) {
|
|
54
96
|
placeHolders.push(
|
|
55
97
|
ibiz.i18n.t(
|
|
56
98
|
searchField.lnlanguageRes.lanResTag,
|
|
57
99
|
searchField.logicName,
|
|
58
100
|
),
|
|
59
101
|
);
|
|
60
|
-
} else if (searchField
|
|
102
|
+
} else if (searchField.logicName) {
|
|
61
103
|
placeHolders.push(searchField.logicName);
|
|
62
104
|
}
|
|
63
105
|
});
|
|
@@ -84,7 +126,121 @@ export class SearchBarController
|
|
|
84
126
|
* @author: zhujiamin
|
|
85
127
|
* @Date: 2023-06-01 18:08:18
|
|
86
128
|
*/
|
|
87
|
-
|
|
129
|
+
onSearch(): void {
|
|
88
130
|
this.evt.emit('onSearch', undefined);
|
|
89
131
|
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* 获取搜索栏的过滤参数(包括快速搜索,快速分组和过滤器的参数)
|
|
135
|
+
* @author lxm
|
|
136
|
+
* @date 2023-10-16 03:54:07
|
|
137
|
+
* @return {*} {IParams}
|
|
138
|
+
*/
|
|
139
|
+
getFilterParams(): IParams {
|
|
140
|
+
const params: IParams = {};
|
|
141
|
+
// 快速搜索
|
|
142
|
+
if (this.state.query) {
|
|
143
|
+
params.query = this.state.query;
|
|
144
|
+
}
|
|
145
|
+
// 快速分组
|
|
146
|
+
if (this.state.selectedGroupItem?.data) {
|
|
147
|
+
// eslint-disable-next-line no-new-func
|
|
148
|
+
const func = new Function(
|
|
149
|
+
`return (${this.state.selectedGroupItem.data});`,
|
|
150
|
+
);
|
|
151
|
+
const addParams = func() as IData;
|
|
152
|
+
Object.assign(params, addParams);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// 搜索过滤器
|
|
156
|
+
const filters = this.calcFilters();
|
|
157
|
+
if (filters) {
|
|
158
|
+
params.filters = filters;
|
|
159
|
+
}
|
|
160
|
+
return params;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* 重置过滤器
|
|
165
|
+
* @author lxm
|
|
166
|
+
* @date 2023-10-16 03:52:44
|
|
167
|
+
*/
|
|
168
|
+
resetFilter(): void {
|
|
169
|
+
this.state.filterNodes = [
|
|
170
|
+
{
|
|
171
|
+
leaf: false,
|
|
172
|
+
logicType: 'AND',
|
|
173
|
+
children: [{ leaf: true, field: null, valueOP: null, value: null }],
|
|
174
|
+
},
|
|
175
|
+
];
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* 初始化过滤项控制器
|
|
180
|
+
* @author lxm
|
|
181
|
+
* @date 2023-10-13 03:33:17
|
|
182
|
+
* @protected
|
|
183
|
+
* @return {*} {Promise<void>}
|
|
184
|
+
*/
|
|
185
|
+
protected async initSearchBarFilters(): Promise<void> {
|
|
186
|
+
if (this.model.searchBarFilters?.length) {
|
|
187
|
+
this.model.searchBarFilters.forEach(item => {
|
|
188
|
+
const filterController = new SearchBarFilterController(item, this);
|
|
189
|
+
this.filterControllers.push(filterController);
|
|
190
|
+
});
|
|
191
|
+
await Promise.all(
|
|
192
|
+
this.filterControllers.map(controller => controller.init()),
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* 计算过滤项参数
|
|
199
|
+
* @author lxm
|
|
200
|
+
* @date 2023-10-13 05:53:35
|
|
201
|
+
* @return {*} {IData}
|
|
202
|
+
*/
|
|
203
|
+
calcFilters(): IData | undefined {
|
|
204
|
+
if (!this.model.enableFilter) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
let hasFilter = false; // 是否有过滤项
|
|
208
|
+
let hasError = false; // 是否有过滤项格式不正确
|
|
209
|
+
recursiveIterate(this.state.filterNodes[0], (node: IFilterNode) => {
|
|
210
|
+
if (node.leaf) {
|
|
211
|
+
if (node.field && node.valueOP && !isNil(node.value)) {
|
|
212
|
+
hasFilter = true;
|
|
213
|
+
} else {
|
|
214
|
+
// 如果过滤项不给
|
|
215
|
+
hasError = true;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
if (hasFilter && !hasError) {
|
|
220
|
+
const filter = this.formatFilters(this.state.filterNodes[0]);
|
|
221
|
+
return filter;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* 格式化过滤项
|
|
227
|
+
* @author lxm
|
|
228
|
+
* @date 2023-10-16 03:45:41
|
|
229
|
+
* @param {IFilterNode} node
|
|
230
|
+
* @return {*} {IData}
|
|
231
|
+
*/
|
|
232
|
+
formatFilters(node: IFilterNode): IData {
|
|
233
|
+
if (!node.leaf) {
|
|
234
|
+
return {
|
|
235
|
+
[`$${node.logicType.toLowerCase()}`]: node.children.map(item =>
|
|
236
|
+
this.formatFilters(item),
|
|
237
|
+
),
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
return {
|
|
241
|
+
[`${node.field}`]: {
|
|
242
|
+
[`$${node.valueOP!.toLowerCase()}`]: node.value,
|
|
243
|
+
},
|
|
244
|
+
};
|
|
245
|
+
}
|
|
90
246
|
}
|
|
@@ -17,6 +17,41 @@ export class DELogicContext {
|
|
|
17
17
|
*/
|
|
18
18
|
lastReturn: unknown;
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* 实体逻辑执行参数
|
|
22
|
+
* @author lxm
|
|
23
|
+
* @date 2023-10-16 02:22:31
|
|
24
|
+
* @type {{ context: IParams; data: IData; params: IParams }}
|
|
25
|
+
*/
|
|
26
|
+
parameters: { context: IParams; data: IData; params: IParams };
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 上下文
|
|
30
|
+
*/
|
|
31
|
+
get context(): IParams {
|
|
32
|
+
if (Object.prototype.hasOwnProperty.call(this.params, 'context')) {
|
|
33
|
+
return this.params.context;
|
|
34
|
+
}
|
|
35
|
+
return this.parameters.context;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* 数据
|
|
40
|
+
*/
|
|
41
|
+
get data(): IData {
|
|
42
|
+
return this.parameters.data;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* 视图参数
|
|
47
|
+
*/
|
|
48
|
+
get viewParam(): IParams {
|
|
49
|
+
if (Object.prototype.hasOwnProperty.call(this.params, 'viewParam')) {
|
|
50
|
+
return this.params.viewParam;
|
|
51
|
+
}
|
|
52
|
+
return this.parameters.params;
|
|
53
|
+
}
|
|
54
|
+
|
|
20
55
|
/**
|
|
21
56
|
* Creates an instance of DELogicContext.
|
|
22
57
|
* @author lxm
|
|
@@ -24,14 +59,16 @@ export class DELogicContext {
|
|
|
24
59
|
* @param {Map<string, DELogicParam>} deLogicParams 实体逻辑参数集合
|
|
25
60
|
* @param {IParams} context 上下文
|
|
26
61
|
* @param {IData} data 数据对象
|
|
27
|
-
* @param {IParams}
|
|
62
|
+
* @param {IParams} params 视图参数
|
|
28
63
|
*/
|
|
29
64
|
constructor(
|
|
30
65
|
private deLogicParams: Map<string, DELogicParam>,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
) {
|
|
66
|
+
context: IParams,
|
|
67
|
+
data: IData,
|
|
68
|
+
params: IParams,
|
|
69
|
+
) {
|
|
70
|
+
this.parameters = { context, data, params };
|
|
71
|
+
}
|
|
35
72
|
|
|
36
73
|
/**
|
|
37
74
|
* 重置实体逻辑参数
|
|
@@ -21,14 +21,13 @@ export class DataSetNode extends DELogicNode {
|
|
|
21
21
|
dstDELogicParamId,
|
|
22
22
|
retDELogicParamId,
|
|
23
23
|
} = this.model;
|
|
24
|
-
const
|
|
24
|
+
const queryParams = ctx.params[dstDELogicParamId!];
|
|
25
25
|
const app = ibiz.hub.getApp(ctx.context.srfappid);
|
|
26
26
|
const res = await app.deService.exec(
|
|
27
27
|
dstAppDataEntityId!,
|
|
28
28
|
dstAppDEDataSetId!,
|
|
29
29
|
ctx.context,
|
|
30
|
-
|
|
31
|
-
ctx.viewParams,
|
|
30
|
+
queryParams,
|
|
32
31
|
);
|
|
33
32
|
if (res.ok) {
|
|
34
33
|
ctx.params[retDELogicParamId!] = res.data;
|
|
@@ -62,13 +62,13 @@ export function handleSrcVal(
|
|
|
62
62
|
return ibiz.util.rawValue.format(srcValue);
|
|
63
63
|
case 'WEBCONTEXT': // 网页请求上下文
|
|
64
64
|
case 'VIEWPARAM': // 视图参数
|
|
65
|
-
value = ctx.
|
|
65
|
+
value = ctx.parameters.params;
|
|
66
66
|
break;
|
|
67
67
|
case 'APPLICATION': // 系统全局对象
|
|
68
68
|
case 'SESSION': // 用户全局对象
|
|
69
69
|
case 'APPDATA': // 应用上下文
|
|
70
70
|
case 'DATACONTEXT': // 数据上下文
|
|
71
|
-
value = ctx.context;
|
|
71
|
+
value = ctx.parameters.context;
|
|
72
72
|
break;
|
|
73
73
|
// 当前环境参数
|
|
74
74
|
case 'ENVPARAM':
|
|
@@ -334,36 +334,11 @@ export class MDViewEngine extends ViewEngineBase {
|
|
|
334
334
|
const params: IParams = {};
|
|
335
335
|
// 有搜索表单的整合相关参数
|
|
336
336
|
if (this.searchForm) {
|
|
337
|
-
|
|
338
|
-
const filteredParams = Object.entries(addParams).reduce(
|
|
339
|
-
(result: IData, [key, value]) => {
|
|
340
|
-
if (value !== null && value !== undefined && value !== '') {
|
|
341
|
-
result[key] = value;
|
|
342
|
-
}
|
|
343
|
-
return result;
|
|
344
|
-
},
|
|
345
|
-
{},
|
|
346
|
-
);
|
|
347
|
-
Object.assign(params, filteredParams);
|
|
337
|
+
Object.assign(params, this.searchForm.getFilterParams());
|
|
348
338
|
}
|
|
349
339
|
// 有搜索栏的整合相关参数
|
|
350
340
|
if (this.searchBar) {
|
|
351
|
-
|
|
352
|
-
if (this.searchBar.state.query) {
|
|
353
|
-
const addParams = {
|
|
354
|
-
query: this.searchBar.state.query,
|
|
355
|
-
};
|
|
356
|
-
Object.assign(params, addParams);
|
|
357
|
-
}
|
|
358
|
-
// 快速分组
|
|
359
|
-
if (this.searchBar.state.selectedGroupItem?.data) {
|
|
360
|
-
// eslint-disable-next-line no-new-func
|
|
361
|
-
const func = new Function(
|
|
362
|
-
`return (${this.searchBar.state.selectedGroupItem.data});`,
|
|
363
|
-
);
|
|
364
|
-
const addParams = func() as IData;
|
|
365
|
-
Object.assign(params, addParams);
|
|
366
|
-
}
|
|
341
|
+
Object.assign(params, this.searchBar.getFilterParams());
|
|
367
342
|
}
|
|
368
343
|
return params;
|
|
369
344
|
}
|
|
@@ -12,4 +12,13 @@ import { IControlController } from './i-control.controller';
|
|
|
12
12
|
* @extends {IControlController}
|
|
13
13
|
*/
|
|
14
14
|
export interface ISearchBarController
|
|
15
|
-
extends IControlController<ISearchBar, ISearchBarState, ISearchBarEvent> {
|
|
15
|
+
extends IControlController<ISearchBar, ISearchBarState, ISearchBarEvent> {
|
|
16
|
+
/**
|
|
17
|
+
* 获取搜索栏的过滤参数
|
|
18
|
+
*
|
|
19
|
+
* @author lxm
|
|
20
|
+
* @date 2022-09-22 17:09:21
|
|
21
|
+
* @returns {*} {IParams}
|
|
22
|
+
*/
|
|
23
|
+
getFilterParams(): IParams;
|
|
24
|
+
}
|
|
@@ -22,13 +22,13 @@ export interface ISearchFormController
|
|
|
22
22
|
load(): Promise<IData>;
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* 获取搜索表单的过滤参数
|
|
26
26
|
*
|
|
27
27
|
* @author lxm
|
|
28
28
|
* @date 2022-09-22 17:09:21
|
|
29
29
|
* @returns {*} {IParams}
|
|
30
30
|
*/
|
|
31
|
-
|
|
31
|
+
getFilterParams(): IParams;
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* 执行搜索行为
|
|
@@ -1,6 +1,84 @@
|
|
|
1
1
|
import { ISearchBarGroup } from '@ibiz/model-core';
|
|
2
2
|
import { IControlState } from './i-control.state';
|
|
3
3
|
|
|
4
|
+
export interface IFilterBranchNode {
|
|
5
|
+
/**
|
|
6
|
+
* 是否是叶子节点
|
|
7
|
+
* @author lxm
|
|
8
|
+
* @date 2023-10-12 05:14:28
|
|
9
|
+
* @type {boolean}
|
|
10
|
+
*/
|
|
11
|
+
leaf: false;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* 父节点的逻辑类型
|
|
15
|
+
* @author lxm
|
|
16
|
+
* @date 2023-10-12 05:21:18
|
|
17
|
+
* @type {('AND' | 'OR')}
|
|
18
|
+
*/
|
|
19
|
+
logicType: 'AND' | 'OR';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 过滤项值
|
|
23
|
+
* @author lxm
|
|
24
|
+
* @date 2023-10-12 05:16:52
|
|
25
|
+
* @type {unknown}
|
|
26
|
+
*/
|
|
27
|
+
value?: unknown;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* 值操作类型
|
|
31
|
+
* @author lxm
|
|
32
|
+
* @date 2023-10-12 05:27:07
|
|
33
|
+
* @type {string}
|
|
34
|
+
*/
|
|
35
|
+
valueOP?: string;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 子节点数据集合
|
|
39
|
+
* @author lxm
|
|
40
|
+
* @date 2023-10-12 05:18:19
|
|
41
|
+
* @type {IFilterTreeNode[]}
|
|
42
|
+
*/
|
|
43
|
+
children: IFilterNode[];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface IFilterLeafNode {
|
|
47
|
+
/**
|
|
48
|
+
* 是否是叶子节点
|
|
49
|
+
* @author lxm
|
|
50
|
+
* @date 2023-10-12 05:14:28
|
|
51
|
+
* @type {boolean}
|
|
52
|
+
*/
|
|
53
|
+
leaf: true;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 实体属性名称
|
|
57
|
+
* @author lxm
|
|
58
|
+
* @date 2023-10-13 02:35:42
|
|
59
|
+
* @type {string}
|
|
60
|
+
*/
|
|
61
|
+
field: string | null;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* 过滤项值
|
|
65
|
+
* @author lxm
|
|
66
|
+
* @date 2023-10-12 05:16:52
|
|
67
|
+
* @type {unknown}
|
|
68
|
+
*/
|
|
69
|
+
value: unknown | null;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* 值操作类型
|
|
73
|
+
* @author lxm
|
|
74
|
+
* @date 2023-10-12 05:27:07
|
|
75
|
+
* @type {string}
|
|
76
|
+
*/
|
|
77
|
+
valueOP: string | null;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export type IFilterNode = IFilterBranchNode | IFilterLeafNode;
|
|
81
|
+
|
|
4
82
|
export interface ISearchBarState extends IControlState {
|
|
5
83
|
/**
|
|
6
84
|
* 快速搜索字符串
|
|
@@ -25,4 +103,12 @@ export interface ISearchBarState extends IControlState {
|
|
|
25
103
|
* @type {boolean}
|
|
26
104
|
*/
|
|
27
105
|
selectedGroupItem: ISearchBarGroup | null;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* 过滤项树节点数据集合
|
|
109
|
+
* @author lxm
|
|
110
|
+
* @date 2023-10-12 05:16:12
|
|
111
|
+
* @type {IFilterNode[]}
|
|
112
|
+
*/
|
|
113
|
+
filterNodes: IFilterNode[];
|
|
28
114
|
}
|
|
@@ -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';
|
|
@@ -90,14 +90,14 @@ export interface IAppDEService {
|
|
|
90
90
|
*
|
|
91
91
|
* @author chitanda
|
|
92
92
|
* @date 2023-10-12 16:10:03
|
|
93
|
-
* @param {(data:
|
|
93
|
+
* @param {(data: IPortalAsyncAction) => void} onmessage
|
|
94
94
|
* @param {IParams} context
|
|
95
95
|
* @param {IParams} [params]
|
|
96
96
|
* @param {IData} [data]
|
|
97
97
|
* @return {*} {Promise<void>}
|
|
98
98
|
*/
|
|
99
99
|
aiChatSse(
|
|
100
|
-
onmessage: (data:
|
|
100
|
+
onmessage: (data: IPortalAsyncAction) => void,
|
|
101
101
|
context: IParams,
|
|
102
102
|
params?: IParams,
|
|
103
103
|
data?: IData,
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { IAppDEMethod, IAppDataEntity } from '@ibiz/model-core';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
IHttpResponse,
|
|
4
|
+
IPortalAsyncAction,
|
|
5
|
+
ModelError,
|
|
6
|
+
RuntimeError,
|
|
7
|
+
} from '@ibiz-template/core';
|
|
3
8
|
import { DECache, calcResPath } from '../../utils';
|
|
4
9
|
import { WorkFlowService } from '../work-flow/work-flow.service';
|
|
5
10
|
import { Method } from './method/method';
|
|
@@ -174,14 +179,15 @@ export class DEService implements IAppDEService {
|
|
|
174
179
|
* 实体级别 AI 聊天会话
|
|
175
180
|
*
|
|
176
181
|
* @author chitanda
|
|
177
|
-
* @date 2023-10-
|
|
182
|
+
* @date 2023-10-16 16:10:16
|
|
183
|
+
* @param {(data: IPortalAsyncAction) => void} onmessage
|
|
178
184
|
* @param {IParams} context
|
|
179
185
|
* @param {IParams} [params={}]
|
|
180
|
-
* @param {
|
|
186
|
+
* @param {IData} [data={}]
|
|
181
187
|
* @return {*} {Promise<void>}
|
|
182
188
|
*/
|
|
183
189
|
aiChatSse(
|
|
184
|
-
onmessage: (data:
|
|
190
|
+
onmessage: (data: IPortalAsyncAction) => void,
|
|
185
191
|
context: IParams,
|
|
186
192
|
params: IParams = {},
|
|
187
193
|
data: IData = {},
|
|
@@ -197,8 +203,11 @@ export class DEService implements IAppDEService {
|
|
|
197
203
|
'Content-Type': 'application/json',
|
|
198
204
|
},
|
|
199
205
|
body: JSON.stringify(data),
|
|
200
|
-
onmessage:
|
|
201
|
-
|
|
206
|
+
onmessage: e => {
|
|
207
|
+
if (e.data) {
|
|
208
|
+
const json = JSON.parse(e.data);
|
|
209
|
+
onmessage(json as IPortalAsyncAction);
|
|
210
|
+
}
|
|
202
211
|
},
|
|
203
212
|
onclose: () => {
|
|
204
213
|
resolve();
|
|
@@ -111,7 +111,7 @@ export abstract class Method {
|
|
|
111
111
|
case 'POST':
|
|
112
112
|
res = await this.app.net.post(
|
|
113
113
|
this.mergeRequestPath(path, methodName),
|
|
114
|
-
notNilEmpty(data) ? data! : params
|
|
114
|
+
notNilEmpty(data) ? data! : params || {},
|
|
115
115
|
);
|
|
116
116
|
break;
|
|
117
117
|
case 'GET':
|
|
@@ -123,7 +123,7 @@ export abstract class Method {
|
|
|
123
123
|
case 'PUT': {
|
|
124
124
|
res = await this.app.net.put(
|
|
125
125
|
this.mergeRequestPath(path, methodName),
|
|
126
|
-
notNilEmpty(data) ? data! : params
|
|
126
|
+
notNilEmpty(data) ? data! : params || {},
|
|
127
127
|
);
|
|
128
128
|
break;
|
|
129
129
|
}
|
|
@@ -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
|
|
@@ -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;
|