dcim-topology2d 2.0.2 → 2.0.5

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 (41) 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 +6 -6
  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 +56 -0
  7. package/chart-diagram/src/utils/conversion.js +22 -37
  8. package/chart-diagram/src/utils/render.d.ts +1 -0
  9. package/chart-diagram/src/utils/render.js +17 -0
  10. package/core/src/common.js +81 -8
  11. package/core/src/core.js +58 -17
  12. package/core/src/divLayer.js +1 -1
  13. package/core/src/element/select.d.ts +2 -2
  14. package/core/src/element/select.js +92 -57
  15. package/core/src/element/tab.js +7 -10
  16. package/core/src/healps/changeData.js +20 -6
  17. package/core/src/middles/nodes/formselect.js +26 -12
  18. package/core/src/middles/nodes/iframe.js +5 -5
  19. package/core/src/models/pen.js +2 -50
  20. package/core/src/options.d.ts +1 -0
  21. package/core/src/options.js +2 -1
  22. package/core/src/preview.js +6 -1
  23. package/core/src/store/data.d.ts +70 -19
  24. package/core/src/store/data.js +88 -34
  25. package/core/src/utils/assignment.d.ts +1 -1
  26. package/core/src/utils/assignment.js +53 -23
  27. package/core/src/utils/construction.d.ts +2 -1
  28. package/core/src/utils/construction.js +2 -1
  29. package/core/src/utils/conversion.d.ts +1 -1
  30. package/core/src/utils/conversion.js +14 -20
  31. package/core/src/utils/onmousevent.d.ts +1 -1
  32. package/core/src/utils/onmousevent.js +4 -5
  33. package/core/src/utils/params.d.ts +2 -7
  34. package/core/src/utils/params.js +19 -87
  35. package/myShape-diagram/index.js +196 -0
  36. package/package.json +1 -1
  37. package/store/actions.js +1 -17
  38. package/store/clear.js +0 -62
  39. package/core/src/poll.js +0 -37
  40. package/myShape-diagram/myShape.js +0 -196
  41. /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,
@@ -9,7 +10,6 @@ import {
9
10
  setMapDataOptions
10
11
  } from '../utils';
11
12
  import {echartsTypeMap} from '../../../static';
12
- import {echartsDataPool, echartsOptionsPool} from '../../../store';
13
13
 
