@ibiz-template/runtime 0.3.2 → 0.3.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 (127) hide show
  1. package/dist/index.esm.js +838 -316
  2. package/dist/index.system.min.js +2 -2
  3. package/dist/index.system.min.js.map +1 -1
  4. package/out/app-hub.d.ts +5 -5
  5. package/out/app-hub.d.ts.map +1 -1
  6. package/out/app-hub.js +2 -2
  7. package/out/constant/sys-uiaction-tag.d.ts +4 -0
  8. package/out/constant/sys-uiaction-tag.d.ts.map +1 -1
  9. package/out/constant/sys-uiaction-tag.js +4 -0
  10. package/out/controller/common/control/control.controller.js +2 -2
  11. package/out/controller/control/app-menu/app-menu.controller.d.ts +2 -3
  12. package/out/controller/control/app-menu/app-menu.controller.d.ts.map +1 -1
  13. package/out/controller/control/calendar/calendar.controller.d.ts +7 -0
  14. package/out/controller/control/calendar/calendar.controller.d.ts.map +1 -1
  15. package/out/controller/control/calendar/calendar.controller.js +28 -2
  16. package/out/controller/control/chart/chart.controller.d.ts +6 -0
  17. package/out/controller/control/chart/chart.controller.d.ts.map +1 -1
  18. package/out/controller/control/chart/chart.controller.js +5 -3
  19. package/out/controller/control/chart/generator/base-series-generator.d.ts +21 -6
  20. package/out/controller/control/chart/generator/base-series-generator.d.ts.map +1 -1
  21. package/out/controller/control/chart/generator/base-series-generator.js +51 -7
  22. package/out/controller/control/chart/generator/chart-options-generator.d.ts +15 -1
  23. package/out/controller/control/chart/generator/chart-options-generator.d.ts.map +1 -1
  24. package/out/controller/control/chart/generator/chart-options-generator.js +23 -3
  25. package/out/controller/control/chart/generator/funnel-series-generator.d.ts +2 -3
  26. package/out/controller/control/chart/generator/funnel-series-generator.d.ts.map +1 -1
  27. package/out/controller/control/chart/generator/funnel-series-generator.js +1 -5
  28. package/out/controller/control/chart/generator/pie-series-generator.d.ts +2 -3
  29. package/out/controller/control/chart/generator/pie-series-generator.d.ts.map +1 -1
  30. package/out/controller/control/chart/generator/pie-series-generator.js +1 -5
  31. package/out/controller/control/chart/generator/radar-series-generator.d.ts +1 -2
  32. package/out/controller/control/chart/generator/radar-series-generator.d.ts.map +1 -1
  33. package/out/controller/control/chart/generator/radar-series-generator.js +1 -4
  34. package/out/controller/control/exp-bar/chart-exp-bar.controller.d.ts +25 -1
  35. package/out/controller/control/exp-bar/chart-exp-bar.controller.d.ts.map +1 -1
  36. package/out/controller/control/exp-bar/chart-exp-bar.controller.js +68 -2
  37. package/out/controller/control/form/search-form/search-form.controller.d.ts +9 -0
  38. package/out/controller/control/form/search-form/search-form.controller.d.ts.map +1 -1
  39. package/out/controller/control/form/search-form/search-form.controller.js +59 -0
  40. package/out/controller/control/grid/grid/grid.controller.d.ts +23 -2
  41. package/out/controller/control/grid/grid/grid.controller.d.ts.map +1 -1
  42. package/out/controller/control/grid/grid/grid.controller.js +73 -21
  43. package/out/controller/control/panel/panel/panel.controller.d.ts +4 -1
  44. package/out/controller/control/panel/panel/panel.controller.d.ts.map +1 -1
  45. package/out/controller/control/panel/panel/panel.controller.js +17 -16
  46. package/out/controller/utils/data-file-util/data-file-util.d.ts +3 -3
  47. package/out/controller/utils/data-file-util/data-file-util.d.ts.map +1 -1
  48. package/out/controller/utils/data-file-util/data-file-util.js +10 -4
  49. package/out/engine/md-view.engine.d.ts.map +1 -1
  50. package/out/engine/md-view.engine.js +8 -0
  51. package/out/interface/common/i-app-hub-service/i-app-hub-service.d.ts +5 -5
  52. package/out/interface/common/i-app-hub-service/i-app-hub-service.d.ts.map +1 -1
  53. package/out/interface/common/i-app-service/i-app-service.d.ts +53 -0
  54. package/out/interface/common/i-app-service/i-app-service.d.ts.map +1 -1
  55. package/out/interface/controller/controller/control/i-grid.controller.d.ts +27 -1
  56. package/out/interface/controller/controller/control/i-grid.controller.d.ts.map +1 -1
  57. package/out/interface/controller/controller/control/i-panel.controller.d.ts +8 -0
  58. package/out/interface/controller/controller/control/i-panel.controller.d.ts.map +1 -1
  59. package/out/interface/controller/state/control/i-chart.state.d.ts +21 -0
  60. package/out/interface/controller/state/control/i-chart.state.d.ts.map +1 -1
  61. package/out/interface/service/service/i-app-de.service.d.ts +66 -0
  62. package/out/interface/service/service/i-app-de.service.d.ts.map +1 -1
  63. package/out/model/utils/util.d.ts +5 -5
  64. package/out/model/utils/util.d.ts.map +1 -1
  65. package/out/model/utils/util.js +14 -6
  66. package/out/service/dto/method.dto.d.ts +2 -2
  67. package/out/service/dto/method.dto.d.ts.map +1 -1
  68. package/out/service/dto/method.dto.js +3 -1
  69. package/out/service/service/config/config.service.d.ts.map +1 -1
  70. package/out/service/service/control/control.service.d.ts +2 -2
  71. package/out/service/service/control/control.service.d.ts.map +1 -1
  72. package/out/service/service/entity/de.service.d.ts +6 -0
  73. package/out/service/service/entity/de.service.d.ts.map +1 -1
  74. package/out/service/service/entity/de.service.js +18 -0
  75. package/out/service/service/entity/method/method.d.ts +2 -3
  76. package/out/service/service/entity/method/method.d.ts.map +1 -1
  77. package/out/service/service/work-flow/work-flow.service.d.ts.map +1 -1
  78. package/out/service/vo/chart-data/chart-data.d.ts +11 -0
  79. package/out/service/vo/chart-data/chart-data.d.ts.map +1 -0
  80. package/out/service/vo/chart-data/chart-data.js +50 -0
  81. package/out/service/vo/chart-data/index.d.ts +2 -0
  82. package/out/service/vo/chart-data/index.d.ts.map +1 -0
  83. package/out/service/vo/chart-data/index.js +1 -0
  84. package/out/service/vo/index.d.ts +1 -0
  85. package/out/service/vo/index.d.ts.map +1 -1
  86. package/out/service/vo/index.js +1 -0
  87. package/out/ui-action/provider/front-ui-action-provider.d.ts +24 -0
  88. package/out/ui-action/provider/front-ui-action-provider.d.ts.map +1 -1
  89. package/out/ui-action/provider/front-ui-action-provider.js +128 -1
  90. package/out/ui-action/provider/sys-ui-action-provider.d.ts.map +1 -1
  91. package/out/ui-action/provider/sys-ui-action-provider.js +2 -0
  92. package/package.json +3 -3
  93. package/src/app-hub.ts +5 -5
  94. package/src/constant/sys-uiaction-tag.ts +4 -0
  95. package/src/controller/common/control/control.controller.ts +2 -2
  96. package/src/controller/control/app-menu/app-menu.controller.ts +2 -2
  97. package/src/controller/control/calendar/calendar.controller.ts +29 -2
  98. package/src/controller/control/chart/chart.controller.ts +11 -3
  99. package/src/controller/control/chart/generator/base-series-generator.ts +71 -9
  100. package/src/controller/control/chart/generator/chart-options-generator.ts +24 -3
  101. package/src/controller/control/chart/generator/funnel-series-generator.ts +3 -7
  102. package/src/controller/control/chart/generator/pie-series-generator.ts +3 -7
  103. package/src/controller/control/chart/generator/radar-series-generator.ts +2 -6
  104. package/src/controller/control/exp-bar/chart-exp-bar.controller.ts +97 -4
  105. package/src/controller/control/form/search-form/search-form.controller.ts +64 -0
  106. package/src/controller/control/grid/grid/grid.controller.ts +110 -27
  107. package/src/controller/control/panel/panel/panel.controller.ts +15 -0
  108. package/src/controller/utils/data-file-util/data-file-util.ts +11 -3
  109. package/src/engine/md-view.engine.ts +8 -0
  110. package/src/interface/common/i-app-hub-service/i-app-hub-service.ts +5 -5
  111. package/src/interface/common/i-app-service/i-app-service.ts +71 -0
  112. package/src/interface/controller/controller/control/i-grid.controller.ts +30 -1
  113. package/src/interface/controller/controller/control/i-panel.controller.ts +9 -0
  114. package/src/interface/controller/state/control/i-chart.state.ts +24 -0
  115. package/src/interface/service/service/i-app-de.service.ts +96 -0
  116. package/src/model/utils/util.ts +16 -6
  117. package/src/service/dto/method.dto.ts +5 -3
  118. package/src/service/service/config/config.service.ts +2 -3
  119. package/src/service/service/control/control.service.ts +2 -2
  120. package/src/service/service/entity/de.service.ts +48 -0
  121. package/src/service/service/entity/method/method.ts +2 -3
  122. package/src/service/service/work-flow/work-flow.service.ts +2 -3
  123. package/src/service/vo/chart-data/chart-data.ts +75 -0
  124. package/src/service/vo/chart-data/index.ts +1 -0
  125. package/src/service/vo/index.ts +1 -0
  126. package/src/ui-action/provider/front-ui-action-provider.ts +153 -1
  127. package/src/ui-action/provider/sys-ui-action-provider.ts +2 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/service/vo/chart-data/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1 @@
