@ibiz-template/runtime 0.2.8 → 0.2.10

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 (156) hide show
  1. package/dist/index.esm.js +678 -336
  2. package/dist/index.system.min.js +1 -1
  3. package/dist/index.system.min.js.map +1 -1
  4. package/out/controller/common/control/md-control.controller.d.ts.map +1 -1
  5. package/out/controller/common/control/md-control.controller.js +16 -21
  6. package/out/controller/control/form/form-detail/form-detail/form-detail.controller.d.ts +11 -11
  7. package/out/controller/control/form/form-detail/form-detail/form-detail.controller.d.ts.map +1 -1
  8. package/out/controller/control/form/form-detail/form-detail/form-detail.controller.js +22 -16
  9. package/out/controller/control/form/form-detail/form-group-panel/form-group-panel.controller.d.ts +1 -1
  10. package/out/controller/control/form/form-detail/form-group-panel/form-group-panel.controller.d.ts.map +1 -1
  11. package/out/controller/control/form/form-detail/form-group-panel/form-group-panel.controller.js +2 -2
  12. package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl-content-type.controller.js +4 -2
  13. package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl.controller.d.ts +20 -0
  14. package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl.controller.d.ts.map +1 -1
  15. package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl.controller.js +57 -1
  16. package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl.state.d.ts +1 -1
  17. package/out/controller/control/form/form-detail/form-mdctrl/form-mdctrl.state.d.ts.map +1 -1
  18. package/out/controller/control/grid/grid/grid.controller.d.ts.map +1 -1
  19. package/out/controller/control/grid/grid/grid.controller.js +19 -32
  20. package/out/controller/control/map/map.controller.d.ts +6 -0
  21. package/out/controller/control/map/map.controller.d.ts.map +1 -1
  22. package/out/controller/control/map/map.controller.js +37 -3
  23. package/out/controller/control/panel/panel/panel-item.controller.d.ts +1 -0
  24. package/out/controller/control/panel/panel/panel-item.controller.d.ts.map +1 -1
  25. package/out/controller/control/panel/panel/panel-item.controller.js +1 -0
  26. package/out/controller/control/panel/panel/panel.controller.d.ts +3 -1
  27. package/out/controller/control/panel/panel/panel.controller.d.ts.map +1 -1
  28. package/out/controller/control/panel/panel/panel.controller.js +23 -21
  29. package/out/controller/utils/data-file-util/data-file-util.d.ts +45 -0
  30. package/out/controller/utils/data-file-util/data-file-util.d.ts.map +1 -0
  31. package/out/controller/utils/data-file-util/data-file-util.js +121 -0
  32. package/out/controller/utils/index.d.ts +1 -0
  33. package/out/controller/utils/index.d.ts.map +1 -1
  34. package/out/controller/utils/index.js +1 -0
  35. package/out/global/global-util/global-util.d.ts +2 -2
  36. package/out/global/global-util/global-util.d.ts.map +1 -1
  37. package/out/interface/controller/controller/control/panel-item/i-panel-data-container.controller.d.ts +1 -1
  38. package/out/interface/controller/controller/control/panel-item/i-panel-data-container.controller.d.ts.map +1 -1
  39. package/out/interface/controller/controller/control/panel-item/i-panel-item.controller.d.ts +6 -0
  40. package/out/interface/controller/controller/control/panel-item/i-panel-item.controller.d.ts.map +1 -1
  41. package/out/interface/controller/state/control/i-map.state.d.ts +25 -4
  42. package/out/interface/controller/state/control/i-map.state.d.ts.map +1 -1
  43. package/out/interface/index.d.ts +2 -1
  44. package/out/interface/index.d.ts.map +1 -1
  45. package/out/interface/index.js +2 -1
  46. package/out/interface/provider/i-ui-login-node.provider.d.ts +23 -0
  47. package/out/interface/provider/i-ui-login-node.provider.d.ts.map +1 -0
  48. package/out/interface/provider/index.d.ts +1 -0
  49. package/out/interface/provider/index.d.ts.map +1 -1
  50. package/out/interface/ui-login/i-ui-logic-context.d.ts +85 -0
  51. package/out/interface/ui-login/i-ui-logic-context.d.ts.map +1 -0
  52. package/out/interface/ui-login/i-ui-logic-context.js +1 -0
  53. package/out/interface/ui-login/index.d.ts +2 -0
  54. package/out/interface/ui-login/index.d.ts.map +1 -0
  55. package/out/interface/ui-login/index.js +1 -0
  56. package/out/interface/util/{i-export-excel/i-export-excel.d.ts → i-excel-util/i-excel-util.d.ts} +4 -4
  57. package/out/interface/util/i-excel-util/i-excel-util.d.ts.map +1 -0
  58. package/out/interface/util/i-excel-util/i-excel-util.js +1 -0
  59. package/out/interface/util/index.d.ts +1 -1
  60. package/out/interface/util/index.d.ts.map +1 -1
  61. package/out/logic-scheduler/executor/app-ui-logic-executor.d.ts +6 -9
  62. package/out/logic-scheduler/executor/app-ui-logic-executor.d.ts.map +1 -1
  63. package/out/logic-scheduler/executor/app-ui-logic-executor.js +14 -16
  64. package/out/model/data-entity/data-entity.d.ts +0 -11
  65. package/out/model/data-entity/data-entity.d.ts.map +1 -1
  66. package/out/model/data-entity/data-entity.js +0 -14
  67. package/out/model/panel/index.d.ts +1 -0
  68. package/out/model/panel/index.d.ts.map +1 -1
  69. package/out/model/panel/index.js +1 -0
  70. package/out/model/panel/panel-field.d.ts +11 -0
  71. package/out/model/panel/panel-field.d.ts.map +1 -0
  72. package/out/model/panel/panel-field.js +35 -0
  73. package/out/model/utils/util.d.ts +12 -1
  74. package/out/model/utils/util.d.ts.map +1 -1
  75. package/out/model/utils/util.js +18 -0
  76. package/out/register/helper/common-register.js +1 -1
  77. package/out/register/helper/index.d.ts +3 -2
  78. package/out/register/helper/index.d.ts.map +1 -1
  79. package/out/register/helper/index.js +3 -2
  80. package/out/register/helper/ui-logic-node-register.d.ts +25 -0
  81. package/out/register/helper/ui-logic-node-register.d.ts.map +1 -0
  82. package/out/register/helper/ui-logic-node-register.js +37 -0
  83. package/out/service/service/entity/method/de-action.d.ts.map +1 -1
  84. package/out/service/service/entity/method/de-action.js +3 -0
  85. package/out/service/service/entity/method/fetch.d.ts.map +1 -1
  86. package/out/service/service/entity/method/fetch.js +1 -1
  87. package/out/service/vo/index.d.ts +1 -0
  88. package/out/service/vo/index.d.ts.map +1 -1
  89. package/out/service/vo/index.js +1 -0
  90. package/out/service/vo/map-data/map-data.d.ts +1 -1
  91. package/out/service/vo/map-data/map-data.d.ts.map +1 -1
  92. package/out/service/vo/map-data/map-data.js +4 -3
  93. package/out/service/vo/panel-data/index.d.ts +2 -0
  94. package/out/service/vo/panel-data/index.d.ts.map +1 -0
  95. package/out/service/vo/panel-data/index.js +1 -0
  96. package/out/service/vo/panel-data/panel-data.d.ts +26 -0
  97. package/out/service/vo/panel-data/panel-data.d.ts.map +1 -0
  98. package/out/service/vo/panel-data/panel-data.js +90 -0
  99. package/out/service/vo/tree-node-data/tree-data-set-node-data.d.ts.map +1 -1
  100. package/out/service/vo/tree-node-data/tree-data-set-node-data.js +6 -2
  101. package/out/ui-logic/ui-logic-context.d.ts +7 -2
  102. package/out/ui-logic/ui-logic-context.d.ts.map +1 -1
  103. package/out/ui-logic/ui-logic-context.js +5 -0
  104. package/out/ui-logic/ui-logic-node/index.d.ts +1 -0
  105. package/out/ui-logic/ui-logic-node/index.d.ts.map +1 -1
  106. package/out/ui-logic/ui-logic-node/index.js +1 -0
  107. package/out/ui-logic/ui-logic-node/pf-plugin-node/pf-plugin-node.d.ts +17 -0
  108. package/out/ui-logic/ui-logic-node/pf-plugin-node/pf-plugin-node.d.ts.map +1 -0
  109. package/out/ui-logic/ui-logic-node/pf-plugin-node/pf-plugin-node.js +19 -0
  110. package/out/ui-logic/ui-logic.d.ts.map +1 -1
  111. package/out/ui-logic/ui-logic.js +3 -1
  112. package/package.json +2 -2
  113. package/src/controller/common/control/md-control.controller.ts +22 -22
  114. package/src/controller/control/form/form-detail/form-detail/form-detail.controller.ts +35 -25
  115. package/src/controller/control/form/form-detail/form-group-panel/form-group-panel.controller.ts +2 -2
  116. package/src/controller/control/form/form-detail/form-mdctrl/form-mdctrl-content-type.controller.ts +2 -2
  117. package/src/controller/control/form/form-detail/form-mdctrl/form-mdctrl.controller.ts +66 -1
  118. package/src/controller/control/form/form-detail/form-mdctrl/form-mdctrl.state.ts +1 -1
  119. package/src/controller/control/grid/grid/grid.controller.ts +20 -32
  120. package/src/controller/control/map/map.controller.ts +40 -3
  121. package/src/controller/control/panel/panel/panel-item.controller.ts +2 -0
  122. package/src/controller/control/panel/panel/panel.controller.ts +23 -22
  123. package/src/controller/utils/data-file-util/data-file-util.ts +156 -0
  124. package/src/controller/utils/index.ts +1 -0
  125. package/src/global/global-util/global-util.ts +2 -2
  126. package/src/interface/controller/controller/control/panel-item/i-panel-data-container.controller.ts +1 -1
  127. package/src/interface/controller/controller/control/panel-item/i-panel-item.controller.ts +7 -0
  128. package/src/interface/controller/state/control/i-map.state.ts +28 -4
  129. package/src/interface/index.ts +2 -1
  130. package/src/interface/provider/i-ui-login-node.provider.ts +23 -0
  131. package/src/interface/provider/index.ts +1 -0
  132. package/src/interface/ui-login/i-ui-logic-context.ts +95 -0
  133. package/src/interface/ui-login/index.ts +1 -0
  134. package/src/interface/util/{i-export-excel/i-export-excel.ts → i-excel-util/i-excel-util.ts} +3 -3
  135. package/src/interface/util/index.ts +1 -1
  136. package/src/logic-scheduler/executor/app-ui-logic-executor.ts +17 -16
  137. package/src/model/data-entity/data-entity.ts +0 -17
  138. package/src/model/panel/index.ts +1 -0
  139. package/src/model/panel/panel-field.ts +49 -0
  140. package/src/model/utils/util.ts +20 -0
  141. package/src/register/helper/common-register.ts +1 -1
  142. package/src/register/helper/index.ts +3 -2
  143. package/src/register/helper/ui-logic-node-register.ts +52 -0
  144. package/src/service/service/entity/method/de-action.ts +4 -1
  145. package/src/service/service/entity/method/fetch.ts +7 -1
  146. package/src/service/vo/index.ts +1 -0
  147. package/src/service/vo/map-data/map-data.ts +6 -4
  148. package/src/service/vo/panel-data/index.ts +1 -0
  149. package/src/service/vo/panel-data/panel-data.ts +112 -0
  150. package/src/service/vo/tree-node-data/tree-data-set-node-data.ts +6 -2
  151. package/src/ui-logic/ui-logic-context.ts +7 -2
  152. package/src/ui-logic/ui-logic-node/index.ts +1 -0
  153. package/src/ui-logic/ui-logic-node/pf-plugin-node/pf-plugin-node.ts +24 -0
  154. package/src/ui-logic/ui-logic.ts +3 -0
  155. package/out/interface/util/i-export-excel/i-export-excel.d.ts.map +0 -1
  156. /package/out/interface/{util/i-export-excel/i-export-excel.js → provider/i-ui-login-node.provider.js} +0 -0
