@ibiz-template/runtime 0.1.17 → 0.1.19
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 +248 -135
- package/dist/index.system.min.js +1 -1
- package/dist/index.system.min.js.map +1 -1
- package/out/app-hub.d.ts +9 -0
- package/out/app-hub.d.ts.map +1 -1
- package/out/app-hub.js +14 -0
- package/out/application.d.ts.map +1 -1
- package/out/application.js +5 -12
- package/out/controller/common/control/md-control.controller.d.ts.map +1 -1
- package/out/controller/common/control/md-control.controller.js +4 -2
- package/out/controller/common/index.d.ts +1 -0
- package/out/controller/common/index.d.ts.map +1 -1
- package/out/controller/common/index.js +1 -0
- package/out/controller/common/view/wf-step-trace-view.controller.d.ts +8 -0
- package/out/controller/common/view/wf-step-trace-view.controller.d.ts.map +1 -0
- package/out/controller/common/view/wf-step-trace-view.controller.js +20 -0
- package/out/controller/control/dashboard/dashboard.controller.d.ts.map +1 -1
- package/out/controller/control/dashboard/dashboard.controller.js +3 -3
- package/out/controller/control/exp-bar/exp-bar.controller.d.ts.map +1 -1
- package/out/controller/control/exp-bar/exp-bar.controller.js +2 -0
- 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 +18 -6
- package/out/controller/control/form/form/form.controller.d.ts.map +1 -1
- package/out/controller/control/form/form/form.controller.js +4 -3
- package/out/controller/control/grid/grid/grid.controller.d.ts.map +1 -1
- package/out/controller/control/grid/grid/grid.controller.js +14 -9
- package/out/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.js +1 -1
- package/out/controller/control/list/list.controller.d.ts.map +1 -1
- package/out/controller/control/list/list.controller.js +1 -0
- package/out/controller/control/tree/tree.controller.d.ts.map +1 -1
- package/out/controller/control/tree/tree.controller.js +4 -1
- package/out/engine/md-view.engine.d.ts +7 -0
- package/out/engine/md-view.engine.d.ts.map +1 -1
- package/out/engine/md-view.engine.js +11 -2
- package/out/interface/common/i-app-hub-service/i-app-hub-service.d.ts +9 -0
- package/out/interface/common/i-app-hub-service/i-app-hub-service.d.ts.map +1 -1
- package/out/interface/controller/state/view/i-wf-step-trace-view.state.d.ts +6 -0
- package/out/interface/controller/state/view/i-wf-step-trace-view.state.d.ts.map +1 -1
- package/out/interface/provider/model-loader.provider.d.ts +9 -0
- package/out/interface/provider/model-loader.provider.d.ts.map +1 -1
- package/out/service/app-data-entity/app-data-entity.d.ts +1 -0
- package/out/service/app-data-entity/app-data-entity.d.ts.map +1 -1
- package/out/service/app-data-entity/app-data-entity.js +8 -0
- package/out/service/dto/method.dto.d.ts +2 -1
- package/out/service/dto/method.dto.d.ts.map +1 -1
- package/out/service/dto/method.dto.js +13 -4
- package/out/service/service/authority/authority.service.js +1 -1
- package/out/service/service/entity/method/de-action.d.ts.map +1 -1
- package/out/service/service/entity/method/de-action.js +2 -1
- package/out/service/service/entity/method/fetch.d.ts.map +1 -1
- package/out/service/service/entity/method/fetch.js +2 -1
- package/out/service/service/entity/method/method-input.d.ts +6 -6
- package/out/service/service/entity/method/method-input.d.ts.map +1 -1
- package/out/service/service/entity/method/method-input.js +10 -6
- package/out/service/service/entity/method/method-renturn.d.ts +6 -5
- package/out/service/service/entity/method/method-renturn.d.ts.map +1 -1
- package/out/service/service/entity/method/method-renturn.js +10 -5
- package/out/service/service/entity/method/method.js +2 -2
- package/out/service/service/entity/util/util.d.ts +12 -0
- package/out/service/service/entity/util/util.d.ts.map +1 -0
- package/out/service/service/entity/util/util.js +13 -0
- package/out/utils/handlebars/helpers/index.d.ts.map +1 -1
- package/out/utils/handlebars/helpers/index.js +4 -2
- package/out/utils/handlebars/helpers/json/json-parse.d.ts +16 -0
- package/out/utils/handlebars/helpers/json/json-parse.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/json/json-parse.js +19 -0
- package/out/utils/handlebars/helpers/json/{json.d.ts → json-stringify.d.ts} +3 -3
- package/out/utils/handlebars/helpers/json/json-stringify.d.ts.map +1 -0
- package/out/utils/handlebars/helpers/json/{json.js → json-stringify.js} +2 -2
- package/package.json +3 -3
- package/src/app-hub.ts +15 -0
- package/src/application.ts +8 -17
- package/src/controller/common/control/md-control.controller.ts +4 -2
- package/src/controller/common/index.ts +1 -0
- package/src/controller/common/view/wf-step-trace-view.controller.ts +36 -0
- package/src/controller/control/dashboard/dashboard.controller.ts +3 -3
- package/src/controller/control/exp-bar/exp-bar.controller.ts +2 -0
- package/src/controller/control/form/edit-form/edit-form.controller.ts +30 -10
- package/src/controller/control/form/form/form.controller.ts +4 -3
- package/src/controller/control/grid/grid/grid.controller.ts +26 -13
- package/src/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.ts +1 -1
- package/src/controller/control/list/list.controller.ts +1 -0
- package/src/controller/control/tree/tree.controller.ts +7 -1
- package/src/engine/md-view.engine.ts +12 -2
- package/src/interface/common/i-app-hub-service/i-app-hub-service.ts +10 -0
- package/src/interface/controller/state/view/i-wf-step-trace-view.state.ts +8 -1
- package/src/interface/provider/model-loader.provider.ts +10 -0
- package/src/service/app-data-entity/app-data-entity.ts +10 -0
- package/src/service/dto/method.dto.ts +12 -3
- package/src/service/service/authority/authority.service.ts +1 -1
- package/src/service/service/entity/method/de-action.ts +2 -1
- package/src/service/service/entity/method/fetch.ts +2 -1
- package/src/service/service/entity/method/method-input.ts +11 -6
- package/src/service/service/entity/method/method-renturn.ts +11 -5
- package/src/service/service/entity/method/method.ts +2 -2
- package/src/service/service/entity/util/util.ts +17 -0
- package/src/utils/handlebars/helpers/index.ts +4 -2
- package/src/utils/handlebars/helpers/json/json-parse.ts +21 -0
- package/src/utils/handlebars/helpers/json/{json.ts → json-stringify.ts} +2 -2
- package/out/utils/handlebars/helpers/json/json.d.ts.map +0 -1
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
} from '../../../../interface';
|
|
15
15
|
import { hasDeCodeName } from '../../../../model';
|
|
16
16
|
import { Srfuf, ControlVO } from '../../../../service';
|
|
17
|
+
import { ScriptFactory } from '../../../../utils';
|
|
17
18
|
import { FormNotifyState } from '../../../constant';
|
|
18
19
|
import { FormController } from '../form';
|
|
19
20
|
import { EditFormService } from './edit-form.service';
|
|
@@ -255,20 +256,39 @@ export class EditFormController
|
|
|
255
256
|
throw new RuntimeError(`没找到${formItemUpdateId}表单项更新`);
|
|
256
257
|
}
|
|
257
258
|
|
|
258
|
-
const { appDEMethodId, defiupdateDetails } =
|
|
259
|
+
const { appDEMethodId, defiupdateDetails, customCode, scriptCode } =
|
|
260
|
+
formItemUpdate;
|
|
259
261
|
const updateItems = defiupdateDetails!.map(item => item.id!);
|
|
260
262
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
263
|
+
let updateData: IData; // 要修改的数据
|
|
264
|
+
if (customCode && scriptCode) {
|
|
265
|
+
// 脚本模式获取修改数据
|
|
266
|
+
updateData = ScriptFactory.execScriptFn(
|
|
267
|
+
{
|
|
268
|
+
...this.getEventArgs(),
|
|
269
|
+
data: this.data,
|
|
270
|
+
},
|
|
271
|
+
scriptCode,
|
|
272
|
+
{
|
|
273
|
+
isAsync: false,
|
|
274
|
+
},
|
|
275
|
+
) as IData;
|
|
276
|
+
} else {
|
|
277
|
+
// 后台服务获取修改数据
|
|
278
|
+
const params = { ...this.params, ...this.data.getOrigin() };
|
|
279
|
+
const res = await this.service.updateFormItem(
|
|
280
|
+
appDEMethodId!,
|
|
281
|
+
this.context,
|
|
282
|
+
params,
|
|
283
|
+
);
|
|
284
|
+
updateData = res.data;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// 修改表单项更新的值
|
|
288
|
+
if (updateData && updateItems?.length) {
|
|
269
289
|
await Promise.all(
|
|
270
290
|
updateItems.map(itemName =>
|
|
271
|
-
this.setDataValue(itemName,
|
|
291
|
+
this.setDataValue(itemName, updateData[itemName]),
|
|
272
292
|
),
|
|
273
293
|
);
|
|
274
294
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-param-reassign */
|
|
2
|
-
import {
|
|
2
|
+
import { debounceAndAsyncMerge } from '@ibiz-template/core';
|
|
3
3
|
import { IDEForm, IDEFormDetail } from '@ibiz/model-core';
|
|
4
4
|
import {
|
|
5
5
|
IFormState,
|
|
@@ -102,9 +102,10 @@ export abstract class FormController<
|
|
|
102
102
|
return detail.dataChangeNotify(names);
|
|
103
103
|
}),
|
|
104
104
|
);
|
|
105
|
-
|
|
105
|
+
const rejectedValue = values.find(item => item.status === 'rejected');
|
|
106
|
+
if (rejectedValue) {
|
|
106
107
|
ibiz.log.error('dataChangeNotify报错', values);
|
|
107
|
-
throw
|
|
108
|
+
throw (rejectedValue as PromiseRejectedResult).reason;
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
111
|
|
|
@@ -670,9 +670,10 @@ export class GridController
|
|
|
670
670
|
return column.dataChangeNotify(row, names);
|
|
671
671
|
}),
|
|
672
672
|
);
|
|
673
|
-
|
|
673
|
+
const rejectedValue = values.find(item => item.status === 'rejected');
|
|
674
|
+
if (rejectedValue) {
|
|
674
675
|
ibiz.log.error('dataChangeNotify报错', values);
|
|
675
|
-
throw
|
|
676
|
+
throw (rejectedValue as PromiseRejectedResult).reason;
|
|
676
677
|
}
|
|
677
678
|
}
|
|
678
679
|
|
|
@@ -807,25 +808,37 @@ export class GridController
|
|
|
807
808
|
const { appDEMethodId, degeiupdateDetails, customCode, scriptCode } =
|
|
808
809
|
findUpdate;
|
|
809
810
|
const updateItems = degeiupdateDetails!.map(item => item.id!);
|
|
811
|
+
|
|
812
|
+
let updateData: IData; // 要修改的数据
|
|
810
813
|
if (customCode && scriptCode) {
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
+
// 脚本模式获取修改数据
|
|
815
|
+
updateData = ScriptFactory.execScriptFn(
|
|
816
|
+
{
|
|
817
|
+
...this.getEventArgs(),
|
|
818
|
+
data: row.data,
|
|
819
|
+
},
|
|
820
|
+
scriptCode,
|
|
821
|
+
{
|
|
822
|
+
isAsync: false,
|
|
823
|
+
},
|
|
824
|
+
) as IData;
|
|
814
825
|
} else {
|
|
826
|
+
// 后台服务获取修改数据
|
|
815
827
|
const params = { ...this.params, ...row.data.getOrigin() };
|
|
816
828
|
const res = await this.service.updateGridEditItem(
|
|
817
829
|
appDEMethodId!,
|
|
818
830
|
this.context,
|
|
819
831
|
params,
|
|
820
832
|
);
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
833
|
+
updateData = res.data;
|
|
834
|
+
}
|
|
835
|
+
// 修改更新的值
|
|
836
|
+
if (updateData && updateItems?.length) {
|
|
837
|
+
await Promise.all(
|
|
838
|
+
updateItems.map(itemName => {
|
|
839
|
+
return this.setRowValue(row, itemName, updateData![itemName]);
|
|
840
|
+
}),
|
|
841
|
+
);
|
|
829
842
|
}
|
|
830
843
|
}
|
|
831
844
|
|
package/src/controller/control/grid/grid-column/grid-field-column/grid-field-column.controller.ts
CHANGED
|
@@ -279,7 +279,7 @@ export class GridFieldColumnController extends GridColumnController<IDEGridField
|
|
|
279
279
|
*/
|
|
280
280
|
formatValue(value: unknown = ''): string {
|
|
281
281
|
// 根据数据类型增强转换显示文本
|
|
282
|
-
if (this.model.valueType) {
|
|
282
|
+
if (this.model.valueType !== 'SIMPLE') {
|
|
283
283
|
return ValueExUtil.toText(this.model, value);
|
|
284
284
|
}
|
|
285
285
|
|
|
@@ -184,7 +184,13 @@ export class TreeController
|
|
|
184
184
|
|
|
185
185
|
setSelection(selection: IData[]): void {
|
|
186
186
|
// todo 当自己点选中时,父节点选不选中,如果选中需要在这边优化
|
|
187
|
-
|
|
187
|
+
|
|
188
|
+
// 通过id过滤出原始的树节点数据,避免外部使用的时候传入的选中数据有问题。
|
|
189
|
+
const selectionIds = selection.map(item => item.id);
|
|
190
|
+
const filterArr = this.state.items.filter(item =>
|
|
191
|
+
selectionIds.includes(item.id),
|
|
192
|
+
);
|
|
193
|
+
super.setSelection(filterArr);
|
|
188
194
|
}
|
|
189
195
|
|
|
190
196
|
/**
|
|
@@ -117,14 +117,14 @@ export class MDViewEngine extends ViewEngineBase {
|
|
|
117
117
|
// 搜索表单搜索触发加载
|
|
118
118
|
if (this.searchForm) {
|
|
119
119
|
this.searchForm.evt.on('onSearch', () => {
|
|
120
|
-
this.
|
|
120
|
+
this.reLoad();
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
// 搜索栏搜索触发加载
|
|
125
125
|
if (this.searchBar) {
|
|
126
126
|
this.searchBar.evt.on('onSearch', () => {
|
|
127
|
-
this.
|
|
127
|
+
this.reLoad();
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
130
|
|
|
@@ -304,6 +304,16 @@ export class MDViewEngine extends ViewEngineBase {
|
|
|
304
304
|
await this.xdataControl.refresh();
|
|
305
305
|
}
|
|
306
306
|
|
|
307
|
+
/**
|
|
308
|
+
* 视图重新加载
|
|
309
|
+
* @author lxm
|
|
310
|
+
* @date 2023-05-22 03:17:33
|
|
311
|
+
* @return {*} {Promise<void>}
|
|
312
|
+
*/
|
|
313
|
+
protected async reLoad(): Promise<void> {
|
|
314
|
+
await this.xdataControl.load({ isInitialLoad: true });
|
|
315
|
+
}
|
|
316
|
+
|
|
307
317
|
/**
|
|
308
318
|
* 获取搜索相关的查询参数
|
|
309
319
|
* @author lxm
|
|
@@ -105,6 +105,16 @@ export interface IAppHubService {
|
|
|
105
105
|
*/
|
|
106
106
|
hasAppView(tag: string): boolean;
|
|
107
107
|
|
|
108
|
+
/**
|
|
109
|
+
* 获取应用模型样式内容
|
|
110
|
+
*
|
|
111
|
+
* @author chitanda
|
|
112
|
+
* @date 2023-09-06 10:09:07
|
|
113
|
+
* @param {string} appId
|
|
114
|
+
* @return {*} {(Promise<string | null>)}
|
|
115
|
+
*/
|
|
116
|
+
getAppStyle(appId: string): Promise<string | null>;
|
|
117
|
+
|
|
108
118
|
/**
|
|
109
119
|
* 根据应用视图 codeName 或 id 获取应用视图模型
|
|
110
120
|
*
|
|
@@ -7,4 +7,11 @@ import { IViewState } from './i-view.state';
|
|
|
7
7
|
* @class IWFDynaActionViewState
|
|
8
8
|
* @extends {IViewState}
|
|
9
9
|
*/
|
|
10
|
-
export interface IWFStepTraceViewState extends IViewState {
|
|
10
|
+
export interface IWFStepTraceViewState extends IViewState {
|
|
11
|
+
/**
|
|
12
|
+
* 工作流历史数据
|
|
13
|
+
* @return {*}
|
|
14
|
+
* @author: zhujiamin
|
|
15
|
+
*/
|
|
16
|
+
historyData: IData | null;
|
|
17
|
+
}
|
|
@@ -52,4 +52,14 @@ export interface ModelLoaderProvider {
|
|
|
52
52
|
appId: string,
|
|
53
53
|
codeName: string,
|
|
54
54
|
): Promise<IAppDataEntity>;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* 获取应用样式表
|
|
58
|
+
*
|
|
59
|
+
* @author chitanda
|
|
60
|
+
* @date 2023-09-06 10:09:14
|
|
61
|
+
* @param {string} appId
|
|
62
|
+
* @return {*} {(Promise<string | null>)}
|
|
63
|
+
*/
|
|
64
|
+
getAppStyle(appId: string): Promise<string | null>;
|
|
55
65
|
}
|
|
@@ -32,6 +32,8 @@ export class AppDataEntity implements IDataEntity {
|
|
|
32
32
|
|
|
33
33
|
declare srfkey: string;
|
|
34
34
|
|
|
35
|
+
declare srfsourcekey: string;
|
|
36
|
+
|
|
35
37
|
declare srfmajortext: string;
|
|
36
38
|
|
|
37
39
|
get srfuf(): Srfuf {
|
|
@@ -87,6 +89,14 @@ export class AppDataEntity implements IDataEntity {
|
|
|
87
89
|
return this._data[key] || _srfkey;
|
|
88
90
|
},
|
|
89
91
|
});
|
|
92
|
+
Object.defineProperty(this, 'srfsourcekey', {
|
|
93
|
+
set(val: unknown) {
|
|
94
|
+
this._data[key] = val;
|
|
95
|
+
},
|
|
96
|
+
get() {
|
|
97
|
+
return this._data[key];
|
|
98
|
+
},
|
|
99
|
+
});
|
|
90
100
|
} else {
|
|
91
101
|
ibiz.log.warn(`实体[${entity.codeName}]未配置主键字段`);
|
|
92
102
|
}
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
IAppDEMethodDTOField,
|
|
6
6
|
} from '@ibiz/model-core';
|
|
7
7
|
import { ModelError } from '@ibiz-template/core';
|
|
8
|
+
import { notNilEmpty } from 'qx-util';
|
|
8
9
|
import { Application } from '../../application';
|
|
9
10
|
import { AppDataEntity } from '../app-data-entity/app-data-entity';
|
|
10
11
|
import { findModelChild } from '../../model';
|
|
@@ -26,6 +27,7 @@ export class MethodDto {
|
|
|
26
27
|
|
|
27
28
|
constructor(
|
|
28
29
|
protected entity: IAppDataEntity,
|
|
30
|
+
protected isLocalMode?: boolean,
|
|
29
31
|
protected dto?: IAppDEMethodDTO,
|
|
30
32
|
) {
|
|
31
33
|
if (dto) {
|
|
@@ -56,6 +58,9 @@ export class MethodDto {
|
|
|
56
58
|
break;
|
|
57
59
|
}
|
|
58
60
|
case 'DTOS': {
|
|
61
|
+
if (notNilEmpty(data[key])) {
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
59
64
|
// 没有实体id的不处理
|
|
60
65
|
if (!field.refAppDataEntityId) {
|
|
61
66
|
break;
|
|
@@ -98,7 +103,9 @@ export class MethodDto {
|
|
|
98
103
|
*/
|
|
99
104
|
async sets(context: IParams, data: IData[]): Promise<AppDataEntity[]> {
|
|
100
105
|
const service = await this.app!.deService.getService(this.entity.id!);
|
|
101
|
-
|
|
106
|
+
if (this.isLocalMode) {
|
|
107
|
+
service.local.clear(context);
|
|
108
|
+
}
|
|
102
109
|
return Promise.all(
|
|
103
110
|
data.map(async datum => {
|
|
104
111
|
const all = this.fields
|
|
@@ -119,7 +126,9 @@ export class MethodDto {
|
|
|
119
126
|
await all[i];
|
|
120
127
|
}
|
|
121
128
|
const entityData = new AppDataEntity(this.entity, datum);
|
|
122
|
-
|
|
129
|
+
if (this.isLocalMode) {
|
|
130
|
+
await service.local.add(context, entityData);
|
|
131
|
+
}
|
|
123
132
|
return entityData;
|
|
124
133
|
}),
|
|
125
134
|
);
|
|
@@ -146,7 +155,7 @@ export class MethodDto {
|
|
|
146
155
|
entity.appDEMethodDTOs || [],
|
|
147
156
|
field.refAppDEMethodDTOId!,
|
|
148
157
|
)!;
|
|
149
|
-
const dto = new MethodDto(entity, methodDto);
|
|
158
|
+
const dto = new MethodDto(entity, this.isLocalMode, methodDto);
|
|
150
159
|
this.dtoMap.set(field.codeName!, dto);
|
|
151
160
|
return dto;
|
|
152
161
|
}
|
|
@@ -8,6 +8,7 @@ import { Method } from './method';
|
|
|
8
8
|
import { IDataEntity } from '../../../../interface';
|
|
9
9
|
import { findDELogic } from '../../../../model';
|
|
10
10
|
import { execDELogicAction, execFieldLogics } from '../../../../de-logic';
|
|
11
|
+
import { isLocalMode } from '../util/util';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* 实体行为方法
|
|
@@ -31,7 +32,7 @@ export class DEActionMethod extends Method {
|
|
|
31
32
|
* @type {boolean}
|
|
32
33
|
*/
|
|
33
34
|
protected get isLocalMode(): boolean {
|
|
34
|
-
return this.method
|
|
35
|
+
return isLocalMode(this.method);
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
async exec(
|
|
@@ -10,6 +10,7 @@ import { PSDEDQCondEngine, SearchFilter } from '../../../utils';
|
|
|
10
10
|
import { Method } from './method';
|
|
11
11
|
import { IDataEntity } from '../../../../interface';
|
|
12
12
|
import { execFieldLogics } from '../../../../de-logic';
|
|
13
|
+
import { isLocalMode } from '../util/util';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* 数据集请求
|
|
@@ -24,7 +25,7 @@ export class FetchMethod extends Method {
|
|
|
24
25
|
declare method: IAppDEDataSet;
|
|
25
26
|
|
|
26
27
|
protected get isLocalMode(): boolean {
|
|
27
|
-
return this.method
|
|
28
|
+
return isLocalMode(this.method);
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
async exec(
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { IAppDataEntity,
|
|
1
|
+
import { IAppDataEntity, IAppDEMethod } from '@ibiz/model-core';
|
|
2
2
|
import { MethodDto } from '../../../dto/method.dto';
|
|
3
3
|
import { findModelChild } from '../../../../model';
|
|
4
|
+
import { isLocalMode } from '../util/util';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* 应用实体方法输入转换
|
|
@@ -13,25 +14,29 @@ import { findModelChild } from '../../../../model';
|
|
|
13
14
|
export class MethodInput {
|
|
14
15
|
protected dto?: MethodDto;
|
|
15
16
|
|
|
17
|
+
protected get isLocalMode(): boolean {
|
|
18
|
+
return isLocalMode(this.method);
|
|
19
|
+
}
|
|
20
|
+
|
|
16
21
|
/**
|
|
17
22
|
* Creates an instance of MethodInput.
|
|
18
|
-
*
|
|
19
23
|
* @author chitanda
|
|
20
|
-
* @date
|
|
24
|
+
* @date 2023-09-06 16:09:26
|
|
21
25
|
* @param {IAppDataEntity} entity
|
|
22
|
-
* @param {
|
|
26
|
+
* @param {IAppDEMethod} method
|
|
23
27
|
*/
|
|
24
28
|
constructor(
|
|
25
29
|
protected entity: IAppDataEntity,
|
|
26
|
-
protected
|
|
30
|
+
protected method: IAppDEMethod,
|
|
27
31
|
) {
|
|
32
|
+
const input = method.appDEMethodInput;
|
|
28
33
|
if (input) {
|
|
29
34
|
const methodDto = findModelChild(
|
|
30
35
|
entity.appDEMethodDTOs || [],
|
|
31
36
|
input.appDEMethodDTOId!,
|
|
32
37
|
);
|
|
33
38
|
if (methodDto) {
|
|
34
|
-
this.dto = new MethodDto(entity, methodDto);
|
|
39
|
+
this.dto = new MethodDto(entity, this.isLocalMode, methodDto);
|
|
35
40
|
}
|
|
36
41
|
}
|
|
37
42
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { IAppDataEntity,
|
|
1
|
+
import { IAppDataEntity, IAppDEMethod } from '@ibiz/model-core';
|
|
2
2
|
import { MethodDto } from '../../../dto/method.dto';
|
|
3
3
|
import { AppDataEntity } from '../../../app-data-entity/app-data-entity';
|
|
4
4
|
import { findModelChild } from '../../../../model';
|
|
5
5
|
import { IDataEntity } from '../../../../interface';
|
|
6
|
+
import { isLocalMode } from '../util/util';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* 应用实体方法输出转换
|
|
@@ -15,25 +16,30 @@ import { IDataEntity } from '../../../../interface';
|
|
|
15
16
|
export class MethodReturn {
|
|
16
17
|
protected dto?: MethodDto;
|
|
17
18
|
|
|
19
|
+
protected get isLocalMode(): boolean {
|
|
20
|
+
return isLocalMode(this.method);
|
|
21
|
+
}
|
|
22
|
+
|
|
18
23
|
/**
|
|
19
24
|
* Creates an instance of MethodReturn.
|
|
20
|
-
*
|
|
21
25
|
* @author chitanda
|
|
22
|
-
* @date
|
|
26
|
+
* @date 2023-09-06 16:09:45
|
|
23
27
|
* @param {IAppDataEntity} entity
|
|
28
|
+
* @param {IAppDEMethod} method
|
|
24
29
|
* @param {IAppDEMethodReturn} [output]
|
|
25
30
|
*/
|
|
26
31
|
constructor(
|
|
27
32
|
protected entity: IAppDataEntity,
|
|
28
|
-
protected
|
|
33
|
+
protected method: IAppDEMethod,
|
|
29
34
|
) {
|
|
35
|
+
const output = method.appDEMethodReturn;
|
|
30
36
|
if (output) {
|
|
31
37
|
const methodDto = findModelChild(
|
|
32
38
|
entity.appDEMethodDTOs || [],
|
|
33
39
|
output.appDEMethodDTOId!,
|
|
34
40
|
);
|
|
35
41
|
if (methodDto) {
|
|
36
|
-
this.dto = new MethodDto(entity, methodDto);
|
|
42
|
+
this.dto = new MethodDto(entity, this.isLocalMode, methodDto);
|
|
37
43
|
}
|
|
38
44
|
}
|
|
39
45
|
}
|
|
@@ -64,8 +64,8 @@ export abstract class Method {
|
|
|
64
64
|
protected method: IAppDEMethod,
|
|
65
65
|
) {
|
|
66
66
|
this.app = ibiz.hub.getApp(entity.appId);
|
|
67
|
-
this.input = new MethodInput(entity, method
|
|
68
|
-
this.result = new MethodReturn(entity, method
|
|
67
|
+
this.input = new MethodInput(entity, method);
|
|
68
|
+
this.result = new MethodReturn(entity, method);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
/**
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IAppDEAction, IAppDEDataSet, IAppDEMethod } from '@ibiz/model-core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 是否为本地模式
|
|
5
|
+
*
|
|
6
|
+
* @author chitanda
|
|
7
|
+
* @date 2023-09-06 16:09:06
|
|
8
|
+
* @export
|
|
9
|
+
* @param {IAppDEMethod} method
|
|
10
|
+
* @return {*} {boolean}
|
|
11
|
+
*/
|
|
12
|
+
export function isLocalMode(method: IAppDEMethod): boolean {
|
|
13
|
+
return (
|
|
14
|
+
(method as IAppDEAction).actionType === 'BUILTIN' ||
|
|
15
|
+
(method as IAppDEDataSet).dataSetType === 'DATAQUERY'
|
|
16
|
+
);
|
|
17
|
+
}
|
|
@@ -5,7 +5,8 @@ import { HelperEq } from './eq/eq';
|
|
|
5
5
|
import { HelperGt } from './gt/gt';
|
|
6
6
|
import { HelperGte } from './gte/gte';
|
|
7
7
|
import { HelperEqPropertyValue } from './eq-property-value/eq-property-value';
|
|
8
|
-
import {
|
|
8
|
+
import { HelperJsonParse } from './json/json-parse';
|
|
9
|
+
import { HelperJsonStringify } from './json/json-stringify';
|
|
9
10
|
import { HelperLowerCase } from './lower-case/lower-case';
|
|
10
11
|
import { HelperLt } from './lt/lt';
|
|
11
12
|
import { HelperLte } from './lte/lte';
|
|
@@ -31,7 +32,8 @@ export function installHelpers(hsb: IData): void {
|
|
|
31
32
|
new HelperEq(hsb);
|
|
32
33
|
new HelperGt(hsb);
|
|
33
34
|
new HelperGte(hsb);
|
|
34
|
-
new
|
|
35
|
+
new HelperJsonParse(hsb);
|
|
36
|
+
new HelperJsonStringify(hsb);
|
|
35
37
|
new HelperLowerCase(hsb);
|
|
36
38
|
new HelperLt(hsb);
|
|
37
39
|
new HelperLte(hsb);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { HelperBase } from '../helper-base';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* json字符创 转 对象
|
|
5
|
+
*
|
|
6
|
+
* @description 用法 {{json xxx 2}},支持第二个参数传递格式化。效果: 将 json 对象转为 json 字符串
|
|
7
|
+
* @author chitanda
|
|
8
|
+
* @date 2021-12-24 15:12:59
|
|
9
|
+
* @export
|
|
10
|
+
* @class HelperJson
|
|
11
|
+
* @extends {HelperBase}
|
|
12
|
+
*/
|
|
13
|
+
export class HelperJsonParse extends HelperBase {
|
|
14
|
+
constructor(hbs: IData) {
|
|
15
|
+
super(hbs, 'jsonParse');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
onExecute(obj: string): string {
|
|
19
|
+
return JSON.parse(obj);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -7,10 +7,10 @@ import { HelperBase } from '../helper-base';
|
|
|
7
7
|
* @author chitanda
|
|
8
8
|
* @date 2021-12-24 15:12:59
|
|
9
9
|
* @export
|
|
10
|
-
* @class
|
|
10
|
+
* @class HelperJsonStringify
|
|
11
11
|
* @extends {HelperBase}
|
|
12
12
|
*/
|
|
13
|
-
export class
|
|
13
|
+
export class HelperJsonStringify extends HelperBase {
|
|
14
14
|
constructor(hbs: IData) {
|
|
15
15
|
super(hbs, 'jsonStringify');
|
|
16
16
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../../../../src/utils/handlebars/helpers/json/json.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C;;;;;;;;;GASG;AACH,qBAAa,UAAW,SAAQ,UAAU;gBAC5B,GAAG,EAAE,KAAK;IAItB,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;CAO3E"}
|