@ibiz-template/runtime 0.5.7-alpha.2 → 0.5.7-alpha.4

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 (177) hide show
  1. package/dist/index.esm.js +2384 -278
  2. package/dist/index.system.min.js +1 -1
  3. package/out/app-hub.d.ts +2 -0
  4. package/out/app-hub.d.ts.map +1 -1
  5. package/out/app-hub.js +2 -0
  6. package/out/application.d.ts +7 -0
  7. package/out/application.d.ts.map +1 -1
  8. package/out/application.js +23 -10
  9. package/out/constant/index.d.ts +1 -0
  10. package/out/constant/index.d.ts.map +1 -1
  11. package/out/constant/index.js +1 -0
  12. package/out/constant/preset-identifier.d.ts +15 -0
  13. package/out/constant/preset-identifier.d.ts.map +1 -0
  14. package/out/constant/preset-identifier.js +16 -0
  15. package/out/controller/common/editor/editor.controller.d.ts.map +1 -1
  16. package/out/controller/common/editor/editor.controller.js +4 -0
  17. package/out/controller/control/exp-bar/exp-bar.controller.d.ts.map +1 -1
  18. package/out/controller/control/exp-bar/exp-bar.controller.js +7 -0
  19. package/out/controller/control/exp-bar/tree-exp-bar.controller.d.ts +5 -0
  20. package/out/controller/control/exp-bar/tree-exp-bar.controller.d.ts.map +1 -1
  21. package/out/controller/control/exp-bar/tree-exp-bar.controller.js +16 -0
  22. package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-ua-column/tree-grid-ex-ua-column.controller.d.ts +23 -1
  23. package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-ua-column/tree-grid-ex-ua-column.controller.d.ts.map +1 -1
  24. package/out/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-ua-column/tree-grid-ex-ua-column.controller.js +56 -4
  25. package/out/controller/notification/async-action.controller.d.ts +64 -0
  26. package/out/controller/notification/async-action.controller.d.ts.map +1 -0
  27. package/out/controller/notification/async-action.controller.js +141 -0
  28. package/out/controller/notification/index.d.ts +2 -0
  29. package/out/controller/notification/index.d.ts.map +1 -0
  30. package/out/controller/notification/index.js +1 -0
  31. package/out/controller/notification/internal-message.controller.d.ts +23 -0
  32. package/out/controller/notification/internal-message.controller.d.ts.map +1 -0
  33. package/out/controller/notification/internal-message.controller.js +50 -0
  34. package/out/controller/notification/notice.controller.d.ts +10 -0
  35. package/out/controller/notification/notice.controller.d.ts.map +1 -0
  36. package/out/controller/notification/notice.controller.js +13 -0
  37. package/out/global/global-util/global-util.d.ts +17 -1
  38. package/out/global/global-util/global-util.d.ts.map +1 -1
  39. package/out/global/global-util/global-util.js +17 -1
  40. package/out/interface/common/i-app-hub-service/i-app-hub-service.d.ts +8 -1
  41. package/out/interface/common/i-app-hub-service/i-app-hub-service.d.ts.map +1 -1
  42. package/out/interface/common/i-app-service/i-app-service.d.ts +16 -1
  43. package/out/interface/common/i-app-service/i-app-service.d.ts.map +1 -1
  44. package/out/interface/common/i-popover-options/i-popover-options.d.ts +9 -1
  45. package/out/interface/common/i-popover-options/i-popover-options.d.ts.map +1 -1
  46. package/out/interface/controller/controller/index.d.ts +1 -0
  47. package/out/interface/controller/controller/index.d.ts.map +1 -1
  48. package/out/interface/controller/controller/index.js +1 -0
  49. package/out/interface/controller/controller/notice/i-async-action.controller.d.ts +49 -0
  50. package/out/interface/controller/controller/notice/i-async-action.controller.d.ts.map +1 -0
  51. package/out/interface/controller/controller/notice/i-async-action.controller.js +1 -0
  52. package/out/interface/controller/controller/notice/i-internal-message.controller.d.ts +68 -0
  53. package/out/interface/controller/controller/notice/i-internal-message.controller.d.ts.map +1 -0
  54. package/out/interface/controller/controller/notice/i-internal-message.controller.js +1 -0
  55. package/out/interface/controller/controller/notice/i-notice.controller.d.ts +33 -0
  56. package/out/interface/controller/controller/notice/i-notice.controller.d.ts.map +1 -0
  57. package/out/interface/controller/controller/notice/i-notice.controller.js +1 -0
  58. package/out/interface/controller/controller/notice/index.d.ts +4 -0
  59. package/out/interface/controller/controller/notice/index.d.ts.map +1 -0
  60. package/out/interface/controller/controller/notice/index.js +1 -0
  61. package/out/interface/provider/i-async-action.provider.d.ts +11 -3
  62. package/out/interface/provider/i-async-action.provider.d.ts.map +1 -1
  63. package/out/interface/provider/i-internal-message.provider.d.ts +10 -2
  64. package/out/interface/provider/i-internal-message.provider.d.ts.map +1 -1
  65. package/out/interface/util/i-animation-util/i-animation-options.d.ts +31 -0
  66. package/out/interface/util/i-animation-util/i-animation-options.d.ts.map +1 -0
  67. package/out/interface/util/i-animation-util/i-animation-options.js +1 -0
  68. package/out/interface/util/i-notice-util/i-notice-util.d.ts +34 -0
  69. package/out/interface/util/i-notice-util/i-notice-util.d.ts.map +1 -0
  70. package/out/interface/util/i-notice-util/i-notice-util.js +1 -0
  71. package/out/interface/util/i-open-view-util/i-open-view-util.d.ts +2 -2
  72. package/out/interface/util/i-open-view-util/i-open-view-util.d.ts.map +1 -1
  73. package/out/interface/util/index.d.ts +2 -0
  74. package/out/interface/util/index.d.ts.map +1 -1
  75. package/out/register/helper/async-action-register.d.ts +2 -1
  76. package/out/register/helper/async-action-register.d.ts.map +1 -1
  77. package/out/register/helper/async-action-register.js +3 -3
  78. package/out/register/helper/internal-message-register.js +2 -2
  79. package/out/service/dto/method.dto.d.ts.map +1 -1
  80. package/out/service/dto/method.dto.js +11 -0
  81. package/out/service/mqtt/mqtt.service.d.ts.map +1 -1
  82. package/out/service/mqtt/mqtt.service.js +1 -0
  83. package/out/service/service/auth/v7-auth.service.d.ts.map +1 -1
  84. package/out/service/service/auth/v7-auth.service.js +4 -0
  85. package/out/service/service/entity/method/de-action.d.ts.map +1 -1
  86. package/out/service/service/entity/method/de-action.js +4 -4
  87. package/out/service/service/internal-message/internal-message.service.d.ts +1 -1
  88. package/out/service/service/internal-message/internal-message.service.d.ts.map +1 -1
  89. package/out/service/service/internal-message/internal-message.service.js +7 -16
  90. package/out/service/utils/de-cache/de-cache.d.ts +2 -4
  91. package/out/service/utils/de-cache/de-cache.d.ts.map +1 -1
  92. package/out/service/utils/de-cache/de-cache.js +4 -8
  93. package/out/service/utils/dyna-sys-params/dyna-sys-params.d.ts +21 -0
  94. package/out/service/utils/dyna-sys-params/dyna-sys-params.d.ts.map +1 -0
  95. package/out/service/utils/dyna-sys-params/dyna-sys-params.js +48 -0
  96. package/out/service/utils/dynamic-code-list/dynamic-code-list.d.ts.map +1 -1
  97. package/out/service/utils/dynamic-code-list/dynamic-code-list.js +9 -5
  98. package/out/service/utils/index.d.ts +1 -0
  99. package/out/service/utils/index.d.ts.map +1 -1
  100. package/out/service/utils/index.js +1 -0
  101. package/out/service/vo/tree-node-data/tree-data-set-node-data.d.ts.map +1 -1
  102. package/out/service/vo/tree-node-data/tree-data-set-node-data.js +8 -0
  103. package/out/types.d.ts +8 -1
  104. package/out/types.d.ts.map +1 -1
  105. package/out/ui-action/uiaction-util.d.ts +23 -0
  106. package/out/ui-action/uiaction-util.d.ts.map +1 -1
  107. package/out/ui-action/uiaction-util.js +39 -1
  108. package/out/utils/anime/anime-element-util.d.ts +44 -0
  109. package/out/utils/anime/anime-element-util.d.ts.map +1 -0
  110. package/out/utils/anime/anime-element-util.js +108 -0
  111. package/out/utils/anime/anime-util/anime-util.d.ts +60 -0
  112. package/out/utils/anime/anime-util/anime-util.d.ts.map +1 -0
  113. package/out/utils/anime/anime-util/anime-util.js +96 -0
  114. package/out/utils/anime/anime.d.ts +27 -0
  115. package/out/utils/anime/anime.d.ts.map +1 -0
  116. package/out/utils/anime/anime.js +86 -0
  117. package/out/utils/anime/index.d.ts +2 -0
  118. package/out/utils/anime/index.d.ts.map +1 -0
  119. package/out/utils/anime/index.js +1 -0
  120. package/out/utils/file-util/file-util.d.ts +57 -0
  121. package/out/utils/file-util/file-util.d.ts.map +1 -0
  122. package/out/utils/file-util/file-util.js +113 -0
  123. package/out/utils/file-util/index.d.ts +2 -0
  124. package/out/utils/file-util/index.d.ts.map +1 -0
  125. package/out/utils/file-util/index.js +1 -0
  126. package/out/utils/index.d.ts +2 -0
  127. package/out/utils/index.d.ts.map +1 -1
  128. package/out/utils/index.js +2 -0
  129. package/package.json +9 -5
  130. package/src/app-hub.ts +3 -0
  131. package/src/application.ts +31 -16
  132. package/src/constant/index.ts +1 -0
  133. package/src/constant/preset-identifier.ts +15 -0
  134. package/src/controller/common/editor/editor.controller.ts +11 -1
  135. package/src/controller/control/exp-bar/exp-bar.controller.ts +6 -0
  136. package/src/controller/control/exp-bar/tree-exp-bar.controller.ts +17 -0
  137. package/src/controller/control/tree-grid-ex/tree-grid-ex-column/tree-grid-ex-ua-column/tree-grid-ex-ua-column.controller.ts +68 -4
  138. package/src/controller/notification/async-action.controller.ts +163 -0
  139. package/src/controller/notification/index.ts +1 -0
  140. package/src/controller/notification/internal-message.controller.ts +64 -0
  141. package/src/controller/notification/notice.controller.ts +16 -0
  142. package/src/global/global-util/global-util.ts +20 -0
  143. package/src/interface/common/i-app-hub-service/i-app-hub-service.ts +9 -1
  144. package/src/interface/common/i-app-service/i-app-service.ts +18 -0
  145. package/src/interface/common/i-popover-options/i-popover-options.ts +10 -1
  146. package/src/interface/controller/controller/index.ts +1 -0
  147. package/src/interface/controller/controller/notice/i-async-action.controller.ts +52 -0
  148. package/src/interface/controller/controller/notice/i-internal-message.controller.ts +74 -0
  149. package/src/interface/controller/controller/notice/i-notice.controller.ts +36 -0
  150. package/src/interface/controller/controller/notice/index.ts +9 -0
  151. package/src/interface/provider/i-async-action.provider.ts +14 -3
  152. package/src/interface/provider/i-internal-message.provider.ts +10 -2
  153. package/src/interface/util/i-animation-util/i-animation-options.ts +34 -0
  154. package/src/interface/util/i-notice-util/i-notice-util.ts +34 -0
  155. package/src/interface/util/i-open-view-util/i-open-view-util.ts +2 -1
  156. package/src/interface/util/index.ts +2 -0
  157. package/src/register/helper/async-action-register.ts +4 -4
  158. package/src/register/helper/internal-message-register.ts +2 -2
  159. package/src/service/dto/method.dto.ts +16 -0
  160. package/src/service/mqtt/mqtt.service.ts +1 -0
  161. package/src/service/service/auth/v7-auth.service.ts +5 -0
  162. package/src/service/service/entity/method/de-action.ts +2 -12
  163. package/src/service/service/internal-message/internal-message.service.ts +12 -18
  164. package/src/service/utils/de-cache/de-cache.ts +4 -18
  165. package/src/service/utils/dyna-sys-params/dyna-sys-params.ts +66 -0
  166. package/src/service/utils/dynamic-code-list/dynamic-code-list.ts +9 -6
  167. package/src/service/utils/index.ts +1 -0
  168. package/src/service/vo/tree-node-data/tree-data-set-node-data.ts +8 -0
  169. package/src/types.ts +9 -0
  170. package/src/ui-action/uiaction-util.ts +48 -1
  171. package/src/utils/anime/anime-element-util.ts +141 -0
  172. package/src/utils/anime/anime-util/anime-util.ts +123 -0
  173. package/src/utils/anime/anime.ts +111 -0
  174. package/src/utils/anime/index.ts +1 -0
  175. package/src/utils/file-util/file-util.ts +141 -0
  176. package/src/utils/file-util/index.ts +1 -0
  177. package/src/utils/index.ts +2 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibiz-template/runtime",
