@ibiz-template/runtime 0.3.3 → 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 (51) hide show
  1. package/dist/index.esm.js +255 -43
  2. package/dist/index.system.min.js +2 -2
  3. package/dist/index.system.min.js.map +1 -1
  4. package/out/controller/control/calendar/calendar.controller.d.ts +7 -0
  5. package/out/controller/control/calendar/calendar.controller.d.ts.map +1 -1
  6. package/out/controller/control/calendar/calendar.controller.js +28 -2
  7. package/out/controller/control/chart/chart.controller.d.ts +6 -0
  8. package/out/controller/control/chart/chart.controller.d.ts.map +1 -1
  9. package/out/controller/control/chart/chart.controller.js +5 -3
  10. package/out/controller/control/chart/generator/base-series-generator.d.ts +21 -6
  11. package/out/controller/control/chart/generator/base-series-generator.d.ts.map +1 -1
  12. package/out/controller/control/chart/generator/base-series-generator.js +51 -7
  13. package/out/controller/control/chart/generator/chart-options-generator.d.ts +15 -1
  14. package/out/controller/control/chart/generator/chart-options-generator.d.ts.map +1 -1
  15. package/out/controller/control/chart/generator/chart-options-generator.js +23 -3
  16. package/out/controller/control/chart/generator/funnel-series-generator.d.ts +2 -3
  17. package/out/controller/control/chart/generator/funnel-series-generator.d.ts.map +1 -1
  18. package/out/controller/control/chart/generator/funnel-series-generator.js +1 -5
  19. package/out/controller/control/chart/generator/pie-series-generator.d.ts +2 -3
  20. package/out/controller/control/chart/generator/pie-series-generator.d.ts.map +1 -1
  21. package/out/controller/control/chart/generator/pie-series-generator.js +1 -5
  22. package/out/controller/control/chart/generator/radar-series-generator.d.ts +1 -2
  23. package/out/controller/control/chart/generator/radar-series-generator.d.ts.map +1 -1
  24. package/out/controller/control/chart/generator/radar-series-generator.js +1 -4
  25. package/out/controller/control/exp-bar/chart-exp-bar.controller.d.ts +25 -1
  26. package/out/controller/control/exp-bar/chart-exp-bar.controller.d.ts.map +1 -1
  27. package/out/controller/control/exp-bar/chart-exp-bar.controller.js +68 -2
  28. package/out/interface/controller/state/control/i-chart.state.d.ts +21 -0
  29. package/out/interface/controller/state/control/i-chart.state.d.ts.map +1 -1
  30. package/out/service/vo/chart-data/chart-data.d.ts +11 -0
  31. package/out/service/vo/chart-data/chart-data.d.ts.map +1 -0
  32. package/out/service/vo/chart-data/chart-data.js +50 -0
  33. package/out/service/vo/chart-data/index.d.ts +2 -0
  34. package/out/service/vo/chart-data/index.d.ts.map +1 -0
  35. package/out/service/vo/chart-data/index.js +1 -0
  36. package/out/service/vo/index.d.ts +1 -0
  37. package/out/service/vo/index.d.ts.map +1 -1
  38. package/out/service/vo/index.js +1 -0
  39. package/package.json +3 -3
  40. package/src/controller/control/calendar/calendar.controller.ts +29 -2
  41. package/src/controller/control/chart/chart.controller.ts +11 -3
  42. package/src/controller/control/chart/generator/base-series-generator.ts +71 -9
  43. package/src/controller/control/chart/generator/chart-options-generator.ts +24 -3
  44. package/src/controller/control/chart/generator/funnel-series-generator.ts +3 -7
  45. package/src/controller/control/chart/generator/pie-series-generator.ts +3 -7
  46. package/src/controller/control/chart/generator/radar-series-generator.ts +2 -6
  47. package/src/controller/control/exp-bar/chart-exp-bar.controller.ts +97 -4
  48. package/src/interface/controller/state/control/i-chart.state.ts +24 -0
  49. package/src/service/vo/chart-data/chart-data.ts +75 -0
  50. package/src/service/vo/chart-data/index.ts +1 -0
  51. package/src/service/vo/index.ts +1 -0
@@ -1,4 +1,5 @@
1
1
  import { ExpBarControlController } from './exp-bar.controller';
2
+ import { convertNavData } from '../../../utils';
2
3
  /**
3
4
  * 图表导航栏控制器
4
5
  *
@@ -8,6 +9,65 @@ import { ExpBarControlController } from './exp-bar.controller';
8
9
  * @implements {IChartExpBarController}
9
10
  */