14
14
  export function echarts(ctx, node) {
15
15
  if (!(commonStore[node.TID] && commonStore[node.TID].data.dataResize)) return;
@@ -19,7 +19,7 @@ export function echarts(ctx, node) {
19
19
  // 绘制一个底图,类似于占位符。
20
20
  rectangle(ctx, node)
21
21
  // tslint:disable-next-line:no-shadowed-variable
22
- var echarts = echartsDataPool.echarts || window.echarts
22
+ var echarts = plugsPool.echarts || window.echarts
23
23
  if (!node.data || !echarts) {
24
24
  return
25
25
  }
@@ -32,7 +32,7 @@ export function echarts(ctx, node) {
32
32
  if (!node.elementId) {
33
33
  node.elementId = s8()
34
34
  }
35
- let echartsData = echartsDataPool[node.id];
35
+ let echartsData = commonStore[node.TID].echartsDataPool[node.id];
36
36
  if (!node.elementLoaded && !(echartsData && echartsData.div)) {
37
37
  if(!echartsData) {
38
38
  echartsData = {
@@ -51,7 +51,7 @@ export function echarts(ctx, node) {
51
51
  setTimeout(function () {
52
52
  echartsData.chart.resize()
53
53
  });
54
- echartsDataPool[node.id] = echartsData;
54
+ commonStore[node.TID].echartsDataPool[node.id] = echartsData;
55
55
  }
56
56
  if (!node.elementRendered) {
57
57
  const appearance = node.appearance;
@@ -60,7 +60,7 @@ export function echarts(ctx, node) {
60
60
  let option = node.data.echarts.option;
61
61
  if(!(echartsData && echartsData.chart)) return;
62
62
  const isLocked = commonStore[node.TID] && commonStore[node.TID].data.locked;
63
- if (!isLocked || !echartsOptionsPool[node.id]) {
63
+ if (!isLocked || !commonStore[node.TID].echartsOptionsPool[node.id]) {
64
64
  // 【未锁定(编辑)状态, options未初始化的状态】
65
65
  if (!appearance.type) appearance.type = echartsTypeMap[`type_${option.displayMode}`]; // 兼容旧数据配置
66
66
  // 公共配置 Top排行榜跳过公共属性配置
@@ -77,7 +77,7 @@ export function echarts(ctx, node) {
77
77
  if (appearance.type === 'TOP') setMapTopOptions(option, node);
78
78
  //option.title = appearance.title;
79
79
  option.backgroundColor = appearance.backgroundColor;
80
- echartsOptionsPool[node.id] = {
80
+ commonStore[node.TID].echartsOptionsPool[node.id] = {
81
81
  option: JSON.parse(JSON.stringify(option)),
82
82
  data: {
83
83
  appearance,
@@ -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++) {
@@ -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} from "../../../core";
18
21
 
19
22
  export function getXYAxisLabelVal(index, intervalNum, value) {
20
23
  if (index === 0 || index % intervalNum === 0) {
@@ -108,9 +111,17 @@ export function setMapGaugeOptions(option, node) {
108
111
  // 自动配置环形图和饼图的节点数据
109
112
  export function setMapRingOptions(option, node) {
110
113
  //const chartOption = JSON.parse(JSON.stringify(option));
111
- const seriesNode = option.series[0];
112
114
  const appearance = node.appearance;
113
- if(!appearance.inner) {
115
+ if(appearance.type === 'ringPre'){
116
+
117
+ setRingPreSeriesOptions(option, appearance);
118
+
119
+ }else if(appearance.type === 'ringPro'){
120
+
121
+ setRingProSeriesOptions(option, appearance);
122
+
123
+ }else {
124
+ const seriesNode = option.series[0];
114
125
  if ((!appearance.label || typeof appearance.label.showValue !== 'boolean')) {
115
126
  appearance.label = {
116
127
  showValue: appearance.type === 'ring',
@@ -130,35 +141,6 @@ export function setMapRingOptions(option, node) {
130
141
  return `${data.name}`;
131
142
  }
132
143
  }
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
144
  }
163
145
  }
164
146
 
@@ -221,14 +203,14 @@ export function setMapGlobalOptions(option, node) {
221
203
 
222
204
  // 实时改变图表data值
223
205
  export function setMapDataOptions(option, node) {
224
- const optionNode = echartsOptionsPool[node.id].option;
206
+ const optionNode = commonStore[node.TID].echartsOptionsPool[node.id].option;
225
207
  const appearance = node.appearance;
226
208
  const params = node.data ? node.data.params : node.params;
227
209
  // 3d 柱状图
228
210
  if (appearance.type === '3dBar') renderMap3dBarSeriesItem(optionNode.series[0], appearance);
229
211
  const displayMode = parseInt(option.displayMode); // 图表类型
230
212
  const staticForType = params && params.staticForType || ''; //统计类型:日,周,月,年,实时
231
- const syncEchartsData = echartsRealDataPool[node.id]; // 统计图实时数据
213
+ const syncEchartsData = commonStore[node.TID].echartsRealDataPool[node.id]; // 统计图实时数据
232
214
  const staticTypeData = staticForType ? syncEchartsData && syncEchartsData[`${staticForType}_Data`] : syncEchartsData; // 统计类型数据
233
215
  // 实时数据加载
234
216
  if(staticTypeData) {
@@ -244,11 +226,14 @@ export function setMapDataOptions(option, node) {
244
226
 
245
227
  }
246
228
  if (displayMode === 5 || displayMode === 3) { // 饼图/环形图
247
- const pieData = staticTypeData || staticTypeData.data || [];
229
+ const pieData = staticTypeData && staticTypeData.data || staticTypeData || [];
248
230
  if(appearance.type === 'ringPre') {
249
231
  // 按照资产总台数统计设备告警数量
250
232
  pieRingAssetTotalAuto(optionNode, pieData, appearance.total, appearance.alarmCount);
251
233
 
234
+ }else if(appearance.type === 'ringPro'){
235
+ // 按照百分比统计设备配置情况
236
+ pieRingProportionAuto(optionNode, pieData, appearance.proportion);
252
237
  }else {
253
238
 
254
239
  pieRingNormalAuto(optionNode, pieData);
@@ -295,7 +280,7 @@ export function setMapDataOptions(option, node) {
295
280
  }
296
281
  }
297
282
 
298
- const currentChartNode = echartsDataPool[node.id];
283
+ const currentChartNode = commonStore[node.TID].echartsDataPool[node.id];
299
284
  const mapChart = currentChartNode.chart;
300
285
  clearInterval(currentChartNode.timeTicket);
301
286
  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;
@@ -74,6 +74,23 @@ export function pieRingAssetTotalAuto(option, data, total, count) {
74
74
  option.series[0].data[1].value = 100 - value1;
75
75
  }
76
76
 
77
+ /**
78
+ *
79
+ * @param option 图表配置数据
80
+ * @param data 实时图表数据
81
+ * @param proportion 默认百分数
82
+ */
83
+ export function pieRingProportionAuto(option, data, proportion) {
84
+ if(data && data.length) {
85
+ proportion = Number(data[0].value) * 100;
86
+ }
87
+ if(!option.series[0].data[0].label.normal.formatter) option.series[0].data[0].label.normal.formatter = function(params){
88
+ return params.value ? `{v|${params.value}}{unit|%}` : `{v|${params.value}}`;
89
+ }
90
+ option.series[0].data[0].value = proportion;
91
+ option.series[0].data[1].value = 100 - proportion;
92
+ }
93
+
77
94
  /**
78
95
  * 饼图环形图默认展示 实时数据
79
96
  * @param option 图表配置数据
@@ -10,12 +10,12 @@ import {
10
10
  getRect,
11
11
  setInitNodeDataValidat,
12
12
  setDefaultNodeValidat,
13
- initSwitchTabData,
13
+ setConnectionTagForConf,
14
14
  setInitConfData,
15
+ getParams,
15
16
  } from './utils';
16
- import { useStore, clearStore } from './store'
17
+ import {useStore, clearStore, commonStore} from './store'
17
18
  import * as mqtt from './mqtt.min';
18
- import { switchTabDataPool } from "../../store";
19
19
  import {setElementSwitchTabState} from './element';
20
20
  var MoveInType;
21
21
  (function (MoveInType) {
@@ -167,6 +167,76 @@ var Common = /** @class */ (function () {
167
167
  this.createMarkdownTip();
168
168
  window.topology = this;
169
169
  }
170
+ Common.prototype.categoryDataParams = function (data){
171
+ getParams(this.id, data);
172
+ };
173
+ Common.prototype.getParams = function (assetId){
174
+ const params = {
175
+ doorIds: this.store.mqttParams.doorIds,
176
+ tagIds: this.store.mqttParams.tagIds.join(","),
177
+ assetIds: this.store.mqttParams.assetIds.join(","),
178
+ areaIds: this.store.mqttParams.areaIds.join(","),
179
+ routingkey: this.store.mqttParams.routingkey,
180
+ echart: this.store.mqttParams.tagEcharts.join(","),
181
+ echartData: this.store.mqttParams.echartData
182
+ }
183
+ if (this.store.mqttParams.echartAssemblyData.length) params.echartAssemblyData = [...this.store.mqttParams.echartAssemblyData];
184
+ if(assetId) {
185
+ params.varValueIds = this.store.mqttParams.varVaule.join(",");
186
+ }else {
187
+ if(this.store.mqttParams.assetIds.length && this.store.mqttParams.varVaule.length) {
188
+ const assetId = this.store.mqttParams.assetIds[this.store.mqttParams.assetIds.length -1];
189
+ for(let va = 0; va < this.store.mqttParams.varVaule.length; va++) {
190
+ this.store.mqttParams.varVaule[va] = `${assetId}_${this.store.mqttParams.varVaule[va]}`;
191
+ }
192
+ params.varValueIds = this.store.mqttParams.varVaule.join(",");
193
+ }else {
194
+ params.varVaule = this.store.mqttParams.varVaule.join(",");
195
+ }
196
+ }
197
+ return params;
198
+ };
199
+ // 根据图表id数据获取测点数据
200
+ Common.prototype.getTagIdsForEchartsIds = function (data){
201
+ this.store.mqttParams.echartAssemblyData = data;
202
+ };
203
+ // 根据指标地址数据获取测点数据
204
+ Common.prototype.getTagIdsForKpiAddrs = function (data){
205
+ let tagIds = [];
206
+ data.map((item) => {
207
+ tagIds.push(item.tagId);
208
+ });
209
+ this.store.mqttParams.tagIds = tagIds;
210
+ };
211
+ // 获取绑定值类型参数
212
+ Common.prototype.getVarValueIdsForVarData = function (data){
213
+ const ids = [];
214
+ data.map((item) => {
215
+ if(item.varVal) ids.push(item.assetVarIds);
216
+ })
217
+ this.store.mqttParams.varVaule = ids;
218
+ };
219
+ // 固定资产详情数据赋值
220
+ Common.prototype.renderForAssetPoperties = function (asset, data){
221
+ if(!Object.keys(asset).length) return;
222
+ data.map((node) => {
223
+ if (node.data && Array.isArray(node.data) && node.data.length) {
224
+ node.data.map((item) => {
225
+ if (item.key === 'assetKey' && asset[item.value]) {
226
+ if (['imgUrl', 'principleImg'].includes(item.value)) {
227
+ node.text = '';
228
+ node.image = `${this.store.mqttParams.pathRewrite}${asset[item.value]}`;
229
+ } else {
230
+ node.text = asset[item.value];
231
+ }
232
+ }
233
+ })
234
+ }
235
+ if (node.children && node.children.length) {
236
+ renderForAssetPoperties(asset, node.children);
237
+ }
238
+ });
239
+ };
170
240
 
171
241
  Common.prototype.conversionData = function (obj) {
172
242
  this.clear();
@@ -185,7 +255,7 @@ var Common = /** @class */ (function () {
185
255
  const item = new Node(_a[_i]);
186
256
  this.store.data.pens.push(item);
187
257
  ///this.store.pens[item.id] = item;
188
- initSwitchTabData(item);
258
+ setConnectionTagForConf(item);
189
259
  }
190
260
  for (var _b = 0, _c = data.lines; _b < _c.length; _b++) {
191
261
  _c[_b].TID = this.id;
@@ -203,7 +273,7 @@ var Common = /** @class */ (function () {
203
273
  const node = new Node(item);
204
274
  this.store.data.pens.push(node);
205
275
  //this.store.pens[item.id] = node;
206
- initSwitchTabData(node);
276
+ setConnectionTagForConf(node);
207
277
  } else {
208
278
  const linNode = new Line(item);
209
279
  this.store.data.pens.push(linNode);
@@ -400,7 +470,7 @@ var Common = /** @class */ (function () {
400
470
  return t.includes('switchTabType');
401
471
  }); // 获取按钮组类型
402
472
  if(!switchTabData) return;
403
- const topologyChangeData = switchTabDataPool; // 获取所有按钮组和按类型统计图组数据
473
+ const topologyChangeData = commonStore[node.TID].switchTabDataPool; // 获取所有按钮组和按类型统计图组数据
404
474
  const changeNode = topologyChangeData[`${switchTabData}Data`]; // 分别获取按钮组数据
405
475
  if(!changeNode[node.id]) return;
406
476
  // 如果存在按钮组节点数据
@@ -686,16 +756,19 @@ var Common = /** @class */ (function () {
686
756
  };
687
757
  Common.prototype.mqttDataDrawing = function (data, retData) {
688
758
  // console.log('收到消息', syncData)
759
+ this.store.monitorAlarm = false;
689
760
  data.map((item) => {
690
- if(this.store.options.type === 'topology') setInitConfData(item);
761
+ if(this.store.options.type === 'topology') setInitConfData(this.id, item);
691
762
  setDefaultNodeValidat(item, retData);
692
763
  if (item.children && item.children.length) {
693
764
  this.mqttDataDrawing(item.children, retData);
694
765
  }
695
- })
766
+ });
696
767
  //console.log('执行完毕-----', this.store.data.pens)
697
768
  this.render();
698
769
  this.animate(true);
770
+ // 九所的 服务器状态监测功能中用到
771
+ if(this.store.options.storeSubscribe) Store.set(this.generateStoreKey('M:monitor'), this.store.monitorAlarm);
699
772
  return data
700
773
  };
701
774
  Common.prototype.hidePenByTag = function (pens, val) {
package/core/src/core.js CHANGED
@@ -28,7 +28,7 @@ import {
28
28
  setAreaIdData,
29
29
  setVarValueData,
30
30
  setThreeCategoryIdData,
31
- initSwitchTabData
31
+ setConnectionTagForConf
32
32
  } from './utils';
33
33
  import {setSelectElementPosition} from './element';
34
34
  import {elementType} from '../../static';
@@ -999,8 +999,10 @@ var Topology = (function (_super) {
999
999
  if (this.store.data.scale !== 1) {
1000
1000
  node.scale(this.store.data.scale);
1001
1001
  }
1002
+ node.visibleSwitch = true;
1003
+ node.order = this.store.data.pens.length;
1002
1004
  this.store.data.pens.push(node);
1003
- initSwitchTabData(node);
1005
+ setConnectionTagForConf(node);
1004
1006
  if (focus) {
1005
1007
  this.render();
1006
1008
  this.animate(true);
@@ -1105,7 +1107,7 @@ var Topology = (function (_super) {
1105
1107
  }
1106
1108
  }
1107
1109
  }
1108
- // In active pen.
1110
+ // In active pen.
1109
1111
  if (!this.store.data.locked) {
1110
1112
  for (var _i = 0, _a = this.activeLayer.pens; _i < _a.length; _i++) {
1111
1113
  var item = _a[_i];
@@ -1130,13 +1132,15 @@ var Topology = (function (_super) {
1130
1132
  this.divLayer.canvas.style.cursor = 'default';
1131
1133
  var len = this.store.data.pens.length;
1132
1134
  for (var i = len - 1; i > -1; --i) {
1133
- if (this.store.data.pens[i].type === PenType.Node &&
1134
- this.inNode(pt, this.store.data.pens[i])) {
1135
- return;
1136
- } else if (this.store.data.pens[i].type === PenType.Line &&
1137
- this.inLine(pt, this.store.data.pens[i])) {
1138
- // 需要优先判断十分在节点锚点上
1139
- // return;
1135
+ if(this.store.data.pens[i].visible || this.store.data.pens[i].visibleSwitch){
1136
+ if (this.store.data.pens[i].type === PenType.Node &&
1137
+ this.inNode(pt, this.store.data.pens[i])) {
1138
+ return;
1139
+ } else if (this.store.data.pens[i].type === PenType.Line &&
1140
+ this.inLine(pt, this.store.data.pens[i])) {
1141
+ // 需要优先判断十分在节点锚点上
1142
+ // return;
1143
+ }
1140
1144
  }
1141
1145
  }
1142
1146
  };
@@ -1706,9 +1710,10 @@ var Topology = (function (_super) {
1706
1710
  }
1707
1711
  pen.controlPoints = controlPoints;
1708
1712
  }
1713
+ pen.order = this.store.data.pens.length;
1709
1714
  this.store.data.pens.push(pen);
1710
1715
  this.activeLayer.add(pen);
1711
- initSwitchTabData(pen);
1716
+ setConnectionTagForConf(pen);
1712
1717
  }
1713
1718
  this.render();
1714
1719
  this.animate(true);
@@ -1924,6 +1929,8 @@ var Topology = (function (_super) {
1924
1929
  paddingTop: 0,
1925
1930
  paddingBottom: 0,
1926
1931
  strokeStyle: 'transparent',
1932
+ visible: true,
1933
+ visibleSwitch: true,
1927
1934
  children: [],
1928
1935
  });
1929
1936
  if (temp) {
@@ -1934,9 +1941,13 @@ var Topology = (function (_super) {
1934
1941
  item.stand = stand;
1935
1942
  item.parentId = node.id;
1936
1943
  item.animatePlay = false;
1944
+ item.visible = true;
1945
+ item.visibleSwitch = true;
1937
1946
  item.calcRectInParent(node);
1947
+ this.deleteSelectTabOptionNode(item);
1938
1948
  node.children.push(item);
1939
1949
  }
1950
+ node.order = this.store.data.pens.length;
1940
1951
  this.store.data.pens.push(node);
1941
1952
  this.activeLayer.setPens([node]);
1942
1953
  this.dispatch('node', node);
@@ -1950,23 +1961,53 @@ var Topology = (function (_super) {
1950
1961
  return;
1951
1962
  }
1952
1963
  const nodeChildren = JSON.parse(JSON.stringify(node));
1964
+ var i = this.findIndex(nodeChildren);
1965
+ if (i > -1 && nodeChildren.name === 'combine') {
1966
+ this.store.data.pens.splice(i, 1);
1967
+ } else {
1968
+ nodeChildren.children = null;
1969
+ }
1953
1970
  for (var _i = 0, _a = nodeChildren.children; _i < _a.length; _i++) {
1954
1971
  var item = new Node(_a[_i]);
1955
1972
  item.parentId = undefined;
1956
1973
  item.rectInParent = undefined;
1957
1974
  item.locked = Lock.None;
1975
+ item.order = this.store.data.pens.length;
1976
+ this.addSelectTabOptionNode(item);
1958
1977
  this.store.data.pens.push(item);
1959
1978
  }
1960
- var i = this.findIndex(nodeChildren);
1961
- if (i > -1 && nodeChildren.name === 'combine') {
1962
- this.store.data.pens.splice(i, 1);
1963
- } else {
1964
- nodeChildren.children = null;
1965
- }
1979
+ this.deleteSelectTabOptionNode(nodeChildren);
1966
1980
  this.cache();
1967
1981
  this.activeLayer.clear();
1968
1982
  this.hoverLayer.clear();
1969
1983
  };
1984
+ Topology.prototype.deleteSelectTabOptionNode = function (node) {
1985
+ const tagNode = node.tags.find((t) => {return t.includes('selectOption')});
1986
+ if(tagNode){
1987
+ // 删除下拉节点关联的这个元件
1988
+ const tagArr = tagNode.split('-');
1989
+ const parentId = tagArr[1] && tagArr[1].trim();
1990
+ if(parentId && this.store.selectTabDataPool[parentId].has(node.id)) this.store.selectTabDataPool[parentId].delete(node.id);
1991
+ }
1992
+ },
1993
+ Topology.prototype.addSelectTabOptionNode = function (node) {
1994
+ const tagNode = node.tags.find((t) => {return t.includes('selectOption')});
1995
+ if(tagNode){
1996
+ // 添加下拉节点关联的这个元件
1997
+ const tagArr = tagNode.split('-');
1998
+ const parentId = tagArr[1] && tagArr[1].trim();
1999
+ if(!parentId) return;
2000
+ const params = {
2001
+ TID: node.TID,
2002
+ id: node.id,
2003
+ name: node.name,
2004
+ order: node.order,
2005
+ visible: node.visible,
2006
+ tag: tagNode
2007
+ }
2008
+ this.store.selectTabDataPool[parentId].set(node.id, params);
2009
+ }
2010
+ },
1970
2011
  Topology.prototype.find = function (idOrTag, pens) {
1971
2012
  var _this = this;
1972
2013
  if (!pens) {
@@ -97,7 +97,7 @@ var DivLayer = /** @class */ (function (_super) {
97
97
  if (item.elementId) {
98
98
  const elementNode = this.elements[item.id];
99
99
  if(elementNode) {
100
- this.canvas.parentElement.removeChild(elementNode);
100
+ elementNode.parentNode.removeChild(elementNode);
101
101
  this.elements[item.id] = null;
102
102
  }
103
103
  }
@@ -3,9 +3,9 @@ import { Node } from '../models';
3
3
  export declare function createSelectElement(node: Node): HTMLDivElement;
4
4
  export declare function createSelectDropdown(node: Node): HTMLDivElement;
5
5
  export declare function createSelectOptions(data: [], node: Node): string;
6
- export declare function getSelectedData(e: Event, data: any): void;
6
+ export declare function getSelectedData(e: Event, data: any, editData: any): void;
7
7
  export declare function setSelectInteractiveState(selected: any, node: Node): void;
8
8
  export declare function resetSelectInteractiveState(node: Node): void;
9
- export declare function setSelectDropdownInteractiveState(node: Node, staticType: any, type: any): void;
9
+ export declare function setSelectDropdownInteractiveState(node: any, staticType: any, type: any): void;
10
10
  export declare function setSelectElementPosition(node: Node, type: string): void;
11
11
  export declare function setSelectElementTheme(node: Node): void;