1
+ export { ChartData } from './chart-data';
@@ -4,4 +4,5 @@ export * from './ui-map-field';
4
4
  export * from './calendar-item-data';
5
5
  export * from './map-data';
6
6
  export * from './panel-data';
7
+ export * from './chart-data';
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/service/vo/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/service/vo/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
@@ -4,3 +4,4 @@ export * from './ui-map-field';
4
4
  export * from './calendar-item-data';
5
5
  export * from './map-data';
6
6
  export * from './panel-data';
7
+ export * from './chart-data';
@@ -22,5 +22,29 @@ export declare class FrontUIActionProvider extends UIActionProviderBase {
22
22
  * @return {*}
23
23
  */
24
24
  protected doOther(action: IAppDEUIAction, args: IUILogicParams): IUIActionResult;
25
+ /**
26
+ * 执行打印行为
27
+ * @protected
28
+ * @param {IAppDEUIAction} action
29
+ * @param {IUILogicParams} args
30
+ * @return {*}
31
+ */
32
+ protected executePrint(action: IAppDEUIAction, args: IUILogicParams): Promise<void>;
33
+ /**
34
+ * 执行导入行为
35
+ * @protected
36
+ * @param {IAppDEUIAction} action
37
+ * @param {IUILogicParams} args
38
+ * @return {*}
39
+ */
40
+ protected executeDataImport(action: IAppDEUIAction, _args: IUILogicParams): Promise<IUIActionResult>;
41
+ /**
42
+ * 执行导出行为
43
+ * @protected
44
+ * @param {IAppDEUIAction} action
45
+ * @param {IUILogicParams} args
46
+ * @return {*}
47
+ */
48
+ protected executeDataExport(action: IAppDEUIAction, _args: IUILogicParams): Promise<void>;
25
49
  }
