@ibiz-template/runtime 0.0.1-beta.17 → 0.0.2-beta.1

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 (212) hide show
  1. package/dist/system/index.system.js +1 -1
  2. package/out/application.d.ts +55 -0
  3. package/out/application.d.ts.map +1 -0
  4. package/out/application.js +35 -0
  5. package/out/constant/index.d.ts +1 -1
  6. package/out/constant/index.d.ts.map +1 -1
  7. package/out/constant/index.js +1 -1
  8. package/out/controller/control/app-menu.d.ts +5 -3
  9. package/out/controller/control/app-menu.d.ts.map +1 -1
  10. package/out/controller/control/app-menu.js +10 -6
  11. package/out/controller/control/grid/grid-column.d.ts +3 -1
  12. package/out/controller/control/grid/grid-column.d.ts.map +1 -1
  13. package/out/controller/control/grid/grid-column.js +1 -0
  14. package/out/controller/control/grid/grid-field-column.js +1 -1
  15. package/out/controller/control/index.d.ts +1 -0
  16. package/out/controller/control/index.d.ts.map +1 -1
  17. package/out/controller/control/index.js +1 -0
  18. package/out/controller/control/tree.d.ts +34 -0
  19. package/out/controller/control/tree.d.ts.map +1 -0
  20. package/out/controller/control/tree.js +32 -0
  21. package/out/controller/editor/code-list-editor.js +1 -1
  22. package/out/controller/editor/editor.d.ts +9 -0
  23. package/out/controller/editor/editor.d.ts.map +1 -1
  24. package/out/controller/editor/editor.js +1 -0
  25. package/out/controller/editor/picker.js +1 -1
  26. package/out/controller/editor/upload.js +1 -1
  27. package/out/controller/interface/ability/control/i-tree-ability.d.ts +12 -0
  28. package/out/controller/interface/ability/control/i-tree-ability.d.ts.map +1 -0
  29. package/out/controller/interface/ability/control/i-tree-ability.js +1 -0
  30. package/out/controller/interface/ability/control/index.d.ts +1 -0
  31. package/out/controller/interface/ability/control/index.d.ts.map +1 -1
  32. package/out/controller/interface/ability/control/index.js +1 -0
  33. package/out/controller/interface/ability/view/i-tree-exp-view-ability.d.ts +12 -0
  34. package/out/controller/interface/ability/view/i-tree-exp-view-ability.d.ts.map +1 -0
  35. package/out/controller/interface/ability/view/i-tree-exp-view-ability.js +1 -0
  36. package/out/controller/interface/ability/view/index.d.ts +1 -0
  37. package/out/controller/interface/ability/view/index.d.ts.map +1 -1
  38. package/out/controller/interface/ability/view/index.js +1 -0
  39. package/out/controller/interface/event/control/i-tree-event.d.ts +11 -0
  40. package/out/controller/interface/event/control/i-tree-event.d.ts.map +1 -0
  41. package/out/controller/interface/event/control/i-tree-event.js +1 -0
  42. package/out/controller/interface/event/control/index.d.ts +1 -0
  43. package/out/controller/interface/event/control/index.d.ts.map +1 -1
  44. package/out/controller/interface/event/control/index.js +1 -0
  45. package/out/controller/interface/event/view/i-tree-exp-view-event.d.ts +12 -0
  46. package/out/controller/interface/event/view/i-tree-exp-view-event.d.ts.map +1 -0
  47. package/out/controller/interface/event/view/i-tree-exp-view-event.js +1 -0
  48. package/out/controller/interface/event/view/index.d.ts +1 -0
  49. package/out/controller/interface/event/view/index.d.ts.map +1 -1
  50. package/out/controller/interface/event/view/index.js +1 -0
  51. package/out/controller/interface/provider/i-control-provider.d.ts +1 -1
  52. package/out/controller/interface/provider/i-editor-provider.d.ts +2 -2
  53. package/out/controller/interface/provider/i-editor-provider.d.ts.map +1 -1
  54. package/out/controller/interface/provider/i-form-detail-provider.d.ts +1 -1
  55. package/out/controller/interface/provider/i-form-detail-provider.d.ts.map +1 -1
  56. package/out/controller/interface/provider/i-grid-column-provider.d.ts +1 -1
  57. package/out/controller/interface/provider/i-grid-column-provider.d.ts.map +1 -1
  58. package/out/controller/interface/provider/i-portlet-part-provider.d.ts +1 -1
  59. package/out/controller/interface/provider/i-view-provider.d.ts +1 -1
  60. package/out/controller/neuron/nerve/control/index.d.ts +1 -0
  61. package/out/controller/neuron/nerve/control/index.d.ts.map +1 -1
  62. package/out/controller/neuron/nerve/control/index.js +1 -0
  63. package/out/controller/neuron/nerve/control/tree-nerve.d.ts +16 -0
  64. package/out/controller/neuron/nerve/control/tree-nerve.d.ts.map +1 -0
  65. package/out/controller/neuron/nerve/control/tree-nerve.js +16 -0
  66. package/out/controller/neuron/nerve/view/index.d.ts +1 -0
  67. package/out/controller/neuron/nerve/view/index.d.ts.map +1 -1
  68. package/out/controller/neuron/nerve/view/index.js +1 -0
  69. package/out/controller/neuron/nerve/view/tree-exp-view-nerve.d.ts +19 -0
  70. package/out/controller/neuron/nerve/view/tree-exp-view-nerve.d.ts.map +1 -0
  71. package/out/controller/neuron/nerve/view/tree-exp-view-nerve.js +28 -0
  72. package/out/controller/neuron/neuron/view.d.ts +4 -2
  73. package/out/controller/neuron/neuron/view.d.ts.map +1 -1
  74. package/out/controller/neuron/neuron/view.js +3 -0
  75. package/out/controller/neuron/neuron/widget.d.ts +4 -2
  76. package/out/controller/neuron/neuron/widget.d.ts.map +1 -1
  77. package/out/controller/neuron/neuron/widget.js +2 -0
  78. package/out/controller/utils/button-state/button-state.d.ts +2 -0
  79. package/out/controller/utils/button-state/button-state.d.ts.map +1 -1
  80. package/out/controller/utils/button-state/button-state.js +2 -1
  81. package/out/controller/view/edit-view.js +1 -1
  82. package/out/controller/view/index.d.ts +1 -0
  83. package/out/controller/view/index.d.ts.map +1 -1
  84. package/out/controller/view/index.js +1 -0
  85. package/out/controller/view/tree-exp-view.d.ts +25 -0
  86. package/out/controller/view/tree-exp-view.d.ts.map +1 -0
  87. package/out/controller/view/tree-exp-view.js +41 -0
  88. package/out/controller/view/view.d.ts +9 -0
  89. package/out/controller/view/view.d.ts.map +1 -1
  90. package/out/controller/view/view.js +3 -2
  91. package/out/controller/view/wf-step-trace-view.js +1 -1
  92. package/out/install.d.ts.map +1 -1
  93. package/out/install.js +6 -7
  94. package/out/interface/i-plugin-factory/i-plugin-factory.d.ts +1 -1
  95. package/out/model.d.ts +88 -0
  96. package/out/model.d.ts.map +1 -0
  97. package/out/model.js +166 -0
  98. package/out/runtime-hub.d.ts +35 -0
  99. package/out/runtime-hub.d.ts.map +1 -0
  100. package/out/runtime-hub.js +66 -0
  101. package/out/service/authority/authority.service.d.ts +4 -1
  102. package/out/service/authority/authority.service.d.ts.map +1 -1
  103. package/out/service/authority/authority.service.js +7 -3
  104. package/out/service/dto/method.dto.d.ts +2 -0
  105. package/out/service/dto/method.dto.d.ts.map +1 -1
  106. package/out/service/dto/method.dto.js +9 -3
  107. package/out/service/index.d.ts +1 -0
  108. package/out/service/index.d.ts.map +1 -1
  109. package/out/service/index.js +1 -0
  110. package/out/service/service/code-list/code-list.service.d.ts +4 -3
  111. package/out/service/service/code-list/code-list.service.d.ts.map +1 -1
  112. package/out/service/service/code-list/code-list.service.js +5 -7
  113. package/out/service/service/entity/method/de-action.js +5 -5
  114. package/out/service/service/entity/method/method-renturn.d.ts +2 -0
  115. package/out/service/service/entity/method/method-renturn.d.ts.map +1 -1
  116. package/out/service/service/entity/method/method-renturn.js +2 -1
  117. package/out/service/service/entity/method/method.d.ts +2 -0
  118. package/out/service/service/entity/method/method.d.ts.map +1 -1
  119. package/out/service/service/entity/method/method.js +6 -5
  120. package/out/service/service/widget/control-service.d.ts +2 -0
  121. package/out/service/service/widget/control-service.d.ts.map +1 -1
  122. package/out/service/service/widget/control-service.js +2 -1
  123. package/out/service/service/widget/index.d.ts +2 -1
  124. package/out/service/service/widget/index.d.ts.map +1 -1
  125. package/out/service/service/widget/index.js +2 -1
  126. package/out/service/service/widget/tree-service.d.ts +51 -0
  127. package/out/service/service/widget/tree-service.d.ts.map +1 -0
  128. package/out/service/service/widget/tree-service.js +100 -0
  129. package/out/service/service/work-flow/work-flow.service.d.ts +0 -8
  130. package/out/service/service/work-flow/work-flow.service.d.ts.map +1 -1
  131. package/out/service/service/work-flow/work-flow.service.js +10 -10
  132. package/out/service/service-util.d.ts +13 -5
  133. package/out/service/service-util.d.ts.map +1 -1
  134. package/out/service/service-util.js +15 -9
  135. package/out/service/utils/app-counter/app-counter.d.ts +2 -0
  136. package/out/service/utils/app-counter/app-counter.d.ts.map +1 -1
  137. package/out/service/utils/app-counter/app-counter.js +2 -1
  138. package/out/service/utils/dynamic-code-list/dynamic-code-list.d.ts +2 -0
  139. package/out/service/utils/dynamic-code-list/dynamic-code-list.d.ts.map +1 -1
  140. package/out/service/utils/dynamic-code-list/dynamic-code-list.js +3 -2
  141. package/out/service/utils/service-path-util/service-path-util.d.ts.map +1 -1
  142. package/out/service/utils/service-path-util/service-path-util.js +1 -2
  143. package/out/service/vo/tree-node-data.d.ts +44 -0
  144. package/out/service/vo/tree-node-data.d.ts.map +1 -0
  145. package/out/service/vo/tree-node-data.js +1 -0
  146. package/out/types.d.ts +19 -25
  147. package/out/types.d.ts.map +1 -1
  148. package/out/utils/app-de-ui-action-util/handler/backend-ui-action-handler.d.ts.map +1 -1
  149. package/out/utils/app-de-ui-action-util/handler/backend-ui-action-handler.js +2 -1
  150. package/out/utils/open-redirect-view/open-redirect-view.d.ts.map +1 -1
  151. package/out/utils/open-redirect-view/open-redirect-view.js +2 -1
  152. package/package.json +6 -6
  153. package/src/application.ts +73 -0
  154. package/src/constant/index.ts +1 -1
  155. package/src/controller/control/app-menu.ts +11 -7
  156. package/src/controller/control/grid/grid-column.ts +5 -1
  157. package/src/controller/control/grid/grid-field-column.ts +1 -1
  158. package/src/controller/control/index.ts +1 -0
  159. package/src/controller/control/tree.ts +47 -0
  160. package/src/controller/editor/code-list-editor.ts +1 -1
  161. package/src/controller/editor/editor.ts +11 -0
  162. package/src/controller/editor/picker.ts +1 -1
  163. package/src/controller/editor/upload.ts +1 -1
  164. package/src/controller/interface/ability/control/i-tree-ability.ts +12 -0
  165. package/src/controller/interface/ability/control/index.ts +1 -0
  166. package/src/controller/interface/ability/view/i-tree-exp-view-ability.ts +12 -0
  167. package/src/controller/interface/ability/view/index.ts +1 -0
  168. package/src/controller/interface/event/control/i-tree-event.ts +11 -0
  169. package/src/controller/interface/event/control/index.ts +1 -0
  170. package/src/controller/interface/event/view/i-tree-exp-view-event.ts +12 -0
  171. package/src/controller/interface/event/view/index.ts +1 -0
  172. package/src/controller/interface/provider/i-control-provider.ts +1 -1
  173. package/src/controller/interface/provider/i-editor-provider.ts +4 -3
  174. package/src/controller/interface/provider/i-form-detail-provider.ts +1 -2
  175. package/src/controller/interface/provider/i-grid-column-provider.ts +1 -2
  176. package/src/controller/interface/provider/i-portlet-part-provider.ts +1 -1
  177. package/src/controller/interface/provider/i-view-provider.ts +1 -1
  178. package/src/controller/neuron/nerve/control/index.ts +1 -0
  179. package/src/controller/neuron/nerve/control/tree-nerve.ts +18 -0
  180. package/src/controller/neuron/nerve/view/index.ts +1 -0
  181. package/src/controller/neuron/nerve/view/tree-exp-view-nerve.ts +38 -0
  182. package/src/controller/neuron/neuron/view.ts +8 -0
  183. package/src/controller/neuron/neuron/widget.ts +3 -0
  184. package/src/controller/utils/button-state/button-state.ts +5 -1
  185. package/src/controller/view/edit-view.ts +1 -1
  186. package/src/controller/view/index.ts +1 -0
  187. package/src/controller/view/tree-exp-view.ts +49 -0
  188. package/src/controller/view/view.ts +12 -5
  189. package/src/controller/view/wf-step-trace-view.ts +1 -1
  190. package/src/install.ts +6 -12
  191. package/src/interface/i-plugin-factory/i-plugin-factory.ts +1 -1
  192. package/src/model.ts +188 -0
  193. package/src/runtime-hub.ts +76 -0
  194. package/src/service/authority/authority.service.ts +9 -2
  195. package/src/service/dto/method.dto.ts +11 -3
  196. package/src/service/index.ts +1 -0
  197. package/src/service/service/code-list/code-list.service.ts +6 -6
  198. package/src/service/service/entity/method/de-action.ts +5 -5
  199. package/src/service/service/entity/method/method-renturn.ts +5 -1
  200. package/src/service/service/entity/method/method.ts +9 -5
  201. package/src/service/service/widget/control-service.ts +5 -1
  202. package/src/service/service/widget/index.ts +2 -1
  203. package/src/service/service/widget/tree-service.ts +143 -0
  204. package/src/service/service/work-flow/work-flow.service.ts +13 -20
  205. package/src/service/service-util.ts +15 -8
  206. package/src/service/utils/app-counter/app-counter.ts +7 -2
  207. package/src/service/utils/dynamic-code-list/dynamic-code-list.ts +6 -2
  208. package/src/service/utils/service-path-util/service-path-util.ts +2 -2
  209. package/src/service/vo/tree-node-data.ts +47 -0
  210. package/src/types.ts +27 -33
  211. package/src/utils/app-de-ui-action-util/handler/backend-ui-action-handler.ts +2 -1
  212. package/src/utils/open-redirect-view/open-redirect-view.ts +2 -1