3
- "version": "0.5.7-alpha.2",
3
+ "version": "0.5.7-alpha.4",
4
4
  "description": "控制器包",
5
5
  "type": "module",
6
6
  "main": "out/index.js",
@@ -30,8 +30,9 @@
30
30
  "author": "chitanda",
31
31
  "license": "MIT",
32
32
  "devDependencies": {
33
- "@ibiz-template/core": "^0.5.7-alpha.0",
34
- "@ibiz/model-core": "^0.1.7",
33
+ "@ibiz-template/core": "^0.5.7-alpha.4",
34
+ "@ibiz/model-core": "^0.1.8",
35
+ "@types/animejs": "^3.1.12",
35
36
  "@types/path-browserify": "^1.0.2",
36
37
  "@types/qs": "^6.9.11",
37
38
  "@types/systemjs": "^6.13.5",
@@ -48,7 +49,7 @@
48
49
  },
49
50
  "peerDependencies": {
50
51
  "@ibiz-template/core": "^0.5.0-beta.0",
51
- "@ibiz/model-core": "^0.1.7",
52
+ "@ibiz/model-core": "^0.1.8",
52
53
  "async-validator": "^4.2.5",
53
54
  "dayjs": "^1.11.7",
54
55
  "echarts": "^5.4.3",
@@ -60,5 +61,8 @@
60
61
  "qx-util": "^0.4.8",
61
62
  "ramda": "^0.29.0"
62
63
  },