26
50
  //# sourceMappingURL=front-ui-action-provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"front-ui-action-provider.d.ts","sourceRoot":"","sources":["../../../src/ui-action/provider/front-ui-action-provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAa,MAAM,kBAAkB,CAAC;AAE7D,OAAO,EAAE,cAAc,EAAE,eAAe,EAAc,MAAM,iBAAiB,CAAC;AAE9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE;;;;;;;;GAQG;AACH,qBAAa,qBAAsB,SAAQ,oBAAoB;IACvD,UAAU,CACd,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,eAAe,CAAC;IAuD3B;;;;;;;;OAQG;IAEH,SAAS,CAAC,OAAO,CACf,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,cAAc,GACnB,eAAe;CAYnB"}
1
+ {"version":3,"file":"front-ui-action-provider.d.ts","sourceRoot":"","sources":["../../../src/ui-action/provider/front-ui-action-provider.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAa,MAAM,kBAAkB,CAAC;AAE7D,OAAO,EAAE,cAAc,EAAE,eAAe,EAAc,MAAM,iBAAiB,CAAC;AAE9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE;;;;;;;;GAQG;AACH,qBAAa,qBAAsB,SAAQ,oBAAoB;IACvD,UAAU,CACd,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,eAAe,CAAC;IAgE3B;;;;;;;;OAQG;IAEH,SAAS,CAAC,OAAO,CACf,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,cAAc,GACnB,eAAe;IAalB;;;;;;OAMG;cACa,YAAY,CAC1B,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,IAAI,CAAC;IAiChB;;;;;;OAMG;cACa,iBAAiB,CAC/B,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,cAAc,GACpB,OAAO,CAAC,eAAe,CAAC;IA8B3B;;;;;;OAMG;cACa,iBAAiB,CAC/B,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,cAAc,GACpB,OAAO,CAAC,IAAI,CAAC;CA4CjB"}
@@ -1,4 +1,4 @@
1
- import { StringUtil, RuntimeModelError, ModelError } from '@ibiz-template/core';
1
+ import { StringUtil, RuntimeModelError, ModelError, RuntimeError, } from '@ibiz-template/core';
2
2
  import { OpenAppViewCommand } from '../../command';
3
3
  import { ScriptFactory } from '../../utils';
4
4
  import { UIActionProviderBase } from './ui-action-provider-base';
@@ -42,6 +42,15 @@ export class FrontUIActionProvider extends UIActionProviderBase {
42
42
  }
43
43
  break;
44
44
  }
45
+ case 'PRINT':
46
+ await this.executePrint(action, args);
47
+ break;
48
+ case 'DATAIMP':
49
+ actionResult = await this.executeDataImport(action, args);
50
+ break;
51
+ case 'DATAEXP':
52
+ await this.executeDataExport(action, args);
53
+ break;
45
54
  case 'OTHER':
46
55
  actionResult = this.doOther(action, args);
47
56
  break;
@@ -69,4 +78,122 @@ export class FrontUIActionProvider extends UIActionProviderBase {
69
78
  }
