dcim-topology2d 2.0.2 → 2.0.6

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 (45) hide show
  1. package/chart-diagram/index.d.ts +1 -1
  2. package/chart-diagram/index.js +1 -1
  3. package/chart-diagram/src/echarts/index.js +17 -11
  4. package/chart-diagram/src/register.js +2 -2
  5. package/chart-diagram/src/utils/changeOptions.d.ts +3 -0
  6. package/chart-diagram/src/utils/changeOptions.js +61 -1
  7. package/chart-diagram/src/utils/conversion.d.ts +1 -0
  8. package/chart-diagram/src/utils/conversion.js +63 -41
  9. package/chart-diagram/src/utils/render.d.ts +1 -0
  10. package/chart-diagram/src/utils/render.js +24 -0
  11. package/core/src/common.js +121 -25
  12. package/core/src/core.js +83 -17
  13. package/core/src/divLayer.js +2 -2
  14. package/core/src/element/select.d.ts +2 -2
  15. package/core/src/element/select.js +119 -56
  16. package/core/src/element/tab.js +12 -11
  17. package/core/src/healps/changeData.js +20 -6
  18. package/core/src/middles/nodes/formoverflow.js +61 -0
  19. package/core/src/middles/nodes/formselect.js +40 -18
  20. package/core/src/middles/nodes/iframe.js +5 -5
  21. package/core/src/middles/nodes/index.d.ts +2 -1
  22. package/core/src/middles/nodes/index.js +1 -0
  23. package/core/src/models/node.js +7 -0
  24. package/core/src/models/pen.js +2 -50
  25. package/core/src/options.d.ts +2 -1
  26. package/core/src/options.js +2 -1
  27. package/core/src/preview.js +6 -1
  28. package/core/src/store/data.d.ts +74 -19
  29. package/core/src/store/data.js +102 -34
  30. package/core/src/utils/assignment.d.ts +1 -1
  31. package/core/src/utils/assignment.js +53 -23
  32. package/core/src/utils/construction.d.ts +4 -1
  33. package/core/src/utils/construction.js +3 -1
  34. package/core/src/utils/conversion.d.ts +3 -2
  35. package/core/src/utils/conversion.js +65 -19
  36. package/core/src/utils/onmousevent.d.ts +1 -1
  37. package/core/src/utils/onmousevent.js +4 -5
  38. package/core/src/utils/params.d.ts +2 -7
  39. package/core/src/utils/params.js +22 -87
  40. package/myShape-diagram/{myShape.js → index.js} +3 -0
  41. package/package.json +1 -1
  42. package/store/actions.js +1 -17
  43. package/store/clear.js +0 -62
  44. package/core/src/poll.js +0 -37
  45. /package/myShape-diagram/{myShape.ts → index.ts} +0 -0
@@ -2,4 +2,4 @@
2
2
  export * from './src/utils';
3
3
  export * from './src/echarts';
4
4
  export * from './src/register';
5
- export * from '../myShape-diagram/myShape';
5
+ export * from '../myShape-diagram/index.js';
@@ -1,5 +1,5 @@
1
1
  export * from './src/utils';
2
2
  export * from './src/echarts';
3
3
  export * from './src/register';
4
- export * from '../myShape-diagram/myShape.js';
4
+ export * from '../myShape-diagram/index.js';
5
5
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,5 @@
1
1
  import {s8, createDiv, rectangle, commonStore} from '../../../core';