63
- "gitHead": "1f04c8345f5b91063b3163f1f057eeb8b6a0ce1b"
64
+ "dependencies": {
65
+ "animejs": "^3.2.2"
66
+ },
67
+ "gitHead": "8e644e8b907662a8510d34b18f91c609b3781968"
64
68
  }
package/src/app-hub.ts CHANGED
@@ -10,6 +10,7 @@ import {
10
10
  import { AppConfigService, Convert } from './hub';
11
11
  import { HubController } from './controller';
12
12
  import { ConfigService } from './service';
13
+ import { NoticeController } from './controller/notification';
13
14
 
14
15
  /**
15
16
  * 运行时总集
@@ -112,6 +113,8 @@ export class AppHub implements IAppHubService {
112
113
  */
113
114
  config = new AppConfigService();
114
115
 
116
+ notice = new NoticeController();
117
+
115
118
  /**
116
119
  * 默认首页视图名称
117
120
  *
@@ -130,22 +130,7 @@ export class Application implements IAppService {
130
130
  async init(): Promise<void> {
131
131
  await this.authority.init();
132
132
  await this.loadAppModelStyle();
133
- if (
134
- ibiz.env.enableMqtt &&
135
- ibiz.appData &&
136
- ibiz.appData.mqtttopic &&
137
- ibiz.auth.isAnonymous !== true
138
- ) {
139
- this.mqtt = new MqttService(
140
- ibiz.appData.mqtttopic,
141
- getToken()!,
142
- this.model.appId!,
143
- );
144
- this.mqtt.evt.on('message', message => {
145
- ibiz.mc.command.asyncAction.next(message);
146
- });
147
- await this.mqtt.connect();
148
- }
133
+ await this.initMqtt();
149
134
  }
150
135
 
151
136
  /**
@@ -254,4 +239,34 @@ export class Application implements IAppService {
254
239
  return logic.id === deUILogicId;
255
240
  });
256
241
  }
242
+
243
+ /**
244
+ * 初始化Mqtt服务
245
+ * @author lxm
246
+ * @date 2024-01-25 10:47:06
247
+ * @return {*} {Promise<void>}
248
+ */
249
+ async initMqtt(): Promise<void> {
250
+ // 如果已经存在,即重新初始化,把旧的销毁
251
+ if (this.mqtt) {
252
+ this.mqtt.close();
253
+ }
254
+
255
+ if (
256
+ ibiz.env.enableMqtt &&
257
+ ibiz.appData &&
258
+ ibiz.appData.mqtttopic &&
259
+ ibiz.auth.isAnonymous !== true
260
+ ) {
261
+ this.mqtt = new MqttService(
262
+ ibiz.appData.mqtttopic,
263
+ getToken()!,
264
+ this.model.appId!,
265
+ );
266
+ this.mqtt.evt.on('message', message => {
267
+ ibiz.mc.command.next(message);
268
+ });
269
+ await this.mqtt.connect();
270
+ }
271
+ }
257
272
  }