70
79
  throw new RuntimeModelError(action, '自定义类型缺少配置脚本代码');
71
80
  }
81
+ /**
82
+ * 执行打印行为
83
+ * @protected
84
+ * @param {IAppDEUIAction} action
85
+ * @param {IUILogicParams} args
86
+ * @return {*}
87
+ */
88
+ async executePrint(action, args) {
89
+ var _a, _b;
90
+ const appDataEntity = await ibiz.hub.getAppDataEntity(action.appDataEntityId);
91
+ const appDEPrint = (_a = appDataEntity.appDEPrints) === null || _a === void 0 ? void 0 : _a.find(print => {
92
+ return print.id === action.appDEPrintId;
93
+ });
94
+ if (appDEPrint) {
95
+ let requestUrl = '';
96
+ const { context } = args;
97
+ if (context && context[appDataEntity.codeName.toLowerCase()]) {
98
+ // TODO 临时写死printdata, 非标准,后续优化
99
+ requestUrl += `/${(_b = appDataEntity.codeName2) === null || _b === void 0 ? void 0 : _b.toLowerCase()}/printdata/${context[appDataEntity.codeName.toLowerCase()]}?srfprinttag=${appDEPrint.codeName}`;
100
+ }
101
+ else {
102
+ throw new RuntimeError('没有找到数据主键');
103
+ }
104
+ const res = await ibiz.net.request(requestUrl, {
105
+ method: 'get',
106
+ responseType: 'blob',
107
+ });
108
+ if (res.ok) {
109
+ const link = window.URL.createObjectURL(res.data);
110
+ window.open(link, '_blank');
111
+ }
112
+ else {
113
+ throw new RuntimeError('打印失败');
114
+ }
115
+ }
116
+ else {
117
+ throw new RuntimeError('没有找到实体打印项');
118
+ }
119
+ }
120
+ /**
121
+ * 执行导入行为
122
+ * @protected
123
+ * @param {IAppDEUIAction} action
124
+ * @param {IUILogicParams} args
125
+ * @return {*}
126
+ */
127
+ async executeDataImport(action, _args) {
128
+ var _a;
129
+ const appDataEntity = await ibiz.hub.getAppDataEntity(action.appDataEntityId);
130
+ const appDEDataImport = (_a = appDataEntity.appDEDataImports) === null || _a === void 0 ? void 0 : _a.find(dataImport => dataImport.id === action.appDEDataImportId);
131
+ if (appDEDataImport) {
132
+ const modal = ibiz.overlay.createModal('DataImport', {
133
+ dismiss: () => modal.dismiss(),
134
+ appDataEntity,
135
+ dataImport: appDEDataImport,
136
+ }, {
137
+ width: 'auto',
138
+ placement: 'center',
139
+ });
140
+ modal.present();
141
+ await modal.onWillDismiss();
142
+ return {
143
+ refresh: true,
144
+ refreshMode: 1,
145
+ };
146
+ }
147
+ throw new RuntimeError('没有找到实体导入项');
148
+ }
149
+ /**
150
+ * 执行导出行为
151
+ * @protected
152
+ * @param {IAppDEUIAction} action
153
+ * @param {IUILogicParams} args
154
+ * @return {*}
155
+ */
156
+ async executeDataExport(action, _args) {
157
+ var _a, _b;
158
+ const appDataEntity = await ibiz.hub.getAppDataEntity(action.appDataEntityId);
159
+ const appDEDataExport = (_a = appDataEntity.appDEDataExports) === null || _a === void 0 ? void 0 : _a.find(dataExport => {
160
+ return dataExport.id === action.appDEDataExportId;
161
+ });
162
+ if (appDEDataExport) {
163
+ // TODO 临时写死fetchdefault,应该从appDEDataExport的主表格上获取加载行为,但现在缺主表格模型,后续优化
164
+ const url = `/${(_b = appDataEntity.codeName2) === null || _b === void 0 ? void 0 : _b.toLowerCase()}/exportdata/fetchdefault?srfexporttag=${appDEDataExport.codeName}`;
165
+ // 参数
166
+ const params = {
167
+ page: 0,
168
+ size: appDEDataExport.maxRowCount ? appDEDataExport.maxRowCount : 1000,
169
+ responseType: 'blob',
170
+ };
171
+ const res = await ibiz.net.request(url, {
172
+ method: 'post',
173
+ data: params,
174
+ responseType: 'blob',
175
+ });
176
+ if (res.status === 200) {
177
+ let fileName = `${appDataEntity.logicName}表.xlsx`;
178
+ fileName = decodeURIComponent(fileName);
179
+ const blob = new Blob([res.data], {
180
+ type: 'application/vnd.ms-excel',
181
+ });
182
+ const elink = document.createElement('a');
183
+ elink.download = fileName;
184
+ elink.style.display = 'none';
185
+ elink.href = URL.createObjectURL(blob);
186
+ document.body.appendChild(elink);
187
+ elink.click();
188
+ URL.revokeObjectURL(elink.href); // 释放URL 对象
189
+ document.body.removeChild(elink);
190
+ }
191
+ else {
192
+ throw new RuntimeError('导出请求失败');
193
+ }
194
+ }
195
+ else {
196
+ throw new RuntimeError('没有找到实体导出项');
197
+ }
198
+ }
72
199
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sys-ui-action-provider.d.ts","sourceRoot":"","sources":["../../../src/ui-action/provider/sys-ui-action-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE;;;;;;;;GAQG;AACH,qBAAa,mBAAoB,SAAQ,oBAAoB;IAC3D,OAAO,CAAC,mBAAmB,CAoCxB;IAEG,UAAU,CACd,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,eAAe,CAAC;CAc5B"}
1
+ {"version":3,"file":"sys-ui-action-provider.d.ts","sourceRoot":"","sources":["../../../src/ui-action/provider/sys-ui-action-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE;;;;;;;;GAQG;AACH,qBAAa,mBAAoB,SAAQ,oBAAoB;IAC3D,OAAO,CAAC,mBAAmB,CAsCxB;IAEG,UAAU,CACd,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,eAAe,CAAC;CAc5B"}
@@ -48,6 +48,8 @@ export class SysUIActionProvider extends UIActionProviderBase {
48
48
  ['GRIDVIEW_SAVEROWACTION', 'SaveRow'],
49
49
  ['APP_LOGIN', 'Login'],
50
50
  ['APP_LOGOUT', 'logout'],
51
+ ['UTIL_RESET', 'Reset'],
52
+ ['UTIL_SEARCH', 'Search'],
51
53
  ]);