2
+ import {plugsPool} from '../../../store';
2
3
  import {
3
4
  setMapLineBarOptions,
4
5
  setMapGaugeOptions,
@@ -6,20 +7,21 @@ import {
6
7
  setMap3dBarOptions,
7
8
  setMapTopOptions,
8
9
  setMapGlobalOptions,
9
- setMapDataOptions
10
+ setMapDataOptions,
11
+ initBindTabSetting
10
12
  } from '../utils';
11
13
  import {echartsTypeMap} from '../../../static';
12
- import {echartsDataPool, echartsOptionsPool} from '../../../store';
13
14
 
14
15
  export function echarts(ctx, node) {
15
- if (!(commonStore[node.TID] && commonStore[node.TID].data.dataResize)) return;
16
+ const currentStore = commonStore[node.TID];
17
+ if (!(currentStore && currentStore.data.dataResize)) return;
16
18
  //console.log('echarts绘制-----node', node);
17
19
  // if(currentElement) currentElement.style.display = !node.visible ? 'none': 'block';
18
20
  // if(!node.visible) return;
19
21
  // 绘制一个底图,类似于占位符。
20
22
  rectangle(ctx, node)
21
23
  // tslint:disable-next-line:no-shadowed-variable
22
- var echarts = echartsDataPool.echarts || window.echarts
24
+ var echarts = plugsPool.echarts || window.echarts
23
25
  if (!node.data || !echarts) {
24
26
  return
25
27
  }
@@ -32,7 +34,7 @@ export function echarts(ctx, node) {
32
34
  if (!node.elementId) {
33
35
  node.elementId = s8()
34
36
  }
35
- let echartsData = echartsDataPool[node.id];
37
+ let echartsData = currentStore.echartsDataPool[node.id];
36
38
  if (!node.elementLoaded && !(echartsData && echartsData.div)) {
37
39
  if(!echartsData) {
38
40
  echartsData = {
@@ -51,7 +53,7 @@ export function echarts(ctx, node) {
51
53
  setTimeout(function () {
52
54
  echartsData.chart.resize()
53
55
  });
54
- echartsDataPool[node.id] = echartsData;
56
+ currentStore.echartsDataPool[node.id] = echartsData;
55
57
  }
56
58
  if (!node.elementRendered) {
57
59
  const appearance = node.appearance;
@@ -59,8 +61,10 @@ export function echarts(ctx, node) {
59
61
  setTimeout(function () {
60
62
  let option = node.data.echarts.option;
61
63
  if(!(echartsData && echartsData.chart)) return;
62
- const isLocked = commonStore[node.TID] && commonStore[node.TID].data.locked;
63
- if (!isLocked || !echartsOptionsPool[node.id]) {
64
+ if(node.data.params) node.data.params.tabCorrelationType = echartsData.tabCorrelationType || ''; // 统计图与Tab关联
65
+ const isLocked = currentStore.data.locked;
66
+ if (!isLocked || !currentStore.echartsOptionsPool[node.id]) {
67
+ const tabData = initBindTabSetting(node); // 初始化Tabs数据配置
64
68
  // 【未锁定(编辑)状态, options未初始化的状态】
65
69
  if (!appearance.type) appearance.type = echartsTypeMap[`type_${option.displayMode}`]; // 兼容旧数据配置
66
70
  // 公共配置 Top排行榜跳过公共属性配置
@@ -77,18 +81,20 @@ export function echarts(ctx, node) {
77
81
  if (appearance.type === 'TOP') setMapTopOptions(option, node);
78
82
  //option.title = appearance.title;
79
83
  option.backgroundColor = appearance.backgroundColor;
80
- echartsOptionsPool[node.id] = {
84
+ currentStore.echartsOptionsPool[node.id] = {
81
85
  option: JSON.parse(JSON.stringify(option)),
82
86
  data: {
87
+ TID: node.TID,
83
88
  appearance,
84
89
  id: node.id,
85
- params: node.data.params
90
+ params: node.data.params,
91
+ tabData
86
92
  }
87
93
  };
88
94
  if (!isLocked) echartsData.chart.clear();
89
95
  }
90
96
  // echarts 数据渲染更新
91
- setMapDataOptions(option, node);
97
+ setMapDataOptions(option, currentStore.echartsOptionsPool[node.id].data);
92
98
 
93
99
  node.elementRendered = true;
94
100
  })
@@ -1,9 +1,9 @@
1
1
  import { registerNode } from '../../core';
2
2
  import { echarts } from './echarts';
3
- import { echartsDataPool } from '../../store';
3
+ import { plugsPool } from '../../store';
4
4
  // import './echarts/echarts.min.js';
5
5
  export function register(_echarts) {
6
- echartsDataPool.echarts = _echarts;
6
+ plugsPool.echarts = _echarts;
7
7
  // if (process.browser && !echartsDataPool.echarts && !window.echarts) {
8
8
  // //loadJS('https://cdn.bootcdn.net/ajax/libs/echarts/4.8.0/echarts.min.js', null, true);
9
9
  // loadJS(`${location.origin}/libary/echarts.min.js`, null, true);
@@ -1,3 +1,6 @@
1
+ export declare function setRingChartText<T>(textData: T): void;
2
+ export declare function setRingPreSeriesOptions<T>(option: T, appearance: T): void;
3
+ export declare function setRingProSeriesOptions<T>(option: T, appearance: T): void;
1
4
  export declare function setChartLegendData<T>(legend: T, appearance: T): void;
2
5
  export declare function setChartXAxisData<T>(xAxis: [], appearance: T): void;
3
6
  export declare function setChartYAxisData<T>(yAxis: [], appearance: T): void;
@@ -7,6 +7,62 @@ import {
7
7
  echartsColorData
8
8
  } from '../../../static';
9
9
 
10
+ // 配置环形图中间区域文字样式
11
+ export function setRingChartText(textData) {
12
+ const {
13
+ vFontSize, vFontWeight, vColor,
14
+ vTop, unitTop, unitFontSize, unitFontWeight,
15
+ unitColor} = textData;
16
+ if(!unitTop) textData.unitTop = 0;
17
+ return {
18
+ v: {
19
+ fontSize: vFontSize,
20
+ fontWeight: vFontWeight,
21
+ color: vColor,
22
+ padding: [vTop, 0, 0, 0]
23
+ },
24
+ unit: {
25
+ fontSize: unitFontSize,
26
+ fontWeight: unitFontWeight,
27
+ color: unitColor,
28
+ padding: [unitTop, 0, 0, 0]
29
+ }
30
+ };
31
+ }
32
+ // 配置环形‘设备告警统计图’节点展示
33
+ export function setRingPreSeriesOptions(option, appearance) {
34
+ const rich = setRingChartText(appearance.text);
35
+ Object.assign(option.title.textStyle.rich, rich);
36
+ option.title.y = `${appearance.text.y}%`;
37
+ option.series[0].radius[1] = `${appearance.inner.borderWidth}%`;
38
+ option.series[0].data[0].itemStyle.color = appearance.inner.borderColor;
39
+ option.series[0].data[1].itemStyle.color = appearance.inner.borderBgColor;
40
+ option.series[1].radius[1] = `${appearance.outer.borderWidth}%`;
41
+ option.series[1].data[0].itemStyle.color = appearance.outer.borderColor;
42
+ }
43
+ // 配置环形‘内存、硬盘、CPU指标占比统计’节点展示
44
+ export function setRingProSeriesOptions(option, appearance) {
45
+ const seriesFirstChildNode = option.series[0];
46
+ const rich = setRingChartText(appearance.text);
47
+ Object.assign(seriesFirstChildNode.data[0].label.normal.rich, rich);
48
+ seriesFirstChildNode.data[0].label.normal.formatter = function(params){
49
+ return `{v|${params.value}}{unit|%}`;
50
+ }
51
+ seriesFirstChildNode.data[0].value = appearance.proportion;
52
+ seriesFirstChildNode.radius = appearance.outer.radius;
53
+ seriesFirstChildNode.data[0].itemStyle = {
54
+ normal: {
55
+ color: appearance.outer.borderColor,
56
+ shadowColor: appearance.outer.borderColor,
57
+ shadowBlur: 0
58
+ }
59
+ };
60
+ seriesFirstChildNode.data[1].value = 100 - appearance.proportion;
61
+ seriesFirstChildNode.data[1].itemStyle.normal.color = appearance.outer.borderBgColor;
62
+ const seriesLastChildNode = option.series[1];
63
+ seriesLastChildNode.radius = appearance.inner.radius;
64
+ seriesLastChildNode.itemStyle.normal.color.colorStops[0].color = appearance.inner.borderColor;
65
+ }
10
66
  // 图表X轴数据
11
67
  export function setChartXAxisData(xAxis, appearance) {
12
68
  for (let i = 0; i < xAxis.length; i++) {
@@ -26,7 +82,11 @@ export function setChartXAxisData(xAxis, appearance) {
26
82
  //return xAxis;
27
83
  }
28
84
 
29
- // 图表Y轴数据
85
+ /**
86
+ * 图表Y轴数据
87
+ * @param yAxis Y轴配置数据
88
+ * @param appearance 图表自定义配置
89
+ */
30
90
  export function setChartYAxisData(yAxis, appearance) {
31
91
  if (typeof appearance.ySplitLineShow !== 'boolean') {
32
92
  appearance.ySplitLineShow = yAxis[0].splitLine.show;
@@ -6,6 +6,7 @@ interface echartsOptions {
6
6
  tooltip: null
7
7
  }
8
8
  export declare function getXYAxisLabelVal(index: number, intervalNum: number, value: any): string;
9
+ export declare function initBindTabSetting(node: any): string;
9
10
  export declare function setMapLineBarOptions(option: echartsOptions, node: any): void;
10
11
  export declare function setMapGaugeOptions(option: echartsOptions, node: any): void;
11
12
  export declare function setMapRingOptions(option: echartsOptions, node: any): void;
@@ -1,20 +1,23 @@
1
1
  import {echartsDataRoom, echartsColorData} from '../../../static';
2
- import {echartsOptionsPool, echartsDataPool, echartsRealDataPool} from '../../../store';
3
2
  import {
4
3
  setSeriesRenderGroup,
5
4
  drawGraphicShape,
6
5
  setChartLegendData,
7
6
  setChartXAxisData,
8
7
  setChartYAxisData,
9
- setLineSeriesStyleData
8
+ setLineSeriesStyleData,
9
+ setRingPreSeriesOptions,
10
+ setRingProSeriesOptions
10
11
  } from '../utils';
11
12
  import {
12
13
  gaugeNormalAuto,
13
14
  lineBarDataAuto,
14
15
  pieRingAssetTotalAuto,
16
+ pieRingProportionAuto,
15
17
  pieRingNormalAuto,
16
18
  topRankingListAuto
17
19
  } from './render';
20
+ import {commonStore, echartsStaticType} from "../../../core";
18
21
 
19
22
  export function getXYAxisLabelVal(index, intervalNum, value) {
20
23
  if (index === 0 || index % intervalNum === 0) {
@@ -24,6 +27,26 @@ export function getXYAxisLabelVal(index, intervalNum, value) {
24
27
  }
25
28
  }
26
29
 
30
+ /**
31
+ * 初始化图表与tabs关联的配置数据
32
+ * @param node 元件节点
33
+ */
34
+ export function initBindTabSetting(node) {
35
+ const tabStaticKey = node.tags && node.tags.find((tag) => {return tag.includes('switchTabType')});
36
+ const switchTabData = tabStaticKey && commonStore[node.TID].switchTabDataPool[`${tabStaticKey}Data`];
37
+ if(switchTabData) {
38
+ const tabNode = Object.values(switchTabData)[0];
39
+ const tabEventNode = tabNode.events.find((ev) => {return ev.action === 8});
40
+ const tabStaticType = tabEventNode && tabEventNode.dcimStaticForType || '';
41
+ node.data.params.staticForType = tabStaticType;
42
+ return {
43
+ type: tabStaticType,
44
+ data: tabNode.tabData
45
+ };
46
+ }
47
+ return null;
48
+ }
49
+
27
50
  // 自动滑动展示数据
28
51
  export function setMapAutoMoveOptions(option, chartNode, node, callback) {
29
52
  option.dataZoom = echartsDataRoom;
@@ -108,9 +131,17 @@ export function setMapGaugeOptions(option, node) {
108
131
  // 自动配置环形图和饼图的节点数据
109
132
  export function setMapRingOptions(option, node) {
110
133
  //const chartOption = JSON.parse(JSON.stringify(option));
111
- const seriesNode = option.series[0];
112
134
  const appearance = node.appearance;
113
- if(!appearance.inner) {
135
+ if(appearance.type === 'ringPre'){
136
+
137
+ setRingPreSeriesOptions(option, appearance);
138
+
139
+ }else if(appearance.type === 'ringPro'){
140
+
141
+ setRingProSeriesOptions(option, appearance);
142
+
143
+ }else {
144
+ const seriesNode = option.series[0];
114
145
  if ((!appearance.label || typeof appearance.label.showValue !== 'boolean')) {
115
146
  appearance.label = {
116
147
  showValue: appearance.type === 'ring',
@@ -130,35 +161,6 @@ export function setMapRingOptions(option, node) {
130
161
  return `${data.name}`;
131
162
  }
132
163
  }
133
- }else {
134
- // chartOption.title.text = '{v|'+appearance.alarmCount+'}{unit|/'+appearance.total+'台}';
135
- const {
136
- vFontSize, vFontWeight, vColor,
137
- vTop, unitFontSize, unitFontWeight,
138
- unitColor} = appearance.text;
139
- const rich = {
140
- v: {
141
- fontSize: vFontSize,
142
- fontWeight: vFontWeight,
143
- color: vColor,
144
- padding: [vTop, 0, 0, 0]
145
- },
146
- unit: {
147
- fontSize: unitFontSize,
148
- fontWeight: unitFontWeight,
149
- color: unitColor
150
- }
151
- };
152
- Object.assign(option.title.textStyle.rich, rich);
153
- option.title.y = `${appearance.text.y}%`;
154
- option.series[0].radius[1] = `${appearance.inner.borderWidth}%`;
155
- // const value1 = ((100 / appearance.total) * appearance.alarmCount).toFixed(6);
156
- // chartOption.series[0].data[0].value = value1;
157
- option.series[0].data[0].itemStyle.color = appearance.inner.borderColor;
158
- // chartOption.series[0].data[1].value = 100 - value1;
159
- option.series[0].data[1].itemStyle.color = appearance.inner.borderBgColor;
160
- option.series[1].radius[1] = `${appearance.outer.borderWidth}%`;
161
- option.series[1].data[0].itemStyle.color = appearance.outer.borderColor;
162
164
  }
163
165
  }
164
166
 
@@ -199,7 +201,11 @@ export function setMapTopOptions(option, node) {
199
201
  Object.assign(option.grid, appearance.grid);
200
202
  }
201
203
 
202
- // 公共配置
204
+ /**
205
+ * 公共配置
206
+ * @param option 图表配置数据
207
+ * @param node 元件数据
208
+ */
203
209
  export function setMapGlobalOptions(option, node) {
204
210
  // const chartOption = JSON.parse(JSON.stringify(option));
205
211
  const appearance = node.appearance;
@@ -221,20 +227,33 @@ export function setMapGlobalOptions(option, node) {
221
227
 
222
228
  // 实时改变图表data值
223
229
  export function setMapDataOptions(option, node) {
224
- const optionNode = echartsOptionsPool[node.id].option;
230
+ const optionNode = commonStore[node.TID].echartsOptionsPool[node.id].option;
225
231
  const appearance = node.appearance;
226
- const params = node.data ? node.data.params : node.params;
232
+ const params = node.params;
227
233
  // 3d 柱状图
228
234
  if (appearance.type === '3dBar') renderMap3dBarSeriesItem(optionNode.series[0], appearance);
229
235
  const displayMode = parseInt(option.displayMode); // 图表类型
230
- const staticForType = params && params.staticForType || ''; //统计类型:日,周,月,年,实时
231
- const syncEchartsData = echartsRealDataPool[node.id]; // 统计图实时数据
232
- const staticTypeData = staticForType ? syncEchartsData && syncEchartsData[`${staticForType}_Data`] : syncEchartsData; // 统计类型数据
236
+ const staticForType = params && params.staticForType || ''; //统计类型:日,周,月,年,实时,其他
237
+ const syncEchartsData = commonStore[node.TID].echartsRealDataPool[node.id]; // 统计图实时数据
238
+ let staticTypeData = null; // 统计类型数据
239
+ if(staticForType === 'OTHER'){
240
+ // 其他类型,类型中的数据通常统计的都是历史数据,日、周、月、年、实时中的某一类,通常搭配分组统计使用。
241
+ // 类型中绑定一个测点为一个类型,绑定多个测点为多个类型。比如:有电功率和功率因数为两个分类,图表分组中分类数据绑定时就要同时绑定有电功率和功率因数两个测点,否则无法实现切换
242
+ for (let i = 0 ; i < echartsStaticType.length; i++) {
243
+ const chartData = syncEchartsData && syncEchartsData[`${echartsStaticType[i]}_Data`];
244
+ if(chartData) staticTypeData = chartData;
245
+ }
246
+ }else {
247
+ // 日,周,月,年,实时类型,不与分组统计一起使用
248
+ staticTypeData = staticForType ? syncEchartsData && syncEchartsData[`${staticForType}_Data`] : syncEchartsData;
249
+ }
233
250
  // 实时数据加载
234
251
  if(staticTypeData) {
235
252
 
236
253
  if (displayMode === 1 || displayMode === 2) { // 折线图,柱状图
237
254
 
255
+ if(node.tabData && node.tabData.data.state && optionNode.yAxis[0].max) Object.assign(optionNode.yAxis[0], node.tabData.data); //若Tabs切换配置了数据,则修改Y轴原有配置
256
+
238
257
  lineBarDataAuto(optionNode, params, staticTypeData);
239
258
 
240
259
  }
@@ -244,11 +263,14 @@ export function setMapDataOptions(option, node) {
244
263
 
245
264
  }
246
265
  if (displayMode === 5 || displayMode === 3) { // 饼图/环形图
247
- const pieData = staticTypeData || staticTypeData.data || [];
266
+ const pieData = staticTypeData && staticTypeData.data || staticTypeData || [];
248
267
  if(appearance.type === 'ringPre') {
249
268
  // 按照资产总台数统计设备告警数量
250
269
  pieRingAssetTotalAuto(optionNode, pieData, appearance.total, appearance.alarmCount);
251
270
 
271
+ }else if(appearance.type === 'ringPro'){
272
+ // 按照百分比统计设备配置情况
273
+ pieRingProportionAuto(optionNode, pieData, appearance.proportion);
252
274
  }else {
253
275
 
254
276
  pieRingNormalAuto(optionNode, pieData);
@@ -295,7 +317,7 @@ export function setMapDataOptions(option, node) {
295
317
  }
296
318
  }
297
319
 
298
- const currentChartNode = echartsDataPool[node.id];
320
+ const currentChartNode = commonStore[node.TID].echartsDataPool[node.id];
299
321
  const mapChart = currentChartNode.chart;
300
322
  clearInterval(currentChartNode.timeTicket);
301
323
  currentChartNode.timeTicket = null;
@@ -1,5 +1,6 @@
1
1
  export declare function lineBarDataAuto(option: any, params: {}, data: {}): void;
2
2
  export declare function topRankingListAuto(option: any, data: {}): void;
3
3
  export declare function pieRingAssetTotalAuto(option: any, data: {}, total: number, count: number): void;
4
+ export declare function pieRingProportionAuto(option: any, data: {}, proportion: number): void;
4
5
  export declare function pieRingNormalAuto(option: any, data: {}): void;
5
6
  export declare function gaugeNormalAuto(option: any, data: {}): void;
@@ -10,6 +10,13 @@ export function lineBarDataAuto(option, params, data) {
10
10
  const seriesNodes = option.series;
11
11
  if(data && data.XData) option.xAxis[0].data = data.XData;
12
12
  if(!(data && data.seriesData && data.seriesData.length)) return;
13
+ if(params.tabCorrelationType) {
14
+ // 如果操作类型是select下拉分组下的tab切换,执行下面的逻辑
15
+ const realSeriesNode = data.seriesData[params.tabVisitOrder || 0];
16
+ seriesNodes[0].data = realSeriesNode.data;
17
+ if(realSeriesNode.name) seriesNodes[0].name = realSeriesNode.name;
18
+ return;
19
+ }
13
20
  if(seriesNodes.length > 1 || params && params.curveNum > 1){
14
21
  // 双曲线|柱状
15
22
  const legendData = [];
@@ -74,6 +81,23 @@ export function pieRingAssetTotalAuto(option, data, total, count) {
74
81
  option.series[0].data[1].value = 100 - value1;
75
82
  }
76
83
 
84
+ /**
85
+ *
86
+ * @param option 图表配置数据
87
+ * @param data 实时图表数据
88
+ * @param proportion 默认百分数
89
+ */
90
+ export function pieRingProportionAuto(option, data, proportion) {
91
+ if(data && data.length) {
92
+ proportion = Number(data[0].value) * 100;
93
+ }
94
+ if(!option.series[0].data[0].label.normal.formatter) option.series[0].data[0].label.normal.formatter = function(params){
95
+ return params.value ? `{v|${params.value}}{unit|%}` : `{v|${params.value}}`;
96
+ }
97
+ option.series[0].data[0].value = proportion;
98
+ option.series[0].data[1].value = 100 - proportion;
99
+ }
100
+
77
101
  /**
78
102
  * 饼图环形图默认展示 实时数据
79
103
  * @param option 图表配置数据
@@ -10,12 +10,15 @@ import {
10
10
  getRect,
11
11
  setInitNodeDataValidat,
12
12
  setDefaultNodeValidat,
13
- initSwitchTabData,
13
+ setConnectionTagForConf,
14
14
  setInitConfData,
15
+ getParams,
16
+ tabHideShowOperation,
17
+ tabStaticOperation,
18
+ echartsStaticType
15
19
  } from './utils';
16
- import { useStore, clearStore } from './store'
20
+ import {useStore, clearStore, commonStore} from './store'
17
21
  import * as mqtt from './mqtt.min';
18
- import { switchTabDataPool } from "../../store";
19
22
  import {setElementSwitchTabState} from './element';
20
23
  var MoveInType;
21
24
  (function (MoveInType) {
@@ -167,6 +170,76 @@ var Common = /** @class */ (function () {
167
170
  this.createMarkdownTip();
168
171
  window.topology = this;
169
172
  }
173
+ Common.prototype.categoryDataParams = function (data){
174
+ getParams(this.id, data);
175
+ };
176
+ Common.prototype.getParams = function (assetId){
177
+ const params = {
178
+ doorIds: this.store.mqttParams.doorIds,
179
+ tagIds: this.store.mqttParams.tagIds.join(","),
180
+ assetIds: this.store.mqttParams.assetIds.join(","),
181
+ areaIds: this.store.mqttParams.areaIds.join(","),
182
+ routingkey: this.store.mqttParams.routingkey,
183
+ echart: this.store.mqttParams.tagEcharts.join(","),
184
+ echartData: this.store.mqttParams.echartData
185
+ }
186
+ if (this.store.mqttParams.echartAssemblyData.length) params.echartAssemblyData = [...this.store.mqttParams.echartAssemblyData];
187
+ if(assetId) {
188
+ params.varValueIds = this.store.mqttParams.varVaule.join(",");
189
+ }else {
190
+ if(this.store.mqttParams.assetIds.length && this.store.mqttParams.varVaule.length) {
191
+ const assetId = this.store.mqttParams.assetIds[this.store.mqttParams.assetIds.length -1];
192
+ for(let va = 0; va < this.store.mqttParams.varVaule.length; va++) {
193
+ this.store.mqttParams.varVaule[va] = `${assetId}_${this.store.mqttParams.varVaule[va]}`;
194
+ }
195
+ params.varValueIds = this.store.mqttParams.varVaule.join(",");
196
+ }else {
197
+ params.varVaule = this.store.mqttParams.varVaule.join(",");
198
+ }
199
+ }
200
+ return params;
201
+ };
202
+ // 根据图表id数据获取测点数据
203
+ Common.prototype.getTagIdsForEchartsIds = function (data){
204
+ this.store.mqttParams.echartAssemblyData = data;
205
+ };
206
+ // 根据指标地址数据获取测点数据
207
+ Common.prototype.getTagIdsForKpiAddrs = function (data){
208
+ let tagIds = [];
209
+ data.map((item) => {
210
+ tagIds.push(item.tagId);
211
+ });
212
+ this.store.mqttParams.tagIds = tagIds;
213
+ };
214
+ // 获取绑定值类型参数
215
+ Common.prototype.getVarValueIdsForVarData = function (data){
216
+ const ids = [];
217
+ data.map((item) => {
218
+ if(item.varVal) ids.push(item.assetVarIds);
219
+ })
220
+ this.store.mqttParams.varVaule = ids;
221
+ };
222
+ // 固定资产详情数据赋值
223
+ Common.prototype.renderForAssetPoperties = function (asset, data){
224
+ if(!Object.keys(asset).length) return;
225
+ data.map((node) => {
226
+ if (node.data && Array.isArray(node.data) && node.data.length) {
227
+ node.data.map((item) => {
228
+ if (item.key === 'assetKey' && asset[item.value]) {
229
+ if (['imgUrl', 'principleImg'].includes(item.value)) {
230
+ node.text = '';
231
+ node.image = `${this.store.mqttParams.pathRewrite}${asset[item.value]}`;
232
+ } else {
233
+ node.text = asset[item.value];
234
+ }
235
+ }
236
+ })
237
+ }
238
+ if (node.children && node.children.length) {
239
+ this.renderForAssetPoperties(asset, node.children);
240
+ }
241
+ });
242
+ };
170
243
 
171
244
  Common.prototype.conversionData = function (obj) {
172
245
  this.clear();
@@ -185,7 +258,7 @@ var Common = /** @class */ (function () {
185
258
  const item = new Node(_a[_i]);
186
259
  this.store.data.pens.push(item);
187
260
  ///this.store.pens[item.id] = item;
188
- initSwitchTabData(item);
261
+ setConnectionTagForConf(item);
189
262
  }
190
263
  for (var _b = 0, _c = data.lines; _b < _c.length; _b++) {
191
264
  _c[_b].TID = this.id;
@@ -203,7 +276,7 @@ var Common = /** @class */ (function () {
203
276
  const node = new Node(item);
204
277
  this.store.data.pens.push(node);
205
278
  //this.store.pens[item.id] = node;
206
- initSwitchTabData(node);
279
+ setConnectionTagForConf(node);
207
280
  } else {
208
281
  const linNode = new Line(item);
209
282
  this.store.data.pens.push(linNode);
@@ -400,34 +473,29 @@ var Common = /** @class */ (function () {
400
473
  return t.includes('switchTabType');
401
474
  }); // 获取按钮组类型
402
475
  if(!switchTabData) return;
403
- const topologyChangeData = switchTabDataPool; // 获取所有按钮组和按类型统计图组数据
476
+ const topologyChangeData = commonStore[node.TID].switchTabDataPool; // 获取所有按钮组和按类型统计图组数据
404
477
  const changeNode = topologyChangeData[`${switchTabData}Data`]; // 分别获取按钮组数据
405
478
  if(!changeNode[node.id]) return;
406
479
  // 如果存在按钮组节点数据
407
480
  const tabAreaData = topologyChangeData[`${switchTabData}AreaData`];
481
+ let tabIndex = 0;
482
+ const visitParams = {
483
+ order: 0
484
+ };
408
485
  for (let switchNode of Object.values(changeNode)) {
409
486
  const penNode = this.store.data.pens[switchNode.order];
410
487
  if(!penNode) return;
411
- penNode.activeImgeIndex = switchNode.id !== node.id;
412
- if(staticType === 'SH'){
413
- // 对显示隐藏的功能进行交互处理
414
- const areaNode = tabAreaData[switchNode.bindStaticId];
415
- if(areaNode && this.store.data.pens[areaNode.order]) {
416
- const tagNode = this.store.data.pens[areaNode.order];
417
- tagNode.visible = !(switchNode.id !== node.id);
418
- setElementSwitchTabState(tagNode);
419
- }
488
+ const isActive = switchNode.id !== node.id;
489
+ if(!isActive) {
490
+ visitParams.order = tabIndex;
491
+ visitParams.data = switchNode.tabData;
420
492
  }
493
+ penNode.activeImgeIndex = isActive;
494
+ tabIndex++;
495
+ if(staticType === 'SH') tabHideShowOperation(switchNode, tabAreaData); // 对显示隐藏的功能进行交互处理
421
496
  }
422
497
  // 对绑定的图表进行数据处理
423
- if (node.bindStaticId && ['DAY', 'WEEK', 'MONTH', 'YEAR'].includes(staticType)) {
424
- const findCurentEchart = tabAreaData[node.bindStaticId]; // 获取当前点中的节点绑定的统计图表数据
425
- if (findCurentEchart && findCurentEchart.data.params) {
426
- const cn = this.store.data.pens[findCurentEchart.order];
427
- cn.data.params['staticForType'] = staticType; // 统计类型赋值
428
- cn.elementRendered = false;
429
- }
430
- }
498
+ tabStaticOperation(staticType, node, tabAreaData, visitParams);
431
499
  this.store.data.dataResize = 1;
432
500
  this.render();
433
501
  };
@@ -686,16 +754,22 @@ var Common = /** @class */ (function () {
686
754
  };
687
755
  Common.prototype.mqttDataDrawing = function (data, retData) {
688
756
  // console.log('收到消息', syncData)
757
+ this.store.monitorAlarm = false;
689
758
  data.map((item) => {
690
- if(this.store.options.type === 'topology') setInitConfData(item);
759
+ if(this.store.options.type === 'topology') setInitConfData(this.id, item);
691
760
  setDefaultNodeValidat(item, retData);
692
761
  if (item.children && item.children.length) {
693
762
  this.mqttDataDrawing(item.children, retData);
694
763
  }
695
- })
764
+ if (item.formData && item.formData.detailPageData && item.formData.detailPageData.pens && item.formData.detailPageData.pens.length) {
765
+ this.mqttDataDrawing(item.formData.detailPageData.pens, retData);
766
+ }
767
+ });
696
768
  //console.log('执行完毕-----', this.store.data.pens)
697
769
  this.render();
698
770
  this.animate(true);
771
+ // 九所的 服务器状态监测功能中用到
772
+ if(this.store.options.storeSubscribe) Store.set(this.generateStoreKey('M:monitor'), this.store.monitorAlarm);
699
773
  return data
700
774
  };
701
775
  Common.prototype.hidePenByTag = function (pens, val) {
@@ -753,6 +827,28 @@ var Common = /** @class */ (function () {
753
827
  }
754
828
  }
755
829
  };
830
+ Common.prototype.formOverflowConversionData = function (obj) {
831
+ if (!obj) {
832
+ obj = {pens: []};
833
+ }
834
+ let data = JSON.parse(JSON.stringify(obj));
835
+ Object.assign(this.store.data, data);
836
+ this.store.data.pens = [];
837
+ this.openCount = 0
838
+ const type = this.store.options.type;
839
+ if (data.pens) {
840
+ for (var _d = 0, _e = data.pens; _d < _e.length; _d++) {
841
+ const item = _e[_d];
842
+ if (!item.from) {
843
+ const node = new Node(item);
844
+ this.store.data.pens.push(node);
845
+ } else {
846
+ const linNode = new Line(item);
847
+ this.store.data.pens.push(linNode);
848
+ }
849
+ }
850
+ }
851
+ };
756
852
  Common.prototype.destroyStatic = function () {
757
853
  this.clear('destroy');
758
854
  //this.closeSocket();