@@ -7,3 +7,4 @@ export { ValueOP } from './value-op';
7
7
  export { ViewCallTag } from './view-call-tag';
8
8
  export { ViewMode } from './view-mode';
9
9
  export { ViewType } from './view-type';
10
+ export { PresetIdentifier } from './preset-identifier';
@@ -0,0 +1,15 @@
1
+ /* eslint-disable no-shadow */
2
+ /**
3
+ * 内置标识符
4
+ *
5
+ * @author zk
6
+ * @date 2024-01-24 10:01:11
7
+ * @export
8
+ * @enum {number}
9
+ */
10
+ export enum PresetIdentifier {
11
+ /**
12
+ * 消息组件
13
+ */
14
+ MESSAGE = 'preset-message',
15
+ }
@@ -1,5 +1,9 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import { IEditor, INavigateParamContainer } from '@ibiz/model-core';
2
+ import {
3
+ IEditor,
4
+ IEditorItem,
5
+ INavigateParamContainer,
6
+ } from '@ibiz/model-core';
3
7
  import { DataTypes } from '@ibiz-template/core';
4
8
  import dayjs from 'dayjs';
5
9
  import { convertNavData } from '../../../utils';
@@ -163,6 +167,12 @@ export class EditorController<T extends IEditor = IEditor>
163
167
  this.style.height = `${height}px`;
