@ibiz-template/runtime 0.1.18 → 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.
Files changed (74) hide show
  1. package/dist/index.esm.js +190 -118
  2. package/dist/index.system.min.js +1 -1
  3. package/dist/index.system.min.js.map +1 -1
  4. package/out/app-hub.d.ts +9 -0
  5. package/out/app-hub.d.ts.map +1 -1
  6. package/out/app-hub.js +14 -0
  7. package/out/application.d.ts.map +1 -1
  8. package/out/application.js +5 -12
  9. package/out/controller/control/dashboard/dashboard.controller.d.ts.map +1 -1
  10. package/out/controller/control/dashboard/dashboard.controller.js +3 -3
  11. package/out/controller/control/form/edit-form/edit-form.controller.d.ts.map +1 -1
  12. package/out/controller/control/form/edit-form/edit-form.controller.js +18 -6
  13. package/out/controller/control/form/form/form.controller.d.ts.map +1 -1
  14. package/out/controller/control/form/form/form.controller.js +4 -3
  15. package/out/controller/control/grid/grid/grid.controller.d.ts.map +1 -1
  16. package/out/controller/control/grid/grid/grid.controller.js +14 -9
  17. package/out/controller/control/tree/tree.controller.d.ts.map +1 -1
  18. package/out/controller/control/tree/tree.controller.js +4 -1
  19. package/out/interface/common/i-app-hub-service/i-app-hub-service.d.ts +9 -0
  20. package/out/interface/common/i-app-hub-service/i-app-hub-service.d.ts.map +1 -1
  21. package/out/interface/provider/model-loader.provider.d.ts +9 -0
  22. package/out/interface/provider/model-loader.provider.d.ts.map +1 -1
  23. package/out/service/app-data-entity/app-data-entity.d.ts +1 -0
  24. package/out/service/app-data-entity/app-data-entity.d.ts.map +1 -1
  25. package/out/service/app-data-entity/app-data-entity.js +8 -0
  26. package/out/service/dto/method.dto.d.ts +2 -1
  27. package/out/service/dto/method.dto.d.ts.map +1 -1
  28. package/out/service/dto/method.dto.js +9 -4
  29. package/out/service/service/authority/authority.service.js +1 -1
  30. package/out/service/service/entity/method/de-action.d.ts.map +1 -1
  31. package/out/service/service/entity/method/de-action.js +2 -1
  32. package/out/service/service/entity/method/fetch.d.ts.map +1 -1
  33. package/out/service/service/entity/method/fetch.js +2 -1
  34. package/out/service/service/entity/method/method-input.d.ts +6 -6
  35. package/out/service/service/entity/method/method-input.d.ts.map +1 -1
  36. package/out/service/service/entity/method/method-input.js +10 -6
  37. package/out/service/service/entity/method/method-renturn.d.ts +6 -5
  38. package/out/service/service/entity/method/method-renturn.d.ts.map +1 -1
  39. package/out/service/service/entity/method/method-renturn.js +10 -5
  40. package/out/service/service/entity/method/method.js +2 -2
  41. package/out/service/service/entity/util/util.d.ts +12 -0
  42. package/out/service/service/entity/util/util.d.ts.map +1 -0
  43. package/out/service/service/entity/util/util.js +13 -0
  44. package/out/utils/handlebars/helpers/index.d.ts.map +1 -1
  45. package/out/utils/handlebars/helpers/index.js +4 -2
  46. package/out/utils/handlebars/helpers/json/json-parse.d.ts +16 -0
  47. package/out/utils/handlebars/helpers/json/json-parse.d.ts.map +1 -0
  48. package/out/utils/handlebars/helpers/json/json-parse.js +19 -0
  49. package/out/utils/handlebars/helpers/json/{json.d.ts → json-stringify.d.ts} +3 -3
  50. package/out/utils/handlebars/helpers/json/json-stringify.d.ts.map +1 -0
  51. package/out/utils/handlebars/helpers/json/{json.js → json-stringify.js} +2 -2
  52. package/package.json +2 -2
  53. package/src/app-hub.ts +15 -0
  54. package/src/application.ts +8 -17
  55. package/src/controller/control/dashboard/dashboard.controller.ts +3 -3
  56. package/src/controller/control/form/edit-form/edit-form.controller.ts +30 -10
  57. package/src/controller/control/form/form/form.controller.ts +4 -3
  58. package/src/controller/control/grid/grid/grid.controller.ts +26 -13
  59. package/src/controller/control/tree/tree.controller.ts +7 -1
  60. package/src/interface/common/i-app-hub-service/i-app-hub-service.ts +10 -0
  61. package/src/interface/provider/model-loader.provider.ts +10 -0
  62. package/src/service/app-data-entity/app-data-entity.ts +10 -0
  63. package/src/service/dto/method.dto.ts +8 -3
  64. package/src/service/service/authority/authority.service.ts +1 -1
  65. package/src/service/service/entity/method/de-action.ts +2 -1
  66. package/src/service/service/entity/method/fetch.ts +2 -1
  67. package/src/service/service/entity/method/method-input.ts +11 -6
  68. package/src/service/service/entity/method/method-renturn.ts +11 -5
  69. package/src/service/service/entity/method/method.ts +2 -2
  70. package/src/service/service/entity/util/util.ts +17 -0
  71. package/src/utils/handlebars/helpers/index.ts +4 -2
  72. package/src/utils/handlebars/helpers/json/json-parse.ts +21 -0
  73. package/src/utils/handlebars/helpers/json/{json.ts → json-stringify.ts} +2 -2
  74. package/out/utils/handlebars/helpers/json/json.d.ts.map +0 -1