@@ -0,0 +1,38 @@
1
+ import { ViewNerve, TreeExpViewNeuron, TreeNeuron, Neuron } from '../..';
2
+ import { TreeExpViewController } from '../../..';
3
+
4
+ /**
5
+ * 树导航视图神经系统
6
+ *
7
+ * @author lxm
8
+ * @date 2022-10-14 14:10:48
9
+ * @export
10
+ * @class TreeExpViewNerve
11
+ * @extends {ViewNerve<TreeExpViewNeuron, TreeExpViewController>}
12
+ */
13
+ export class TreeExpViewNerve extends ViewNerve<
14
+ TreeExpViewNeuron,
15
+ TreeExpViewController
16
+ > {
17
+ tree!: TreeNeuron;
18
+
19
+ protected createNeuron(): TreeExpViewNeuron {
20
+ return new TreeExpViewNeuron(this.bindAbility());
21
+ }
22
+
23
+ inclusive(name: string): boolean {
24
+ return name === 'tree' || super.inclusive(name);
25
+ }
26
+
27
+ connect(name: string, neuron: Neuron): void {
28
+ super.connect(name, neuron);
29
+ if (name === 'tree') {
30
+ this.tree = neuron as TreeNeuron;
31
+ }
32
+ }
33
+
34
+ destroy(): void {
35
+ super.destroy();
36
+ this.tree = undefined as never;
37
+ }
38
+ }
@@ -10,6 +10,7 @@ import {
10
10
  IOptViewAbility,
11
11
  IPickupGridViewAbility,
12
12
  IPickupViewAbility,
13
+ ITreeExpViewAbility,
13
14
  IViewAbility,
14
15
  IWFDynaActionViewAbility,
15
16
  IWFDynaEditView3Ability,
@@ -27,6 +28,7 @@ import {
27
28
  IOptViewEvent,
28
29
  IPickupGridViewEvent,
29
30
  IPickupViewEvent,
31
+ ITreeExpViewEvent,
30
32
  IViewEvent,
31
33
  IWFDynaActionViewEvent,
32
34
  IWFDynaEditView3Event,
@@ -91,3 +93,9 @@ export class AppPortalViewNeuron extends Neuron<
91
93
  IAppPortalViewEvent,
92
94
  IAppPortalViewAbility
93
95
  > {}
96
+
97
+ // 导航类
98
+ export class TreeExpViewNeuron extends Neuron<
99
+ ITreeExpViewEvent,
100
+ ITreeExpViewAbility
101
+ > {}
@@ -12,6 +12,7 @@ import {
12
12
  IPickupViewPanelAbility,
13
13
  ISearchFormAbility,
14
14
  IToolbarAbility,
15
+ ITreeAbility,
15
16
  IViewPanelAbility,
16
17
  } from '../../interface/ability';
17
18
  import {
@@ -26,6 +27,7 @@ import {
26
27
  IPickupViewPanelEvent,
27
28
  ISearchFormEvent,
28
29
  IToolbarEvent,
30
+ ITreeEvent,
29
31
  IViewPanelEvent,
30
32
  } from '../../interface/event';
31
33
 
@@ -46,6 +48,7 @@ export class MDControlNeuron extends Neuron<
46
48
  > {}
47
49
  export class GridNeuron extends Neuron<IGridEvent, IGridAbility> {}
48
50
  export class ListNeuron extends Neuron<IListEvent, IListAbility> {}
51
+ export class TreeNeuron extends Neuron<ITreeEvent, ITreeAbility> {}
49
52
 
50
53
  // *面板部件
51
54
  export class ViewPanelNeuron extends Neuron<
@@ -3,9 +3,12 @@ import {
3
3
  IPSAppDEUIAction,
4
4
  IPSUIAction,
5
5
  } from '@ibiz-template/model';
6
+ import { Application } from '../../../application';
6
7
  import { IButtonState } from '../../interface';
7
8
 
8
9
  export class ButtonState implements IButtonState {
10
+ protected app: Application;
11
+
9
12
  disabled: boolean = false;
10
13
 
11
14
  visible: boolean = true;
@@ -23,6 +26,7 @@ export class ButtonState implements IButtonState {
23
26
  declare entity: AppEntityModel;
24
27
 
25
28
  constructor(name: string, uiAction: IPSUIAction, entity: AppEntityModel) {
29
+ this.app = ibiz.hub.getApp(entity.modelService.app);
26
30
  this.name = name;
27
31
  // 赋值uiAction
28
32
  Object.defineProperty(this, 'uiAction', {
@@ -49,7 +53,7 @@ export class ButtonState implements IButtonState {
49
53
  }
50
54
 
51
55
  update(data?: IData | undefined): void {
52
- const permitted = ibiz.authority.hasUIActionPermitted(
56
+ const permitted = this.app.authority.hasUIActionPermitted(
53
57
  this.uiAction,
54
58
  data,
55
59
  this.entity,
@@ -38,7 +38,7 @@ export class EditViewController<
38
38
 
39
39
  protected async onInit(): Promise<void> {
40
40
  await super.onInit();
41
- this.entityService = await ibiz.entityService.getService(
41
+ this.entityService = await this.app.es.getService(
42
42
  this.model.appEntity.codeName,
43
43
  this.context,
44
44
  );
@@ -16,3 +16,4 @@ export * from './wf-dyna-start-view';
16
16
  export * from './wf-dyna-action-view';
17
17
  export * from './wf-step-trace-view';
18
18
  export { AppPortalViewController } from './app-portal-view';
19
+ export { TreeExpViewController } from './tree-exp-view';
@@ -0,0 +1,49 @@
1
+ import { TreeExpViewModel } from '@ibiz-template/model';
2
+ import { ViewMode } from '../../constant';
3
+ import { TreeExpViewNerve } from '../neuron';
4
+ import { ViewController } from './view';
5
+
6
+ /**
7
+ * 树导航视图控制器
8
+ *
9
+ * @author lxm
10
+ * @date 2022-09-08 16:09:49
11
+ * @export
12
+ * @class TreeExpViewController
13
+ * @extends {ViewController}
14
+ */
15
+ export class TreeExpViewController<
16
+ T extends TreeExpViewModel = TreeExpViewModel,
17
+ > extends ViewController<T> {
18
+ declare nerve: TreeExpViewNerve;
19
+
20
+ protected createNerve(): TreeExpViewNerve {
21
+ return new TreeExpViewNerve(this);
22
+ }
23
+
24
+ protected async onInit(): Promise<void> {
25
+ await super.onInit();
26
+ // 数据看板适配器
27
+ const { tree } = this.model;
28
+ if (tree) {
29
+ this.providers[tree.name] = await ibiz.register.control.get(tree);
30
+ }
31
+ this.nerve.self.evt.on('mounted', () => {
32
+ if (this.modal.mode !== ViewMode.EMBED && this.model.source.loadDefault) {
33
+ this.load();
34
+ }
35
+ });
36
+ }
37
+
38
+ /**
39
+ * 加载方法
40
+ *
41
+ * @author lxm
42
+ * @date 2022-08-31 11:08:10
43
+ */
44
+ async load(): Promise<IData[]> {
45
+ // 调用数部件加载
46
+ const { tree } = this.nerve;
47
+ return tree.call.load();
48
+ }
49
+ }
@@ -3,7 +3,6 @@ import {
3
3
  DefectModelError,
4
4
  IPSAppViewLogic,
5
5
  IPSDETBUIActionItem,
6
- ModelUtil,
7
6
  ViewModel,
8
7
  } from '@ibiz-template/model';
9
8
  import { createUUID, notNilEmpty } from 'qx-util';
@@ -15,6 +14,7 @@ import { IModal, IModalData } from '../../interface';
15
14
  import { ViewMode } from '../../constant';
16
15
  import { convertNavData } from '../../utils';
17
16
  import { executeViewLogic } from '../../view-logic';
17
+ import { Application } from '../../application';
18
18
 
19
19
  /**
20
20
  * 视图控制器
@@ -35,6 +35,15 @@ export class ViewController<T extends ViewModel = ViewModel> {
35
35
  */
36
36
  model!: T;
37
37
 
38
+ /**
39
+ * 当前视图所归属的应用
40
+ *
41
+ * @author chitanda
42
+ * @date 2022-12-21 11:12:29
43
+ * @type {Application}
44
+ */
45
+ app!: Application;
46
+
38
47
  /**
39
48
  * 当为模态、飘窗等非路由模式打开时,外部会注入此方法,用于关闭视图。
40
49
  *
@@ -175,10 +184,8 @@ export class ViewController<T extends ViewModel = ViewModel> {
175
184
  */
176
185
  protected async onInit(): Promise<void> {
177
186
  this.emit('neuronInit', this.nerve.self);
178
- this.model = (await ModelUtil.getViewModel(
179
- this.modelPath,
180
- this.context,
181
- )) as T;
187
+ this.model = (await ibiz.model.getView(this.modelPath)) as T;
188
+ this.app = ibiz.hub.getApp(this.model.modelService.app);
182
189
 
183
190
  // 处理上下文和导航参数
184
191
  this.handleViewParams();
@@ -44,7 +44,7 @@ export class WFStepTraceViewController extends ViewController {
44
44
  if (!this.deName) {
45
45
  throw new RuntimeError('没有接收到deName');
46
46
  }
47
- this.entityService = await ibiz.entityService.getService(
47
+ this.entityService = await this.app.es.getService(
48
48
  this.deName,
49
49
  this.context,
50
50
  );
package/src/install.ts CHANGED
@@ -2,12 +2,9 @@ import { GlobalConfig } from './config/global-config';
2
2
  import { RegisterCenter } from './register/register-center';
3
3
  import { installCommand } from './command';
4
4
  import { presetUIActionProvider } from './provider';
5
- import {
6
- AuthorityService,
7
- AuthService,
8
- CodeListService,
9
- ServiceUtil,
10
- } from './service';
5
+ import { AuthService } from './service';
6
+ import { GlobalModel } from './model';
7
+ import { RuntimeHub } from './runtime-hub';
11
8
 
12
9
  /**
13
10
  * 安装运行时
@@ -18,18 +15,15 @@ import {
18
15
  */
19
16
  export function install(): void {
20
17
  const { ibiz } = window;
18
+ ibiz.hub = new RuntimeHub();
19
+ // 全局模型对象
20
+ ibiz.model = new GlobalModel();
21
21
  // 挂载注册中心
22
22
  ibiz.register = new RegisterCenter();
23
23
  // 初始化全局配置
24
24
  ibiz.config = new GlobalConfig();
25
- // 代码表服务
26
- ibiz.codeListService = new CodeListService();
27
- // 应用实体服务工具类
28
- ibiz.entityService = new ServiceUtil();
29
25
  // 挂载认证服务
30
26
  ibiz.auth = new AuthService();
31
- // 挂载权限服务
32
- ibiz.authority = new AuthorityService();
33
27
  // 安装默认指令
34
28
  installCommand();
35
29
  // 注册预置的界面行为适配器
@@ -28,7 +28,7 @@ export interface IPluginFactory {
28
28
  */
29
29
  loadPlugin(plugin: IPSSysPFPlugin): Promise<boolean>;
30
30
  /**
31
- * 加载应用饮用插件
31
+ * 加载应用引用插件
32
32
  *
33
33
  * @author chitanda
34
34
  * @date 2022-10-31 16:10:58
package/src/model.ts ADDED
@@ -0,0 +1,188 @@
1
+ import {
2
+ AppMenuItemModel,
3
+ DefectModelError,
4
+ IModelService,
5
+ IPSAppFunc,
6
+ IPSAppView,
7
+ IPSSubAppRef,
8
+ ModelConst,
9
+ ModelService,
10
+ ModelUtil,
11
+ SubModelService,
12
+ ViewModel,
13
+ } from '@ibiz-template/model';
14
+
15
+ /**
16
+ * 全局模型处理
17
+ *
18
+ * @author chitanda
19
+ * @date 2022-12-20 17:12:34
20
+ * @export
21
+ * @class GlobalModel
22
+ */
23
+ export class GlobalModel {
24
+ protected util = new ModelUtil();
25
+
26
+ /**
27
+ * 所有视图对应的应用标识
28
+ *
29
+ * @author chitanda
30
+ * @date 2022-12-20 19:12:37
31
+ * @protected
32
+ * @type {Map<string, string>} Map<视图模型标识, 应用标识>
33
+ */
34
+ protected views: Map<string, string> = new Map();
35
+
36
+ /**
37
+ * 初始化模型加载
38
+ *
39
+ * @author chitanda
40
+ * @date 2022-12-22 21:12:37
41
+ * @param {string} [dynaModelTag]
42
+ * @return {*} {Promise<void>}
43
+ */
44
+ async init(dynaModelTag?: string): Promise<void> {
45
+ // 构造跟 hub 模型加载
46
+ const help = await this.util.create(async modelPath => {
47
+ const url = `${ibiz.env.remoteModelUrl}${modelPath}?dynamodeltag=${dynaModelTag}`;
48
+ const res = await ibiz.net.get(url);
49
+ if (res.ok) {
50
+ if (modelPath.endsWith('PSSYSAPP.json')) {
51
+ res.data.id = ibiz.env.appId;
52
+ }
53
+ return res.data as IModel;
54
+ }
55
+ return {};
56
+ }, ibiz.env.hub);
57
+ // 根模型对象
58
+ const root = (await help.getModelService()) as unknown as ModelService;
59
+ this.setViews(
60
+ ModelConst.DEFAULT_SANDBOX,
61
+ root.app.getAllPSAppViews() || [],
62
+ );
63
+ await ibiz.hub.createApp(ModelConst.DEFAULT_SANDBOX, root);
64
+ const appRefs = root.app.getAllPSSubAppRefs();
65
+ if (appRefs) {
66
+ for (let i = 0; i < appRefs.length; i++) {
67
+ const app = appRefs[i];
68
+ this.setViews(app.M.id, app.getAllPSAppViews() || []);
69
+ }
70
+ }
71
+ }
72
+
73
+ /**
74
+ * 初始化子应用模型实例
75
+ *
76
+ * @author chitanda
77
+ * @date 2022-12-20 18:12:05
78
+ * @protected
79
+ * @param {IPSSubAppRef} app
80
+ * @return {*} {Promise<SubModelService>}
81
+ */
82
+ protected async initSubApp(appRef: IPSSubAppRef): Promise<SubModelService> {
83
+ const appId = appRef.M.id;
84
+ const help = await this.util.createSub(async modelPath => {
85
+ const url = `${ibiz.env.remoteModelUrl}/subapps/${appId}${modelPath}?dynamodeltag=${appRef.M.dynamodeltag}`;
86
+ const res = await ibiz.net.get(url);
87
+ if (res.ok) {
88
+ if (modelPath.endsWith('PSSYSAPP.json')) {
89
+ res.data.id = appId;
90
+ }
91
+ return res.data as IModel;
92
+ }
93
+ return {};
94
+ }, appId);
95
+ const service =
96
+ (await help.getModelService()) as unknown as SubModelService;
97
+ await ibiz.hub.createApp(appId, service);
98
+ return service;
99
+ }
100
+
101
+ /**
102
+ * 设置视图指定层级缓存
103
+ *
104
+ * @author chitanda
105
+ * @date 2022-12-20 19:12:23
106
+ * @protected
107
+ * @param {string} appTag
108
+ * @param {IPSAppView[]} views
109
+ */
110
+ protected setViews(appTag: string, views: IPSAppView[]): void {
111
+ views.forEach(view => {
112
+ this.views.set(view.modelPath!, appTag);
113
+ });
114
+ }
115
+
116
+ /**
117
+ * 获取指定应用的模型服务,服务不存在则创建
118
+ *
119
+ * @author chitanda
120
+ * @date 2022-12-22 15:12:03
121
+ * @protected
122
+ * @param {string} appTag
123
+ * @return {*} {Promise<IModelService>}
124
+ */
125
+ protected async getAppModelService(appTag: string): Promise<IModelService> {
126
+ try {
127
+ const service = await this.util.getModelService(appTag);
128
+ return service;
129
+ } catch (error) {
130
+ const rootService = await this.util.getModelService();
131
+ const app = rootService.app.findPSSubAppRef(appTag);
132
+ if (!app) {
133
+ throw new DefectModelError(rootService.app, `子应用[${appTag}]不存在`);
134
+ }
135
+ return this.initSubApp(app!);
136
+ }
137
+ }
138
+
139
+ /**
140
+ * 根据路径
141
+ *
142
+ * @author chitanda
143
+ * @date 2022-12-20 20:12:54
144
+ * @param {string} path
145
+ * @return {*} {Promise<ViewModel>}
146
+ */
147
+ async getView(path: string): Promise<ViewModel> {
148
+ if (!this.views.has(path)) {
149
+ throw new Error(`未找到视图模型: ${path}`);
150
+ }
151
+ const appTag = this.views.get(path)!;
152
+ const service = await this.getAppModelService(appTag);
153
+ const view = await service.factory.getView(path);
154
+ if (view) {
155
+ return view;
156
+ }
157
+ throw new DefectModelError(service.app, `未找到视图[${path}]`);
158
+ }
159
+
160
+ /**
161
+ * 根据菜单项所归属应用,获取应用功能
162
+ *
163
+ * @author chitanda
164
+ * @date 2022-12-22 15:12:59
165
+ * @param {AppMenuItemModel} menu
166
+ * @return {*} {(Promise<IPSAppFunc | null>)}
167
+ */
168
+ async getAppFunc(menu: AppMenuItemModel): Promise<IPSAppFunc | null> {
169
+ const { appId } = menu;
170
+ if (appId === ModelConst.DEFAULT_SANDBOX) {
171
+ return menu.appFunc;
172
+ }
173
+ const service = await this.getAppModelService(appId);
174
+ return service.app.findPSAppFunc(menu.source.M.getPSAppFunc);
175
+ }
176
+
177
+ /**
178
+ * 获取指定应用模型服务
179
+ *
180
+ * @author chitanda
181
+ * @date 2022-12-20 21:12:58
182
+ * @param {IContext} [context]
183
+ * @return {*}
184
+ */
185
+ async getModelService(context?: IContext) {
186
+ return this.util.getModelService(context?.srfsandbox);
187
+ }
188
+ }
@@ -0,0 +1,76 @@
1
+ import {
2
+ IPSApplication,
3
+ ModelConst,
4
+ ModelObject,
5
+ ModelService,
6
+ } from '@ibiz-template/model';
7
+ import { Application } from './application';
8
+
9
+ /**
10
+ * 运行时总集
11
+ *
12
+ * @author chitanda
13
+ * @date 2022-12-21 14:12:00
14
+ * @export
15
+ * @class RuntimeHub
16
+ */
17
+ export class RuntimeHub {
18
+ /**
19
+ * 应用总集
20
+ *
21
+ * @author chitanda
22
+ * @date 2022-12-21 14:12:45
23
+ * @protected
24
+ * @type {Map<string, Application>}
25
+ */
26
+ protected appMap: Map<string, Application> = new Map();
27
+
28
+ /**
29
+ * 创建应用对象
30
+ *
31
+ * @author chitanda
32
+ * @date 2022-12-21 14:12:33
33
+ * @param {string} key 应用标识
34
+ * @param {ModelService} service 应用所对应的模型服务
35
+ * @return {*} {Promise<Application>}
36
+ */
37
+ async createApp(key: string, service: ModelService): Promise<Application> {
38
+ const app = new Application(service);
39
+ this.appMap.set(key, app);
40
+ await app.init();
41
+ return app;
42
+ }
43
+
44
+ getApp(key?: string): Application;
45
+
46
+ getApp(appModel?: IPSApplication): Application;
47
+
48
+ getApp(model?: ModelObject): Application;
49
+
50
+ /**
51
+ * 根据标识获取应用对象
52
+ *
53
+ * @author chitanda
54
+ * @date 2022-12-21 20:12:53
55
+ * @param {(string | IPSApplication)} [app]
56
+ * @return {*} {Application}
57
+ */
58
+ getApp(app?: string | IPSApplication | ModelObject): Application {
59
+ let key: string | null = null;
60
+ if (app) {
61
+ if (app instanceof Object) {
62
+ if (app instanceof ModelObject) {
63
+ key = app.modelService.app.appId;
64
+ } else {
65
+ key = (app as IPSApplication).appId;
66
+ }
67
+ } else {
68
+ key = app;
69
+ }
70
+ }
71
+ if (!key) {
72
+ key = ModelConst.DEFAULT_SANDBOX;
73
+ }
74
+ return this.appMap.get(key)!;
75
+ }
76
+ }
@@ -2,8 +2,8 @@ import { MenuPermissionMode, RuntimeError } from '@ibiz-template/core';
2
2
  import {
3
3
  AppEntityModel,
4
4
  AppMenuItemModel,
5
- getModelService,
6
5
  IPSDEUIAction,
6
+ ModelService,
7
7
  } from '@ibiz-template/model';
8
8
 
9
9
  /**
@@ -15,6 +15,8 @@ import {
15
15
  * @class AuthorityService
16
16
  */
17
17
  export class AuthorityService {
18
+ protected isInit: boolean = false;
19
+
18
20
  /**
19
21
  * 统一资源集合
20
22
  *
@@ -55,6 +57,8 @@ export class AuthorityService {
55
57
  */
56
58
  private opPrivs: string[] = [];
57
59
 
60
+ constructor(protected modelService: ModelService) {}
61
+
58
62
  /**
59
63
  * 权限服务初始化
60
64
  *
@@ -94,7 +98,7 @@ export class AuthorityService {
94
98
  * @returns {*} {Promise<void>}
95
99
  */
96
100
  async calcOPPrivs(resCodes: string[]): Promise<void> {
97
- const appModel = (await getModelService()).app;
101
+ const appModel = this.modelService.app;
98
102
  // 先置空
99
103
  this.opPrivs = [];
100
104
  if (appModel.getAllPSDEOPPrivs()?.length) {
@@ -108,6 +112,9 @@ export class AuthorityService {
108
112
  }
109
113
  });
110
114
  }
115
+ // throw new Error(
116
+ // '多应用模式下,需要补充每个应用自己的计算。整体结构需要改到app下去',
117
+ // );
111
118
  }
112
119
 
113
120
  /**
@@ -7,6 +7,7 @@ import {
7
7
  UnsupportedModelError,
8
8
  } from '@ibiz-template/model';
9
9
  import { isNilOrEmpty } from 'qx-util';
10
+ import { Application } from '../../application';
10
11
  import { Entity } from '../entity/entity';
11
12
 
12
13
  /**
@@ -18,6 +19,8 @@ import { Entity } from '../entity/entity';
18
19
  * @class MethodDto
19
20
  */
20
21
  export class MethodDto {
22
+ protected app?: Application;
23
+
21
24
  protected fields: IPSAppDEMethodDTOField[];
22
25
 
23
26
  protected dtoMap: Map<string, MethodDto> = new Map();
@@ -43,7 +46,12 @@ export class MethodDto {
43
46
  * @param {IPSAppDEMethodDTO} dto
44
47
  */
45
48
  constructor(protected dto?: IPSAppDEMethodDTO) {
46
- this.fields = dto?.getPSAppDEMethodDTOFields() || [];
49
+ if (dto) {
50
+ this.app = ibiz.hub.getApp(dto.getPSModelService().app);
51
+ this.fields = dto.getPSAppDEMethodDTOFields() || [];
52
+ } else {
53
+ this.fields = [];
54
+ }
47
55
  }
48
56
 
49
57
  /**
@@ -73,7 +81,7 @@ export class MethodDto {
73
81
  case 'DTOS': {
74
82
  const dto = await this.getFieldDto(field);
75
83
  const refEntity = field.getRefPSAppDataEntity()!;
76
- const service = await ibiz.entityService.getService(
84
+ const service = await this.app!.es.getService(
77
85
  refEntity.codeName,
78
86
  context,
79
87
  );
@@ -107,7 +115,7 @@ export class MethodDto {
107
115
  * @return {*} {Promise<IData>}
108
116
  */
109
117
  async set(context: IContext, data: IData): Promise<Entity> {
110
- const service = await ibiz.entityService.getService(this.entity.codeName);
118
+ const service = await this.app!.es.getService(this.entity.codeName);
111
119
  const all = await this.fields
112
120
  .filter(field => field.type === 'DTOS')
113
121
  .map(async field => {
@@ -3,6 +3,7 @@ export * from './utils';
3
3
  export * from './service';
4
4
  export * from './constant';
5
5
  export * from './vo/control.vo';
6
+ export * from './vo/tree-node-data';
6
7
 
7
8
  export { AuthService } from './auth/auth.service';
8
9
  export { AuthorityService } from './authority/authority.service';