@ibiz-template/runtime 0.5.7-alpha.3 → 0.5.7-alpha.5
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 +661 -309
- package/dist/index.system.min.js +1 -1
- package/out/app-hub.d.ts +2 -0
- package/out/app-hub.d.ts.map +1 -1
- package/out/app-hub.js +2 -0
- package/out/application.js +1 -1
- package/out/controller/control/exp-bar/exp-bar.controller.d.ts.map +1 -1
- package/out/controller/control/exp-bar/exp-bar.controller.js +7 -0
- package/out/controller/control/exp-bar/tree-exp-bar.controller.d.ts +5 -0
- package/out/controller/control/exp-bar/tree-exp-bar.controller.d.ts.map +1 -1
- package/out/controller/control/exp-bar/tree-exp-bar.controller.js +16 -0
- package/out/controller/control/search-bar/entity-schema.d.ts +1 -2
- package/out/controller/control/search-bar/entity-schema.d.ts.map +1 -1
- package/out/controller/control/search-bar/entity-schema.js +2 -2
- package/out/controller/control/search-bar/index.d.ts +2 -0
- package/out/controller/control/search-bar/index.d.ts.map +1 -1
- package/out/controller/control/search-bar/index.js +2 -0
- package/out/controller/control/search-bar/search-bar-filter.controller.d.ts +5 -6
- package/out/controller/control/search-bar/search-bar-filter.controller.d.ts.map +1 -1
- package/out/controller/control/search-bar/search-bar-filter.controller.js +6 -9
- package/out/controller/control/search-bar/search-bar.controller.d.ts +1 -24
- package/out/controller/control/search-bar/search-bar.controller.d.ts.map +1 -1
- package/out/controller/control/search-bar/search-bar.controller.js +11 -88
- package/out/controller/control/search-bar/use-searchcond.d.ts +33 -0
- package/out/controller/control/search-bar/use-searchcond.d.ts.map +1 -0
- package/out/controller/control/search-bar/use-searchcond.js +91 -0
- package/out/controller/notification/async-action.controller.d.ts +64 -0
- package/out/controller/notification/async-action.controller.d.ts.map +1 -0
- package/out/controller/notification/async-action.controller.js +141 -0
- package/out/controller/notification/index.d.ts +2 -0
- package/out/controller/notification/index.d.ts.map +1 -0
- package/out/controller/notification/index.js +1 -0
- package/out/controller/notification/internal-message.controller.d.ts +23 -0
- package/out/controller/notification/internal-message.controller.d.ts.map +1 -0
- package/out/controller/notification/internal-message.controller.js +50 -0
- package/out/controller/notification/notice.controller.d.ts +10 -0
- package/out/controller/notification/notice.controller.d.ts.map +1 -0
- package/out/controller/notification/notice.controller.js +13 -0
- package/out/global/global-util/global-util.d.ts +9 -1
- package/out/global/global-util/global-util.d.ts.map +1 -1
- package/out/global/global-util/global-util.js +9 -1
- package/out/interface/common/i-app-hub-service/i-app-hub-service.d.ts +8 -1
- package/out/interface/common/i-app-hub-service/i-app-hub-service.d.ts.map +1 -1
- package/out/interface/common/i-popover-options/i-popover-options.d.ts +9 -1
- package/out/interface/common/i-popover-options/i-popover-options.d.ts.map +1 -1
- package/out/interface/controller/controller/index.d.ts +1 -0
- package/out/interface/controller/controller/index.d.ts.map +1 -1
- package/out/interface/controller/controller/index.js +1 -0
- package/out/interface/controller/controller/notice/i-async-action.controller.d.ts +49 -0
- package/out/interface/controller/controller/notice/i-async-action.controller.d.ts.map +1 -0
- package/out/interface/controller/controller/notice/i-async-action.controller.js +1 -0
- package/out/interface/controller/controller/notice/i-internal-message.controller.d.ts +68 -0
- package/out/interface/controller/controller/notice/i-internal-message.controller.d.ts.map +1 -0
- package/out/interface/controller/controller/notice/i-internal-message.controller.js +1 -0
- package/out/interface/controller/controller/notice/i-notice.controller.d.ts +33 -0
- package/out/interface/controller/controller/notice/i-notice.controller.d.ts.map +1 -0
- package/out/interface/controller/controller/notice/i-notice.controller.js +1 -0
- package/out/interface/controller/controller/notice/index.d.ts +4 -0
- package/out/interface/controller/controller/notice/index.d.ts.map +1 -0
- package/out/interface/controller/controller/notice/index.js +1 -0
- package/out/interface/provider/i-async-action.provider.d.ts +11 -3
- package/out/interface/provider/i-async-action.provider.d.ts.map +1 -1
- package/out/interface/provider/i-internal-message.provider.d.ts +10 -2
- package/out/interface/provider/i-internal-message.provider.d.ts.map +1 -1
- package/out/interface/util/i-notice-util/i-notice-util.d.ts +34 -0
- package/out/interface/util/i-notice-util/i-notice-util.d.ts.map +1 -0
- package/out/interface/util/i-notice-util/i-notice-util.js +1 -0
- package/out/interface/util/i-open-view-util/i-open-view-util.d.ts +2 -2
- package/out/interface/util/i-open-view-util/i-open-view-util.d.ts.map +1 -1
- package/out/interface/util/index.d.ts +1 -0
- package/out/interface/util/index.d.ts.map +1 -1
- package/out/register/helper/async-action-register.d.ts +2 -1
- package/out/register/helper/async-action-register.d.ts.map +1 -1
- package/out/register/helper/async-action-register.js +3 -3
- package/out/register/helper/internal-message-register.js +2 -2
- package/out/service/service/auth/v7-auth.service.d.ts +8 -0
- package/out/service/service/auth/v7-auth.service.d.ts.map +1 -1
- package/out/service/service/auth/v7-auth.service.js +15 -0
- package/out/service/service/internal-message/internal-message.service.d.ts +1 -1
- package/out/service/service/internal-message/internal-message.service.d.ts.map +1 -1
- package/out/service/service/internal-message/internal-message.service.js +7 -16
- package/out/types.d.ts +8 -1
- package/out/types.d.ts.map +1 -1
- package/out/utils/file-util/file-util.d.ts +57 -0
- package/out/utils/file-util/file-util.d.ts.map +1 -0
- package/out/utils/file-util/file-util.js +113 -0
- package/out/utils/file-util/index.d.ts +2 -0
- package/out/utils/file-util/index.d.ts.map +1 -0
- package/out/utils/file-util/index.js +1 -0
- package/out/utils/index.d.ts +1 -0
- package/out/utils/index.d.ts.map +1 -1
- package/out/utils/index.js +1 -0
- package/package.json +5 -6
- package/src/app-hub.ts +3 -0
- package/src/application.ts +1 -1
- package/src/controller/control/exp-bar/exp-bar.controller.ts +6 -0
- package/src/controller/control/exp-bar/tree-exp-bar.controller.ts +17 -0
- package/src/controller/control/search-bar/entity-schema.ts +4 -4
- package/src/controller/control/search-bar/index.ts +2 -0
- package/src/controller/control/search-bar/search-bar-filter.controller.ts +15 -10
- package/src/controller/control/search-bar/search-bar.controller.ts +24 -98
- package/src/controller/control/search-bar/use-searchcond.ts +100 -0
- package/src/controller/notification/async-action.controller.ts +163 -0
- package/src/controller/notification/index.ts +1 -0
- package/src/controller/notification/internal-message.controller.ts +64 -0
- package/src/controller/notification/notice.controller.ts +16 -0
- package/src/global/global-util/global-util.ts +10 -0
- package/src/interface/common/i-app-hub-service/i-app-hub-service.ts +9 -1
- package/src/interface/common/i-popover-options/i-popover-options.ts +10 -1
- package/src/interface/controller/controller/index.ts +1 -0
- package/src/interface/controller/controller/notice/i-async-action.controller.ts +52 -0
- package/src/interface/controller/controller/notice/i-internal-message.controller.ts +74 -0
- package/src/interface/controller/controller/notice/i-notice.controller.ts +36 -0
- package/src/interface/controller/controller/notice/index.ts +9 -0
- package/src/interface/provider/i-async-action.provider.ts +14 -3
- package/src/interface/provider/i-internal-message.provider.ts +10 -2
- package/src/interface/util/i-notice-util/i-notice-util.ts +34 -0
- package/src/interface/util/i-open-view-util/i-open-view-util.ts +2 -1
- package/src/interface/util/index.ts +1 -0
- package/src/register/helper/async-action-register.ts +4 -4
- package/src/register/helper/internal-message-register.ts +2 -2
- package/src/service/service/auth/v7-auth.service.ts +16 -1
- package/src/service/service/internal-message/internal-message.service.ts +12 -18
- package/src/types.ts +9 -0
- package/src/utils/file-util/file-util.ts +141 -0
- package/src/utils/file-util/index.ts +1 -0
- package/src/utils/index.ts +1 -0
|
@@ -63,6 +63,23 @@ export class TreeExpBarController
|
|
|
63
63
|
*/
|
|
64
64
|
navNodeModelIds: string[] = [];
|
|
65
65
|
|
|
66
|
+
/**
|
|
67
|
+
* 组件挂载
|
|
68
|
+
*
|
|
69
|
+
*/
|
|
70
|
+
protected async onMounted(): Promise<void> {
|
|
71
|
+
super.onMounted();
|
|
72
|
+
if (this.xDataController) {
|
|
73
|
+
this.xDataController.evt.on('onAfterRefreshParent', _event => {
|
|
74
|
+
// 刷新后需要重新进行导航,计算导航上下文等参数的变更
|
|
75
|
+
const data = this.xDataController.state.selectedData;
|
|
76
|
+
if (data[0]) {
|
|
77
|
+
this.xDataController.setActive(data[0]);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
66
83
|
/**
|
|
67
84
|
* 获取指定节点模型
|
|
68
85
|
*
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { IDropDownList, IEditor, ISearchBarFilter } from '@ibiz/model-core';
|
|
2
2
|
import { ValueOP } from '../../../constant';
|
|
3
|
-
import { SearchBarController } from './search-bar.controller';
|
|
4
3
|
import { ExcludeOPs } from './search-bar-filter.controller';
|
|
5
4
|
|
|
6
5
|
type ISchemaField = {
|
|
@@ -124,7 +123,8 @@ function getEditor(field: ISchemaField, op: string): IEditor {
|
|
|
124
123
|
*/
|
|
125
124
|
export async function calcFilterModelBySchema(
|
|
126
125
|
json: IData,
|
|
127
|
-
|
|
126
|
+
appDataEntityId: string,
|
|
127
|
+
modelAppId: string,
|
|
128
128
|
): Promise<ISearchBarFilter[]> {
|
|
129
129
|
if (!json.properties) {
|
|
130
130
|
return [];
|
|
@@ -166,8 +166,8 @@ export async function calcFilterModelBySchema(
|
|
|
166
166
|
// 属性codeName对应的属性id
|
|
167
167
|
const codeNameToId: { [p: string]: string } = {};
|
|
168
168
|
const dataEntity = await ibiz.hub.getAppDataEntity(
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
appDataEntityId,
|
|
170
|
+
modelAppId,
|
|
171
171
|
);
|
|
172
172
|
dataEntity.appDEFields?.forEach(field => {
|
|
173
173
|
codeNameToId[field.codeName!.toLowerCase()] = field.id!;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { RuntimeModelError } from '@ibiz-template/core';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
IAppDEField,
|
|
4
|
+
IAppDataEntity,
|
|
5
|
+
ISearchBarFilter,
|
|
6
|
+
} from '@ibiz/model-core';
|
|
3
7
|
import {
|
|
4
8
|
IEditorContainerController,
|
|
5
9
|
IEditorController,
|
|
@@ -7,7 +11,6 @@ import {
|
|
|
7
11
|
} from '../../../interface';
|
|
8
12
|
import { findFieldById } from '../../../model';
|
|
9
13
|
import { getEditorProvider } from '../../../register';
|
|
10
|
-
import { SearchBarController } from './search-bar.controller';
|
|
11
14
|
import { ValueOP } from '../../../constant';
|
|
12
15
|
|
|
13
16
|
/** 不需要编辑器的OP */
|
|
@@ -29,13 +32,9 @@ export class SearchBarFilterController implements IEditorContainerController {
|
|
|
29
32
|
|
|
30
33
|
valueFormat: string | undefined;
|
|
31
34
|
|
|
32
|
-
|
|
33
|
-
return this.searchBar.context;
|
|
34
|
-
}
|
|
35
|
+
context: IContext;
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
return this.searchBar.params;
|
|
38
|
-
}
|
|
37
|
+
params: IParams;
|
|
39
38
|
|
|
40
39
|
dataType: number | undefined;
|
|
41
40
|
|
|
@@ -90,12 +89,18 @@ export class SearchBarFilterController implements IEditorContainerController {
|
|
|
90
89
|
|
|
91
90
|
constructor(
|
|
92
91
|
public model: ISearchBarFilter,
|
|
93
|
-
public
|
|
92
|
+
public appDataEntity: IAppDataEntity,
|
|
93
|
+
context: IContext,
|
|
94
|
+
params: IParams,
|
|
94
95
|
) {
|
|
96
|
+
// 上下文、参数
|
|
97
|
+
this.context = context;
|
|
98
|
+
this.params = params;
|
|
99
|
+
|
|
95
100
|
// 实体属性
|
|
96
101
|
let field: IAppDEField | undefined;
|
|
97
102
|
if (model.appDEFieldId) {
|
|
98
|
-
field = findFieldById(
|
|
103
|
+
field = findFieldById(appDataEntity, model.appDEFieldId)!;
|
|
99
104
|
}
|
|
100
105
|
this.fieldName = field ? field.codeName!.toLowerCase() : model.id!;
|
|
101
106
|
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
RuntimeError,
|
|
3
|
-
mergeInLeft,
|
|
4
|
-
recursiveIterate,
|
|
5
|
-
} from '@ibiz-template/core';
|
|
1
|
+
import { mergeInLeft } from '@ibiz-template/core';
|
|
6
2
|
import { IAppDataEntity, ISearchBar, ISearchBarFilter } from '@ibiz/model-core';
|
|
7
|
-
import { clone
|
|
3
|
+
import { clone } from 'ramda';
|
|
8
4
|
import {
|
|
9
5
|
ISearchBarState,
|
|
10
6
|
ISearchBarEvent,
|
|
11
7
|
ISearchBarController,
|
|
12
|
-
IFilterNode,
|
|
13
8
|
IBackendSearchBarGroup,
|
|
14
9
|
IGridController,
|
|
15
10
|
} from '../../../interface';
|
|
@@ -19,6 +14,11 @@ import { SearchBarFilterController } from './search-bar-filter.controller';
|
|
|
19
14
|
import { SearchBarService } from './search-bar.service';
|
|
20
15
|
import { getEntitySchema } from '../../utils';
|
|
21
16
|
import { calcFilterModelBySchema } from './entity-schema';
|
|
17
|
+
import {
|
|
18
|
+
calcSearchConds,
|
|
19
|
+
getOriginFilterNodes,
|
|
20
|
+
parseFilters,
|
|
21
|
+
} from './use-searchcond';
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* 搜索栏控制器
|
|
@@ -106,7 +106,7 @@ export class SearchBarController
|
|
|
106
106
|
* @author lxm
|
|
107
107
|
* @date 2024-01-05 10:10:37
|
|
108
108
|
*/
|
|
109
|
-
addSchemaFilters =
|
|
109
|
+
addSchemaFilters = true;
|
|
110
110
|
|
|
111
111
|
/**
|
|
112
112
|
* 表格控制器
|
|
@@ -184,7 +184,11 @@ export class SearchBarController
|
|
|
184
184
|
if (!json) {
|
|
185
185
|
return;
|
|
186
186
|
}
|
|
187
|
-
const addSearchBarFilters = await calcFilterModelBySchema(
|
|
187
|
+
const addSearchBarFilters = await calcFilterModelBySchema(
|
|
188
|
+
json,
|
|
189
|
+
this.model.appDataEntityId!,
|
|
190
|
+
this.model.appId,
|
|
191
|
+
);
|
|
188
192
|
|
|
189
193
|
const mergeFilters: ISearchBarFilter[] = [];
|
|
190
194
|
this.model.searchBarFilters?.forEach(filter => {
|
|
@@ -304,7 +308,7 @@ export class SearchBarController
|
|
|
304
308
|
* @date 2023-10-16 03:52:44
|
|
305
309
|
*/
|
|
306
310
|
resetFilter(): void {
|
|
307
|
-
this.state.filterNodes =
|
|
311
|
+
this.state.filterNodes = getOriginFilterNodes();
|
|
308
312
|
this.evt.emit('onSearch', undefined);
|
|
309
313
|
}
|
|
310
314
|
|
|
@@ -318,7 +322,12 @@ export class SearchBarController
|
|
|
318
322
|
protected async initSearchBarFilters(): Promise<void> {
|
|
319
323
|
if (this.searchBarFilters?.length) {
|
|
320
324
|
this.searchBarFilters.forEach(item => {
|
|
321
|
-
const filterController = new SearchBarFilterController(
|
|
325
|
+
const filterController = new SearchBarFilterController(
|
|
326
|
+
item,
|
|
327
|
+
this.appDataEntity,
|
|
328
|
+
this.context,
|
|
329
|
+
this.params,
|
|
330
|
+
);
|
|
322
331
|
this.filterControllers.push(filterController);
|
|
323
332
|
});
|
|
324
333
|
await Promise.all(
|
|
@@ -337,91 +346,8 @@ export class SearchBarController
|
|
|
337
346
|
if (!this.enableFilter) {
|
|
338
347
|
return;
|
|
339
348
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
recursiveIterate(this.state.filterNodes[0], (node: IFilterNode) => {
|
|
343
|
-
if (node.leaf) {
|
|
344
|
-
if (node.field && node.valueOP && !isNil(node.value)) {
|
|
345
|
-
hasFilter = true;
|
|
346
|
-
} else {
|
|
347
|
-
// 如果过滤项不给
|
|
348
|
-
hasError = true;
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
});
|
|
352
|
-
if (hasFilter && !hasError) {
|
|
353
|
-
const filter = [this.formatFilters(this.state.filterNodes[0])];
|
|
354
|
-
return filter;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
/**
|
|
359
|
-
* 格式化过滤项 (后续如果修改这里的逻辑记得把下方的反推函数parseFilters也跟着修改!)
|
|
360
|
-
* @author lxm
|
|
361
|
-
* @date 2023-10-16 03:45:41
|
|
362
|
-
* @param {IFilterNode} node
|
|
363
|
-
* @return {*} {IData}
|
|
364
|
-
*/
|
|
365
|
-
formatFilters(node: IFilterNode): IData {
|
|
366
|
-
if (!node.leaf) {
|
|
367
|
-
return {
|
|
368
|
-
condtype: 'GROUP',
|
|
369
|
-
condop: node.logicType,
|
|
370
|
-
bnotmode: false,
|
|
371
|
-
searchconds: node.children.map(item => this.formatFilters(item)),
|
|
372
|
-
};
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
return {
|
|
376
|
-
condtype: 'DEFIELD',
|
|
377
|
-
fieldname: node.field,
|
|
378
|
-
condop: node.valueOP,
|
|
379
|
-
value: node.value,
|
|
380
|
-
};
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
/**
|
|
384
|
-
* 根据格式化后的过滤项反推出过滤项树节点数据集合
|
|
385
|
-
* @param {IData} data
|
|
386
|
-
* @return {*}
|
|
387
|
-
* @author: zhujiamin
|
|
388
|
-
* @Date: 2023-12-28 09:47:45
|
|
389
|
-
*/
|
|
390
|
-
parseFilters(data: IData): IFilterNode {
|
|
391
|
-
if (data.condtype === 'GROUP') {
|
|
392
|
-
return {
|
|
393
|
-
leaf: false,
|
|
394
|
-
logicType: data.condop === 'AND' ? 'AND' : 'OR',
|
|
395
|
-
children: (data.searchconds || []).map((item: IData) =>
|
|
396
|
-
this.parseFilters(item),
|
|
397
|
-
),
|
|
398
|
-
};
|
|
399
|
-
}
|
|
400
|
-
if (data.condtype === 'DEFIELD') {
|
|
401
|
-
return {
|
|
402
|
-
leaf: true,
|
|
403
|
-
field: data.fieldname || null,
|
|
404
|
-
valueOP: data.condop || null,
|
|
405
|
-
value: data.value || null,
|
|
406
|
-
};
|
|
407
|
-
}
|
|
408
|
-
throw new RuntimeError(`无效的condtype:${data.condtype}`);
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
/**
|
|
412
|
-
* 获取初始过滤项树节点数据集合
|
|
413
|
-
* @return {*}
|
|
414
|
-
* @author: zhujiamin
|
|
415
|
-
* @Date: 2023-12-21 17:29:47
|
|
416
|
-
*/
|
|
417
|
-
protected getOriginFilterNodes(): IFilterNode[] {
|
|
418
|
-
return [
|
|
419
|
-
{
|
|
420
|
-
leaf: false,
|
|
421
|
-
logicType: 'AND',
|
|
422
|
-
children: [{ leaf: true, field: null, valueOP: null, value: null }],
|
|
423
|
-
},
|
|
424
|
-
];
|
|
349
|
+
const searchconds = calcSearchConds(this.state.filterNodes);
|
|
350
|
+
return searchconds;
|
|
425
351
|
}
|
|
426
352
|
|
|
427
353
|
/**
|
|
@@ -611,11 +537,11 @@ export class SearchBarController
|
|
|
611
537
|
) {
|
|
612
538
|
// 根据后台标准的searchconds计算出 前端回显的树形结构FilterNodes
|
|
613
539
|
const filterNodes = groupItem.searchGroupData.searchconds.map(item =>
|
|
614
|
-
|
|
540
|
+
parseFilters(item),
|
|
615
541
|
);
|
|
616
542
|
this.state.filterNodes = filterNodes;
|
|
617
543
|
} else {
|
|
618
|
-
this.state.filterNodes =
|
|
544
|
+
this.state.filterNodes = getOriginFilterNodes();
|
|
619
545
|
}
|
|
620
546
|
if (this.grid && groupItem && groupItem.searchGroupData) {
|
|
621
547
|
this.grid.setGroupParams(groupItem.searchGroupData);
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { RuntimeError, recursiveIterate } from '@ibiz-template/core';
|
|
2
|
+
import { isNil } from 'ramda';
|
|
3
|
+
import { IFilterNode } from '../../../interface';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 获取初始过滤项树节点数据集合
|
|
7
|
+
* @return {*}
|
|
8
|
+
* @author: zhujiamin
|
|
9
|
+
* @Date: 2023-12-21 17:29:47
|
|
10
|
+
*/
|
|
11
|
+
export function getOriginFilterNodes(): IFilterNode[] {
|
|
12
|
+
return [
|
|
13
|
+
{
|
|
14
|
+
leaf: false,
|
|
15
|
+
logicType: 'AND',
|
|
16
|
+
children: [{ leaf: true, field: null, valueOP: null, value: null }],
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 格式化过滤项 (后续如果修改这里的逻辑记得把下方的反推函数parseFilters也跟着修改!)
|
|
23
|
+
* @author lxm
|
|
24
|
+
* @date 2023-10-16 03:45:41
|
|
25
|
+
* @param {IFilterNode} node
|
|
26
|
+
* @return {*} {IData}
|
|
27
|
+
*/
|
|
28
|
+
export function formatFilters(node: IFilterNode): IData {
|
|
29
|
+
if (!node.leaf) {
|
|
30
|
+
return {
|
|
31
|
+
condtype: 'GROUP',
|
|
32
|
+
condop: node.logicType,
|
|
33
|
+
bnotmode: false,
|
|
34
|
+
searchconds: node.children.map(item => formatFilters(item)),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
condtype: 'DEFIELD',
|
|
40
|
+
fieldname: node.field,
|
|
41
|
+
condop: node.valueOP,
|
|
42
|
+
value: node.value,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* 根据格式化后的过滤项反推出过滤项树节点数据集合
|
|
48
|
+
* @param {IData} data
|
|
49
|
+
* @return {*}
|
|
50
|
+
* @author: zhujiamin
|
|
51
|
+
* @Date: 2023-12-28 09:47:45
|
|
52
|
+
*/
|
|
53
|
+
export function parseFilters(data: IData): IFilterNode {
|
|
54
|
+
if (data.condtype === 'GROUP') {
|
|
55
|
+
return {
|
|
56
|
+
leaf: false,
|
|
57
|
+
logicType: data.condop === 'AND' ? 'AND' : 'OR',
|
|
58
|
+
children: (data.searchconds || []).map((item: IData) =>
|
|
59
|
+
parseFilters(item),
|
|
60
|
+
),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
if (data.condtype === 'DEFIELD') {
|
|
64
|
+
return {
|
|
65
|
+
leaf: true,
|
|
66
|
+
field: data.fieldname || null,
|
|
67
|
+
valueOP: data.condop || null,
|
|
68
|
+
value: data.value || null,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
throw new RuntimeError(`无效的condtype:${data.condtype}`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* 根据filterNodes计算出SearchConds
|
|
76
|
+
* @param {IData} data
|
|
77
|
+
* @return {*}
|
|
78
|
+
* @author: zhujiamin
|
|
79
|
+
* @Date: 2023-12-28 09:47:45
|
|
80
|
+
*/
|
|
81
|
+
export function calcSearchConds(
|
|
82
|
+
filterNodes: IFilterNode[],
|
|
83
|
+
): IData[] | undefined {
|
|
84
|
+
let hasFilter = false; // 是否有过滤项
|
|
85
|
+
let hasError = false; // 是否有过滤项格式不正确
|
|
86
|
+
recursiveIterate(filterNodes[0], (node: IFilterNode) => {
|
|
87
|
+
if (node.leaf) {
|
|
88
|
+
if (node.field && node.valueOP && !isNil(node.value)) {
|
|
89
|
+
hasFilter = true;
|
|
90
|
+
} else {
|
|
91
|
+
// 如果过滤项不给
|
|
92
|
+
hasError = true;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
if (hasFilter && !hasError) {
|
|
97
|
+
const filter = [formatFilters(filterNodes[0])];
|
|
98
|
+
return filter;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { QXEvent } from 'qx-util';
|
|
2
|
+
import { IPortalAsyncAction, IPortalMessage } from '@ibiz-template/core';
|
|
3
|
+
import { clone } from 'ramda';
|
|
4
|
+
import { isNil, isNumber } from 'lodash-es';
|
|
5
|
+
import dayjs from 'dayjs';
|
|
6
|
+
import { AsyncActionService } from '../../service';
|
|
7
|
+
import { IAsyncActionController, IAsyncActionEvent } from '../../interface';
|
|
8
|
+
|
|
9
|
+
export class AsyncActionController implements IAsyncActionController {
|
|
10
|
+
readonly evt: QXEvent<IAsyncActionEvent> = new QXEvent();
|
|
11
|
+
|
|
12
|
+
total: number = 0;
|
|
13
|
+
|
|
14
|
+
actions: IPortalAsyncAction[] = [];
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 正在处理中的数量
|
|
18
|
+
* @author lxm
|
|
19
|
+
* @date 2024-01-25 04:51:18
|
|
20
|
+
* @type {number}
|
|
21
|
+
*/
|
|
22
|
+
doingNum: number = 0;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 结束的状态值集合
|
|
26
|
+
* @author lxm
|
|
27
|
+
* @date 2024-01-25 05:08:26
|
|
28
|
+
* @protected
|
|
29
|
+
*/
|
|
30
|
+
protected finishedStates = [30, 40];
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* 请求服务
|
|
34
|
+
* @author lxm
|
|
35
|
+
* @date 2024-01-25 04:50:12
|
|
36
|
+
* @protected
|
|
37
|
+
*/
|
|
38
|
+
protected service = new AsyncActionService();
|
|
39
|
+
|
|
40
|
+
async init(): Promise<void> {
|
|
41
|
+
this.listenMessage();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 监听全局的实时消息
|
|
46
|
+
* @author lxm
|
|
47
|
+
* @date 2024-01-25 04:47:36
|
|
48
|
+
*/
|
|
49
|
+
protected listenMessage(): void {
|
|
50
|
+
ibiz.mc.command.asyncAction.on(async (msg: IPortalMessage) => {
|
|
51
|
+
if (!msg.data || msg.subtype !== 'ASYNCACTION') {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const asyncAction = this.formatAsyncAction(
|
|
56
|
+
msg.data as IPortalAsyncAction,
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
const findIndex = this.actions.findIndex(
|
|
60
|
+
item => item.asyncacitonid === asyncAction.asyncacitonid,
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
if (findIndex === -1) {
|
|
64
|
+
this.add(asyncAction);
|
|
65
|
+
} else {
|
|
66
|
+
this.update(asyncAction);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* 格式化数据
|
|
73
|
+
* @author lxm
|
|
74
|
+
* @date 2024-01-25 05:03:47
|
|
75
|
+
* @protected
|
|
76
|
+
* @param {IPortalAsyncAction} data
|
|
77
|
+
* @return {*} {IPortalAsyncAction}
|
|
78
|
+
*/
|
|
79
|
+
protected formatAsyncAction(data: IPortalAsyncAction): IPortalAsyncAction {
|
|
80
|
+
// 处理时间日期为毫秒值时,转换成字符串。
|
|
81
|
+
const dateFields = [
|
|
82
|
+
'begintime',
|
|
83
|
+
'endtime',
|
|
84
|
+
'createdate',
|
|
85
|
+
'updatedate',
|
|
86
|
+
] as const;
|
|
87
|
+
dateFields.forEach(key => {
|
|
88
|
+
if (isNumber(data[key])) {
|
|
89
|
+
data[key] = dayjs(data[key]).format('YYYY-MM-DD HH:mm:ss');
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
if (!isNil(data.actionresult)) {
|
|
94
|
+
try {
|
|
95
|
+
const json = JSON.parse(data.actionresult as string);
|
|
96
|
+
data.actionresult = json;
|
|
97
|
+
} catch (error) {
|
|
98
|
+
// 不是对象类型就是字符串。
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (!isNil(data.completionrate)) {
|
|
103
|
+
const num = Number(data.completionrate);
|
|
104
|
+
if (Number.isNaN(num)) {
|
|
105
|
+
data.completionrate = undefined;
|
|
106
|
+
} else {
|
|
107
|
+
data.completionrate = num;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return data;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* 添加一条新消息
|
|
116
|
+
* @author lxm
|
|
117
|
+
* @date 2024-01-25 04:58:37
|
|
118
|
+
* @protected
|
|
119
|
+
* @param {IPortalAsyncAction} action
|
|
120
|
+
*/
|
|
121
|
+
protected add(action: IPortalAsyncAction): void {
|
|
122
|
+
this.actions.unshift(action);
|
|
123
|
+
|
|
124
|
+
// 非结束状态的消息加一
|
|
125
|
+
if (!this.finishedStates.includes(action.actionstate)) {
|
|
126
|
+
this.doingNum += 1;
|
|
127
|
+
ibiz.notice.showDoingNotice({ num: this.doingNum });
|
|
128
|
+
} else {
|
|
129
|
+
this.noticeResult(action);
|
|
130
|
+
}
|
|
131
|
+
this.evt.emit('add', clone(action));
|
|
132
|
+
this.evt.emit('dataChange');
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* 添加一条新消息
|
|
137
|
+
* @author lxm
|
|
138
|
+
* @date 2024-01-25 04:58:37
|
|
139
|
+
* @protected
|
|
140
|
+
* @param {IPortalAsyncAction} action
|
|
141
|
+
*/
|
|
142
|
+
protected update(action: IPortalAsyncAction): void {
|
|
143
|
+
const index = this.actions.findIndex(
|
|
144
|
+
item => item.asyncacitonid === action.asyncacitonid,
|
|
145
|
+
);
|
|
146
|
+
this.actions.splice(index, 1, action);
|
|
147
|
+
|
|
148
|
+
// 执行结束的减一
|
|
149
|
+
if (this.finishedStates.includes(action.actionstate)) {
|
|
150
|
+
this.doingNum -= 1;
|
|
151
|
+
if (this.doingNum <= 0) {
|
|
152
|
+
ibiz.notice.closeDoingNotice();
|
|
153
|
+
}
|
|
154
|
+
this.noticeResult(action);
|
|
155
|
+
}
|
|
156
|
+
this.evt.emit('change', clone(action));
|
|
157
|
+
this.evt.emit('dataChange');
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
protected noticeResult(action: IPortalAsyncAction): void {
|
|
161
|
+
ibiz.notice.showAsyncAction(action);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { NoticeController } from './notice.controller';
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { IInternalMessage } from '@ibiz-template/core';
|
|
2
|
+
import { QXEvent } from 'qx-util';
|
|
3
|
+
import {
|
|
4
|
+
IInternalMessageController,
|
|
5
|
+
InternalMessageEvent,
|
|
6
|
+
} from '../../interface';
|
|
7
|
+
import { InternalMessageService } from '../../service';
|
|
8
|
+
|
|
9
|
+
export class InternalMessageController implements IInternalMessageController {
|
|
10
|
+
readonly evt: QXEvent<InternalMessageEvent> = new QXEvent();
|
|
11
|
+
|
|
12
|
+
total: number = 0;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 当前分页
|
|
16
|
+
* @author lxm
|
|
17
|
+
* @date 2024-01-26 10:06:28
|
|
18
|
+
* @type {number}
|
|
19
|
+
*/
|
|
20
|
+
page: number = 0;
|
|
21
|
+
|
|
22
|
+
size: number = 20;
|
|
23
|
+
|
|
24
|
+
messages: IInternalMessage[] = [];
|
|
25
|
+
|
|
26
|
+
protected service = new InternalMessageService();
|
|
27
|
+
|
|
28
|
+
async init(): Promise<void> {
|
|
29
|
+
this.load();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async load(): Promise<void> {
|
|
33
|
+
await this.fetch(false);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async loadMore(): Promise<void> {
|
|
37
|
+
await this.fetch(true);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
protected async fetch(loadMore: boolean = false): Promise<void> {
|
|
41
|
+
// *计算查询参数
|
|
42
|
+
if (loadMore === false) {
|
|
43
|
+
this.page = 0;
|
|
44
|
+
} else {
|
|
45
|
+
this.page += 1;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const fetchParams = {
|
|
49
|
+
page: this.page,
|
|
50
|
+
size: this.size,
|
|
51
|
+
sort: 'update_time,desc',
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const res = await this.service.fetch(fetchParams);
|
|
55
|
+
this.total = res.total!;
|
|
56
|
+
|
|
57
|
+
if (loadMore) {
|
|
58
|
+
this.messages.push(...res.data);
|
|
59
|
+
} else {
|
|
60
|
+
this.messages = res.data;
|
|
61
|
+
}
|
|
62
|
+
this.evt.emit('dataChange');
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { INoticeController } from '../../interface';
|
|
2
|
+
import { AsyncActionController } from './async-action.controller';
|
|
3
|
+
import { InternalMessageController } from './internal-message.controller';
|
|
4
|
+
|
|
5
|
+
export class NoticeController implements INoticeController {
|
|
6
|
+
total = 0;
|
|
7
|
+
|
|
8
|
+
asyncAction = new AsyncActionController();
|
|
9
|
+
|
|
10
|
+
internalMessage = new InternalMessageController();
|
|
11
|
+
|
|
12
|
+
async init(): Promise<void> {
|
|
13
|
+
await this.internalMessage.init();
|
|
14
|
+
await this.asyncAction.init();
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
ErrorHandlerCenter,
|
|
11
11
|
ViewStack,
|
|
12
12
|
AnimeUtil,
|
|
13
|
+
FileUtil,
|
|
13
14
|
} from '../../utils';
|
|
14
15
|
|
|
15
16
|
/**
|
|
@@ -93,6 +94,15 @@ export class GlobalUtil {
|
|
|
93
94
|
*/
|
|
94
95
|
readonly anime = new AnimeUtil();
|
|
95
96
|
|
|
97
|
+
/**
|
|
98
|
+
* 文件工具类
|
|
99
|
+
*
|
|
100
|
+
* @author zk
|
|
101
|
+
* @date 2024-01-26 04:01:24
|
|
102
|
+
* @memberof GlobalUtil
|
|
103
|
+
*/
|
|
104
|
+
readonly file = new FileUtil();
|
|
105
|
+
|
|
96
106
|
constructor() {
|
|
97
107
|
this.error.register(new DefaultErrorHandler());
|
|
98
108
|
}
|
|
@@ -2,7 +2,7 @@ import { IAppDataEntity, IAppView, IApplication } from '@ibiz/model-core';
|
|
|
2
2
|
import { Convert } from '../../../hub';
|
|
3
3
|
import { ModelLoaderProvider } from '../../provider';
|
|
4
4
|
import { IAppConfigService } from '../i-app-config-service/i-app-config-service';
|
|
5
|
-
import { IHubController } from '../../controller';
|
|
5
|
+
import { IHubController, INoticeController } from '../../controller';
|
|
6
6
|
import { IAppDEService, IConfigService } from '../../service';
|
|
7
7
|
import { IAppService } from '../i-app-service/i-app-service';
|
|
8
8
|
|
|
@@ -58,6 +58,14 @@ export interface IAppHubService {
|
|
|
58
58
|
*/
|
|
59
59
|
config: IAppConfigService;
|
|
60
60
|
|
|
61
|
+
/**
|
|
62
|
+
* 全局消息总控制器
|
|
63
|
+
* @author lxm
|
|
64
|
+
* @date 2024-01-25 06:49:19
|
|
65
|
+
* @type {INoticeController}
|
|
66
|
+
*/
|
|
67
|
+
notice: INoticeController;
|
|
68
|
+
|
|
61
69
|
/**
|
|
62
70
|
* 注册模型加载适配器
|
|
63
71
|
*
|