@ibiz-template/runtime 0.1.13 → 0.1.15
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 +606 -136
- package/dist/index.system.min.js +1 -1
- package/dist/index.system.min.js.map +1 -1
- package/out/controller/common/base.controller.d.ts.map +1 -1
- package/out/controller/common/base.controller.js +2 -0
- package/out/controller/common/editor/editor.controller.d.ts +1 -1
- package/out/controller/common/editor/editor.controller.d.ts.map +1 -1
- package/out/controller/common/editor/editor.controller.js +3 -1
- package/out/controller/control/caption-bar/caption-bar.controller.js +1 -1
- package/out/controller/control/form/form-detail/form-druipart/form-druipart.controller.d.ts.map +1 -1
- package/out/controller/control/form/form-detail/form-druipart/form-druipart.controller.js +4 -2
- package/out/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.d.ts +1 -1
- package/out/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.d.ts.map +1 -1
- package/out/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.js +16 -14
- package/out/controller/control/search-bar/search-bar.controller.d.ts.map +1 -1
- package/out/controller/control/search-bar/search-bar.controller.js +1 -0
- package/out/controller/control/tree/tree.controller.d.ts.map +1 -1
- package/out/controller/control/tree/tree.controller.js +0 -1
- package/out/controller/utils/event/controller-event.d.ts +7 -0
- package/out/controller/utils/event/controller-event.d.ts.map +1 -1
- package/out/controller/utils/event/controller-event.js +17 -0
- package/out/controller/utils/index.d.ts +1 -0
- package/out/controller/utils/index.d.ts.map +1 -1
- package/out/controller/utils/index.js +1 -0
- package/out/controller/utils/value-ex/value-ex.d.ts +47 -0
- package/out/controller/utils/value-ex/value-ex.d.ts.map +1 -0
- package/out/controller/utils/value-ex/value-ex.js +48 -0
- package/out/engine/md-view.engine.d.ts.map +1 -1
- package/out/engine/md-view.engine.js +16 -5
- package/out/interface/common/i-modal/i-modal.d.ts +8 -0
- package/out/interface/common/i-modal/i-modal.d.ts.map +1 -1
- package/out/interface/controller/state/common/i-controller.state.d.ts +8 -0
- package/out/interface/controller/state/common/i-controller.state.d.ts.map +1 -1
- package/out/interface/controller/state/control/i-search-bar.state.d.ts +8 -0
- package/out/interface/controller/state/control/i-search-bar.state.d.ts.map +1 -1
- package/out/service/dto/method.dto.d.ts.map +1 -1
- package/out/service/dto/method.dto.js +3 -1
- package/out/service/service/entity/method/method.d.ts.map +1 -1
- package/out/service/service/entity/method/method.js +5 -4
- package/out/ui-action/provider/backend-ui-action-provider.d.ts.map +1 -1
- package/out/ui-action/provider/backend-ui-action-provider.js +6 -3
- package/out/ui-action/uiaction-util.d.ts.map +1 -1
- package/out/ui-action/uiaction-util.js +1 -0
- package/out/utils/handlebars/handlebars.d.ts +11 -2
- package/out/utils/handlebars/handlebars.d.ts.map +1 -1
- package/out/utils/handlebars/handlebars.js +24 -2
- package/out/utils/handlebars/helpers/and/and.d.ts +16 -0
- package/out/utils/handlebars/helpers/and/and.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/and/and.js +24 -0
- package/out/utils/handlebars/helpers/camel-case/camel-case.d.ts +16 -0
- package/out/utils/handlebars/helpers/camel-case/camel-case.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/camel-case/camel-case.js +23 -0
- package/out/utils/handlebars/helpers/concat/concat.d.ts +16 -0
- package/out/utils/handlebars/helpers/concat/concat.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/concat/concat.js +20 -0
- package/out/utils/handlebars/helpers/eq/eq.d.ts +16 -0
- package/out/utils/handlebars/helpers/eq/eq.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/eq/eq.js +22 -0
- package/out/utils/handlebars/helpers/eq-property-value/eq-property-value.d.ts +15 -0
- package/out/utils/handlebars/helpers/eq-property-value/eq-property-value.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/eq-property-value/eq-property-value.js +32 -0
- package/out/utils/handlebars/helpers/gt/gt.d.ts +16 -0
- package/out/utils/handlebars/helpers/gt/gt.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/gt/gt.js +22 -0
- package/out/utils/handlebars/helpers/gte/gte.d.ts +16 -0
- package/out/utils/handlebars/helpers/gte/gte.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/gte/gte.js +22 -0
- package/out/utils/handlebars/helpers/helper-base.d.ts +29 -0
- package/out/utils/handlebars/helpers/helper-base.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/helper-base.js +20 -0
- package/out/utils/handlebars/helpers/index.d.ts +9 -0
- package/out/utils/handlebars/helpers/index.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/index.js +45 -0
- package/out/utils/handlebars/helpers/json/json.d.ts +16 -0
- package/out/utils/handlebars/helpers/json/json.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/json/json.js +19 -0
- package/out/utils/handlebars/helpers/lower-case/lower-case.d.ts +16 -0
- package/out/utils/handlebars/helpers/lower-case/lower-case.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/lower-case/lower-case.js +22 -0
- package/out/utils/handlebars/helpers/lt/lt.d.ts +16 -0
- package/out/utils/handlebars/helpers/lt/lt.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/lt/lt.js +22 -0
- package/out/utils/handlebars/helpers/lte/lte.d.ts +16 -0
- package/out/utils/handlebars/helpers/lte/lte.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/lte/lte.js +22 -0
- package/out/utils/handlebars/helpers/neq/neq.d.ts +16 -0
- package/out/utils/handlebars/helpers/neq/neq.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/neq/neq.js +22 -0
- package/out/utils/handlebars/helpers/not/not.d.ts +16 -0
- package/out/utils/handlebars/helpers/not/not.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/not/not.js +21 -0
- package/out/utils/handlebars/helpers/or/or.d.ts +16 -0
- package/out/utils/handlebars/helpers/or/or.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/or/or.js +27 -0
- package/out/utils/handlebars/helpers/pascal-case/pascal-case.d.ts +16 -0
- package/out/utils/handlebars/helpers/pascal-case/pascal-case.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/pascal-case/pascal-case.js +23 -0
- package/out/utils/handlebars/helpers/snake-case/snake-case.d.ts +16 -0
- package/out/utils/handlebars/helpers/snake-case/snake-case.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/snake-case/snake-case.js +23 -0
- package/out/utils/handlebars/helpers/spinal-case/spinal-case.d.ts +16 -0
- package/out/utils/handlebars/helpers/spinal-case/spinal-case.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/spinal-case/spinal-case.js +23 -0
- package/out/utils/handlebars/helpers/upper-case/upper-case.d.ts +16 -0
- package/out/utils/handlebars/helpers/upper-case/upper-case.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/upper-case/upper-case.js +22 -0
- package/out/utils/handlebars/utils/helper/helper.d.ts +42 -0
- package/out/utils/handlebars/utils/helper/helper.d.ts.map +1 -0
- package/out/utils/handlebars/utils/helper/helper.js +69 -0
- package/out/utils/handlebars/utils/index.d.ts +2 -0
- package/out/utils/handlebars/utils/index.d.ts.map +1 -0
- package/out/utils/handlebars/utils/index.js +1 -0
- package/out/utils/modal/modal.d.ts +1 -0
- package/out/utils/modal/modal.d.ts.map +1 -1
- package/out/utils/modal/modal.js +5 -2
- package/package.json +3 -3
- package/src/controller/common/base.controller.ts +2 -0
- package/src/controller/common/editor/editor.controller.ts +5 -2
- package/src/controller/control/caption-bar/caption-bar.controller.ts +1 -1
- package/src/controller/control/form/form-detail/form-druipart/form-druipart.controller.ts +4 -2
- package/src/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.ts +17 -14
- package/src/controller/control/search-bar/search-bar.controller.ts +1 -0
- package/src/controller/control/tree/tree.controller.ts +0 -1
- package/src/controller/utils/event/controller-event.ts +18 -0
- package/src/controller/utils/index.ts +1 -0
- package/src/controller/utils/value-ex/value-ex.ts +83 -0
- package/src/engine/md-view.engine.ts +17 -5
- package/src/interface/common/i-modal/i-modal.ts +9 -0
- package/src/interface/controller/state/common/i-controller.state.ts +9 -0
- package/src/interface/controller/state/control/i-search-bar.state.ts +9 -0
- package/src/service/dto/method.dto.ts +3 -1
- package/src/service/service/entity/method/method.ts +11 -4
- package/src/ui-action/provider/backend-ui-action-provider.ts +6 -3
- package/src/ui-action/uiaction-util.ts +1 -0
- package/src/utils/handlebars/handlebars.ts +25 -3
- package/src/utils/handlebars/helpers/and/and.ts +26 -0
- package/src/utils/handlebars/helpers/camel-case/camel-case.ts +25 -0
- package/src/utils/handlebars/helpers/concat/concat.ts +22 -0
- package/src/utils/handlebars/helpers/eq/eq.ts +28 -0
- package/src/utils/handlebars/helpers/eq-property-value/eq-property-value.ts +41 -0
- package/src/utils/handlebars/helpers/gt/gt.ts +28 -0
- package/src/utils/handlebars/helpers/gte/gte.ts +28 -0
- package/src/utils/handlebars/helpers/helper-base.ts +31 -0
- package/src/utils/handlebars/helpers/index.ts +46 -0
- package/src/utils/handlebars/helpers/json/json.ts +25 -0
- package/src/utils/handlebars/helpers/lower-case/lower-case.ts +24 -0
- package/src/utils/handlebars/helpers/lt/lt.ts +28 -0
- package/src/utils/handlebars/helpers/lte/lte.ts +28 -0
- package/src/utils/handlebars/helpers/neq/neq.ts +28 -0
- package/src/utils/handlebars/helpers/not/not.ts +26 -0
- package/src/utils/handlebars/helpers/or/or.ts +28 -0
- package/src/utils/handlebars/helpers/pascal-case/pascal-case.ts +25 -0
- package/src/utils/handlebars/helpers/snake-case/snake-case.ts +25 -0
- package/src/utils/handlebars/helpers/spinal-case/spinal-case.ts +25 -0
- package/src/utils/handlebars/helpers/upper-case/upper-case.ts +24 -0
- package/src/utils/handlebars/utils/helper/helper.ts +75 -0
- package/src/utils/handlebars/utils/index.ts +1 -0
- package/src/utils/modal/modal.ts +6 -2
package/src/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.ts
CHANGED
|
@@ -6,7 +6,9 @@ import { clone } from 'ramda';
|
|
|
6
6
|
import { OpenAppViewCommand } from '../../../../../command';
|
|
7
7
|
import { CodeListItem, IModalData } from '../../../../../interface';
|
|
8
8
|
import { parseUserParams } from '../../../../../model';
|
|
9
|
+
import { UIActionUtil } from '../../../../../ui-action';
|
|
9
10
|
import { convertNavData, getWFContext } from '../../../../../utils';
|
|
11
|
+
import { ValueExUtil } from '../../../../utils';
|
|
10
12
|
import { GridColumnController } from '../../grid/grid-column.controller';
|
|
11
13
|
import { GridRowState } from '../../grid/grid-row.state';
|
|
12
14
|
|
|
@@ -156,20 +158,15 @@ export class GridFieldColumnController extends GridColumnController<IDEGridField
|
|
|
156
158
|
* @param {MouseEvent} event 鼠标事件
|
|
157
159
|
* @returns {*} {Promise<void>}
|
|
158
160
|
*/
|
|
159
|
-
async triggerAction(
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
// neuron: this.grid.nerve.self,
|
|
169
|
-
// view: this.grid.ctx.view,
|
|
170
|
-
// },
|
|
171
|
-
// );
|
|
172
|
-
// }
|
|
161
|
+
async triggerAction(row: GridRowState, event: MouseEvent): Promise<void> {
|
|
162
|
+
const actionId = this.model.deuiactionId;
|
|
163
|
+
await UIActionUtil.execAndResolved(actionId!, {
|
|
164
|
+
context: this.context,
|
|
165
|
+
params: this.params,
|
|
166
|
+
data: [row.data],
|
|
167
|
+
view: this.grid.view,
|
|
168
|
+
event,
|
|
169
|
+
});
|
|
173
170
|
}
|
|
174
171
|
|
|
175
172
|
/**
|
|
@@ -277,6 +274,12 @@ export class GridFieldColumnController extends GridColumnController<IDEGridField
|
|
|
277
274
|
* @return {*} {string}
|
|
278
275
|
*/
|
|
279
276
|
formatValue(value: unknown = ''): string {
|
|
277
|
+
// 根据数据类型增强转换显示文本
|
|
278
|
+
if (this.model.valueType) {
|
|
279
|
+
return ValueExUtil.toText(this.model, value);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// 根据格式化配置格式化显示
|
|
280
283
|
const strVal = `${value}`;
|
|
281
284
|
if (!this.valueFormat) {
|
|
282
285
|
return strVal;
|
|
@@ -39,6 +39,14 @@ export type EventTypeObjec<T> = {
|
|
|
39
39
|
* @template A 能力行为接口
|
|
40
40
|
*/
|
|
41
41
|
export class ControllerEvent<E extends IComponentEvent = IComponentEvent> {
|
|
42
|
+
/**
|
|
43
|
+
* 是否已经销毁
|
|
44
|
+
* @author lxm
|
|
45
|
+
* @date 2023-08-30 02:54:14
|
|
46
|
+
* @type {boolean}
|
|
47
|
+
*/
|
|
48
|
+
isDestroyed: boolean = false;
|
|
49
|
+
|
|
42
50
|
/**
|
|
43
51
|
* 事件对象
|
|
44
52
|
*
|
|
@@ -60,6 +68,9 @@ export class ControllerEvent<E extends IComponentEvent = IComponentEvent> {
|
|
|
60
68
|
name: K,
|
|
61
69
|
args: EventTypeObjec<E>[K]['emitArgs'],
|
|
62
70
|
): Promise<void> {
|
|
71
|
+
if (this.isDestroyed) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
63
74
|
// 自动补全其他事件对象参数
|
|
64
75
|
await this.evt.asyncEmit(name as string, {
|
|
65
76
|
...this.getBaseArgs(),
|
|
@@ -80,6 +91,9 @@ export class ControllerEvent<E extends IComponentEvent = IComponentEvent> {
|
|
|
80
91
|
name: K,
|
|
81
92
|
fn: (event: EventTypeObjec<E>[K]['event']) => void | Promise<void>,
|
|
82
93
|
): void {
|
|
94
|
+
if (this.isDestroyed) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
83
97
|
this.evt.on(name as string, fn);
|
|
84
98
|
}
|
|
85
99
|
|
|
@@ -92,6 +106,9 @@ export class ControllerEvent<E extends IComponentEvent = IComponentEvent> {
|
|
|
92
106
|
onAll(
|
|
93
107
|
fn: (eventName: string, event: EventBase) => void | Promise<void>,
|
|
94
108
|
): void {
|
|
109
|
+
if (this.isDestroyed) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
95
112
|
this.evt.onAll(fn as any);
|
|
96
113
|
}
|
|
97
114
|
|
|
@@ -112,5 +129,6 @@ export class ControllerEvent<E extends IComponentEvent = IComponentEvent> {
|
|
|
112
129
|
destroy(): void {
|
|
113
130
|
this.getBaseArgs = undefined as any;
|
|
114
131
|
this.evt.reset();
|
|
132
|
+
this.isDestroyed = true;
|
|
115
133
|
}
|
|
116
134
|
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { RuntimeError } from '@ibiz-template/core';
|
|
2
|
+
import { isNil, mergeLeft } from 'ramda';
|
|
3
|
+
|
|
4
|
+
export type ValueExOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* 值类型
|
|
7
|
+
*/
|
|
8
|
+
valueType?: string | 'SIMPLE' | 'SIMPLES' | 'OBJECT' | 'OBJECTS';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* 对象标识属性
|
|
12
|
+
*/
|
|
13
|
+
objectIdField?: string;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 对象名称属性(显示文本)
|
|
17
|
+
*/
|
|
18
|
+
objectNameField?: string;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 对象值属性
|
|
22
|
+
*/
|
|
23
|
+
objectValueField?: string;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 多项值分隔符
|
|
27
|
+
*/
|
|
28
|
+
valueSeparator?: string;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 多项文本分隔符
|
|
32
|
+
*/
|
|
33
|
+
textSeparator?: string;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export class ValueExUtil {
|
|
37
|
+
/**
|
|
38
|
+
* 合并默认值
|
|
39
|
+
* @author lxm
|
|
40
|
+
* @date 2023-08-30 02:06:58
|
|
41
|
+
* @static
|
|
42
|
+
* @param {ValueExOptions} options
|
|
43
|
+
* @return {*} {ValueExOptions}
|
|
44
|
+
*/
|
|
45
|
+
static mergeDefault(options: ValueExOptions): ValueExOptions {
|
|
46
|
+
return mergeLeft(options, {
|
|
47
|
+
textSeparator: ',',
|
|
48
|
+
valueSeparator: ',',
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* 转成显示用的文本
|
|
54
|
+
* @author lxm
|
|
55
|
+
* @date 2023-08-30 01:55:38
|
|
56
|
+
* @param {ValueExOptions} options
|
|
57
|
+
* @param {unknown} value
|
|
58
|
+
* @return {*} {string}
|
|
59
|
+
*/
|
|
60
|
+
static toText(options: ValueExOptions, value: unknown): string {
|
|
61
|
+
if (isNil(value) || value === '') {
|
|
62
|
+
return '';
|
|
63
|
+
}
|
|
64
|
+
const { valueType, objectNameField, textSeparator } =
|
|
65
|
+
this.mergeDefault(options);
|
|
66
|
+
if (['OBJECTS', 'OBJECT'].includes(valueType!)) {
|
|
67
|
+
if (!objectNameField) {
|
|
68
|
+
throw new RuntimeError('缺少objectNameField');
|
|
69
|
+
}
|
|
70
|
+
const textKey = objectNameField.toLowerCase();
|
|
71
|
+
if (valueType === 'OBJECTS') {
|
|
72
|
+
return (value as IData[])
|
|
73
|
+
.map(item => item[textKey] || '---')
|
|
74
|
+
.join(textSeparator);
|
|
75
|
+
}
|
|
76
|
+
return (value as IData)[textKey];
|
|
77
|
+
}
|
|
78
|
+
if (valueType === 'SIMPLES') {
|
|
79
|
+
return (value as string[]).join(textSeparator);
|
|
80
|
+
}
|
|
81
|
+
return `${value}`;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -316,11 +316,23 @@ export class MDViewEngine extends ViewEngineBase {
|
|
|
316
316
|
Object.assign(params, filteredParams);
|
|
317
317
|
}
|
|
318
318
|
// 有搜索栏的整合相关参数
|
|
319
|
-
if (this.searchBar
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
319
|
+
if (this.searchBar) {
|
|
320
|
+
// 快速搜索
|
|
321
|
+
if (this.searchBar.state.query) {
|
|
322
|
+
const addParams = {
|
|
323
|
+
query: this.searchBar.state.query,
|
|
324
|
+
};
|
|
325
|
+
Object.assign(params, addParams);
|
|
326
|
+
}
|
|
327
|
+
// 快速分组
|
|
328
|
+
if (this.searchBar.state.selectedGroupItem?.data) {
|
|
329
|
+
// eslint-disable-next-line no-new-func
|
|
330
|
+
const func = new Function(
|
|
331
|
+
`return (${this.searchBar.state.selectedGroupItem.data});`,
|
|
332
|
+
);
|
|
333
|
+
const addParams = func() as IData;
|
|
334
|
+
Object.assign(params, addParams);
|
|
335
|
+
}
|
|
324
336
|
}
|
|
325
337
|
return params;
|
|
326
338
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ISearchBarGroup } from '@ibiz/model-core';
|
|
1
2
|
import { IControlState } from './i-control.state';
|
|
2
3
|
|
|
3
4
|
export interface ISearchBarState extends IControlState {
|
|
@@ -16,4 +17,12 @@ export interface ISearchBarState extends IControlState {
|
|
|
16
17
|
* @type {boolean}
|
|
17
18
|
*/
|
|
18
19
|
visible: boolean;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 选中的分组项
|
|
23
|
+
* @author lxm
|
|
24
|
+
* @date 2023-08-25 05:32:59
|
|
25
|
+
* @type {boolean}
|
|
26
|
+
*/
|
|
27
|
+
selectedGroupItem: ISearchBarGroup | null;
|
|
19
28
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
2
|
import { HttpResponse, RuntimeModelError } from '@ibiz-template/core';
|
|
3
3
|
import { IAppDataEntity, IAppDEMethod } from '@ibiz/model-core';
|
|
4
|
+
import { notNilEmpty } from 'qx-util';
|
|
4
5
|
import { Application } from '../../../../application';
|
|
5
6
|
import { AppDataEntity } from '../../../app-data-entity/app-data-entity';
|
|
6
7
|
import { calcResPath } from '../../../utils';
|
|
@@ -121,16 +122,22 @@ export abstract class Method {
|
|
|
121
122
|
let res: HttpResponse | null = null;
|
|
122
123
|
switch (requestMethod) {
|
|
123
124
|
case 'POST':
|
|
124
|
-
res = await this.app.net.post(
|
|
125
|
+
res = await this.app.net.post(
|
|
126
|
+
`${path}/${methodName}`,
|
|
127
|
+
notNilEmpty(data) ? data : params,
|
|
128
|
+
);
|
|
125
129
|
break;
|
|
126
130
|
case 'GET':
|
|
127
|
-
res = await this.app.net.get(`${path}/${methodName}`,
|
|
131
|
+
res = await this.app.net.get(`${path}/${methodName}`, data);
|
|
128
132
|
break;
|
|
129
133
|
case 'PUT':
|
|
130
|
-
res = await this.app.net.put(
|
|
134
|
+
res = await this.app.net.put(
|
|
135
|
+
`${path}/${methodName}`,
|
|
136
|
+
notNilEmpty(data) ? data : params,
|
|
137
|
+
);
|
|
131
138
|
break;
|
|
132
139
|
case 'DELETE':
|
|
133
|
-
res = await this.app.net.delete(`${path}/${methodName}`,
|
|
140
|
+
res = await this.app.net.delete(`${path}/${methodName}`, data);
|
|
134
141
|
break;
|
|
135
142
|
default:
|
|
136
143
|
if (requestMethod) {
|
|
@@ -33,6 +33,7 @@ export class BackendUIActionProvider extends UIActionProviderBase {
|
|
|
33
33
|
data,
|
|
34
34
|
params,
|
|
35
35
|
);
|
|
36
|
+
const tempParams = { ...resultParams };
|
|
36
37
|
|
|
37
38
|
// 如果有打开视图,打开视图,并把返回的数据作为子实体数据
|
|
38
39
|
const frontPSAppView = action.frontAppViewId;
|
|
@@ -60,7 +61,9 @@ export class BackendUIActionProvider extends UIActionProviderBase {
|
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
const app = ibiz.hub.getApp(context?.srfappid);
|
|
63
|
-
const _data = resultData
|
|
64
|
+
const _data = resultData
|
|
65
|
+
.map(item => item.getOrigin?.() || item || {})
|
|
66
|
+
.map(item => Object.assign(item, tempParams)); // 界面行为视图参数和data合并一起传给后台
|
|
64
67
|
const isMultiData = ['MULTIKEY', 'MULTIDATA'].includes(
|
|
65
68
|
action.actionTarget!,
|
|
66
69
|
);
|
|
@@ -70,7 +73,7 @@ export class BackendUIActionProvider extends UIActionProviderBase {
|
|
|
70
73
|
methodName,
|
|
71
74
|
resultContext,
|
|
72
75
|
isMultiData ? _data : _data[0],
|
|
73
|
-
|
|
76
|
+
tempParams,
|
|
74
77
|
);
|
|
75
78
|
|
|
76
79
|
// 适配界面行为成功提示信息
|
|
@@ -80,7 +83,7 @@ export class BackendUIActionProvider extends UIActionProviderBase {
|
|
|
80
83
|
Object.assign(actionResult, {
|
|
81
84
|
data: isArray(res.data) ? res.data : [res.data],
|
|
82
85
|
nextContext: resultContext,
|
|
83
|
-
nextParams:
|
|
86
|
+
nextParams: tempParams,
|
|
84
87
|
});
|
|
85
88
|
|
|
86
89
|
return actionResult;
|
|
@@ -49,6 +49,7 @@ export class UIActionUtil {
|
|
|
49
49
|
): Promise<void> {
|
|
50
50
|
const result = await this.exec(actionId, params);
|
|
51
51
|
if (result.closeView) {
|
|
52
|
+
params.view.modal.ignoreDismissCheck = true;
|
|
52
53
|
params.view.closeView({ ok: true });
|
|
53
54
|
} else if (result.refresh) {
|
|
54
55
|
switch (result.refreshMode) {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { installHelpers } from './helpers';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* handlebars 渲染工具类
|
|
3
5
|
*
|
|
@@ -10,6 +12,16 @@ export class HandlebarsUtil {
|
|
|
10
12
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
13
|
protected hsb: any;
|
|
12
14
|
|
|
15
|
+
/**
|
|
16
|
+
* 如果已经在请求中,则不再重复请求
|
|
17
|
+
*
|
|
18
|
+
* @author chitanda
|
|
19
|
+
* @date 2023-08-30 11:08:58
|
|
20
|
+
* @protected
|
|
21
|
+
* @type {(Promise<unknown> | null)}
|
|
22
|
+
*/
|
|
23
|
+
protected p: Promise<unknown> | null = null;
|
|
24
|
+
|
|
13
25
|
/**
|
|
14
26
|
* handlebars 是否已经初始化
|
|
15
27
|
*
|
|
@@ -27,10 +39,20 @@ export class HandlebarsUtil {
|
|
|
27
39
|
*
|
|
28
40
|
* @author chitanda
|
|
29
41
|
* @date 2023-08-28 17:08:24
|
|
30
|
-
* @return {*} {Promise<
|
|
42
|
+
* @return {*} {Promise<unknown>}
|
|
31
43
|
*/
|
|
32
|
-
async init(): Promise<
|
|
33
|
-
this.
|
|
44
|
+
async init(): Promise<unknown> {
|
|
45
|
+
if (this.isInit) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (this.p) {
|
|
49
|
+
return this.p;
|
|
50
|
+
}
|
|
51
|
+
this.p = import('handlebars');
|
|
52
|
+
this.hsb = await this.p;
|
|
53
|
+
this.p = null;
|
|
54
|
+
installHelpers(this.hsb);
|
|
55
|
+
return this.hsb;
|
|
34
56
|
}
|
|
35
57
|
|
|
36
58
|
/**
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { HelperUtil } from '../../utils';
|
|
2
|
+
import { HelperBase } from '../helper-base';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 并且条件模式
|
|
6
|
+
*
|
|
7
|
+
* @description 判断: word wor2 word3 必须在判断中必须全部为 true, 用法: {{#and word word2 word3}}xxx{{else}}yyy{{/and}}、{{and word word2 word3}} 返回值为 boolean 类型
|
|
8
|
+
* @author chitanda
|
|
9
|
+
* @date 2021-12-29 14:12:10
|
|
10
|
+
* @export
|
|
11
|
+
* @class HelperAnd
|
|
12
|
+
* @extends {HelperBase}
|
|
13
|
+
*/
|
|
14
|
+
export class HelperAnd extends HelperBase {
|
|
15
|
+
constructor(hbs: IData) {
|
|
16
|
+
super(hbs, 'and');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
onExecute(...args: unknown[] | Handlebars.HelperOptions[]): string | boolean {
|
|
20
|
+
const options = args[args.length - 1] as Handlebars.HelperOptions;
|
|
21
|
+
args.pop();
|
|
22
|
+
const arr = (args as unknown[]).filter(item => !!item);
|
|
23
|
+
const bol = arr.length === args.length;
|
|
24
|
+
return HelperUtil.handleJudgmentExecute(this, bol, options);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { camelCase } from 'lodash-es';
|
|
2
|
+
import { HelperBase } from '../helper-base';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 转驼峰
|
|
6
|
+
*
|
|
7
|
+
* @description 用法 {{camelCase xxx}},效果: this-is-my-name => thisIsMyName
|
|
8
|
+
* @author chitanda
|
|
9
|
+
* @date 2021-12-24 15:12:59
|
|
10
|
+
* @export
|
|
11
|
+
* @class HelperCamelCase
|
|
12
|
+
* @extends {HelperBase}
|
|
13
|
+
*/
|
|
14
|
+
export class HelperCamelCase extends HelperBase {
|
|
15
|
+
constructor(hbs: IData) {
|
|
16
|
+
super(hbs, 'camelCase');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
onExecute(param: string): string {
|
|
20
|
+
if (!param) {
|
|
21
|
+
return '';
|
|
22
|
+
}
|
|
23
|
+
return camelCase(param);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { HelperBase } from '../helper-base';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 字符串拼接
|
|
5
|
+
*
|
|
6
|
+
* @description 用法:{{concat string1 string2 string3}} 返回值为 string 类型
|
|
7
|
+
* @author mosher
|
|
8
|
+
* @date 2022-10-12 10:59:10
|
|
9
|
+
* @export
|
|
10
|
+
* @class HelperConcat
|
|
11
|
+
* @extends {HelperBase}
|
|
12
|
+
*/
|
|
13
|
+
export class HelperConcat extends HelperBase {
|
|
14
|
+
constructor(hbs: IData) {
|
|
15
|
+
super(hbs, 'concat');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
onExecute(...args: string[]): string {
|
|
19
|
+
args.pop();
|
|
20
|
+
return args.join('');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { eq } from 'lodash-es';
|
|
2
|
+
import { HelperUtil } from '../../utils';
|
|
3
|
+
import { HelperBase } from '../helper-base';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 等于
|
|
7
|
+
*
|
|
8
|
+
* @description 判断: word === word2, 用法: {{#eq word word2}}xxx{{else}}yyy{{/eq}}、{{eq word 'xxx'}} 返回值为 boolean 类型
|
|
9
|
+
* @author chitanda
|
|
10
|
+
* @date 2021-12-24 14:12:25
|
|
11
|
+
* @export
|
|
12
|
+
* @class HelperEq
|
|
13
|
+
* @extends {HelperBase}
|
|
14
|
+
*/
|
|
15
|
+
export class HelperEq extends HelperBase {
|
|
16
|
+
constructor(hbs: IData) {
|
|
17
|
+
super(hbs, 'eq');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
onExecute(
|
|
21
|
+
param: unknown,
|
|
22
|
+
param2: unknown,
|
|
23
|
+
options: Handlebars.HelperOptions,
|
|
24
|
+
): string | boolean {
|
|
25
|
+
const bol = eq(param, param2);
|
|
26
|
+
return HelperUtil.handleJudgmentExecute(this, bol, options);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { eq, findIndex, isArray } from 'lodash-es';
|
|
3
|
+
import { HelperUtil } from '../../utils';
|
|
4
|
+
import { HelperBase } from '../helper-base';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 比较数组或对象是否存在某个属性的值
|
|
8
|
+
*
|
|
9
|
+
* @author zk
|
|
10
|
+
* @date 2023-06-15 09:06:37
|
|
11
|
+
* @export
|
|
12
|
+
* @class HelperHaCtrl
|
|
13
|
+
* @extends {HelperBase}
|
|
14
|
+
*/
|
|
15
|
+
export class HelperEqPropertyValue extends HelperBase {
|
|
16
|
+
constructor(hbs: IData) {
|
|
17
|
+
super(hbs, 'eqPropertyValue');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
onExecute(
|
|
21
|
+
obj: unknown[] | unknown,
|
|
22
|
+
key: string,
|
|
23
|
+
val: unknown,
|
|
24
|
+
options: Handlebars.HelperOptions,
|
|
25
|
+
): string | boolean {
|
|
26
|
+
// 数组
|
|
27
|
+
let bol = false;
|
|
28
|
+
if (isArray(obj)) {
|
|
29
|
+
bol = !eq(
|
|
30
|
+
findIndex(obj, o => eq((o as any)[key], val)),
|
|
31
|
+
-1,
|
|
32
|
+
);
|
|
33
|
+
} else {
|
|
34
|
+
bol =
|
|
35
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
36
|
+
(obj as object).hasOwnProperty(key) &&
|
|
37
|
+
(bol = eq((obj as any)[key], val));
|
|
38
|
+
}
|
|
39
|
+
return HelperUtil.handleJudgmentExecute(this, bol, options);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { gt } from 'lodash-es';
|
|
2
|
+
import { HelperUtil } from '../../utils';
|
|
3
|
+
import { HelperBase } from '../helper-base';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 大于
|
|
7
|
+
*
|
|
8
|
+
* @description 判断: word > word2, 用法: {{#gt word word2}}xxx{{else}}yyy{{/gt}}、{{gt word word2}} 返回值为 boolean 类型
|
|
9
|
+
* @author chitanda
|
|
10
|
+
* @date 2021-12-24 15:12:56
|
|
11
|
+
* @export
|
|
12
|
+
* @class HelperGt
|
|
13
|
+
* @extends {HelperBase}
|
|
14
|
+
*/
|
|
15
|
+
export class HelperGt extends HelperBase {
|
|
16
|
+
constructor(hbs: IData) {
|
|
17
|
+
super(hbs, 'gt');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
onExecute(
|
|
21
|
+
param: unknown,
|
|
22
|
+
param2: unknown,
|
|
23
|
+
options: Handlebars.HelperOptions,
|
|
24
|
+
): string | boolean {
|
|
25
|
+
const bol = gt(param, param2);
|
|
26
|
+
return HelperUtil.handleJudgmentExecute(this, bol, options);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { gte } from 'lodash-es';
|
|
2
|
+
import { HelperUtil } from '../../utils';
|
|
3
|
+
import { HelperBase } from '../helper-base';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 大于等于
|
|
7
|
+
*
|
|
8
|
+
* @description 判断: word >= word2, 用法 {{#gte word word2}}xxx{{else}}yyy{{/gte}}、{{gte word word2}} 返回值为 boolean 类型
|
|
9
|
+
* @author chitanda
|
|
10
|
+
* @date 2021-12-24 15:12:35
|
|
11
|
+
* @export
|
|
12
|
+
* @class HelperGte
|
|
13
|
+
* @extends {HelperBase}
|
|
14
|
+
*/
|
|
15
|
+
export class HelperGte extends HelperBase {
|
|
16
|
+
constructor(hbs: IData) {
|
|
17
|
+
super(hbs, 'gte');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
onExecute(
|
|
21
|
+
param: unknown,
|
|
22
|
+
param2: unknown,
|
|
23
|
+
options: Handlebars.HelperOptions,
|
|
24
|
+
): string | boolean {
|
|
25
|
+
const bol = gte(param, param2);
|
|
26
|
+
return HelperUtil.handleJudgmentExecute(this, bol, options);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* helper 基类
|
|
3
|
+
*
|
|
4
|
+
* @author chitanda
|
|
5
|
+
* @date 2021-12-29 14:12:34
|
|
6
|
+
* @export
|
|
7
|
+
* @class HelperBase
|
|
8
|
+
*/
|
|
9
|
+
export abstract class HelperBase {
|
|
10
|
+
/**
|
|
11
|
+
* Creates an instance of HelperBase.
|
|
12
|
+
*
|
|
13
|
+
* @author chitanda
|
|
14
|
+
* @date 2021-12-29 14:12:47
|
|
15
|
+
* @param {string} tag 助手标识
|
|
16
|
+
*/
|
|
17
|
+
constructor(Handlebars: IData, tag: string) {
|
|
18
|
+
Handlebars.registerHelper(tag, this.onExecute);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 助手执行
|
|
23
|
+
*
|
|
24
|
+
* @author chitanda
|
|
25
|
+
* @date 2022-08-05 18:08:03
|
|
26
|
+
* @abstract
|
|
27
|
+
* @param {...unknown[]} args
|
|
28
|
+
* @return {*} {(string | boolean)}
|
|
29
|
+
*/
|
|
30
|
+
abstract onExecute(...args: unknown[]): string | boolean;
|
|
31
|
+
}
|