@@ -114,6 +114,8 @@ export class PanelItemController<T extends IPanelItem = IPanelItem>
114
114
  }
115
115
  }
116
116
 
117
+ destroy(): void {}
118
+
117
119
  /**
118
120
  * 创建面板状态对象
119
121
  *
@@ -16,7 +16,9 @@ import {
16
16
  IControlProvider,
17
17
  IPanelItemContainerController,
18
18
  } from '../../../../interface';
19
+ import { getAllPanelField } from '../../../../model';
19
20
  import { getPanelItemProvider } from '../../../../register';
21
+ import { PanelData } from '../../../../service/vo';
20
22
  import { ControlController } from '../../../common';
21
23
  import { PanelNotifyState } from '../../../constant';
22
24
  import { ControllerEvent } from '../../../utils';
@@ -115,6 +117,14 @@ export class PanelController<
115
117
  this.load();
116
118
  }
117
119
 
120
+ protected async onDestroyed(): Promise<void> {
121
+ await super.onDestroyed();
122
+ this.data.destroy?.();
123
+ Object.values(this.panelItems).forEach(item => {
124
+ item.destroy();
125
+ });
126
+ }
127
+
118
128
  /**
119
129
  * 初始化面板成员控制器
120
130
  *
@@ -183,6 +193,8 @@ export class PanelController<
183
193
  // 转换数据,处理原始数据和面板项的映射。
184
194
  const panelData = this.convertData(data);
185
195
 
196
+ // 清空上一个,如果存在的话。
197
+ this.data.destroy?.();
186
198
  this.state.data = panelData;
187
199
  this.panelStateNotify(PanelNotifyState.LOAD);
188
200
  }
@@ -221,28 +233,18 @@ export class PanelController<
221
233
  * @returns {*} {IData}
222
234
  * @memberof PanelController
223
235
  */