10
11
  export class ChartExpBarController extends ExpBarControlController {
12
+ /**
13
+ * 导航页面首次打开且没有回显时,
14
+ * 默认取第一条数据进行导航
15
+ * 对于不同的导航,第一条可导航的数据可能定义不同,可以重写改方法。
16
+ * @author lxm
17
+ * @date 2023-08-10 03:58:15
18
+ * @protected
19
+ */
20
+ navByFirstItem() {
21
+ const data = this.xDataController.state.items[0];
22
+ if (!data) {
23
+ // 导航视图传空让他导航占位绘制空界面
24
+ this.state.srfnav = '';
25
+ this._evt.emit('onNavViewChange', {
26
+ navViewMsg: {
27
+ key: '',
28
+ isCache: this.isCache,
29
+ },
30
+ });
31
+ return;
32
+ }
33
+ // 默认选中并激活第一项(这里的第一项是我们自己封装的chartData)
34
+ const activeSeriesGenerator = this.xDataController.generator.seriesGenerators.find(generator => {
35
+ return generator.chartDataArr.length > 0 && generator.model.navAppViewId;
36
+ });
37
+ if (activeSeriesGenerator) {
38
+ this.xDataController.setActive(activeSeriesGenerator.chartDataArr[0]);
39
+ }
40
+ }
41
+ /**
42
+ * 解析参数
43
+ *
44
+ * @author zk
45
+ * @date 2023-05-29 04:05:52
46
+ * @param {IDETabViewPanel} tabViewPanel
47
+ * @return {*}
48
+ * @memberof ExpBarControlController
49
+ */
50
+ prepareParams(XDataModel, data, context, params) {
51
+ var _a;
52
+ const { context: tempContext, params: tempParams } = super.prepareParams(XDataModel, data, context, params);
53
+ // 序列上或配置导航相关参数
54
+ if (data._seriesModelId) {
55
+ const seriesModel = (_a = XDataModel.dechartSerieses) === null || _a === void 0 ? void 0 : _a.find(series => {
56
+ return series.id === data._seriesModelId;
57
+ });
58
+ if (seriesModel) {
59
+ const { navigateContexts, navigateParams } = seriesModel;
60
+ // 序列上配的导航视图参数和上下文
61
+ const tempContext2 = convertNavData(navigateContexts, data, params, tempContext);
62
+ const tempParams2 = convertNavData(navigateParams, data, params, tempParams);
63
+ return {
64
+ context: Object.assign(tempContext.clone(), tempContext2),
65
+ params: tempParams2,
66
+ };
67
+ }
68
+ }
69
+ return { context: tempContext, params: tempParams };
70
+ }
11
71
  /**
12
72
  * 获取导航视图
13
73
  *
@@ -19,10 +79,16 @@ export class ChartExpBarController extends ExpBarControlController {
19
79
  */
20
80
  getNavViewMsg(data, context, params) {
21
81
  var _a;
22
- const viewModelId = (_a = this.XDataModel.dechartSerieses) === null || _a === void 0 ? void 0 : _a[0].navAppViewId;
82
+ let viewModelId;
83
+ if (data._seriesModelId) {
84
+ const seriesModel = (_a = this.XDataModel.dechartSerieses) === null || _a === void 0 ? void 0 : _a.find(series => {
85
+ return series.id === data._seriesModelId;
86
+ });
87
+ viewModelId = seriesModel === null || seriesModel === void 0 ? void 0 : seriesModel.navAppViewId;
88
+ }
23
89
  const result = this.prepareParams(this.XDataModel, data, context, params);
24
90
  return {
25
- key: data[this.navKeyName],
91
+ key: data._uuid,
26
92
  context: result.context,
27
93
  params: result.params,
28
94
  viewId: viewModelId,
@@ -9,4 +9,25 @@ import { IMDControlState } from './i-md-control.state';
9
9
  */
10
10
  export interface IChartState extends IMDControlState {
11
11
  }
12
+ /**
13
+ * 图表数据格式
14
+ *
15
+ */
16
+ export interface IChartData {
17
+ /**
18
+ * 序列模型id
19
+ *
20
+ */
21
+ _seriesModelId?: string;
22
+ /**
23
+ * 分组名称
24
+ *
25
+ */
26
+ _groupName?: string;
27
+ /**
28
+ * 分类值
29
+ *
30
+ */
31
+ _catalog?: string;
32
+ }
12
33
  //# sourceMappingURL=i-chart.state.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"i-chart.state.d.ts","sourceRoot":"","sources":["../../../../../src/interface/controller/state/control/i-chart.state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD;;;;;;;GAOG;AACH,MAAM,WAAW,WAAY,SAAQ,eAAe;CAAG"}
1
+ {"version":3,"file":"i-chart.state.d.ts","sourceRoot":"","sources":["../../../../../src/interface/controller/state/control/i-chart.state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD;;;;;;;GAOG;AACH,MAAM,WAAW,WAAY,SAAQ,eAAe;CAAG;AAEvD;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
@@ -0,0 +1,11 @@
1
+ import { IDEChartSeries } from '@ibiz/model-core';
2
+ import { IChartData } from '../../../interface';
3
+ export declare class ChartData implements IChartData {
4
+ [key: string | symbol]: any;
5
+ _seriesModelId?: string;
6
+ _catalog?: string;
7
+ _groupName?: string;
8
+ _uuid?: string;
9
+ constructor(deData: IData, seriesModel?: IDEChartSeries, catalog?: string, groupName?: string);
10
+ }
11
+ //# sourceMappingURL=chart-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chart-data.d.ts","sourceRoot":"","sources":["../../../../src/service/vo/chart-data/chart-data.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAgBhD,qBAAa,SAAU,YAAW,UAAU;IAE1C,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;IAE5B,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,KAAK,CAAC,EAAE,MAAM,CAAC;gBAGb,MAAM,EAAE,KAAK,EACb,WAAW,CAAC,EAAE,cAAc,EAC5B,OAAO,CAAC,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,MAAM;CAuCrB"}
@@ -0,0 +1,50 @@
1
+ /* eslint-disable no-constructor-return */
2
+ import { createUUID } from 'qx-util';
3
+ // 更新属性,缺的补充定义
4
+ function updateKeyDefine(target, keys) {
5
+ keys.forEach(key => {
6
+ if (!Object.prototype.hasOwnProperty.call(target, key)) {
7
+ Object.defineProperty(target, key, {
8
+ enumerable: true,
9
+ configurable: true,
10
+ writable: true,
11
+ value: undefined,
12
+ });
13
+ }
14
+ });
15
+ }
16
+ export class ChartData {
17
+ constructor(deData, seriesModel, catalog, groupName) {
18
+ this._seriesModelId = seriesModel === null || seriesModel === void 0 ? void 0 : seriesModel.id;
19
+ this._catalog = catalog;
20
+ this._groupName = groupName;
21
+ this._uuid = createUUID();
22
+ return new Proxy(this, {
23
+ set(target, p, value) {
24
+ if (Object.prototype.hasOwnProperty.call(deData, p)) {
25
+ deData[p] = value;
26
+ }
27
+ else {
28
+ target[p] = value;
29
+ }
30
+ return true;
31
+ },
32
+ get(target, p, _receiver) {
33
+ if (target[p] !== undefined) {
34
+ return target[p];
35
+ }
36
+ if (deData[p] !== undefined) {
37
+ return deData[p];
38
+ }
39
+ },
40
+ ownKeys(target) {
41
+ // 整合所有并排除重复
42
+ const allKeys = [
43
+ ...new Set([...Object.keys(target), ...Object.keys(deData)]),
44
+ ];
45
+ updateKeyDefine(target, allKeys);
46
+ return allKeys;
47
+ },
48
+ });
49
+ }
50
+ }
@@ -0,0 +1,2 @@
1
+ export { ChartData } from './chart-data';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -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';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibiz-template/runtime",
3
- "version": "0.3.3",
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": "7f8e0137d5d235f6eebab383f046dd91a22ce94c"
62
+ "gitHead": "a6a5031e07ec179ddb6c855023243fe5006290e7"
63
63
  }
@@ -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
  }
@@ -1,10 +1,10 @@
1
1
  import { IChartSeriesPie } from '@ibiz/model-core';
2
- import type { ECElementEvent, PieSeriesOption, SeriesOption } from 'echarts';
2
+ import type { PieSeriesOption, SeriesOption } from 'echarts';
3
3
  import { BaseSeriesGenerator, CatalogData } from './base-series-generator';
4
4
 
5
5
  interface pieSeriesData {
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 PieSeriesGenerator extends BaseSeriesGenerator<IChartSeriesPie> {
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
  }
@@ -1,5 +1,5 @@
1
1
  import { IChartSeriesRadar } from '@ibiz/model-core';
2
- import type { ECElementEvent, RadarSeriesOption, SeriesOption } from 'echarts';
2
+ import type { RadarSeriesOption, SeriesOption } from 'echarts';
3
3
  import { mergeDeepRight } from 'ramda';
4
4
  import { BaseSeriesGenerator, DEFAULT_GROUP } from './base-series-generator';
5
5
  import { RadarCoordSystem } from './radar-coord-system';
@@ -53,7 +53,7 @@ export class RadarSeriesGenerator extends BaseSeriesGenerator<IChartSeriesRadar>
53
53
  const catalogData = groupData[group];
54
54
  const value = radar.indicatorKeys.map(key => {
55
55
  if (catalogData.has(key)) {
56
- return catalogData.get(key);
56
+ return catalogData.get(key)!.value;
57
57
  }
58
58
  return 0;
59
59
  });
@@ -73,8 +73,4 @@ export class RadarSeriesGenerator extends BaseSeriesGenerator<IChartSeriesRadar>
73
73
 
74
74
  return options as SeriesOption;
75
75
  }
76
-
77
- getSrfkeyByParams(params: ECElementEvent): string {
78
- return (params.value as IData)[1];
79
- }
80
76
  }