@@ -1,6 +1,7 @@
1
1
  import { MethodDto } from '../../../dto/method.dto';
2
2
  import { AppDataEntity } from '../../../app-data-entity/app-data-entity';
3
3
  import { findModelChild } from '../../../../model';
4
+ import { isLocalMode } from '../util/util';
4
5
  /**
5
6
  * 应用实体方法输出转换
6
7
  *
@@ -10,21 +11,25 @@ import { findModelChild } from '../../../../model';
10
11
  * @class MethodReturn
11
12
  */
12
13
  export class MethodReturn {
14
+ get isLocalMode() {
15
+ return isLocalMode(this.method);
16
+ }
13
17
  /**
14
18
  * Creates an instance of MethodReturn.
15
- *
16
19
  * @author chitanda
17
- * @date 2022-10-11 17:10:47
20
+ * @date 2023-09-06 16:09:45
18
21
  * @param {IAppDataEntity} entity
22
+ * @param {IAppDEMethod} method
19
23
  * @param {IAppDEMethodReturn} [output]
20
24
  */
21
- constructor(entity, output) {
25
+ constructor(entity, method) {
22
26
  this.entity = entity;
23
- this.output = output;
27
+ this.method = method;
28
+ const output = method.appDEMethodReturn;
24
29
  if (output) {
25
30
  const methodDto = findModelChild(entity.appDEMethodDTOs || [], output.appDEMethodDTOId);
26
31
  if (methodDto) {
27
- this.dto = new MethodDto(entity, methodDto);
32
+ this.dto = new MethodDto(entity, this.isLocalMode, methodDto);
28
33
  }
29
34
  }
30
35
  }
@@ -27,8 +27,8 @@ export class Method {
27
27
  this.entity = entity;
28
28
  this.method = method;
29
29
  this.app = ibiz.hub.getApp(entity.appId);
30
- this.input = new MethodInput(entity, method.appDEMethodInput);
31
- this.result = new MethodReturn(entity, method.appDEMethodReturn);
30
+ this.input = new MethodInput(entity, method);
31
+ this.result = new MethodReturn(entity, method);
32
32
  }
33
33
  /**
34
34
  * 发送请求
@@ -0,0 +1,12 @@
1
+ import { IAppDEMethod } from '@ibiz/model-core';
2
+ /**
3
+ * 是否为本地模式
4
+ *
5
+ * @author chitanda
6
+ * @date 2023-09-06 16:09:06
7
+ * @export
8
+ * @param {IAppDEMethod} method
9
+ * @return {*} {boolean}
10
+ */
11
+ export declare function isLocalMode(method: IAppDEMethod): boolean;
12
+ //# sourceMappingURL=util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../../../src/service/service/entity/util/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAE7E;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAKzD"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * 是否为本地模式
3
+ *
4
+ * @author chitanda
5
+ * @date 2023-09-06 16:09:06
6
+ * @export
7
+ * @param {IAppDEMethod} method
8
+ * @return {*} {boolean}
9
+ */
10
+ export function isLocalMode(method) {
11
+ return (method.actionType === 'BUILTIN' ||
12
+ method.dataSetType === 'DATAQUERY');
13
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/handlebars/helpers/index.ts"],"names":[],"mappings":"AAmBA;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,KAAK,GAAG,IAAI,CAmB/C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/handlebars/helpers/index.ts"],"names":[],"mappings":"AAoBA;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,KAAK,GAAG,IAAI,CAoB/C"}
@@ -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 { HelperJson } from './json/json';
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';
@@ -30,7 +31,8 @@ export function installHelpers(hsb) {
30
31
  new HelperEq(hsb);
31
32
  new HelperGt(hsb);
32
33
  new HelperGte(hsb);
33
- new HelperJson(hsb);
34
+ new HelperJsonParse(hsb);
35
+ new HelperJsonStringify(hsb);
34
36
  new HelperLowerCase(hsb);
35
37
  new HelperLt(hsb);
36
38
  new HelperLte(hsb);
@@ -0,0 +1,16 @@
1
+ import { HelperBase } from '../helper-base';
2
+ /**
3
+ * json字符创 转 对象
4
+ *
5
+ * @description 用法 {{json xxx 2}},支持第二个参数传递格式化。效果: 将 json 对象转为 json 字符串
6
+ * @author chitanda
7
+ * @date 2021-12-24 15:12:59
8
+ * @export
9
+ * @class HelperJson
10
+ * @extends {HelperBase}
11
+ */
12
+ export declare class HelperJsonParse extends HelperBase {
13
+ constructor(hbs: IData);
14
+ onExecute(obj: string): string;
15
+ }
16
+ //# sourceMappingURL=json-parse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-parse.d.ts","sourceRoot":"","sources":["../../../../../src/utils/handlebars/helpers/json/json-parse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C;;;;;;;;;GASG;AACH,qBAAa,eAAgB,SAAQ,UAAU;gBACjC,GAAG,EAAE,KAAK;IAItB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;CAG/B"}
@@ -0,0 +1,19 @@
1
+ import { HelperBase } from '../helper-base';
2
+ /**
3
+ * json字符创 转 对象
4
+ *
5
+ * @description 用法 {{json xxx 2}},支持第二个参数传递格式化。效果: 将 json 对象转为 json 字符串
6
+ * @author chitanda
7
+ * @date 2021-12-24 15:12:59
8
+ * @export
9
+ * @class HelperJson
10
+ * @extends {HelperBase}
11
+ */
12
+ export class HelperJsonParse extends HelperBase {
13
+ constructor(hbs) {
14
+ super(hbs, 'jsonParse');
15
+ }
16
+ onExecute(obj) {
17
+ return JSON.parse(obj);
18
+ }
19
+ }
@@ -6,11 +6,11 @@ import { HelperBase } from '../helper-base';
6
6
  * @author chitanda
7
7
  * @date 2021-12-24 15:12:59
8
8
  * @export
9
- * @class HelperJson
9
+ * @class HelperJsonStringify
10
10
  * @extends {HelperBase}
11
11
  */
12
- export declare class HelperJson extends HelperBase {
12
+ export declare class HelperJsonStringify extends HelperBase {
13
13
  constructor(hbs: IData);
14
14
  onExecute(obj: Record<string, unknown> | unknown[], space: number): string;
15
15
  }
16
- //# sourceMappingURL=json.d.ts.map
16
+ //# sourceMappingURL=json-stringify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json-stringify.d.ts","sourceRoot":"","sources":["../../../../../src/utils/handlebars/helpers/json/json-stringify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C;;;;;;;;;GASG;AACH,qBAAa,mBAAoB,SAAQ,UAAU;gBACrC,GAAG,EAAE,KAAK;IAItB,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;CAO3E"}
@@ -6,10 +6,10 @@ import { HelperBase } from '../helper-base';
6
6
  * @author chitanda
7
7
  * @date 2021-12-24 15:12:59
8
8
  * @export
9
- * @class HelperJson
9
+ * @class HelperJsonStringify
10
10
  * @extends {HelperBase}
11
11
  */
12
- export class HelperJson extends HelperBase {
12
+ export class HelperJsonStringify extends HelperBase {
13
13
  constructor(hbs) {
14
14
  super(hbs, 'jsonStringify');
15
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibiz-template/runtime",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "description": "控制器包",
5
5
  "type": "module",
6
6
  "main": "out/index.js",
@@ -57,5 +57,5 @@
57
57
  "qx-util": "^0.4.8",
58
58
  "ramda": "^0.29.0"
59
59
  },
60
- "gitHead": "d363fb94c05e098f5a6c928533788e7cba99f833"
60
+ "gitHead": "62b9073941f08f79c2a5ae70c9b895d1a9300c26"
61
61
  }
package/src/app-hub.ts CHANGED
@@ -204,6 +204,21 @@ export class AppHub implements IAppHubService {
204
204
  return this.view2appMap.has(id);
205
205
  }
206
206
 
207
+ /**
208
+ * 获取应用样式
209
+ *
210
+ * @author chitanda
211
+ * @date 2023-09-06 10:09:22
212
+ * @param {string} appId
213
+ * @return {*} {(Promise<string | null>)}
214
+ */
215
+ async getAppStyle(appId: string): Promise<string | null> {
216
+ if (this.modelLoaderProvider) {
217
+ return this.modelLoaderProvider.getAppStyle(appId);
218
+ }
219
+ return null;
220
+ }
221
+
207
222
  /**
208
223
  * 根据视图代码名称查找视图
209
224
  *
@@ -112,23 +112,14 @@ export class Application implements IAppService {
112
112
  * @return {*} {Promise<void>}
113
113
  */
114
114
  protected async loadAppModelStyle(): Promise<void> {
115
- await this.net
116
- .get(`${ibiz.env.remoteModelUrl}/PSSYSAPP.json.css`)
117
- .then(res => {
118
- const dom = document.createElement('style');
119
- dom.setAttribute('type', 'text/css');
120
- if (res.request && res.request.responseURL) {
121
- const url = new URL(res.request.responseURL);
122
- dom.id = url.pathname;
123
- }
124
- dom.innerHTML = res.data as unknown as string;
125
- document.head.appendChild(dom);
126
- })
127
- .catch(err => {
128
- ibiz.log.error(
129
- `应用[${this.appId}]模型全局样式加载失败:${err.message}`,
130
- );
131
- });
115
+ const style = await ibiz.hub.getAppStyle(this.appId);
116
+ if (style) {
117
+ const dom = document.createElement('style');
118
+ dom.setAttribute('type', 'text/css');
119
+ dom.id = this.appId;
120
+ dom.innerHTML = style;
121
+ document.head.appendChild(dom);
122
+ }
132
123
  }
133
124
 
134
125
  /**
@@ -1,4 +1,3 @@
1
- import { RuntimeError } from '@ibiz-template/core';
2
1
  import {
3
2
  IDashboard,
4
3
  IDBContainerPortletPart,
@@ -119,9 +118,10 @@ export class DashboardController
119
118
  return portlet.dataChangeNotify(data);
120
119
  }),
121
120
  );
122
- if (values.find(item => item.status === 'rejected')) {
121
+ const rejectedValue = values.find(item => item.status === 'rejected');
122
+ if (rejectedValue) {
123
123
  ibiz.log.error('dataChangeNotify报错', values);
124
- throw new RuntimeError('数据变更后有错误');
124
+ throw (rejectedValue as PromiseRejectedResult).reason;
125
125
  }
126
126
  }
127
127
  }
@@ -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 } = formItemUpdate;
259
+ const { appDEMethodId, defiupdateDetails, customCode, scriptCode } =
260
+ formItemUpdate;
259
261
  const updateItems = defiupdateDetails!.map(item => item.id!);
260
262
 
261
- const params = { ...this.params, ...this.data.getOrigin() };
262
- const res = await this.service.updateFormItem(
263
- appDEMethodId!,
264
- this.context,
265
- params,
266
- );
267
- const result = res.data;
268
- if (result && updateItems?.length) {
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, result[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 { RuntimeError, debounceAndAsyncMerge } from '@ibiz-template/core';
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
- if (values.find(item => item.status === 'rejected')) {
105
+ const rejectedValue = values.find(item => item.status === 'rejected');
106
+ if (rejectedValue) {
106
107
  ibiz.log.error('dataChangeNotify报错', values);
107
- throw new RuntimeError('数据变更后有错误');
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
- if (values.find(item => item.status === 'rejected')) {
673
+ const rejectedValue = values.find(item => item.status === 'rejected');
674
+ if (rejectedValue) {
674
675
  ibiz.log.error('dataChangeNotify报错', values);
675
- throw new RuntimeError('数据变更后有错误');
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
- ScriptFactory.execScriptFn({ data: row.data }, scriptCode, {
812
- isAsync: false,
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
- const result = res.data;
822
- if (result && updateItems?.length) {
823
- await Promise.all(
824
- updateItems.map(itemName => {
825
- return this.setRowValue(row, itemName, result![itemName]);
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
 
@@ -184,7 +184,13 @@ export class TreeController
184
184
 
185
185
  setSelection(selection: IData[]): void {
186
186
  // todo 当自己点选中时,父节点选不选中,如果选中需要在这边优化
187
- super.setSelection(selection);
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
  /**
@@ -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
  *
@@ -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
  }
@@ -27,6 +27,7 @@ export class MethodDto {
27
27
 
28
28
  constructor(
29
29
  protected entity: IAppDataEntity,
30
+ protected isLocalMode?: boolean,
30
31
  protected dto?: IAppDEMethodDTO,
31
32
  ) {
32
33
  if (dto) {
@@ -102,7 +103,9 @@ export class MethodDto {
102
103
  */
103
104
  async sets(context: IParams, data: IData[]): Promise<AppDataEntity[]> {
104
105
  const service = await this.app!.deService.getService(this.entity.id!);
105
- service.local.clear(context);
106
+ if (this.isLocalMode) {
107
+ service.local.clear(context);
108
+ }
106
109
  return Promise.all(
107
110
  data.map(async datum => {
108
111
  const all = this.fields
@@ -123,7 +126,9 @@ export class MethodDto {
123
126
  await all[i];
124
127
  }
125
128
  const entityData = new AppDataEntity(this.entity, datum);
126
- await service.local.add(context, entityData);
129
+ if (this.isLocalMode) {
130
+ await service.local.add(context, entityData);
131
+ }
127
132
  return entityData;
128
133
  }),
129
134
  );
@@ -150,7 +155,7 @@ export class MethodDto {
150
155
  entity.appDEMethodDTOs || [],
151
156
  field.refAppDEMethodDTOId!,
152
157
  )!;
153
- const dto = new MethodDto(entity, methodDto);
158
+ const dto = new MethodDto(entity, this.isLocalMode, methodDto);
154
159
  this.dtoMap.set(field.codeName!, dto);
155
160
  return dto;
156
161
  }
@@ -117,7 +117,7 @@ export class AuthorityService {
117
117
  */
118
118
  async init(appData = ibiz.appData): Promise<void> {
119
119
  if (!appData) {
120
- throw new RuntimeError('没有appData数据');
120
+ return;
121
121
  }
122
122
  // 设置当前用户拥有的统一标识集合
123
123
  if (appData.unires) {
@@ -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.actionType === 'BUILTIN';
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.dataSetType === 'DATAQUERY';
28
+ return isLocalMode(this.method);
28
29
  }
29
30
 
30
31
  async exec(
@@ -1,6 +1,7 @@
1
- import { IAppDataEntity, IAppDEMethodInput } from '@ibiz/model-core';
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 2022-10-11 17:10:59
24
+ * @date 2023-09-06 16:09:26
21
25
  * @param {IAppDataEntity} entity
22
- * @param {IAppDEMethodInput} [input]
26
+ * @param {IAppDEMethod} method
23
27
  */
24
28
  constructor(
25
29
  protected entity: IAppDataEntity,
26
- protected input?: IAppDEMethodInput,
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
  }