224
- convertData(data: IData): IData {
225
- // const map: IData = {};
226
- // // 绑定数据项和name不一致的映射到map
227
- // this.model.panelFields.forEach(field => {
228
- // if (field.id !== field.dataFieldName) {
229
- // map[field.id] = field.dataFieldName;
230
- // }
231
- // });
236
+ convertData(data: IData): PanelData {
237
+ const fields = getAllPanelField(this.model);
238
+ const fieldKeys = fields.map(item => item.id!);
239
+ const panelData = new PanelData(fields, data);
232
240
 
233
- // return new Proxy(data, {
234
- // get(target, p, receiver) {
235
- // if (Reflect.ownKeys(map).includes(p)) {
236
- // return Reflect.get(target, map[p], receiver);
237
- // }
238
- // return Reflect.get(target, p, receiver);
239
- // },
240
- // set(target, p, value, receiver) {
241
- // Reflect.set(target, p, value, receiver);
242
- // return true;
243
- // },
244
- // });
245
- return data;
241
+ // 面板属性变更的触发变更通知
242
+ panelData._evt.on('change', key => {
243
+ if (fieldKeys.includes(key)) {
244
+ this.dataChangeNotify([key]);
245
+ }
246
+ });
247
+ return panelData;
246
248
  }
247
249
 
248
250
  /**
@@ -287,7 +289,6 @@ export class PanelController<
287
289
 
288
290
  // 改变值
289
291
  this.state.data[name] = value;
290
- this.dataChangeNotify([name]);
291
292
  }
292
293
 
293
294
  protected initControlScheduler(logics: IControlLogic[] = []): void {
@@ -0,0 +1,156 @@
1
+ import {
2
+ IPortalAsyncAction,
3
+ IPortalMessage,
4
+ RuntimeError,
5
+ } from '@ibiz-template/core';
6
+ import { IAppDataEntity } from '@ibiz/model-core';
7
+
8
+ // 异步导入URL
9
+ const asyncImportUrl = '/asyncimportdata2';
10
+
11
+ // 标准导入url
12
+ const importUrl = '/importdata2';
13
+
14
+ // 导入结果类型
15
+ export type ImportDataResult = {
16
+ total: number;
17
+ success: number;
18
+ message?: string;
19
+ };
20
+ // 导出结果类型
21
+ export type IExportDataResult = {
22
+ // 是否导出成功
23
+ ok: boolean;
24
+ // 导出文件地址 (后期异步导出可能会用到)
25
+ url?: string;
26
+ };
27
+
28
+ /**
29
+ * 监听异步作业
30
+ *
31
+ * @author zk
32
+ * @date 2023-10-31 03:10:31
33
+ * @param {string} id
34
+ * @return {*} {Promise<ImportDataResult>}
35
+ */
36
+ function listenAsyncAction(id: string): Promise<ImportDataResult> {
37
+ return new Promise(resolve => {
38
+ const callBack = (msg: IPortalMessage): void => {
39
+ // 兼容接口返回类型与实际返回类型不一致
40
+ const messageid = msg.messageid || (msg.data as IData).asyncacitonid;
41
+ if (
42
+ id === messageid &&
43
+ (msg.data as IPortalAsyncAction).actionstate === 30
44
+ ) {
45
+ // 返回结果是字符串, 需解析
46
+ try {
47
+ const result = JSON.parse(
48
+ (msg.data as IPortalAsyncAction).actionresult as string,
49
+ );
50
+ resolve(result as ImportDataResult);
51
+ } catch (error) {
52
+ throw new RuntimeError('解析数据发生错误');
53
+ } finally {
54
+ // 异步作业结束 取消订阅
55
+ ibiz.mc.command.asyncAction.off(callBack);
56
+ }
57
+ } else if ((msg.data as IPortalAsyncAction).actionstate === 40) {
58
+ resolve({
59
+ total: 0,
60
+ success: 0,
61
+ message: (msg.data as IPortalAsyncAction).actionresult as string,
62
+ });
63
+ // 异步作业结束 取消订阅
64
+ ibiz.mc.command.asyncAction.off(callBack);
65
+ }
66
+ };
67
+ ibiz.mc.command.asyncAction.on(callBack);
68
+ });
69
+ }
70
+
71
+ /**
72
+ * 异步作业导入方法
73
+ *
74
+ * @author zk
75
+ * @date 2023-10-31 02:10:06
76
+ * @export
77
+ * @param {File} file
78
+ * @param {IAppDataEntity} appDataEntity
79
+ * @return {*} {Promise<IData>}
80
+ */
81
+ export async function asyncImportData(
82
+ file: File,
83
+ appDataEntity: IAppDataEntity,
84
+ ): Promise<ImportDataResult> {
85
+ const data = new FormData();
86
+ data.append('file', file);
87
+ const url = `${appDataEntity.codeName2!.toLowerCase()}/${asyncImportUrl}`;
88
+ const res = await ibiz.net.request(url, {
89
+ method: 'post',
90
+ data,
91
+ headers: { 'Content-Type': 'multipart/form-data' },
92
+ });
93
+ return listenAsyncAction(res.data.asyncacitonid);
94
+ }
95
+
96
+ /**
97
+ * 标准导入方法
98
+ *
99
+ * @author zk
100
+ * @date 2023-10-31 02:10:29
101
+ * @export
102
+ * @param {File} file
103
+ * @param {IAppDataEntity} appDataEntity
104
+ * @return {*} {Promise<IData>}
105
+ */
106
+ export async function importData(
107
+ file: File,
108
+ appDataEntity: IAppDataEntity,
109
+ ): Promise<ImportDataResult> {
110
+ const data = new FormData();
111
+ data.append('file', file);
112
+ const url = `${appDataEntity.codeName2!.toLowerCase()}/${importUrl}`;
113
+ const res = await ibiz.net.request(url, {
114
+ method: 'post',
115
+ data,
116
+ headers: { 'Content-Type': 'multipart/form-data' },
117
+ });
118
+ // 错误情况 服务层会抛出异常
119
+ return res.data as ImportDataResult;
120
+ }
121
+
122
+ /**
123
+ * 标准导出方法
124
+ *
125
+ * @author zk
126
+ * @date 2023-10-31 09:10:13
127
+ * @export
128
+ * @param {string[]} header
129
+ * @param {IData[][]} data
130
+ * @param {string} fileName
131
+ * @return {*} {Promise<IExportDataResult>}
132
+ */
133
+ export async function exportData(
134
+ header: string[],
135
+ data: IData[][],
136
+ fileName: string,
137
+ ): Promise<IExportDataResult> {
138
+ if (!ibiz.util.getExcelUtil) {
139
+ throw new RuntimeError('ibiz.util.getExportExcel不存在');
140
+ }
141
+ const exportExcel = await ibiz.util.getExcelUtil();
142
+ if (!exportExcel) {
143
+ throw new RuntimeError('导出模块加载错误');
144
+ }
145
+ try {
146
+ exportExcel.exportJsonToExcel({
147
+ header, // 表头内容 数组格式
148
+ data, // 具体数据 这是个二维数组
149
+ filename: fileName, // 文件名称
150
+ autoWidth: true, // 单元格是否自适应
151
+ });
152
+ return { ok: true };
153
+ } catch (error) {
154
+ return { ok: false };
155
+ }
156
+ }
@@ -6,3 +6,4 @@ export * from './util/util';
6
6
  export * from './value-rule/value-rule';
7
7
  export * from './value-ex/value-ex';
8
8
  export * from './value-default/value-default';
9
+ export * from './data-file-util/data-file-util';
@@ -1,4 +1,4 @@
1
- import { IExportExcelUtil } from '../../interface';
1
+ import { IExcelUtil } from '../../interface';
2
2
  import {
3
3
  TextUtil,
4
4
  LayoutPanelUtil,
@@ -67,7 +67,7 @@ export class GlobalUtil {
67
67
  * @author lxm
68
68
  * @date 2023-08-24 10:47:06
69
69
  */
70
- getExportExcel?: () => Promise<IExportExcelUtil>;
70
+ getExcelUtil?: () => Promise<IExcelUtil>;
71
71
 
72
72
  /**
73
73
  * 显示应用级别的加载提示
@@ -25,5 +25,5 @@ export interface IPanelDataContainerController
25
25
  * @param {string} name 要设置的数据的属性名称
26
26
  * @param {unknown} value 要设置的值
27
27
  */
28
- setDataValue?(name: string, value: unknown): Promise<void>;
28
+ setDataValue(name: string, value: unknown): Promise<void>;
29
29
  }
@@ -52,4 +52,11 @@ export interface IPanelItemController {
52
52
  * @date 2022-09-20 18:09:07
53
53
  */
54
54
  panelStateNotify(state: PanelNotifyState): Promise<void>;
55
+
56
+ /**
57
+ * 销毁方法
58
+ * @author lxm
59
+ * @date 2023-11-02 03:31:29
60
+ */
61
+ destroy(): void;
55
62
  }
@@ -27,6 +27,22 @@ export interface IMapState extends IMDControlState {
27
27
  */
28
28
  areaData: IMapData[];
29
29
 
30
+ /**
31
+ * 区域编码是否是字符串
32
+ * @author lxm
33
+ * @date 2023-11-01 03:30:09
34
+ * @type {boolean}
35
+ */
36
+ strAreaCode: boolean;
37
+
38
+ /**
39
+ * 默认显示的区域代码
40
+ * @author lxm
41
+ * @date 2023-10-31 09:03:23
42
+ * @type {string}
43
+ */
44
+ defaultAreaCode: string | number;
45
+
30
46
  /**
31
47
  * 当前区域代码
32
48
  * @author lxm
@@ -34,6 +50,14 @@ export interface IMapState extends IMDControlState {
34
50
  * @type {string}
35
51
  */
36
52
  areaCode: string | number;
53
+
54
+ /**
55
+ * 地图json数据基础路径
56
+ * @author lxm
57
+ * @date 2023-11-01 03:37:19
58
+ * @type {string}
59
+ */
60
+ jsonBaseUrl?: string;
37
61
  }
38
62
 
39
63
  /**
@@ -52,12 +76,12 @@ export interface IMapData {
52
76
  _id: string;
53
77
 
54
78
  /**
55
- * 类型
79
+ * 呈现样式
56
80
  * @author lxm
57
- * @date 2023-10-30 06:20:14
58
- * @type {('point' | 'area')}
81
+ * @date 2023-11-02 04:59:12
82
+ * @type {string}
59
83
  */
60
- _type: 'point' | 'area';
84
+ _itemStyle: string;
61
85
 
62
86
  /**
63
87
  * 地图项id
@@ -1,5 +1,4 @@
1
1
  export * from './common';
2
- export * from './util';
3
2
  export * from './provider';
4
3
  export * from './register';
5
4
  export * from './controller';
@@ -8,3 +7,5 @@ export * from './engine';
8
7
  export * from './logic-scheduler';
9
8
  export * from './model';
10
9
  export * from './studio';
10
+ export * from './ui-login';
11
+ export * from './util';
@@ -0,0 +1,23 @@
1
+ import { IDEUIPFPluginLogic } from '@ibiz/model-core';
2
+ import { IUILogicContext } from '../ui-login';
3
+
4
+ /**
5
+ * 界面逻辑前端节点适配器
6
+ *
7
+ * @author chitanda
8
+ * @date 2023-11-01 17:11:16
9
+ * @export
10
+ * @interface IUILogicNodeProvider
11
+ */
12
+ export interface IUILogicNodeProvider {
13
+ /**
14
+ * 执行界面逻辑 节点
15
+ *
16
+ * @author chitanda
17
+ * @date 2023-11-01 18:11:17
18
+ * @param {IDEUIPFPluginLogic} model
19
+ * @param {IUILogicContext} ctx
20
+ * @return {*} {Promise<unknown>}
21
+ */
22
+ exec(model: IDEUIPFPluginLogic, ctx: IUILogicContext): Promise<unknown>;
23
+ }
@@ -9,3 +9,4 @@ export * from './i-form-detail.provider';
9
9
  export * from './i-editor.provider';
10
10
  export * from './i-portlet.provider';
11
11
  export { IAppCounterProvider } from './i-app-counter.provider';
12
+ export type { IUILogicNodeProvider } from './i-ui-login-node.provider';
@@ -0,0 +1,95 @@
1
+ export interface IUILogicContext {
2
+ /**
3
+ * 上一次返回值
4
+ */
5
+ lastReturn: unknown;
6
+
7
+ /**
8
+ * 上下文
9
+ */
10
+ readonly context: IContext;
11
+
12
+ /**
13
+ * 数据
14
+ */
15
+ readonly data: IData;
16
+
17
+ /**
18
+ * 视图参数
19
+ */
20
+ readonly viewParam: IParams;
21
+
22
+ /**
23
+ * 界面逻辑参数
24
+ *
25
+ * @author chitanda
26
+ * @date 2023-11-01 17:11:52
27
+ * @type {Record<string, unknown>}
28
+ */
29
+ readonly params: Record<string, unknown>;
30
+
31
+ /**
32
+ * UI 逻辑执行返回值
33
+ *
34
+ * @author chitanda
35
+ * @date 2023-11-01 17:11:29
36
+ * @type {unknown}
37
+ */
38
+ result: unknown;
39
+
40
+ /**
41
+ * 是否存在结束节点
42
+ *
43
+ * @author chitanda
44
+ * @date 2023-11-01 17:11:57
45
+ * @type {boolean}
46
+ */
47
+ isEndNode: boolean;
48
+
49
+ /**
50
+ * 默认参数节点名称
51
+ *
52
+ * @default 'Default'
53
+ * @author chitanda
54
+ * @date 2023-11-01 17:11:31
55
+ * @type {string}
56
+ */
57
+ defaultParamName: string;
58
+
59
+ /**
60
+ * 重置实体逻辑参数
61
+ *
62
+ * @author chitanda
63
+ * @date 2023-11-01 17:11:18
64
+ * @param {string} name
65
+ */
66
+ resetParam(name: string): void;
67
+
68
+ /**
69
+ * 设置上一次返回值
70
+ *
71
+ * @author chitanda
72
+ * @date 2023-11-01 17:11:31
73
+ * @param {string} name
74
+ */
75
+ renewParam(name: string): void;
76
+
77
+ /**
78
+ * 设置上一次返回值
79
+ *
80
+ * @author chitanda
81
+ * @date 2023-11-01 17:11:48
82
+ * @param {unknown} value
83
+ */
84
+ setLastReturn(value: unknown): void;
85
+
86
+ /**
87
+ * 是否是实体参数变量(即后台数据对象)
88
+ *
89
+ * @author chitanda
90
+ * @date 2023-11-01 17:11:01
91
+ * @param {string} paramId
92
+ * @return {*} {boolean}
93
+ */
94
+ isEntityParam(paramId: string): boolean;
95
+ }
@@ -0,0 +1 @@
1
+ export type { IUILogicContext } from './i-ui-logic-context';
@@ -1,11 +1,11 @@
1
1
  /**
2
- * 导出excel文件工具
2
+ * excel文件工具
3
3
  * @author lxm
4
4
  * @date 2023-08-24 10:45:32
5
5
  * @export
6
- * @interface IExportExcelUtil
6
+ * @interface IExcelUtil
7
7
  */
8
- export interface IExportExcelUtil {
8
+ export interface IExcelUtil {
9
9
  /**
10
10
  * 导出成Excel文件
11
11
  * @author lxm
@@ -12,4 +12,4 @@ export { IOverlayController } from './i-overlay-controller/i-overlay-controller'
12
12
  export { IOverlayPopoverContainer } from './i-overlay-popover-container/i-overlay-popover-container';
13
13
 
14
14
  export { IScriptFunctionOpts } from './script/i-script-function';
15
- export { IExportExcelUtil } from './i-export-excel/i-export-excel';
15
+ export { IExcelUtil } from './i-excel-util/i-excel-util';
@@ -12,7 +12,7 @@ import {
12
12
  import { notNilEmpty } from 'qx-util';
13
13
  import { OpenAppViewCommand } from '../../command';
14
14
  import { IModalData, IUILogicParams } from '../../interface';
15
- import { calcDeCodeNameById, getFormTypeFieldName } from '../../model';
15
+ import { calcDeCodeNameById } from '../../model';
16
16
  import { convertNavData } from '../../utils';
17
17
  import { LogicExecutor } from './logic-executor';
18
18
  import { Srfuf } from '../../service';
@@ -47,16 +47,13 @@ export class AppUILogicExecutor extends LogicExecutor {
47
47
  }
48
48
 
49
49
  /**
50
- * 执行应用预置界面逻辑opendata
50
+ * 执行应用预置界面逻辑 opendata
51
51
  *
52
- * @author lxm
53
- * @date 2022-08-22 14:08:03
54
- * @export
55
- * @param {IPSAppUIOpenDataLogic} appUILogic 应用预置界面逻辑opendata模型对象
56
- * @param {IContext} context 上下文参数
57
- * @param {(IData | null)} data 数据集合
58
- * @param {IParams} params 视图参数
59
- * @param {IData} [opts] 额外参数,event是js原生事件
52
+ * @author chitanda
53
+ * @date 2023-11-02 11:11:36
54
+ * @param {IAppUIOpenDataLogic} appUILogic 应用预置界面逻辑 opendata 模型对象
55
+ * @param {IUILogicParams} parameters
56
+ * @return {*} {Promise<IModalData>}
60
57
  */
61
58
  async executeOpenDataAppUILogic(
62
59
  appUILogic: IAppUIOpenDataLogic,
@@ -67,6 +64,7 @@ export class AppUILogicExecutor extends LogicExecutor {
67
64
  if (!data?.[0]) {
68
65
  throw new RuntimeError('opendata没有可操作数据!');
69
66
  }
67
+ // openDataAppViews 只有[索引实体]或[多表单实体]才会有值
70
68
  const openViewRefs = appUILogic.openDataAppViews;
71
69
  let openViewRef: IAppUILogicRefViewBase | undefined;
72
70
  if (openViewRefs) {
@@ -118,18 +116,21 @@ export class AppUILogicExecutor extends LogicExecutor {
118
116
  appUILogic: IAppUIOpenDataLogic,
119
117
  parameters: IUILogicParams,
120
118
  ): Promise<IAppUILogicRefViewBase> {
121
- const appDataEntityId = parameters.view.model.appDataEntityId!;
122
- // 表单类型属性
123
- const formTypeName = await getFormTypeFieldName(appDataEntityId);
124
- if (!formTypeName) {
119
+ const appDataEntity = await ibiz.hub.getAppDataEntity(
120
+ parameters.view.model.appDataEntityId!,
121
+ )!;
122
+ // [多表单实体] or [索引实体]类型属性
123
+ const typeFileName =
124
+ appDataEntity.formTypeAppDEFieldId || appDataEntity.dataTypeAppDEFieldId;
125
+ if (!typeFileName) {
125
126
  throw new RuntimeModelError(
126
127
  appUILogic,
127
- `${appDataEntityId}实体缺少表单类型应用实体属性`,
128
+ `${appDataEntity.codeName}[多表单实体] or [索引实体]缺少类型属性配置`,
128
129
  );
129
130
  }
130
131
  const { data } = parameters;
131
132
  // 表单类型值
132
- const formTypeValue = data[0][formTypeName];
133
+ const formTypeValue = data[0][typeFileName];
133
134
  if (!formTypeValue) {
134
135
  throw new RuntimeModelError(appUILogic, '数据源无表单类型应用实体属性值');
135
136
  }
@@ -52,23 +52,6 @@ export async function getDeACMode(
52
52
  return deACMode;
53
53
  }
54
54
 
55
- /**
56
- * 从实体里找到表单类型应用实体属性
57
- *
58
- * @author zk
59
- * @date 2023-09-07 05:09:41
60
- * @export
61
- * @param {string} entityId
62
- * @param {string} [srfappid]
63
- * @return {*} {(Promise<string | undefined>)}
64
- */
65
- export async function getFormTypeFieldName(
66
- entityId: string,
67
- ): Promise<string | undefined> {
68
- const appDataEntity = await ibiz.hub.getAppDataEntity(entityId)!;
69
- return appDataEntity.formTypeAppDEFieldId;
70
- }
71
-
72
55
  /**
73
56
  * 从实体里找到实体逻辑
74
57
  * @author lxm
@@ -1 +1,2 @@
1
1
  export * from './data-container';
2
+ export * from './panel-field';
@@ -0,0 +1,49 @@
1
+ import {
2
+ IPanel,
3
+ IPanelContainer,
4
+ IPanelField,
5
+ IPanelItem,
6
+ } from '@ibiz/model-core';
7
+ import { isDataContainer } from './data-container';
8
+
9
+ const ChildKeys = ['panelItems', 'panelTabPages', 'rootPanelItems'] as const;
10
+
11
+ function _getAllPanelField(model: IData): IPanelField[] {
12
+ let childItems: IPanelItem[] = [];
13
+ for (const key of ChildKeys) {
14
+ if (model[key]) {
15
+ childItems = model[key];
16
+ break;
17
+ }
18
+ }
19
+ const fields: IPanelField[] = [];
20
+
21
+ if (childItems.length) {
22
+ // 过滤出当前层级的子里面的所有面板属性
23
+ fields.push(...childItems.filter(item => item.itemType === 'FIELD'));
24
+
25
+ // 递归遍历拿子里面的成员
26
+ childItems.forEach(item => {
27
+ // 如果是数据容器则不往下找
28
+ if (!isDataContainer(item)) {
29
+ fields.push(..._getAllPanelField(item));
30
+ }
31
+ });
32
+ }
33
+
34
+ return fields;
35
+ }
36
+
37
+ /**
38
+ * 获取所有子面板属性模型
39
+ * @author lxm
40
+ * @date 2023-11-01 04:45:44
41
+ * @export
42
+ * @param {(IPanel | IPanelContainer)} model
43
+ * @return {*} {IPanelField[]}
44
+ */
45
+ export function getAllPanelField(
46
+ model: IPanel | IPanelContainer,
47
+ ): IPanelField[] {
48
+ return _getAllPanelField(model);
49
+ }
@@ -1,8 +1,10 @@
1
1
  import {
2
2
  IAppView,
3
3
  IAppViewRef,
4
+ IApplication,
4
5
  IControl,
5
6
  IModelObject,
7
+ ISysPFPlugin,
6
8
  } from '@ibiz/model-core';
7
9
 
8
10
  /**
@@ -106,3 +108,21 @@ export function parseUserParams(userParams: Record<string, string>): {
106
108
 
107
109
  return { navigateContexts, navigateParams, other };
108
110
  }
111
+
112
+ /**
113
+ * 从应用里面获取插件配置参数
114
+ *
115
+ * @author chitanda
116
+ * @date 2023-11-01 17:11:28
117
+ * @export
118
+ * @param {IApplication} app
119
+ * @param {string} id
120
+ * @return {*} {ISysPFPlugin}
121
+ */
122
+ export function getPFPlugin(app: IApplication, id: string): ISysPFPlugin {
123
+ const plugin = app.appPFPluginRefs?.find(item => item.id === id);
124
+ if (!plugin) {
125
+ throw new Error(`未找到插件${id}`);
126
+ }
127
+ return plugin;
128
+ }