52
54
  }
53
55
  async execAction(action, args) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibiz-template/runtime",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "控制器包",
5
5
  "type": "module",
6
6
  "main": "out/index.js",
@@ -29,7 +29,7 @@
29
29
  "author": "chitanda",
30
30
  "license": "MIT",
31
31
  "devDependencies": {
32
- "@ibiz-template/core": "^0.3.0",
32
+ "@ibiz-template/core": "^0.3.4",
33
33
  "@ibiz/model-core": "^0.0.20",
34
34
  "@types/path-browserify": "^1.0.2",
35
35
  "@types/qs": "^6.9.10",
@@ -59,5 +59,5 @@
59
59
  "qx-util": "^0.4.8",
60
60
  "ramda": "^0.29.0"
61
61
  },
62
- "gitHead": "792b2b2a3c96a844e7f6d17f47fed4aefdebe2d3"
62
+ "gitHead": "a6a5031e07ec179ddb6c855023243fe5006290e7"
63
63
  }
package/src/app-hub.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { IAppDataEntity, IAppView, IApplication } from '@ibiz/model-core';
2
2
  import { RuntimeError } from '@ibiz-template/core';
3
3
  import { Application } from './application';
4
- import { IAppHubService, ModelLoaderProvider } from './interface';
4
+ import { IAppHubService, IAppService, ModelLoaderProvider } from './interface';
5
5
  import { AppConfigService, Convert } from './hub';
6
6
  import { HubController } from './controller';
7
7
  import { ConfigService } from './service';