164
168
  }
165
169
  }
170
+ // 值项过滤掉自身
171
+ if (this.model.editorItems) {
172
+ this.model.editorItems = this.model.editorItems.filter(
173
+ (item: IEditorItem) => item.id !== this.model.id,
174
+ );
175
+ }
166
176
  }
167
177
 
168
178
  /**
@@ -266,6 +266,12 @@ export class ExpBarControlController<
266
266
  // 默认选中第一条并导航
267
267
  this.navByFirstItem();
268
268
  }
269
+ } else {
270
+ // 刷新后需要重新进行导航,计算导航上下文等参数的变更
271
+ const data = this.xDataController.state.selectedData;
272
+ if (data[0]) {
273
+ this.xDataController.setActive(data[0]);
274
+ }
269
275
  }
270
276
  }
271
277
 
@@ -63,6 +63,23 @@ export class TreeExpBarController
63
63
  */
64
64
  navNodeModelIds: string[] = [];
65
65
 
66
+ /**
67
+ * 组件挂载
68
+ *
69
+ */
70
+ protected async onMounted(): Promise<void> {
71
+ super.onMounted();
72
+ if (this.xDataController) {
73
+ this.xDataController.evt.on('onAfterRefreshParent', _event => {
74
+ // 刷新后需要重新进行导航,计算导航上下文等参数的变更
75
+ const data = this.xDataController.state.selectedData;
76
+ if (data[0]) {
77
+ this.xDataController.setActive(data[0]);
78
+ }
79
+ });
80
+ }
81
+ }
82
+
66
83
  /**
67
84
  * 获取指定节点模型
68
85
  *
@@ -1,6 +1,10 @@
1
1
  /* eslint-disable no-param-reassign */
2
- import { RuntimeModelError } from '@ibiz-template/core';
3
- import { IDETreeUAColumn, IUIActionGroupDetail } from '@ibiz/model-core';
2
+ import {
3
+ IDETreeNodeUAColumn,
4
+ IDETreeUAColumn,
5
+ IUIActionGroup,
6
+ IUIActionGroupDetail,
7
+ } from '@ibiz/model-core';
4
8
  import { UIActionUtil } from '../../../../../ui-action';
5
9
  import { ButtonContainerState, UIActionButtonState } from '../../../../utils';
6
10
  import { TreeGridExColumnController } from '../tree-grid-ex-column/tree-grid-ex-column.controller';
@@ -17,6 +21,65 @@ import { TreeGridExRowState } from '../../tree-grid-ex-row.state';
17
21
  * @extends {TreeGridExColumnController<IDETreeUAColumn>}
18
22
  */