@@ -329,9 +329,9 @@ export class AppHub implements IAppHubService {
329
329
  * @author chitanda
330
330
  * @date 2023-04-17 21:04:41
331
331
  * @param {string} [key=ibiz.env.appId]
332
- * @return {*} {Promise<Application>}
332
+ * @return {*} {Promise<IAppService>}
333
333
  */
334
- async getAppAsync(key: string = ibiz.env.appId): Promise<Application> {
334
+ async getAppAsync(key: string = ibiz.env.appId): Promise<IAppService> {
335
335
  return this.createApp(key);
336
336
  }
337
337
 
@@ -341,9 +341,9 @@ export class AppHub implements IAppHubService {
341
341
  * @author chitanda
342
342
  * @date 2023-04-17 22:04:42
343
343
  * @param {(string | IApplication)} [app]
344
- * @return {*} {Application}
344
+ * @return {*} {IAppService}
345
345
  */
346
- getApp(app?: string | IApplication): Application {
346
+ getApp(app?: string | IApplication): IAppService {
347
347
  let key: string | null = null;
348
348
  if (app) {
349
349
  if (app instanceof Object) {
@@ -91,6 +91,10 @@ export enum SysUIActionTag {
91
91
  * 搜索
92
92
  */
93
93
  'SEARCH' = 'Search',
94
+ /**
95
+ * 重置
96
+ */
97
+ 'RESET' = 'Reset',
94
98
  /**
95
99
  * 完成
96
100
  */
@@ -5,7 +5,7 @@ import {
5
5
  IViewLayoutPanel,
6
6
  } from '@ibiz/model-core';
7
7
  import { IBizContext, IBizParams, NoticeError } from '@ibiz-template/core';
8
- import { isNil } from 'ramda';
8
+ import { clone, isNil } from 'ramda';
9
9
  import { notNilEmpty } from 'qx-util';
10
10
  import { BaseController } from '..';
11
11
  import { CTX } from '../../ctx';
@@ -110,7 +110,7 @@ export class ControlController<
110
110
  `${model.controlType}_DEFAULT`,
111
111
  );
112
112
  if (panelModel) {
113
- this.controlPanel = panelModel;
113
+ this.controlPanel = clone(panelModel);
114
114
  }
115
115
 
116
116
  this.updateContextParams({});
@@ -4,12 +4,12 @@ import {
4
4
  RuntimeModelError,
5
5
  } from '@ibiz-template/core';
6
6
  import { IAppMenu, IAppMenuItem } from '@ibiz/model-core';
7
- import { Application } from '../../../application';
8
7
  import { AppFuncCommand } from '../../../command';
9
8
  import {
10
9
  IAppMenuState,
11
10
  IAppMenuEvent,
12
11
  IAppMenuController,
12
+ IAppService,
13
13
  } from '../../../interface';
14
14
  import { AppCounter } from '../../../service';
15
15
  import { ControlController } from '../../common';
@@ -27,7 +27,7 @@ export class AppMenuController
27
27
  extends ControlController<IAppMenu, IAppMenuState, IAppMenuEvent>
28
28
  implements IAppMenuController
29
29
  {
30
- app!: Application;
30
+ app!: IAppService;
31
31
 
32
32
  protected initState(): void {
33
33
  super.initState();
@@ -88,12 +88,35 @@ export class CalendarController
88
88
  await this.afterLoad(args, items);
89
89
  this.state.isLoaded = true;
90
90
  this.state.items = items;
91
+ this.sortItems();
91
92
  await this.evt.emit('onLoadSuccess', {
92
93
  isInitialLoad,
93
94
  });
94
95
  return items;
95
96
  }
96
97
 
98
+ /**
99
+ * 前台排序(时间轴类型)
100
+ * @return {*}
101
+ * @author: zhujiamin
102
+ * @Date: 2023-11-22 15:16:43
103
+ */
104
+ protected sortItems(): void {
105
+ if (this.model.calendarStyle === 'TIMELINE') {
106
+ this.state.items.sort((a: ICalendarItemData, b: ICalendarItemData) => {
107
+ const x = a.beginTime;
108
+ const y = b.beginTime;
109
+ let result = 0;
110
+ if (dayjs(x).isAfter(y)) {
111
+ result = -1;
112
+ } else if (dayjs(x).isBefore(y)) {
113
+ result = 1;
114
+ }
115
+ return result;
116
+ });
117
+ }
118
+ }
119
+
97
120
  /**
98
121
  * 获取当前选中的日期
99
122
  *
@@ -163,8 +186,12 @@ export class CalendarController
163
186
  if (extraParams) {
164
187
  Object.assign(resultParams, extraParams);
165
188
  }
166
- const timeParam = this.getCurSelectDate(resultParams);
167
- Object.assign(resultParams, timeParam);
189
+
190
+ // 时间轴类型不需要开始结束时间参数
191
+ if (this.model.calendarStyle !== 'TIMELINE') {
192
+ const timeParam = this.getCurSelectDate(resultParams);
193
+ Object.assign(resultParams, timeParam);
194
+ }
168
195
  return resultParams;
169
196
  }
170
197
 
@@ -25,6 +25,12 @@ export class ChartController
25
25
  */
26
26
  chart?: EChartsType;
27
27
 
28
+ /**
29
+ * 图表选项生成器
30
+ * @return {*}
31
+ * @author: zhujiamin
32
+ * @Date: 2023-11-23 14:07:39
33
+ */
28
34
  generator!: ChartOptionsGenerator;
29
35
 
30
36
  /**
@@ -70,9 +76,11 @@ export class ChartController
70
76
  initChart(chart: EChartsType): void {
71
77
  this.chart = chart;
72
78
  this.chart.on('click', params => {
73
- const srfkey = this.generator.getSrfkeyByParams(params);
74
- const activeData = this.state.items.find(item => item.srfkey === srfkey);
75
- console.log('实体数据', activeData);
79
+ const activeData = this.generator.getChartDataByParams(params);
80
+ console.log('激活数据', activeData);
81
+ if (activeData) {
82
+ this.setActive(activeData);
83
+ }
76
84
  });
77
85
  }
78
86
 
@@ -15,6 +15,8 @@ import {
15
15
  ChartOptionsGenerator,
16
16
  parseUserParams,
17
17
  } from './chart-options-generator';
18
+ import { IChartData } from '../../../../interface';
19
+ import { ChartData } from '../../../../service';
18
20
 
19
21
  dayjs.extend(minMax);
20
22
  dayjs.extend(isSameOrBefore);
@@ -30,12 +32,12 @@ export type SingleData = {
30
32
  value: number;
31
33
 
32
34
  /**
33
- * 完整的实体数据
35
+ * 图表数据
34
36
  * @author lxm
35
37
  * @date 2023-06-09 09:31:27
36
- * @type {IData}
38
+ * @type {IChartData}
37
39
  */
38
- deData?: IData;
40
+ chartData?: IChartData;
39
41
  };
40
42
  /** 分类数据,key是分类属性的值 */
41
43
  export type CatalogData = Map<string, SingleData>;
@@ -102,6 +104,14 @@ export class BaseSeriesGenerator<T extends IDEChartSeries = IDEChartSeries> {
102
104
  */
103
105
  groupData?: GroupData;
104
106
 
107
+ /**
108
+ * 根据分组处理出来的图表数据数组
109
+ * @author lxm
110
+ * @date 2023-06-09 02:58:28
111
+ * @type {GroupData}
112
+ */
113
+ chartDataArr: IChartData[] = [];
114
+
105
115
  /**
106
116
  * 静态的序列options
107
117
  * @author lxm
@@ -223,6 +233,29 @@ export class BaseSeriesGenerator<T extends IDEChartSeries = IDEChartSeries> {
223
233
  return isExclude ? undefined : val;
224
234
  }
225
235
 
236
+ /**
237
+ * 准备图表数据
238
+ * @return {*}
239
+ * @author: zhujiamin
240
+ * @Date: 2023-11-23 15:24:12
241
+ */
242
+ protected prepareChartData(
243
+ groupData: GroupData,
244
+ deData: IData,
245
+ catalog: string,
246
+ group: string,
247
+ ): void {
248
+ if (this.groupField) {
249
+ Object.assign(deData, { [this.groupField]: group });
250
+ }
251
+ if (this.catalogField) {
252
+ Object.assign(deData, { [this.catalogField]: catalog });
253
+ }
254
+ const tempChartData = new ChartData(deData, this.model, catalog, group);
255
+ groupData[group].get(catalog)!.chartData = tempChartData;
256
+ this.chartDataArr?.push(tempChartData);
257
+ }
258
+
226
259
  /**
227
260
  * 计算分组数据
228
261
  * @author lxm
@@ -233,6 +266,8 @@ export class BaseSeriesGenerator<T extends IDEChartSeries = IDEChartSeries> {
233
266
  protected calcGroupData(data: IData[]): GroupData {
234
267
  // 清空分组数据
235
268
  this.groupData = {};
269
+ // 清空图表数据数组
270
+ this.chartDataArr = [];
236
271
  const groupData = this.groupData!;
237
272
  // 分组属性代码表和分类属性代码表
238
273
  const { seriesCodeListId, catalogCodeListId } = this.model;
@@ -274,6 +309,19 @@ export class BaseSeriesGenerator<T extends IDEChartSeries = IDEChartSeries> {
274
309
  );
275
310
  // 分类属性没值的数据排除
276
311
  if (!catalog) {
312
+ // 有代码表时,也需要封装chartData,此时值定死为0
313
+ if (catalogCodeListId && this.autoCompleteCategory) {
314
+ const codeListItems =
315
+ this.chartGenerator.codeListMap.get(catalogCodeListId)!;
316
+ codeListItems.forEach(x => {
317
+ this.prepareChartData(
318
+ groupData,
319
+ { [this.valueField!]: 0 },
320
+ x.text,
321
+ group,
322
+ );
323
+ });
324
+ }
277
325
  return;
278
326
  }
279
327
 
@@ -286,7 +334,18 @@ export class BaseSeriesGenerator<T extends IDEChartSeries = IDEChartSeries> {
286
334
  groupData[group].get(catalog)!.value,
287
335
  item[this.valueField],
288
336
  );
289
- groupData[group].get(catalog)!.deData = item;
337
+
338
+ // 没有chartData说明是第一条,有chartData说明是累加数据,自己封装里面的deData
339
+ if (!groupData[group].get(catalog)!.chartData) {
340
+ this.prepareChartData(groupData, item, catalog, group);
341
+ } else {
342
+ this.prepareChartData(
343
+ groupData,
344
+ { [this.valueField!]: groupData[group].get(catalog)!.value },
345
+ catalog,
346
+ group,
347
+ );
348
+ }
290
349
  });
291
350
 
292
351
  return groupData;
@@ -325,7 +384,7 @@ export class BaseSeriesGenerator<T extends IDEChartSeries = IDEChartSeries> {
325
384
 
326
385
  /**
327
386
  * 生成每条序列的data,由于不同图表类型格式不同所以为any
328
- * 默认提供的是二维数组,按[X轴,y]格式
387
+ * 默认提供的是二维数组,按[x轴, y轴, 图表数据]格式
329
388
  * @author lxm
330
389
  * @date 2023-06-09 03:38:07
331
390
  * @param {CatalogData} catalogData
@@ -335,7 +394,7 @@ export class BaseSeriesGenerator<T extends IDEChartSeries = IDEChartSeries> {
335
394
  protected calcSeriesData(catalogData: CatalogData): any {
336
395
  const temData: IData[] = [];
337
396
  catalogData.forEach((catalog, key) => {
338
- temData.push([key, catalog.value, catalog.deData?.srfkey]);
397
+ temData.push([key, catalog.value, catalog.chartData]);
339
398
  });
340
399
  return temData;
341
400
  }
@@ -355,14 +414,17 @@ export class BaseSeriesGenerator<T extends IDEChartSeries = IDEChartSeries> {
355
414
  }
356
415
 
357
416
  /**
358
- * 通过事件的params获取主键
417
+ * 通过echarts事件的params获取封装好的图表数据
359
418
  * @author lxm
360
419
  * @date 2023-06-09 10:56:25
361
420
  * @param {ECElementEvent} params
362
421
  * @return {*} {string}
363
422
  */
364
- getSrfkeyByParams(params: ECElementEvent): string {
365
- return (params.value as IData)[2];
423
+ getChartDataByParams(params: ECElementEvent): IData | undefined {
424
+ if (this.groupData && Object.keys(this.groupData).length === 1) {
425
+ return this.groupData[DEFAULT_GROUP].get(params.name)?.chartData;
426
+ }
427
+ return this.groupData?.[params.seriesName!].get(params.name)?.chartData;
366
428
  }
367
429
 
368
430
  /**
@@ -115,6 +115,14 @@ export class ChartOptionsGenerator {
115
115
  */
116
116
  codeListMap: Map<string, Readonly<CodeListItem[]>> = new Map();
117
117
 
118
+ /**
119
+ * 维护图表序列index对应序列生成器Map
120
+ * @return {*}
121
+ * @author: zhujiamin
122
+ * @Date: 2023-11-22 17:27:15
123
+ */
124
+ seriesGeneratorIndexMap: Map<number, BaseSeriesGenerator> = new Map();
125
+
118
126
  constructor(private model: IDEChart) {
119
127
  const {
120
128
  dechartTitle,
@@ -353,12 +361,18 @@ export class ChartOptionsGenerator {
353
361
  // 生成seriesOptions
354
362
  const seriesOption: SeriesOption[] = [];
355
363
  this.seriesGenerators.forEach(generator => {
364
+ const startIndex = seriesOption.length; // 记录当前生成器开始的索引
356
365
  const series = generator.calcByData(data);
357
366
  if (series instanceof Array) {
358
367
  seriesOption.push(...series);
359
368
  } else {
360
369
  seriesOption.push(series);
361
370
  }
371
+ const endIndex = seriesOption.length - 1; // 记录当前生成器结束的索引
372
+ // 将生成器和对应的索引范围存入映射
373
+ for (let i = startIndex; i <= endIndex; i++) {
374
+ this.seriesGeneratorIndexMap.set(i, generator);
375
+ }
362
376
  });
363
377
  this.options.series = seriesOption;
364
378
 
@@ -391,12 +405,19 @@ export class ChartOptionsGenerator {
391
405
  return this.options;
392
406
  }
393
407
 
394
- getSrfkeyByParams(params: ECElementEvent): string {
395
- const generator = this.seriesGenerators[params.seriesIndex!];
408
+ /**
409
+ * 根据echarts给的params得到图表数据
410
+ * @param {ECElementEvent} params
411
+ * @return {*}
412
+ * @author: zhujiamin
413
+ * @Date: 2023-11-22 16:11:50
414
+ */
415
+ getChartDataByParams(params: ECElementEvent): IData | undefined {
416
+ const generator = this.seriesGeneratorIndexMap.get(params.seriesIndex!);
396
417
  if (!generator) {
397
418
  throw new RuntimeError(`找不到${params.seriesIndex}序列的generator!`);
398
419
  }
399
- return generator.getSrfkeyByParams(params);
420
+ return generator.getChartDataByParams(params);
400
421
  }
401
422
 
402
423
  // protected calcRadarSeries(data: IData[], series: IChartSeriesFunnel) {
@@ -1,10 +1,10 @@
1
1
  import { IChartSeriesFunnel } from '@ibiz/model-core';
2
- import type { ECElementEvent, FunnelSeriesOption, SeriesOption } from 'echarts';
2
+ import type { FunnelSeriesOption, SeriesOption } from 'echarts';
3
3
  import { BaseSeriesGenerator, CatalogData } from './base-series-generator';
4
4
 
5
5
  interface funnelSeriesData {
6
6
  name: string;
7
- value: IData[];
7
+ value: Array<number | IData | undefined>;
8
8
  }
9
9
 
10
10
  /**
@@ -30,13 +30,9 @@ export class FunnelSeriesGenerator extends BaseSeriesGenerator<IChartSeriesFunne
30
30
  catalogData.forEach((catalog, key) => {
31
31
  temData.push({
32
32
  name: key,
33
- value: [catalog.value, catalog.deData?.srfkey],
33
+ value: [catalog.value, catalog.chartData],
34
34
  });
35
35
  });
36
36
  return temData;
37
37
  }
38
-
39
- getSrfkeyByParams(params: ECElementEvent): string {
40
- return (params.value as IData)[1];
41
- }
42
38
  }