19
23
  export class TreeGridExUAColumnController extends TreeGridExColumnController<IDETreeUAColumn> {
24
+ /**
25
+ * 该树表格列对应不同节点模型的节点列控制器
26
+ * @author lxm
27
+ * @date 2024-01-08 05:40:56
28
+ * @type {Map<string, IDETreeNodeUAColumn>}
29
+ */
30
+ nodeColumnMap: Map<string, IDETreeNodeUAColumn> = new Map();
31
+
32
+ async init(): Promise<void> {
33
+ await this.onInit();
34
+ await this.initNodeColumnMap();
35
+ }
36
+
37
+ /**
38
+ * 解析模型初始化节点对应的节点列模型
39
+ * @author lxm
40
+ * @date 2024-01-24 02:41:05
41
+ */
42
+ initNodeColumnMap(): void {
43
+ this.treeGrid.model.detreeNodes?.forEach(node => {
44
+ if (node.treeNodeType !== 'DE') {
45
+ return;
46
+ }
47
+ const nodeColumn = node.detreeNodeColumns?.find(
48
+ (column: IDETreeNodeUAColumn) => {
49
+ return column.detreeColumnId === this.model.id;
50
+ },
51
+ );
52
+
53
+ // 没有指定树表格列的不创建
54
+ if (nodeColumn) {
55
+ this.nodeColumnMap.set(node.id!, nodeColumn);
56
+ }
57
+ });
58
+ }
59
+
60
+ /**
61
+ * 获取界面行为组mode
62
+ * @author lxm
63
+ * @date 2024-01-24 04:13:03
64
+ * @param {ITreeGridExRowState} row
65
+ * @return {*} {(IUIActionGroup | undefined)}
66
+ */
67
+ getUIActionGroup(row: ITreeGridExRowState): IUIActionGroup | undefined {
68
+ let { deuiactionGroup } = this.model;
69
+
70
+ // 对应节点数据项配置了的时候拿数据项的界面行为组
71
+ if (
72
+ row.data._nodeType === 'DE' &&
73
+ this.nodeColumnMap.get(row.data._nodeId)
74
+ ) {
75
+ const nodeColumn = this.nodeColumnMap.get(row.data._nodeId)!;
76
+ if (nodeColumn.deuiactionGroup) {
77
+ deuiactionGroup = nodeColumn.deuiactionGroup;
78
+ }
79
+ }
80
+ return deuiactionGroup;
81
+ }
82
+
20
83
  /**
21
84
  * 给rowController初始化操作列的状态
22
85
  *
@@ -26,10 +89,11 @@ export class TreeGridExUAColumnController extends TreeGridExColumnController<IDE
26
89
  */
27
90
  initActionStates(row: ITreeGridExRowState): void {
28
91
  // 操作列按钮状态控制
29
- const { deuiactionGroup } = this.model;
92
+ const deuiactionGroup = this.getUIActionGroup(row);
93
+
30
94
  if (!deuiactionGroup) {
95
+ ibiz.log.warn(`${this.model.id}操作列没有配置界面行为组`);
31
96
  return;
32
- throw new RuntimeModelError(this.model, '操作列没有配置界面行为组');
33
97
  }
34
98
  if (!deuiactionGroup.uiactionGroupDetails?.length) {
35
99
  ibiz.log.debug('操作列界面行为组没有配置界面行为');
@@ -0,0 +1,163 @@
1
+ import { QXEvent } from 'qx-util';
2
+ import { IPortalAsyncAction, IPortalMessage } from '@ibiz-template/core';
3
+ import { clone } from 'ramda';
4
+ import { isNil, isNumber } from 'lodash-es';
5
+ import dayjs from 'dayjs';
6
+ import { AsyncActionService } from '../../service';
7
+ import { IAsyncActionController, IAsyncActionEvent } from '../../interface';
8
+
9
+ export class AsyncActionController implements IAsyncActionController {
10
+ readonly evt: QXEvent<IAsyncActionEvent> = new QXEvent();
11
+
12
+ total: number = 0;
13
+
14
+ actions: IPortalAsyncAction[] = [];
15
+
16
+ /**
17
+ * 正在处理中的数量
18
+ * @author lxm
19
+ * @date 2024-01-25 04:51:18
20
+ * @type {number}
21
+ */
22
+ doingNum: number = 0;
23
+
24
+ /**
25
+ * 结束的状态值集合
26
+ * @author lxm
27
+ * @date 2024-01-25 05:08:26
28
+ * @protected
29
+ */
30
+ protected finishedStates = [30, 40];
31
+
32
+ /**
33
+ * 请求服务
34
+ * @author lxm
35
+ * @date 2024-01-25 04:50:12
36
+ * @protected
37
+ */
38
+ protected service = new AsyncActionService();
39
+
40
+ async init(): Promise<void> {
41
+ this.listenMessage();
42
+ }
43
+
44
+ /**
45
+ * 监听全局的实时消息
46
+ * @author lxm
47
+ * @date 2024-01-25 04:47:36
48
+ */
49
+ protected listenMessage(): void {
50
+ ibiz.mc.command.asyncAction.on(async (msg: IPortalMessage) => {
51
+ if (!msg.data || msg.subtype !== 'ASYNCACTION') {
52
+ return;
53
+ }
54
+
55
+ const asyncAction = this.formatAsyncAction(
56
+ msg.data as IPortalAsyncAction,
57
+ );
58
+
59
+ const findIndex = this.actions.findIndex(
60
+ item => item.asyncacitonid === asyncAction.asyncacitonid,
61
+ );
62
+
63
+ if (findIndex === -1) {
64
+ this.add(asyncAction);
65
+ } else {
66
+ this.update(asyncAction);
67
+ }
68
+ });
69
+ }
70
+
71
+ /**
72
+ * 格式化数据
73
+ * @author lxm
74
+ * @date 2024-01-25 05:03:47
75
+ * @protected
76
+ * @param {IPortalAsyncAction} data
77
+ * @return {*} {IPortalAsyncAction}
78
+ */
79
+ protected formatAsyncAction(data: IPortalAsyncAction): IPortalAsyncAction {
80
+ // 处理时间日期为毫秒值时,转换成字符串。
81
+ const dateFields = [
82
+ 'begintime',
83
+ 'endtime',
84
+ 'createdate',
85
+ 'updatedate',
86
+ ] as const;
87
+ dateFields.forEach(key => {
88
+ if (isNumber(data[key])) {
89
+ data[key] = dayjs(data[key]).format('YYYY-MM-DD HH:mm:ss');
90
+ }
91
+ });
92
+
93
+ if (!isNil(data.actionresult)) {
94
+ try {
95
+ const json = JSON.parse(data.actionresult as string);
96
+ data.actionresult = json;
97
+ } catch (error) {
98
+ // 不是对象类型就是字符串。
99
+ }
100
+ }
101
+
102
+ if (!isNil(data.completionrate)) {
103
+ const num = Number(data.completionrate);
104
+ if (Number.isNaN(num)) {
105
+ data.completionrate = undefined;
106
+ } else {
107
+ data.completionrate = num;
108
+ }
109
+ }
110
+
111
+ return data;
112
+ }
113
+
114
+ /**
115
+ * 添加一条新消息
116
+ * @author lxm
117
+ * @date 2024-01-25 04:58:37
118
+ * @protected
119
+ * @param {IPortalAsyncAction} action
120
+ */
121
+ protected add(action: IPortalAsyncAction): void {
122
+ this.actions.unshift(action);
123
+
124
+ // 非结束状态的消息加一
125
+ if (!this.finishedStates.includes(action.actionstate)) {
126
+ this.doingNum += 1;
127
+ ibiz.notice.showDoingNotice({ num: this.doingNum });
128
+ } else {
129
+ this.noticeResult(action);
130
+ }
131
+ this.evt.emit('add', clone(action));
132
+ this.evt.emit('dataChange');
133
+ }
134
+
135
+ /**
136
+ * 添加一条新消息
137
+ * @author lxm
138
+ * @date 2024-01-25 04:58:37
139
+ * @protected
140
+ * @param {IPortalAsyncAction} action
141
+ */
142
+ protected update(action: IPortalAsyncAction): void {
143
+ const index = this.actions.findIndex(
144
+ item => item.asyncacitonid === action.asyncacitonid,
145
+ );
146
+ this.actions.splice(index, 1, action);
147
+
148
+ // 执行结束的减一
149
+ if (this.finishedStates.includes(action.actionstate)) {
150
+ this.doingNum -= 1;
151
+ if (this.doingNum <= 0) {
152
+ ibiz.notice.closeDoingNotice();
153
+ }
154
+ this.noticeResult(action);
155
+ }
156
+ this.evt.emit('change', clone(action));
157
+ this.evt.emit('dataChange');
158
+ }
159
+
160
+ protected noticeResult(action: IPortalAsyncAction): void {
161
+ ibiz.notice.showAsyncAction(action);
162
+ }
163
+ }
@@ -0,0 +1 @@
1
+ export { NoticeController } from './notice.controller';
@@ -0,0 +1,64 @@
1
+ import { IInternalMessage } from '@ibiz-template/core';
2
+ import { QXEvent } from 'qx-util';
3
+ import {
4
+ IInternalMessageController,
5
+ InternalMessageEvent,
6
+ } from '../../interface';
7
+ import { InternalMessageService } from '../../service';
8
+
9
+ export class InternalMessageController implements IInternalMessageController {
10
+ readonly evt: QXEvent<InternalMessageEvent> = new QXEvent();
11
+
12
+ total: number = 0;
13
+
14
+ /**
15
+ * 当前分页
16
+ * @author lxm
17
+ * @date 2024-01-26 10:06:28
18
+ * @type {number}
19
+ */
20
+ page: number = 0;
21
+
22
+ size: number = 20;
23
+
24
+ messages: IInternalMessage[] = [];
25
+
26
+ protected service = new InternalMessageService();
27
+
28
+ async init(): Promise<void> {
29
+ this.load();
30
+ }
31
+
32
+ async load(): Promise<void> {
33
+ await this.fetch(false);
34
+ }
35
+
36
+ async loadMore(): Promise<void> {
37
+ await this.fetch(true);
38
+ }
39
+
40
+ protected async fetch(loadMore: boolean = false): Promise<void> {
41
+ // *计算查询参数
42
+ if (loadMore === false) {
43
+ this.page = 0;
44
+ } else {
45
+ this.page += 1;
46
+ }
47
+
48
+ const fetchParams = {
49
+ page: this.page,
50
+ size: this.size,
51
+ sort: 'update_time,desc',
52
+ };
53
+
54
+ const res = await this.service.fetch(fetchParams);
55
+ this.total = res.total!;
56
+
57
+ if (loadMore) {
58
+ this.messages.push(...res.data);
59
+ } else {
60
+ this.messages = res.data;
61
+ }
62
+ this.evt.emit('dataChange');
63
+ }
64
+ }
@@ -0,0 +1,16 @@
1
+ import { INoticeController } from '../../interface';
2
+ import { AsyncActionController } from './async-action.controller';
3
+ import { InternalMessageController } from './internal-message.controller';
4
+
5
+ export class NoticeController implements INoticeController {
6
+ total = 0;
7
+
8
+ asyncAction = new AsyncActionController();
9
+
10
+ internalMessage = new InternalMessageController();
11
+
12
+ async init(): Promise<void> {
13
+ await this.internalMessage.init();
14
+ await this.asyncAction.init();
15
+ }
16
+ }
@@ -9,6 +9,8 @@ import {
9
9
  DefaultErrorHandler,
10
10
  ErrorHandlerCenter,
11
11
  ViewStack,
12
+ AnimeUtil,
13
+ FileUtil,
12
14
  } from '../../utils';
13
15
 
14
16
  /**
@@ -83,6 +85,24 @@ export class GlobalUtil {
83
85
  */
84
86
  readonly viewStack = new ViewStack();
85
87
 
88
+ /**
89
+ * 动画工具类
90
+ *
91
+ * @author zk
92
+ * @date 2024-01-22 09:01:33
93
+ * @memberof GlobalUtil
94
+ */
95
+ readonly anime = new AnimeUtil();
96
+
97
+ /**
98
+ * 文件工具类
99
+ *
100
+ * @author zk
101
+ * @date 2024-01-26 04:01:24
102
+ * @memberof GlobalUtil
103
+ */
104
+ readonly file = new FileUtil();
105
+
86
106
  constructor() {
87
107
  this.error.register(new DefaultErrorHandler());
88
108
  }
@@ -2,7 +2,7 @@ import { IAppDataEntity, IAppView, IApplication } from '@ibiz/model-core';
2
2
  import { Convert } from '../../../hub';
3
3
  import { ModelLoaderProvider } from '../../provider';
4
4
  import { IAppConfigService } from '../i-app-config-service/i-app-config-service';
5
- import { IHubController } from '../../controller';
5
+ import { IHubController, INoticeController } from '../../controller';
6
6
  import { IAppDEService, IConfigService } from '../../service';
7
7
  import { IAppService } from '../i-app-service/i-app-service';
8
8
 
@@ -58,6 +58,14 @@ export interface IAppHubService {
58
58
  */
59
59
  config: IAppConfigService;
60
60
 
61
+ /**
62
+ * 全局消息总控制器
63
+ * @author lxm
64
+ * @date 2024-01-25 06:49:19
65
+ * @type {INoticeController}
66
+ */
67
+ notice: INoticeController;
68
+
61
69
  /**
62
70
  * 注册模型加载适配器
63
71
  *
@@ -10,6 +10,7 @@ import {
10
10
  AuthorityService,
11
11
  CodeListService,
12
12
  DEServiceUtil,
13
+ MqttService,
13
14
  } from '../../../service';
14
15
  import { IConfigService } from '../../service';
15
16
 
@@ -94,6 +95,15 @@ export interface IAppService {
94
95
  */
95
96
  readonly deName2DeCodeName: Map<string, string>;
96
97
 
98
+ /**
99
+ * mqtt 服务
100
+ *
101
+ * @author chitanda
102
+ * @date 2023-10-23 15:10:18
103
+ * @type {MqttService}
104
+ */
105
+ mqtt?: MqttService;
106
+
97
107
  /**
98
108
  * 根据 id 查找应用功能
99
109
  *
@@ -139,4 +149,12 @@ export interface IAppService {
139
149
  deUILogicId: string,
140
150
  appDataEntityId: string,
141
151
  ): Promise<IDEUILogic | undefined>;
152
+
153
+ /**
154
+ * 初始化Mqtt服务
155
+ * @author lxm
156
+ * @date 2024-01-25 10:47:06
157
+ * @return {*} {Promise<void>}
158
+ */
159
+ initMqtt(): Promise<void>;
142
160
  }
@@ -30,7 +30,7 @@ interface AxesOffsets {
30
30
  * @export
31
31
  * @interface IPopoverOptions
32
32
  */
33
- export interface IPopoverOptions {
33
+ export interface IPopoverOptions<O = unknown> {
34
34
  /**
35
35
  * 宽度
36
36
  *
@@ -82,4 +82,13 @@ export interface IPopoverOptions {
82
82
  * @type {boolean}
83
83
  */
84
84
  noArrow?: boolean;
85
+
86
+ /**
87
+ * 原始飘窗参数
88
+ *
89
+ * @author chitanda
90
+ * @date 2024-01-26 09:01:20
91
+ * @type {O}
92
+ */
93
+ options?: O;
85
94
  }
@@ -3,3 +3,4 @@ export * from './common';
3
3
  export * from './i.controller';
4
4
  export * from './view';
5
5
  export * from './editor';
6
+ export * from './notice';