dcim-topology2d 2.2.0 → 3.0.2

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 (217) hide show
  1. package/activity-diagram/src/final/final.d.ts +1 -1
  2. package/activity-diagram/src/final/final.rect.d.ts +1 -1
  3. package/activity-diagram/src/final/final.rect.js +1 -1
  4. package/activity-diagram/src/fork/fork.anchor.d.ts +1 -1
  5. package/activity-diagram/src/fork/fork.anchor.js +1 -1
  6. package/activity-diagram/src/fork/fork.d.ts +1 -1
  7. package/activity-diagram/src/fork/fork.rect.d.ts +1 -1
  8. package/activity-diagram/src/fork/fork.rect.js +1 -1
  9. package/activity-diagram/src/register.js +1 -1
  10. package/activity-diagram/src/swimlaneH/swimlaneH.d.ts +1 -1
  11. package/activity-diagram/src/swimlaneH/swimlaneH.rect.d.ts +1 -1
  12. package/activity-diagram/src/swimlaneH/swimlaneH.rect.js +1 -1
  13. package/activity-diagram/src/swimlaneV/swimlaneV.d.ts +1 -1
  14. package/activity-diagram/src/swimlaneV/swimlaneV.rect.d.ts +1 -1
  15. package/activity-diagram/src/swimlaneV/swimlaneV.rect.js +1 -1
  16. package/chart-diagram/index.d.ts +1 -3
  17. package/chart-diagram/index.js +1 -2
  18. package/chart-diagram/src/echarts/index.d.ts +2 -1
  19. package/chart-diagram/src/echarts/index.js +104 -112
  20. package/chart-diagram/src/register.js +8 -9
  21. package/class-diagram/src/class/class.d.ts +1 -1
  22. package/class-diagram/src/class/class.rect.d.ts +1 -1
  23. package/class-diagram/src/class/class.rect.js +1 -1
  24. package/class-diagram/src/register.js +1 -1
  25. package/core/index.d.ts +0 -2
  26. package/core/index.js +0 -2
  27. package/core/src/activeLayer.d.ts +10 -2
  28. package/core/src/activeLayer.js +47 -42
  29. package/core/src/animateLayer.d.ts +7 -3
  30. package/core/src/animateLayer.js +12 -10
  31. package/core/src/calling.d.ts +4 -1
  32. package/core/src/calling.js +41 -43
  33. package/core/src/canvas.d.ts +6 -1
  34. package/core/src/canvas.js +21 -22
  35. package/core/src/common.d.ts +7 -6
  36. package/core/src/common.js +675 -343
  37. package/core/src/core.d.ts +4 -5
  38. package/core/src/core.js +385 -536
  39. package/core/src/divLayer.d.ts +36 -2
  40. package/core/src/divLayer.js +305 -33
  41. package/core/src/healps/changeData.d.ts +2 -1
  42. package/core/src/healps/changeData.js +100 -86
  43. package/core/src/hoverLayer.d.ts +9 -2
  44. package/core/src/hoverLayer.js +34 -31
  45. package/core/src/middles/default.d.ts +3 -1
  46. package/core/src/middles/default.js +51 -63
  47. package/core/src/middles/index.js +2 -3
  48. package/core/src/middles/nodes/arbitrarygraph.js +9 -11
  49. package/core/src/middles/nodes/pentagon.rect.js +1 -1
  50. package/core/src/middles/nodes/rectangle.rect.js +1 -1
  51. package/core/src/models/data.d.ts +26 -0
  52. package/core/src/models/data.js +77 -0
  53. package/core/src/models/data.js.map +1 -0
  54. package/core/src/models/index.d.ts +1 -0
  55. package/core/src/models/index.js +1 -0
  56. package/core/src/models/line.js +7 -7
  57. package/core/src/models/node.d.ts +0 -10
  58. package/core/src/models/node.js +101 -148
  59. package/core/src/models/pen.js +67 -27
  60. package/core/src/models/rect.js +2 -2
  61. package/core/src/mqtt.d.ts +14 -0
  62. package/core/src/mqtt.js +82 -0
  63. package/core/src/mqtt.js.map +1 -0
  64. package/core/src/offscreen.d.ts +4 -1
  65. package/core/src/offscreen.js +24 -26
  66. package/core/src/options.d.ts +1 -3
  67. package/core/src/options.js +0 -2
  68. package/core/src/poll.js +39 -0
  69. package/core/src/preview.d.ts +13 -2
  70. package/core/src/preview.js +43 -144
  71. package/core/src/renderLayer.d.ts +9 -11
  72. package/core/src/renderLayer.js +61 -60
  73. package/core/src/socket.d.ts +10 -0
  74. package/core/src/socket.js +51 -0
  75. package/core/src/socket.js.map +1 -0
  76. package/core/src/utils/canvas.js +1 -1
  77. package/core/src/utils/construction.d.ts +3 -36
  78. package/core/src/utils/construction.js +1 -29
  79. package/core/src/utils/conversion.d.ts +0 -15
  80. package/core/src/utils/conversion.js +0 -319
  81. package/core/src/utils/dom.d.ts +8 -0
  82. package/core/src/utils/dom.js +67 -0
  83. package/core/src/utils/dom.js.map +1 -0
  84. package/core/src/utils/index.d.ts +1 -2
  85. package/core/src/utils/index.js +1 -2
  86. package/core/src/utils/onmousevent.d.ts +0 -3
  87. package/core/src/utils/onmousevent.js +10 -42
  88. package/flow-diagram/src/comment/comment.anchor.d.ts +1 -1
  89. package/flow-diagram/src/comment/comment.anchor.js +1 -1
  90. package/flow-diagram/src/comment/comment.d.ts +1 -1
  91. package/flow-diagram/src/data/data.anchor.d.ts +1 -1
  92. package/flow-diagram/src/data/data.anchor.js +1 -1
  93. package/flow-diagram/src/data/data.d.ts +1 -1
  94. package/flow-diagram/src/data/data.rect.d.ts +1 -1
  95. package/flow-diagram/src/data/data.rect.js +1 -1
  96. package/flow-diagram/src/db/db.d.ts +1 -1
  97. package/flow-diagram/src/db/db.rect.d.ts +1 -1
  98. package/flow-diagram/src/db/db.rect.js +1 -1
  99. package/flow-diagram/src/display/display.anchor.d.ts +1 -1
  100. package/flow-diagram/src/display/display.anchor.js +1 -1
  101. package/flow-diagram/src/display/display.d.ts +1 -1
  102. package/flow-diagram/src/display/display.rect.d.ts +1 -1
  103. package/flow-diagram/src/display/display.rect.js +1 -1
  104. package/flow-diagram/src/document/document.anchor.d.ts +1 -1
  105. package/flow-diagram/src/document/document.anchor.js +1 -1
  106. package/flow-diagram/src/document/document.d.ts +1 -1
  107. package/flow-diagram/src/document/document.rect.d.ts +1 -1
  108. package/flow-diagram/src/document/document.rect.js +1 -1
  109. package/flow-diagram/src/externStorage/externStorage.anchor.d.ts +1 -1
  110. package/flow-diagram/src/externStorage/externStorage.anchor.js +1 -1
  111. package/flow-diagram/src/externStorage/externStorage.d.ts +1 -1
  112. package/flow-diagram/src/externStorage/externStorage.rect.d.ts +1 -1
  113. package/flow-diagram/src/externStorage/externStorage.rect.js +1 -1
  114. package/flow-diagram/src/internalStorage/internalStorage.d.ts +1 -1
  115. package/flow-diagram/src/internalStorage/internalStorage.rect.d.ts +1 -1
  116. package/flow-diagram/src/internalStorage/internalStorage.rect.js +1 -1
  117. package/flow-diagram/src/manually/manually.anchor.d.ts +1 -1
  118. package/flow-diagram/src/manually/manually.anchor.js +1 -1
  119. package/flow-diagram/src/manually/manually.d.ts +1 -1
  120. package/flow-diagram/src/manually/manually.rect.d.ts +1 -1
  121. package/flow-diagram/src/manually/manually.rect.js +1 -1
  122. package/flow-diagram/src/parallel/parallel.anchor.d.ts +1 -1
  123. package/flow-diagram/src/parallel/parallel.anchor.js +1 -1
  124. package/flow-diagram/src/parallel/parallel.d.ts +1 -1
  125. package/flow-diagram/src/queue/queue.d.ts +1 -1
  126. package/flow-diagram/src/queue/queue.rect.d.ts +1 -1
  127. package/flow-diagram/src/queue/queue.rect.js +1 -1
  128. package/flow-diagram/src/register.js +1 -1
  129. package/flow-diagram/src/subprocess/subprocess.d.ts +1 -1
  130. package/flow-diagram/src/subprocess/subprocess.rect.d.ts +1 -1
  131. package/flow-diagram/src/subprocess/subprocess.rect.js +1 -1
  132. package/layout/src/align.d.ts +1 -1
  133. package/layout/src/align.js +1 -1
  134. package/layout/src/layout.d.ts +1 -1
  135. package/layout/src/layout.js +1 -1
  136. package/myShape-diagram/{index.js → myShape.js} +1 -4
  137. package/package.json +1 -1
  138. package/sequence-diagram/src/focus/focus.anchor.d.ts +1 -1
  139. package/sequence-diagram/src/focus/focus.anchor.js +1 -1
  140. package/sequence-diagram/src/focus/focus.d.ts +1 -1
  141. package/sequence-diagram/src/focus/focus.rect.d.ts +1 -1
  142. package/sequence-diagram/src/focus/focus.rect.js +1 -1
  143. package/sequence-diagram/src/lifeline/lifeline.anchor.d.ts +1 -1
  144. package/sequence-diagram/src/lifeline/lifeline.anchor.js +1 -1
  145. package/sequence-diagram/src/lifeline/lifeline.d.ts +1 -1
  146. package/sequence-diagram/src/lifeline/lifeline.rect.d.ts +1 -1
  147. package/sequence-diagram/src/lifeline/lifeline.rect.js +1 -1
  148. package/sequence-diagram/src/register.js +1 -1
  149. package/chart-diagram/src/utils/changeOptions.d.ts +0 -8
  150. package/chart-diagram/src/utils/changeOptions.js +0 -267
  151. package/chart-diagram/src/utils/conversion.d.ts +0 -19
  152. package/chart-diagram/src/utils/conversion.js +0 -560
  153. package/chart-diagram/src/utils/drawGraphic.d.ts +0 -3
  154. package/chart-diagram/src/utils/drawGraphic.js +0 -97
  155. package/chart-diagram/src/utils/formatter.d.ts +0 -1
  156. package/chart-diagram/src/utils/formatter.js +0 -206
  157. package/chart-diagram/src/utils/index.d.ts +0 -5
  158. package/chart-diagram/src/utils/index.js +0 -5
  159. package/chart-diagram/src/utils/render.d.ts +0 -8
  160. package/chart-diagram/src/utils/render.js +0 -219
  161. package/chart-diagram/src/utils/surfaceParametricConversion.d.ts +0 -3
  162. package/chart-diagram/src/utils/surfaceParametricConversion.js +0 -252
  163. package/core/src/element/common.d.ts +0 -6
  164. package/core/src/element/common.js +0 -63
  165. package/core/src/element/datePicker.d.ts +0 -3
  166. package/core/src/element/datePicker.js +0 -44
  167. package/core/src/element/iframe.d.ts +0 -3
  168. package/core/src/element/iframe.js +0 -12
  169. package/core/src/element/index.d.ts +0 -5
  170. package/core/src/element/index.js +0 -6
  171. package/core/src/element/select.d.ts +0 -11
  172. package/core/src/element/select.js +0 -273
  173. package/core/src/element/tab.d.ts +0 -1
  174. package/core/src/element/tab.js +0 -20
  175. package/core/src/element/time.d.ts +0 -3
  176. package/core/src/element/time.js +0 -44
  177. package/core/src/middles/arrows/index.d.ts +0 -4
  178. package/core/src/middles/arrows/index.js +0 -5
  179. package/core/src/middles/lines/index.d.ts +0 -4
  180. package/core/src/middles/lines/index.js +0 -5
  181. package/core/src/middles/nodes/formDatePicker.d.ts +0 -2
  182. package/core/src/middles/nodes/formDatePicker.js +0 -107
  183. package/core/src/middles/nodes/formoverflow.js +0 -61
  184. package/core/src/middles/nodes/formselect.d.ts +0 -2
  185. package/core/src/middles/nodes/formselect.js +0 -111
  186. package/core/src/middles/nodes/iframe.d.ts +0 -2
  187. package/core/src/middles/nodes/iframe.js +0 -29
  188. package/core/src/middles/nodes/index.d.ts +0 -51
  189. package/core/src/middles/nodes/index.js +0 -53
  190. package/core/src/middles/nodes/switchs.d.ts +0 -2
  191. package/core/src/middles/nodes/switchs.js +0 -46
  192. package/core/src/middles/nodes/time.d.ts +0 -2
  193. package/core/src/middles/nodes/time.js +0 -98
  194. package/core/src/store/common.d.ts +0 -9
  195. package/core/src/store/common.js +0 -5
  196. package/core/src/store/data.d.ts +0 -196
  197. package/core/src/store/data.js +0 -193
  198. package/core/src/store/index.d.ts +0 -2
  199. package/core/src/store/index.js +0 -2
  200. package/core/src/utils/assignment.d.ts +0 -7
  201. package/core/src/utils/assignment.js +0 -216
  202. package/core/src/utils/params.d.ts +0 -3
  203. package/core/src/utils/params.js +0 -136
  204. package/static/echartsDefaultData.js +0 -178
  205. package/static/element.js +0 -14
  206. package/static/form.js +0 -11
  207. package/static/index.js +0 -3
  208. package/store/actions.js +0 -1
  209. package/store/clear.js +0 -10
  210. package/store/default.js +0 -22
  211. package/store/index.js +0 -3
  212. package/style/common.css +0 -15
  213. package/style/datePicker.css +0 -44
  214. package/style/editor.css +0 -16
  215. package/style/index.css +0 -5
  216. package/style/select.css +0 -143
  217. /package/myShape-diagram/{index.ts → myShape.ts} +0 -0
package/core/src/core.js CHANGED
@@ -16,25 +16,10 @@ import { Common } from './common'
16
16
  import {HoverLayer} from './hoverLayer';
17
17
  import {ActiveLayer} from './activeLayer';
18
18
  import {KeyType, KeydownType} from './options';
19
- import {PenType, Node, Point, Line, Lock, AnchorMode, Rect} from './models';
19
+ import {PenType, Node, Point, Line, TopologyData, Lock, AnchorMode, Rect} from './models';
20
20
  import {drawNodeFns, drawLineFns} from './middles/index';
21
- import {
22
- s8,
23
- pointInRect,
24
- formatPadding,
25
- setTagIdData,
26
- setKpiAddrData,
27
- setAssetIdData,
28
- setAreaIdData,
29
- setVarValueData,
30
- setBranchAddressData,
31
- setThreeCategoryIdData,
32
- setConnectionTagForConf,
33
- setConnectionTabsData,
34
- getTabConnectSHConf
35
- } from './utils';
36
- import {setSelectElementPosition} from './element';
37
- import {elementType} from '../../static';
21
+ import { s8, pointInRect, formatPadding, previewType} from './utils';
22
+ import axios from 'axios'
38
23
 
39
24
  var resizeCursors = ['nw-resize', 'ne-resize', 'se-resize', 'sw-resize'];
40
25
  var dockOffset = 10;
@@ -42,8 +27,8 @@ var Topology = (function (_super) {
42
27
  __extends(Topology, _super);
43
28
  function Topology(parent, options) {
44
29
  var _this = _super.call(this, parent, options) || this;
45
- _this.hoverLayer = new HoverLayer(_this.id);
46
- _this.activeLayer = new ActiveLayer(_this.id);
30
+ _this.hoverLayer = new HoverLayer(this.options, _this.id);
31
+ _this.activeLayer = new ActiveLayer(this.options, _this.id);
47
32
  _this.offscreen.getRoutineLayer();
48
33
  _this.activeLayer.topology = this;
49
34
  _this.gridElem = document.createElement('div');
@@ -51,10 +36,8 @@ var Topology = (function (_super) {
51
36
  index: 0,
52
37
  list: [],
53
38
  };
54
- _this.isTabHideShow = false;
55
39
  _this.needCache = false;
56
40
  _this.addingArbitraryGraph = false;
57
- _this.nodeId = '';
58
41
  _this.arbitrarygGraphData = {
59
42
  points: [],
60
43
  circles: [],
@@ -67,7 +50,7 @@ var Topology = (function (_super) {
67
50
  if (Store.get('addingArbitraryGraph')) {
68
51
  return
69
52
  }
70
- if (_this.scheduledAnimationFrame || _this.store.data.locked === Lock.NoEvent) {
53
+ if (_this.scheduledAnimationFrame || _this.data.locked === Lock.NoEvent) {
71
54
  return;
72
55
  }
73
56
  // https://caniuse.com/#feat=mdn-api_mouseevent_buttons
@@ -78,7 +61,7 @@ var Topology = (function (_super) {
78
61
  }
79
62
  if (_this.mouseDown) {
80
63
  var b = false;
81
- switch (_this.store.options.translateKey) {
64
+ switch (_this.options.translateKey) {
82
65
  case KeyType.None:
83
66
  b = true;
84
67
  break;
@@ -112,9 +95,8 @@ var Topology = (function (_super) {
112
95
  _this.dispatch('translate', {x, y});
113
96
  return false;
114
97
  }
115
-
116
98
  }
117
- if (_this.store.data.locked && _this.mouseDown) {
99
+ if (_this.data.locked && _this.mouseDown) {
118
100
  return;
119
101
  }
120
102
  _this.scheduledAnimationFrame = true;
@@ -168,18 +150,18 @@ var Topology = (function (_super) {
168
150
  return;
169
151
  }
170
152
  // Move out parent element.
171
- var moveOutX = pos.x + 50 > _this.store.parentElem.clientWidth + _this.store.parentElem.scrollLeft;
172
- var moveOutY = pos.y + 50 > _this.store.parentElem.clientHeight + _this.store.parentElem.scrollTop;
173
- if (!_this.store.options.disableMoveOutParent && (moveOutX || moveOutY)) {
153
+ var moveOutX = pos.x + 50 > _this.parentElem.clientWidth + _this.parentElem.scrollLeft;
154
+ var moveOutY = pos.y + 50 > _this.parentElem.clientHeight + _this.parentElem.scrollTop;
155
+ if (!_this.options.disableMoveOutParent && (moveOutX || moveOutY)) {
174
156
  _this.dispatch('moveOutParent', pos);
175
- if (_this.store.options.autoExpandDistance > 0) {
157
+ if (_this.options.autoExpandDistance > 0) {
176
158
  var resize = false;
177
159
  if (pos.x + 50 > _this.divLayer.canvas.clientWidth) {
178
- _this.canvas.width += _this.store.options.autoExpandDistance;
160
+ _this.canvas.width += _this.options.autoExpandDistance;
179
161
  resize = true;
180
162
  }
181
163
  if (pos.y + 50 > _this.divLayer.canvas.clientHeight) {
182
- _this.canvas.height += _this.store.options.autoExpandDistance;
164
+ _this.canvas.height += _this.options.autoExpandDistance;
183
165
  resize = true;
184
166
  }
185
167
  if (resize) {
@@ -188,21 +170,20 @@ var Topology = (function (_super) {
188
170
  height: _this.canvas.height,
189
171
  });
190
172
  }
191
- _this.scroll(moveOutX ? _this.store.options.autoExpandDistance / 2 : 0, moveOutY ? _this.store.options.autoExpandDistance / 2 : 0);
173
+ _this.scroll(moveOutX ? _this.options.autoExpandDistance / 2 : 0, moveOutY ? _this.options.autoExpandDistance / 2 : 0);
192
174
  }
193
175
  }
194
- var moveLeft = pos.x - 100 < _this.store.parentElem.scrollLeft;
195
- var moveTop = pos.y - 100 < _this.store.parentElem.scrollTop;
176
+ var moveLeft = pos.x - 100 < _this.parentElem.scrollLeft;
177
+ var moveTop = pos.y - 100 < _this.parentElem.scrollTop;
196
178
  if ((moveLeft || moveTop)) {
197
179
  _this.scroll(moveLeft ? -100 : 0, moveTop ? -100 : 0);
198
180
  }
199
- //console.log('_this.moveIn.type----', _this.moveIn.type)
181
+ // console.log('_this.moveIn.type----', _this.moveIn.type)
200
182
  switch (_this.moveIn.type) {
201
183
  case _this.moveInType.None:
202
184
  _this.hoverLayer.dragRect = new Rect(_this.mouseDown.x, _this.mouseDown.y, pos.x - _this.mouseDown.x, pos.y - _this.mouseDown.y);
203
185
  break;
204
186
  case _this.moveInType.Nodes:
205
- _this.store.data.dataResize = 0;
206
187
  if (_this.activeLayer.locked()) {
207
188
  break;
208
189
  }
@@ -213,15 +194,8 @@ var Topology = (function (_super) {
213
194
  _this.activeLayer.move(offset.x ? offset.x : x, offset.y ? offset.y : y);
214
195
  _this.needCache = true;
215
196
  }
216
- const dropdownSelect = _this.activeLayer.pens.filter((ds) => {return ds.name === elementType.select && ds.selectDropdown});
217
- if(dropdownSelect.length) {
218
- dropdownSelect.map((dropdown) => {
219
- setSelectElementPosition(dropdown);
220
- })
221
- }
222
197
  break;
223
198
  case _this.moveInType.ResizeCP:
224
- _this.store.data.dataResize = 1;
225
199
  var p1 = new Point(_this.mouseDown.x, _this.mouseDown.y);
226
200
  var p2 = new Point(pos.x, pos.y);
227
201
  var offsetX = p2.x - p1.x;
@@ -269,11 +243,8 @@ var Topology = (function (_super) {
269
243
  }
270
244
  }
271
245
  } else {
272
- const activeLayerPens = _this.activeLayer.pens;
273
- const isOnlySelect = activeLayerPens.length < 2 && activeLayerPens[0].name === elementType.select && activeLayerPens[0].selectDropdown;
274
- if(isOnlySelect) setSelectElementPosition(activeLayerPens[0]);
275
246
  _this.activeLayer.resize(_this.moveIn.activeAnchorIndex, _this.mouseDown, pos);
276
- _this.dispatch('resizePens', activeLayerPens);
247
+ _this.dispatch('resizePens', _this.activeLayer.pens);
277
248
  _this.needCache = true;
278
249
  }
279
250
  break;
@@ -314,7 +285,7 @@ var Topology = (function (_super) {
314
285
 
315
286
  } else {
316
287
 
317
- var arrow = _this.store.data.toArrowType;
288
+ var arrow = _this.data.toArrowType;
318
289
  if (_this.moveIn.hoverLine) {
319
290
  arrow = _this.moveIn.hoverLine.toArrow;
320
291
  }
@@ -368,8 +339,8 @@ var Topology = (function (_super) {
368
339
  });
369
340
  };
370
341
  _this.onmousedown = function (e) {
371
- _this.store.data.dataResize = 0;
372
- if (e.button !== 0) return;
342
+ if (e.button !== 0)
343
+ return;
373
344
  var canvasPos = _this.divLayer.canvas.getBoundingClientRect();
374
345
  _this.mouseDown = {x: e.x - canvasPos.x, y: e.y - canvasPos.y};
375
346
  if (e.altKey) {
@@ -404,7 +375,7 @@ var Topology = (function (_super) {
404
375
  break;
405
376
  case _this.moveInType.LineMove:
406
377
  _this.hoverLayer.initLine = new Line(_this.moveIn.hoverLine);
407
- if (_this.store.data.locked || _this.moveIn.hoverLine.locked) {
378
+ if (_this.data.locked || _this.moveIn.hoverLine.locked) {
408
379
  _this.moveIn.hoverLine.click();
409
380
  }
410
381
  // tslint:disable-next-line:no-switch-case-fall-through
@@ -422,12 +393,12 @@ var Topology = (function (_super) {
422
393
 
423
394
  } else {
424
395
  _this.hoverLayer.line = _this.addLine({
425
- name: _this.store.data.lineName,
396
+ name: _this.data.lineName,
426
397
  from: new Point(_this.moveIn.hoverNode.rotatedAnchors[_this.moveIn.hoverAnchorIndex].x, _this.moveIn.hoverNode.rotatedAnchors[_this.moveIn.hoverAnchorIndex].y, _this.moveIn.hoverNode.rotatedAnchors[_this.moveIn.hoverAnchorIndex].direction, _this.moveIn.hoverAnchorIndex, _this.moveIn.hoverNode.id),
427
- fromArrow: _this.store.data.fromArrowType,
398
+ fromArrow: _this.data.fromArrowType,
428
399
  to: new Point(_this.moveIn.hoverNode.rotatedAnchors[_this.moveIn.hoverAnchorIndex].x, _this.moveIn.hoverNode.rotatedAnchors[_this.moveIn.hoverAnchorIndex].y),
429
- toArrow: _this.store.data.toArrowType,
430
- strokeStyle: _this.store.options.color,
400
+ toArrow: _this.data.toArrowType,
401
+ strokeStyle: _this.options.color,
431
402
  });
432
403
  _this.dispatch('anchor', {
433
404
  anchor: _this.moveIn.hoverNode.rotatedAnchors[_this.moveIn.hoverAnchorIndex],
@@ -470,9 +441,10 @@ var Topology = (function (_super) {
470
441
  const activeNode = _this.moveIn.activeNode;
471
442
  if (!_this.checkNodeOfClickType(activeNode)) {
472
443
  _this.activeLayer.setPens([activeNode]);
473
- if(activeNode.name === elementType.select && activeNode.selectDropdown) setSelectElementPosition(activeNode, 'down');
474
- if(activeNode.name == 'tablePagination') {
475
- if (_this.store.options.type === 'topology') return _this.dispatch('node', activeNode);
444
+ if (activeNode && activeNode.name == 'arbitraryGraph') {
445
+ _this.dispatch('node', activeNode);
446
+ } else if (activeNode && activeNode.name == 'tablePagination') {
447
+ if (_this.options.type === 'topology') return _this.dispatch('node', activeNode);
476
448
  const pnlKeys = Object.keys(activeNode.paginationData.pageNumberLocals);
477
449
  const pageNumArea = pnlKeys.find((pna) => {
478
450
  return e.offsetX - 32 < pna && e.offsetX - parseInt(pna) > 0
@@ -485,13 +457,20 @@ var Topology = (function (_super) {
485
457
  if (activeNode.paginationData.pageListState) _this.spreadPageListHandle(activeNode, e);
486
458
  if (activeNode.paginationData.targetPageLocal.hide) _this.targetPageInputHandle(activeNode, e);
487
459
  }
488
- }else {
489
- _this.changeTabsState(activeNode);
460
+ } else {
490
461
  _this.dispatch('node', activeNode);
462
+ if(!window.location.pathname.includes('workspace')) {
463
+ const staticTypeNode = activeNode.events.find((ev) => {
464
+ return parseInt(ev.action) === 8
465
+ }); // 若绑定的是echarts统计图事件
466
+ if (staticTypeNode) {
467
+ _this.switchStaticsCheckType(activeNode, staticTypeNode);
468
+ }
469
+ }
491
470
  }
492
471
  }
493
472
  }
494
- if (_this.store.data.locked || _this.moveIn.activeNode.locked) {
473
+ if (_this.data.locked || _this.moveIn.activeNode.locked) {
495
474
  _this.moveIn.activeNode.click();
496
475
  }
497
476
  break;
@@ -532,10 +511,10 @@ var Topology = (function (_super) {
532
511
  if (_this.hoverLayer.line) {
533
512
  var willAddLine = void 0;
534
513
  if (_this.hoverLayer.line.to.id) {
535
- if (!_this.store.options.disableRepeatLine) {
514
+ if (!_this.options.disableRepeatLine) {
536
515
  willAddLine = true;
537
516
  } else {
538
- var lines = _this.store.data.pens.filter(function (pen) {
517
+ var lines = _this.data.pens.filter(function (pen) {
539
518
  return pen.type === PenType.Line &&
540
519
  pen.from.isSameAs(_this.hoverLayer.line.from) &&
541
520
  pen.to.isSameAs(_this.hoverLayer.line.to);
@@ -543,13 +522,13 @@ var Topology = (function (_super) {
543
522
  willAddLine = lines.length <= 1;
544
523
  }
545
524
  } else {
546
- willAddLine = !_this.store.options.disableEmptyLine;
525
+ willAddLine = !_this.options.disableEmptyLine;
547
526
  }
548
527
  if (willAddLine) {
549
528
  _this.activeLayer.pens = [_this.hoverLayer.line];
550
529
  _this.dispatch('addLine', _this.hoverLayer.line);
551
530
  } else {
552
- _this.store.data.pens.pop();
531
+ _this.data.pens.pop();
553
532
  _this.activeLayer.clear();
554
533
  }
555
534
  }
@@ -568,7 +547,7 @@ var Topology = (function (_super) {
568
547
  (!_this.hoverLayer.line.from.id || !_this.hoverLayer.line.to.id)) {
569
548
  _this.needCache = true;
570
549
  _this.activeLayer.clear();
571
- _this.store.data.pens.splice(_this.findIndex(_this.hoverLayer.line), 1);
550
+ _this.data.pens.splice(_this.findIndex(_this.hoverLayer.line), 1);
572
551
  }
573
552
  break;
574
553
  }
@@ -581,7 +560,7 @@ var Topology = (function (_super) {
581
560
  _this.needCache = false;
582
561
  };
583
562
  _this.onkeydown = function (key) {
584
- if (_this.store && _this.store.data.locked ||
563
+ if (_this.data.locked ||
585
564
  key.target.tagName === 'INPUT' ||
586
565
  key.target.tagName === 'TEXTAREA') {
587
566
  return;
@@ -592,7 +571,7 @@ var Topology = (function (_super) {
592
571
  switch (key.key) {
593
572
  case 'a':
594
573
  case 'A':
595
- _this.activeLayer.setPens(_this.store.data.pens);
574
+ _this.activeLayer.setPens(_this.data.pens);
596
575
  _this.dispatch('multi', _this.activeLayer.pens);
597
576
  done = true;
598
577
  break;
@@ -696,45 +675,41 @@ var Topology = (function (_super) {
696
675
  return;
697
676
  var obj = JSON.parse(json);
698
677
  event.preventDefault();
699
- if(obj.type && obj.type === 'temp') {
700
- obj.locked = 0;
701
- // 模板
702
- _this.animateLayer.stop();
703
- _this.closeMqtt();
704
- _this.open(obj);
705
- const tempData = {
706
- name: obj.name,
707
- component: obj.component,
708
- image: obj.image,
709
- useType: obj.useType,
710
- data: JSON.parse(json)
711
- };
712
- delete tempData.data['pens'];
713
- _this.dispatch('template', tempData);
714
- }else {
715
- if (obj.name && obj.name == 'arbitraryGraph') {
716
- Store.set('addingArbitraryGraph', true);
717
- _this.addingArbitraryGraph = true;
718
- _this.dispatch('addingArbitraryGraph', true);
719
- return
720
- }
721
- _this.addingArbitraryGraph = false;
722
- Store.set('addingArbitraryGraph', false);
723
- _this.arbitrarygGraphData = {
724
- points: [],
725
- circles: [],
726
- indexCircle: 0, //当前点击的圆圈
727
- oZindex: -1, //是否达到起点
728
- isDragging: false, //是否在抓取
729
- close: false, //闭合
730
- };
678
+ if (obj.name && obj.name == 'arbitraryGraph') {
679
+ Store.set('addingArbitraryGraph', true);
680
+ _this.addingArbitraryGraph = true;
681
+ _this.dispatch('addingArbitraryGraph', true);
682
+ return
683
+ }
684
+ _this.addingArbitraryGraph = false;
685
+ Store.set('addingArbitraryGraph', false);
686
+ _this.arbitrarygGraphData = {
687
+ points: [],
688
+ circles: [],
689
+ indexCircle: 0, //当前点击的圆圈
690
+ oZindex: -1, //是否达到起点
691
+ isDragging: false, //是否在抓取
692
+ close: false, //闭合
693
+ };
694
+ if (obj.name == 'temp') {
695
+ // 温湿度元件
696
+ let activeTempNodes = []
697
+ _this.dropNodes([obj.children[0]], event.offsetX - 23.5, event.offsetY)
698
+ activeTempNodes.push(_this.activeLayer.pens[0])
699
+ _this.dropNodes([obj.children[1]], event.offsetX + 11.5, event.offsetY - 8.5)
700
+ activeTempNodes.push(_this.activeLayer.pens[0])
701
+ _this.dropNodes([obj.children[2]], event.offsetX + 11.5, event.offsetY + 8.5)
702
+ activeTempNodes.push(_this.activeLayer.pens[0])
703
+ _this.activeLayer.pens = activeTempNodes
704
+ _this.combine(activeTempNodes, null, 'temp');
705
+ } else {
731
706
  _this.dropNodes(Array.isArray(obj) ? obj : [obj], event.offsetX, event.offsetY);
732
707
  }
733
708
  } catch (_a) {
734
709
  }
735
710
  };
736
711
  _this.subcribeAnimateMoved = Store.subscribe(this.generateStoreKey('LT:rectChanged'), function (e) {
737
- _this.activeLayer.updateLines(_this.store.data.pens);
712
+ _this.activeLayer.updateLines(_this.data.pens);
738
713
  });
739
714
  _this.subcribeMediaEnd = Store.subscribe(this.generateStoreKey('mediaEnd'), function (node) {
740
715
  if (node.nextPlay) {
@@ -747,7 +722,7 @@ var Topology = (function (_super) {
747
722
  if (window.location.pathname.includes('workspace')) {
748
723
  return
749
724
  }
750
- _this.hidePenByTag(_this.store.data.pens, e);
725
+ _this.hidePenByTag(_this.data.pens, e);
751
726
  const obj = e ? JSON.parse(e) : {}
752
727
  const visibleRange = obj.visibleRange
753
728
  if (visibleRange == '1') {
@@ -758,10 +733,10 @@ var Topology = (function (_super) {
758
733
  _this.divLayer.canvas.onmousedown = this.onmousedown;
759
734
  _this.divLayer.canvas.onmouseup = this.onmouseup;
760
735
  _this.divLayer.canvas.onwheel = function (event) {
761
- if (_this.store.options.disableScale) {
736
+ if (_this.options.disableScale) {
762
737
  return;
763
738
  }
764
- switch (_this.store.options.scaleKey) {
739
+ switch (_this.options.scaleKey) {
765
740
  case KeyType.None:
766
741
  break;
767
742
  case KeyType.Ctrl:
@@ -785,28 +760,28 @@ var Topology = (function (_super) {
785
760
  }
786
761
  }
787
762
  event.preventDefault();
788
- // if (event.deltaY < 0) {
789
- // if (event.layerX && event.layerY) {
790
- // _this.scale(1.1, {x: event.layerX, y: event.layerY});
791
- // _this.canvas.scale(1.1, {x: event.layerX, y: event.layerY});
792
- // } else {
793
- // _this.scale(1.1);
794
- // _this.canvas.scale(1.1);
795
- // }
796
- // } else {
797
- // if (event.layerX && event.layerY) {
798
- // _this.scale(0.9, {x: event.layerX, y: event.layerY});
799
- // _this.canvas.scale(0.9, {x: event.layerX, y: event.layerY});
800
- // } else {
801
- // _this.scale(0.9);
802
- // _this.canvas.scale(0.9);
803
- // }
804
- // }
763
+ if (event.deltaY < 0) {
764
+ if (event.layerX && event.layerY) {
765
+ _this.scale(1.1, {x: event.layerX, y: event.layerY});
766
+ _this.canvas.scale(1.1, {x: event.layerX, y: event.layerY});
767
+ } else {
768
+ _this.scale(1.1);
769
+ _this.canvas.scale(1.1);
770
+ }
771
+ } else {
772
+ if (event.layerX && event.layerY) {
773
+ _this.scale(0.9, {x: event.layerX, y: event.layerY});
774
+ _this.canvas.scale(0.9, {x: event.layerX, y: event.layerY});
775
+ } else {
776
+ _this.scale(0.9);
777
+ _this.canvas.scale(0.9);
778
+ }
779
+ }
805
780
  _this.divLayer.canvas.focus();
806
781
  return false;
807
782
  };
808
783
  _this.cache();
809
- switch (_this.store.options.keydown) {
784
+ switch (_this.options.keydown) {
810
785
  case KeydownType.Document:
811
786
  document.onkeydown = _this.onkeydown;
812
787
  break;
@@ -820,7 +795,6 @@ var Topology = (function (_super) {
820
795
  clearTimeout(timer);
821
796
  }
822
797
  timer = setTimeout(function () {
823
- _this.resize();
824
798
  _this.overflow();
825
799
  _this.render();
826
800
  }, 100);
@@ -829,26 +803,26 @@ var Topology = (function (_super) {
829
803
  return _this;
830
804
  }
831
805
  // Render or redraw
832
- Topology.prototype.render = function (noFocus) {
833
- try{
834
- if (noFocus === void 0) {
835
- noFocus = false;
836
- }
837
- if (noFocus) {
838
- this.activeLayer.pens = [];
839
- this.hoverLayer.node = null;
840
- this.hoverLayer.line = null;
841
- }
842
- if (this.rendering) {
843
- return this;
844
- }
845
- this.rendering = true;
846
- this.offscreen.render();
847
- this.canvas.render();
848
- this.rendering = false;
849
- }catch (e){
850
- //console.log('render-error-------------', e)
851
- }
806
+ Topology.prototype.render = function (noFocus, type) {
807
+ try{
808
+ if (noFocus === void 0) {
809
+ noFocus = false;
810
+ }
811
+ if (noFocus) {
812
+ this.activeLayer.pens = [];
813
+ this.hoverLayer.node = null;
814
+ this.hoverLayer.line = null;
815
+ }
816
+ if (this.rendering) {
817
+ return this;
818
+ }
819
+ this.rendering = true;
820
+ this.offscreen.render();
821
+ this.canvas.render();
822
+ this.rendering = false;
823
+ }catch (e){
824
+ console.log('render-error-------------')
825
+ }
852
826
  };
853
827
  Topology.prototype.resize = function (size) {
854
828
  this.canvasResize(size);
@@ -878,26 +852,58 @@ var Topology = (function (_super) {
878
852
  }
879
853
  if (json.name === 'lineAlone') {
880
854
  _this.addLine({
881
- name: _this.store.data.lineName,
855
+ name: _this.data.lineName,
882
856
  from: new Point(json.rect.x, json.rect.y),
883
- fromArrow: _this.store.data.fromArrowType,
857
+ fromArrow: _this.data.fromArrowType,
884
858
  to: new Point(json.rect.x + json.rect.width, json.rect.y + json.rect.height),
885
- toArrow: _this.store.data.toArrowType,
886
- strokeStyle: _this.store.options.color,
859
+ toArrow: _this.data.toArrowType,
860
+ strokeStyle: _this.options.color,
887
861
  }, true);
888
862
  }
889
863
 
890
864
  if (json.name == 'define') {
865
+
891
866
  // console.log('创建自定义组件 ', json);
867
+
892
868
  console.log('store 中的 自定义 ', Store.get('defineNode'));
893
- _this.dropDefineNode(json, offsetX, offsetY);
894
- } else if(json.name === 'temp') {
895
- // 温湿度元件
896
- _this.dropTempNode(json);
897
- }else {
869
+ if (_this.data.locked) return
870
+ // let defineNode = Store.get('defineNode');
871
+ // let nodesList = Store.get('defineNode').pens;
872
+ let defineNode = JSON.parse(localStorage.getItem("defineNode_"))
873
+ let nodesList = defineNode.pens;
874
+
875
+ let renderNodesList = [];
876
+
877
+ for (let i = 0, len = nodesList.length; i < len; i++) {
878
+
879
+ nodesList[i].rect.x = offsetX - nodesList[i].rect.width / 2;
880
+
881
+ nodesList[i].rect.y = offsetY - nodesList[i].rect.height / 2;
882
+
883
+ let node = new Node(nodesList[i]);
884
+
885
+ node.setTID(s8());
886
+ node.id = s8();
887
+ node.fileId = defineNode.fileId;
888
+
889
+ // console.log('push之前的node', node);
890
+
891
+ _this.data.pens.push(node);
892
+
893
+ renderNodesList.push(node);
894
+ }
895
+ _this.activeLayer.setPens([renderNodesList[0]]);
896
+
897
+ _this.render(false);
898
+
899
+ _this.animate(true);
900
+
901
+ _this.cache();
902
+
903
+ _this.dispatch('addNode', renderNodesList[0]);
904
+
905
+ } else {
898
906
  var node = new Node(json);
899
- if(node.name === 'echarts') node.dash = 4;
900
- if(node.name === 'iframe') node.iframe = 'http://www.yingzeshiji.com.cn/'; // 默认展示盈泽世纪官网
901
907
  node.setTID(_this.id);
902
908
  node.clearChildrenIds();
903
909
  _this.addNode(node, true);
@@ -905,7 +911,7 @@ var Topology = (function (_super) {
905
911
  _this.dispatch('LT:addDiv', node);
906
912
  }
907
913
  if (node.name === 'formTable') {
908
- _this.store.data.dataConstruct[node.id] = {
914
+ _this.data.dataConstruct[node.id] = {
909
915
  id: node.id,
910
916
  name: 'table'
911
917
  }
@@ -914,123 +920,36 @@ var Topology = (function (_super) {
914
920
  });
915
921
  this.divLayer.canvas.focus();
916
922
  };
917
- Topology.prototype.setNodeData = function(node) {
918
- const item = new Node(node);
919
- item.setTID(this.id);
920
- item.clearChildrenIds();
921
- return item;
922
- };
923
- Topology.prototype.changeTabsState = function (node) {
924
- if(this.nodeId === node.id) return;
925
- this.nodeId = node.id;
926
- this.isTabHideShow = node.events && node.events.some((ev) => {return ev.action === 8 && ev.dcimStaticForType === 'SH'});
927
- if(!this.isTabHideShow) return;
928
- // tab显示隐藏
929
- const pens = this.store.data.pens;
930
- // 重置tabs数据
931
- for (let i = 0, pensLength = pens.length; i < pensLength; i++) {
932
- pens[i].order = i;
933
- setConnectionTabsData(pens[i]);
934
- }
935
- this.switchStaticsCheckType(node, {dcimStaticForType: 'SH'});
936
- };
937
- // 添加温湿度元件
938
- Topology.prototype.dropTempNode = function(json) {
939
- const nodeChildren = json.children;
940
- delete json['children'];
941
- const node = this.setNodeData(json);
942
- const combinTempData = [];
943
- let nodeX = node.rect.x;
944
- let nodeY = node.rect.y;
945
- for (let i = 0; i < nodeChildren.length; i++) {
946
- const childNode = this.setNodeData(nodeChildren[i]);
947
- childNode.rect.x = i === 0 ? nodeX : nodeX + childNode.rect.width / 2;
948
- childNode.rect.y = i === 2 ? nodeY + childNode.rect.height + 1 : nodeY;
949
- childNode.rect.center = {
950
- x: childNode.rect.x + childNode.rect.width / 2,
951
- y: childNode.rect.y + childNode.rect.height / 2
952
- }
953
- childNode.rect.ex = childNode.rect.x + childNode.rect.width;
954
- childNode.rect.ey = childNode.rect.y + childNode.rect.height;
955
- combinTempData.push(childNode);
956
- }
957
- this.combine(combinTempData, null, 'temp');
958
- this.render();
959
- this.cache();
960
- };
961
- // 添加自定义元件
962
- Topology.prototype.dropDefineNode = function(josn, offsetX, offsetY) {
963
- var _this = this;
964
- if (_this.store.data.locked) return
965
- // let defineNode = Store.get('defineNode');
966
- // let nodesList = Store.get('defineNode').pens;
967
- let defineNode = JSON.parse(localStorage.getItem("defineNode_"))
968
- let nodesList = defineNode.pens;
969
-
970
- let renderNodesList = [];
971
-
972
- for (let i = 0, len = nodesList.length; i < len; i++) {
973
-
974
- nodesList[i].rect.x = offsetX - nodesList[i].rect.width / 2;
975
-
976
- nodesList[i].rect.y = offsetY - nodesList[i].rect.height / 2;
977
-
978
- let node = new Node(nodesList[i]);
979
-
980
- node.setTID(s8());
981
- node.id = s8();
982
- node.fileId = defineNode.fileId;
983
-
984
- // console.log('push之前的node', node);
985
-
986
- _this.store.data.pens.push(node);
987
-
988
- renderNodesList.push(node);
989
- }
990
- _this.activeLayer.setPens([renderNodesList[0]]);
991
-
992
- _this.render(false);
993
-
994
- _this.animate(true);
995
-
996
- _this.cache();
997
-
998
- _this.dispatch('addNode', renderNodesList[0]);
999
- };
1000
- Topology.prototype.addNode = function (node, focus, visit) {
923
+ Topology.prototype.addNode = function (node, focus) {
1001
924
  if (focus === void 0) {
1002
925
  focus = false;
1003
926
  }
1004
- if (this.store.data.locked || !drawNodeFns[node.name]) {
927
+ if (this.data.locked || !drawNodeFns[node.name]) {
1005
928
  return null;
1006
929
  }
1007
930
  // if it's not a Node
1008
931
  if (!node.init) {
1009
932
  node = new Node(node);
1010
933
  }
1011
- if (!node.strokeStyle && this.store.options.color) {
1012
- node.strokeStyle = this.store.options.color;
934
+ if (!node.strokeStyle && this.options.color) {
935
+ node.strokeStyle = this.options.color;
1013
936
  }
1014
937
  for (var key in node.font) {
1015
938
  if (!node.font[key]) {
1016
- node.font[key] = this.store.options.font[key];
939
+ node.font[key] = this.options.font[key];
1017
940
  }
1018
941
  }
1019
- if (this.store.data.scale !== 1) {
1020
- node.scale(this.store.data.scale);
942
+ if (this.data.scale !== 1) {
943
+ node.scale(this.data.scale);
1021
944
  }
1022
- node.visibleSwitch = true;
1023
- node.order = this.store.data.pens.length;
1024
- this.store.data.pens.push(node);
1025
- setConnectionTagForConf(node);
945
+ this.data.pens.push(node);
946
+ this.setSwitchTabData(node, this.data.pens.length-1);
1026
947
  if (focus) {
948
+ this.activeLayer.setPens([node]);
1027
949
  this.render();
1028
950
  this.animate(true);
1029
951
  this.cache();
1030
- if(!visit) {
1031
- this.activeLayer.setPens([node]);
1032
- this.dispatch('addNode', node);
1033
- }
952
+ this.dispatch('addNode', node);
1034
953
  }
1035
954
  return node;
1036
955
  };
@@ -1038,14 +957,14 @@ var Topology = (function (_super) {
1038
957
  if (focus === void 0) {
1039
958
  focus = false;
1040
959
  }
1041
- if (this.store.data.locked) {
960
+ if (this.data.locked) {
1042
961
  return null;
1043
962
  }
1044
963
  if (!line.clone) {
1045
964
  line = new Line(line);
1046
965
  line.calcControlPoints(true);
1047
966
  }
1048
- this.store.data.pens.push(line);
967
+ this.data.pens.push(line);
1049
968
  if (focus) {
1050
969
  this.activeLayer.setPens([line]);
1051
970
  this.render();
@@ -1058,10 +977,10 @@ var Topology = (function (_super) {
1058
977
  // open - redraw by the data
1059
978
  Topology.prototype.open = function (topoJSon) {
1060
979
  this.conversionData(topoJSon);
1061
- Store.set(this.generateStoreKey('LT:scale'), this.store.data.scale);
1062
- this.dispatch('scale', this.store.data.scale);
1063
- this.store.parentElem.scrollLeft = 0;
1064
- this.store.parentElem.scrollTop = 0;
980
+ Store.set(this.generateStoreKey('LT:scale'), this.data.scale);
981
+ this.dispatch('scale', this.data.scale);
982
+ this.parentElem.scrollLeft = 0;
983
+ this.parentElem.scrollTop = 0;
1065
984
  this.caches.list = [];
1066
985
  this.divLayer.clear();
1067
986
  this.cache();
@@ -1071,22 +990,22 @@ var Topology = (function (_super) {
1071
990
  this.showGrid();
1072
991
  };
1073
992
  Topology.prototype.overflow = function () {
1074
- try {
1075
- var rect = this.getRect();
1076
- let _a = this.canvas;
1077
- if(!_a.width) return;
1078
- let width = _a.width, height = _a.height;
1079
- if (width < rect.width) {
1080
- width = rect.width;
1081
- }
1082
- if (height < rect.height) {
1083
- height = rect.height;
1084
- }
1085
- this.resize({width: width, height: height});
1086
- return rect;
1087
- }catch (e){
1088
- //console.log('init-error-----------',e)
993
+ try {
994
+ var rect = this.getRect();
995
+ let _a = this.canvas;
996
+ if(!_a.width) return;
997
+ let width = _a.width, height = _a.height;
998
+ if (width < rect.width) {
999
+ width = rect.width;
1000
+ }
1001
+ if (height < rect.height) {
1002
+ height = rect.height;
1089
1003
  }
1004
+ this.resize({width: width, height: height});
1005
+ return rect;
1006
+ }catch (e){
1007
+ console.log('init-error-----------')
1008
+ }
1090
1009
  };
1091
1010
  Topology.prototype.getMoveIn = function (pt) {
1092
1011
  this.lastHoverNode = this.moveIn.hoverNode;
@@ -1096,13 +1015,13 @@ var Topology = (function (_super) {
1096
1015
  this.moveIn.lineControlPoint = null;
1097
1016
  this.moveIn.hoverLine = null;
1098
1017
  this.hoverLayer.hoverAnchorIndex = -1;
1099
- if (!this.store.data.locked &&
1018
+ if (!this.data.locked &&
1100
1019
  !(this.activeLayer.pens.length === 1 && this.activeLayer.pens[0].type) &&
1101
1020
  !this.activeLayer.locked() &&
1102
1021
  this.activeLayer.rotateCPs[0] &&
1103
1022
  this.activeLayer.rotateCPs[0].hit(pt, 15)) {
1104
1023
  this.moveIn.type = this.moveInType.Rotate;
1105
- var cursor = this.store.options.rotateCursor;
1024
+ var cursor = this.options.rotateCursor;
1106
1025
  this.divLayer.canvas.style.cursor = cursor.includes('/')
1107
1026
  ? "url(\"" + cursor + "\"), auto"
1108
1027
  : cursor;
@@ -1112,9 +1031,9 @@ var Topology = (function (_super) {
1112
1031
  pointInRect(pt, this.activeLayer.sizeCPs)) {
1113
1032
  this.moveIn.type = this.moveInType.Nodes;
1114
1033
  }
1115
- if (!this.store.data.locked &&
1034
+ if (!this.data.locked &&
1116
1035
  !this.activeLayer.locked() &&
1117
- !this.store.options.hideSizeCP) {
1036
+ !this.options.hideSizeCP) {
1118
1037
  if (this.activeLayer.pens.length > 1 ||
1119
1038
  (!this.activeLayer.pens[0].type && !this.activeLayer.pens[0].hideSizeCP)) {
1120
1039
  for (var i = 0; i < this.activeLayer.sizeCPs.length; ++i) {
@@ -1127,8 +1046,8 @@ var Topology = (function (_super) {
1127
1046
  }
1128
1047
  }
1129
1048
  }
1130
- // In active pen.
1131
- if (!this.store.data.locked) {
1049
+ // In active pen.
1050
+ if (!this.data.locked) {
1132
1051
  for (var _i = 0, _a = this.activeLayer.pens; _i < _a.length; _i++) {
1133
1052
  var item = _a[_i];
1134
1053
  if (item instanceof Line && !item.locked) {
@@ -1148,19 +1067,16 @@ var Topology = (function (_super) {
1148
1067
  }
1149
1068
  }
1150
1069
  }
1151
- this.store.data.dataResize = 1;
1152
1070
  this.divLayer.canvas.style.cursor = 'default';
1153
- var len = this.store.data.pens.length;
1071
+ var len = this.data.pens.length;
1154
1072
  for (var i = len - 1; i > -1; --i) {
1155
- if(this.store.data.pens[i].visible || this.store.data.pens[i].visibleSwitch){
1156
- if (this.store.data.pens[i].type === PenType.Node &&
1157
- this.inNode(pt, this.store.data.pens[i])) {
1158
- return;
1159
- } else if (this.store.data.pens[i].type === PenType.Line &&
1160
- this.inLine(pt, this.store.data.pens[i])) {
1161
- // 需要优先判断十分在节点锚点上
1162
- // return;
1163
- }
1073
+ if (this.data.pens[i].type === PenType.Node &&
1074
+ this.inNode(pt, this.data.pens[i])) {
1075
+ return;
1076
+ } else if (this.data.pens[i].type === PenType.Line &&
1077
+ this.inLine(pt, this.data.pens[i])) {
1078
+ // 需要优先判断十分在节点锚点上
1079
+ // return;
1164
1080
  }
1165
1081
  }
1166
1082
  };
@@ -1191,7 +1107,7 @@ var Topology = (function (_super) {
1191
1107
  if (inChild === void 0) {
1192
1108
  inChild = false;
1193
1109
  }
1194
- if (this.store.data.locked === Lock.NoEvent ||
1110
+ if (this.data.locked === Lock.NoEvent ||
1195
1111
  (!node.visible && !window.location.pathname.includes('workspace')) ||
1196
1112
  node.locked === Lock.NoEvent) {
1197
1113
  return null;
@@ -1212,22 +1128,21 @@ var Topology = (function (_super) {
1212
1128
  }
1213
1129
  return child;
1214
1130
  }
1215
- if(!(node instanceof Node)) node = new Node(node);
1216
1131
  if (node.hit(pt)) {
1217
1132
  this.moveIn.hoverNode = node;
1218
1133
  this.moveIn.type = this.moveInType.Nodes;
1219
1134
  // 非绘画页面下禁止不包含点击、双击事件的节点选中鼠标样式
1220
1135
  if (!this.checkNodeOfClickType(node)) {
1221
- if (!this.store.data.locked && !node.locked) {
1136
+ if (!this.data.locked && !node.locked) {
1222
1137
  this.divLayer.canvas.style.cursor = 'move';
1223
1138
  } else {
1224
- this.divLayer.canvas.style.cursor = this.store.options.hoverCursor;
1139
+ this.divLayer.canvas.style.cursor = this.options.hoverCursor;
1225
1140
  }
1226
1141
  }
1227
1142
  // Too small
1228
- if (!this.store.data.locked &&
1143
+ if (!this.data.locked &&
1229
1144
  !node.locked &&
1230
- !(this.store.options.hideAnchor ||
1145
+ !(this.options.hideAnchor ||
1231
1146
  node.hideAnchor ||
1232
1147
  node.rect.width < 20 ||
1233
1148
  node.rect.height < 20)) {
@@ -1250,9 +1165,9 @@ var Topology = (function (_super) {
1250
1165
  }
1251
1166
  return node;
1252
1167
  }
1253
- if (this.store.options.hideAnchor ||
1168
+ if (this.options.hideAnchor ||
1254
1169
  node.hideAnchor ||
1255
- this.store.data.locked ||
1170
+ this.data.locked ||
1256
1171
  node.locked) {
1257
1172
  return null;
1258
1173
  }
@@ -1284,8 +1199,8 @@ var Topology = (function (_super) {
1284
1199
  if (line.from.hit(point, 5)) {
1285
1200
  this.moveIn.type = this.moveInType.LineFrom;
1286
1201
  this.moveIn.hoverLine = line;
1287
- if (this.store.data.locked || line.locked) {
1288
- this.divLayer.canvas.style.cursor = this.store.options.hoverCursor;
1202
+ if (this.data.locked || line.locked) {
1203
+ this.divLayer.canvas.style.cursor = this.options.hoverCursor;
1289
1204
  } else {
1290
1205
  this.divLayer.canvas.style.cursor = 'move';
1291
1206
  }
@@ -1294,8 +1209,8 @@ var Topology = (function (_super) {
1294
1209
  if (line.to.hit(point, 5)) {
1295
1210
  this.moveIn.type = this.moveInType.LineTo;
1296
1211
  this.moveIn.hoverLine = line;
1297
- if (this.store.data.locked || line.locked) {
1298
- this.divLayer.canvas.style.cursor = this.store.options.hoverCursor;
1212
+ if (this.data.locked || line.locked) {
1213
+ this.divLayer.canvas.style.cursor = this.options.hoverCursor;
1299
1214
  } else {
1300
1215
  this.divLayer.canvas.style.cursor = 'move';
1301
1216
  }
@@ -1304,7 +1219,7 @@ var Topology = (function (_super) {
1304
1219
  if (line.pointIn(point)) {
1305
1220
  this.moveIn.type = this.moveInType.LineMove;
1306
1221
  this.moveIn.hoverLine = line;
1307
- this.divLayer.canvas.style.cursor = this.store.options.hoverCursor;
1222
+ this.divLayer.canvas.style.cursor = this.options.hoverCursor;
1308
1223
  if (line.from.id || line.to.id) {
1309
1224
  this.moveIn.type = this.moveInType.Line;
1310
1225
  }
@@ -1314,7 +1229,7 @@ var Topology = (function (_super) {
1314
1229
  };
1315
1230
  Topology.prototype.getLineDock = function (point) {
1316
1231
  this.hoverLayer.dockAnchor = null;
1317
- for (var _i = 0, _a = this.store.data.pens; _i < _a.length; _i++) {
1232
+ for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
1318
1233
  var item = _a[_i];
1319
1234
  if (item instanceof Node) {
1320
1235
  if (item.rect.hit(point, 10)) {
@@ -1381,7 +1296,7 @@ var Topology = (function (_super) {
1381
1296
  rect.ey = rect.y + rect.height;
1382
1297
  }
1383
1298
  this.activeLayer.pens = [];
1384
- for (var _i = 0, _a = this.store.data.pens; _i < _a.length; _i++) {
1299
+ for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
1385
1300
  var item = _a[_i];
1386
1301
  if (item.locked === Lock.NoEvent) {
1387
1302
  continue;
@@ -1428,7 +1343,7 @@ var Topology = (function (_super) {
1428
1343
  x: 0,
1429
1344
  y: 0,
1430
1345
  };
1431
- if (noDock || this.store.options.disableDockLine) {
1346
+ if (noDock || this.options.disableDockLine) {
1432
1347
  return offset;
1433
1348
  }
1434
1349
  var x = 0;
@@ -1437,7 +1352,7 @@ var Topology = (function (_super) {
1437
1352
  var disY = dockOffset;
1438
1353
  for (var _i = 0, _a = this.activeLayer.dockWatchers; _i < _a.length; _i++) {
1439
1354
  var activePt = _a[_i];
1440
- for (var _b = 0, _c = this.store.data.pens; _b < _c.length; _b++) {
1355
+ for (var _b = 0, _c = this.data.pens; _b < _c.length; _b++) {
1441
1356
  var item = _c[_b];
1442
1357
  if (!(item instanceof Node) ||
1443
1358
  this.activeLayer.has(item) ||
@@ -1470,9 +1385,9 @@ var Topology = (function (_super) {
1470
1385
  if (this.caches.index < this.caches.list.length - 1) {
1471
1386
  this.caches.list.splice(this.caches.index + 1, this.caches.list.length - this.caches.index - 1);
1472
1387
  }
1473
- var data = JSON.parse(JSON.stringify(this.store.data));
1388
+ var data = new TopologyData(this.data);
1474
1389
  this.caches.list.push(data);
1475
- if (this.caches.list.length > this.store.options.cacheLen) {
1390
+ if (this.caches.list.length > this.options.cacheLen) {
1476
1391
  this.caches.list.shift();
1477
1392
  }
1478
1393
  this.caches.index = this.caches.list.length - 1;
@@ -1505,31 +1420,31 @@ var Topology = (function (_super) {
1505
1420
  if (noRedo === void 0) {
1506
1421
  noRedo = false;
1507
1422
  }
1508
- if (this.store.data.locked || this.caches.index < 1) {
1423
+ if (this.data.locked || this.caches.index < 1) {
1509
1424
  return;
1510
1425
  }
1511
1426
  this.divLayer.clear();
1512
- var data = JSON.parse(JSON.stringify(this.caches.list[--this.caches.index]));
1513
- this.store.data.pens.splice(0, this.store.data.pens.length);
1514
- this.store.data.pens.push.apply(this.store.data.pens, data.pens);
1427
+ var data = new TopologyData(this.caches.list[--this.caches.index]);
1428
+ this.data.pens.splice(0, this.data.pens.length);
1429
+ this.data.pens.push.apply(this.data.pens, data.pens);
1515
1430
  this.render(true);
1516
1431
  this.divLayer.render();
1517
1432
  if (noRedo) {
1518
1433
  this.caches.list.splice(this.caches.index + 1, this.caches.list.length - this.caches.index - 1);
1519
1434
  }
1520
- this.dispatch('undo', this.store.data);
1435
+ this.dispatch('undo', this.data);
1521
1436
  };
1522
1437
  Topology.prototype.redo = function () {
1523
- if (this.store.data.locked || this.caches.index > this.caches.list.length - 2) {
1438
+ if (this.data.locked || this.caches.index > this.caches.list.length - 2) {
1524
1439
  return;
1525
1440
  }
1526
1441
  this.divLayer.clear();
1527
- var data = JSON.parse(JSON.stringify(this.caches.list[++this.caches.index]));
1528
- this.store.data.pens.splice(0, this.store.data.pens.length);
1529
- this.store.data.pens.push.apply(this.store.data.pens, data.pens);
1442
+ var data = new TopologyData(this.caches.list[++this.caches.index]);
1443
+ this.data.pens.splice(0, this.data.pens.length);
1444
+ this.data.pens.push.apply(this.data.pens, data.pens);
1530
1445
  this.render(true);
1531
1446
  this.divLayer.render();
1532
- this.dispatch('redo', this.store.data);
1447
+ this.dispatch('redo', this.data);
1533
1448
  };
1534
1449
  Topology.prototype.toImage = function (type, quality, callback, padding, thumbnail) {
1535
1450
  if (thumbnail === void 0) {
@@ -1585,15 +1500,7 @@ var Topology = (function (_super) {
1585
1500
  };
1586
1501
  Topology.prototype.delete = function (force, nodes) {
1587
1502
  var pens = [];
1588
- var deleteNodes = [];
1589
- if(this.isTabHideShow) {
1590
- // 如果删除的是tab显示隐藏元件
1591
- deleteNodes = getTabConnectSHConf(this.activeLayer.pens[0]);
1592
- this.activeLayer.pens = [];
1593
- }else {
1594
- deleteNodes = nodes || this.activeLayer.pens;
1595
- }
1596
- let dateIds = '';
1503
+ const deleteNodes = nodes ? nodes : this.activeLayer.pens;
1597
1504
  for (var i = 0; i < deleteNodes.length; i++) {
1598
1505
  var pen = deleteNodes[i];
1599
1506
  if (!force && pen.locked) {
@@ -1601,20 +1508,18 @@ var Topology = (function (_super) {
1601
1508
  }
1602
1509
  var found = this.findIndex(pen);
1603
1510
  if (found > -1) {
1604
- if(pen.pickerOptions) dateIds += `${pen.id},`;
1605
- if (this.store.data.pens[found].type === PenType.Node) {
1606
- this.divLayer.removeDiv(this.store.data.pens[found]);
1511
+ if (this.data.pens[found].type === PenType.Node) {
1512
+ this.divLayer.removeDiv(this.data.pens[found]);
1607
1513
  }
1608
- if (this.store.options.disableEmptyLine) {
1514
+ if (this.options.disableEmptyLine) {
1609
1515
  this.delEmptyLines(pen.id);
1610
1516
  }
1611
- pens.push.apply(pens, this.store.data.pens.splice(found, 1));
1612
- // this.setSwitchTabData(pen, found, 'delete');
1517
+ pens.push.apply(pens, this.data.pens.splice(found, 1));
1518
+ this.setSwitchTabData(pen, found, 'delete');
1613
1519
  --i;
1614
1520
  }
1615
1521
  this.animateLayer.pens.delete(pen.id);
1616
1522
  }
1617
- if(dateIds) this.resetAssociateDateData(dateIds);
1618
1523
  if (!pens.length) {
1619
1524
  return;
1620
1525
  }
@@ -1622,28 +1527,17 @@ var Topology = (function (_super) {
1622
1527
  this.cache();
1623
1528
  this.dispatch('delete', pens);
1624
1529
  };
1625
- Topology.prototype.resetAssociateDateData = function (dateIds) {
1626
- // 重置关联日期数据的元件属性值
1627
- const pens = this.store.data.pens;
1628
- for (var i = 0, length = pens.length; i < length; ++i) {
1629
- const pen = pens[i];
1630
- if(pen.formData && dateIds.includes(pen.formData.dateId)){
1631
- pen.events = pen.events.filter((ev) => { return ev.type !== 4 });
1632
- pen.formData = null;
1633
- }
1634
- }
1635
- };
1636
1530
  Topology.prototype.delEmptyLines = function (deleteedId) {
1637
- for (var i = 0; i < this.store.data.pens.length; i++) {
1638
- if (this.store.data.pens[i].type !== PenType.Line) {
1531
+ for (var i = 0; i < this.data.pens.length; i++) {
1532
+ if (this.data.pens[i].type !== PenType.Line) {
1639
1533
  continue;
1640
1534
  }
1641
- var line = this.store.data.pens[i];
1535
+ var line = this.data.pens[i];
1642
1536
  if (!line.from.id ||
1643
1537
  !line.to.id ||
1644
1538
  line.from.id === deleteedId ||
1645
1539
  line.to.id === deleteedId) {
1646
- this.store.data.pens.splice(i, 1);
1540
+ this.data.pens.splice(i, 1);
1647
1541
  this.animateLayer.pens.delete(line.id);
1648
1542
  --i;
1649
1543
  }
@@ -1652,8 +1546,8 @@ var Topology = (function (_super) {
1652
1546
  Topology.prototype.removeNode = function (node) {
1653
1547
  var i = this.findIndex(node);
1654
1548
  if (i > -1) {
1655
- this.divLayer.removeDiv(this.store.data.pens[i]);
1656
- var nodes = this.store.data.pens.splice(i, 1);
1549
+ this.divLayer.removeDiv(this.data.pens[i]);
1550
+ var nodes = this.data.pens.splice(i, 1);
1657
1551
  this.dispatch('delete', nodes);
1658
1552
  }
1659
1553
  this.render(true);
@@ -1662,28 +1556,28 @@ var Topology = (function (_super) {
1662
1556
  Topology.prototype.removeLine = function (line) {
1663
1557
  var i = this.findIndex(line);
1664
1558
  if (i > -1) {
1665
- var lines = this.store.data.pens.splice(i, 1);
1559
+ var lines = this.data.pens.splice(i, 1);
1666
1560
  this.dispatch('delete', lines);
1667
1561
  }
1668
1562
  this.render(true);
1669
1563
  this.cache();
1670
1564
  };
1671
1565
  Topology.prototype.cut = function () {
1672
- if (this.store.data.locked) {
1566
+ if (this.data.locked) {
1673
1567
  return;
1674
1568
  }
1675
- this.clipboard = {
1569
+ this.clipboard = new TopologyData({
1676
1570
  pens: [],
1677
- };
1571
+ });
1678
1572
  for (var i = 0; i < this.activeLayer.pens.length; i++) {
1679
1573
  var pen = this.activeLayer.pens[i];
1680
1574
  this.clipboard.pens.push(pen.clone());
1681
1575
  var found = this.findIndex(pen);
1682
1576
  if (found > -1) {
1683
1577
  if (pen.type === PenType.Node) {
1684
- this.divLayer.removeDiv(this.store.data.pens[found]);
1578
+ this.divLayer.removeDiv(this.data.pens[found]);
1685
1579
  }
1686
- this.store.data.pens.splice(found, 1);
1580
+ this.data.pens.splice(found, 1);
1687
1581
  --i;
1688
1582
  }
1689
1583
  }
@@ -1700,9 +1594,9 @@ var Topology = (function (_super) {
1700
1594
  return item.animatePlay;
1701
1595
  });
1702
1596
  if(isAnimate) return false;
1703
- this.clipboard = {
1597
+ this.clipboard = new TopologyData({
1704
1598
  pens: [],
1705
- };
1599
+ });
1706
1600
  for (var _i = 0, _a = this.activeLayer.pens; _i < _a.length; _i++) {
1707
1601
  var pen = _a[_i];
1708
1602
  this.clipboard.pens.push(pen.clone());
@@ -1710,7 +1604,7 @@ var Topology = (function (_super) {
1710
1604
  return true;
1711
1605
  };
1712
1606
  Topology.prototype.paste = function () {
1713
- if (!this.clipboard || this.store.data.locked) {
1607
+ if (!this.clipboard || this.data.locked) {
1714
1608
  return;
1715
1609
  }
1716
1610
  this.hoverLayer.node = null;
@@ -1751,10 +1645,9 @@ var Topology = (function (_super) {
1751
1645
  }
1752
1646
  pen.controlPoints = controlPoints;
1753
1647
  }
1754
- pen.order = this.store.data.pens.length;
1755
- this.store.data.pens.push(pen);
1648
+ this.data.pens.push(pen);
1756
1649
  this.activeLayer.add(pen);
1757
- setConnectionTagForConf(pen);
1650
+ this.setSwitchTabData(pen, this.data.pens.length-1);
1758
1651
  }
1759
1652
  this.render();
1760
1653
  this.animate(true);
@@ -1773,41 +1666,62 @@ var Topology = (function (_super) {
1773
1666
  }
1774
1667
  };
1775
1668
  Topology.prototype.bind = function (item, exite, dataType, index) {
1776
- this.clipboard = {
1669
+ this.clipboard = new TopologyData({
1777
1670
  pens: [],
1778
- };
1671
+ });
1779
1672
  for (var _i = 0, _a = this.activeLayer.pens; _i < _a.length; _i++) {
1780
1673
  var pen = _a[_i];
1781
- pen.data = [];
1782
- this.bindInfo(item, pen, dataType, index, exite);
1674
+ pen.data = []
1675
+ this.bindInfo(item, pen, dataType, index)
1783
1676
  this.clipboard.pens.push(pen.clone());
1784
1677
  }
1785
1678
  if (exite == true) {
1786
1679
  this.paste();
1787
1680
  }
1788
1681
  };
1789
- Topology.prototype.bindInfo = async function (item, pen, type, index, exite) {
1790
- const itemNode = item && item.default || item;
1791
- let bindName = '';
1792
- if ([0, '0'].includes(type)) {
1793
- bindName = itemNode.tagName;
1794
- const setTagId = setTagIdData(itemNode);
1795
- pen.data.push(...setTagId);
1682
+ Topology.prototype.bindInfo = async function (item, pen, type, index) {
1683
+ if (type == 0) {
1684
+ pen.data.push({
1685
+ "key": "tagId",
1686
+ "value": item.tagId,
1687
+ "isControlDis": item.isControlDis,
1688
+ "type": item.tagType,
1689
+ "tagVal": item.value,
1690
+ "valExplain": item.valExplain,
1691
+ "tagId": item.tagId
1692
+ }, {
1693
+ "key": "测点名称",
1694
+ "value": item.tagName
1695
+ })
1696
+ let obj = {
1697
+ "key": "threeCategoryId",
1698
+ "value": item.threeCategoryId
1699
+ }
1796
1700
  // 绑定悬浮文字
1797
- pen.title = itemNode.touchpname
1798
- //用于处理场地监控,点击一个资产类别后,隐藏掉这个类别下的所有元件
1799
- const setThreeCategory = setThreeCategoryIdData(pen, itemNode);
1800
- pen.data.push(...setThreeCategory);
1801
- } else if ([1, '1'].includes(type)) {
1802
- bindName = itemNode.kpiName;
1803
- const setKpiAddr = setKpiAddrData(itemNode);
1804
- pen.data.push(...setKpiAddr);
1805
- } else if ([2, '2'].includes(type)) {
1806
- bindName = itemNode.name;
1807
- const setAssetId = setAssetIdData(itemNode);
1808
- pen.data.push(...setAssetId);
1701
+ pen.title = item.touchpname
1702
+ if (!JSON.stringify(pen.data).includes(JSON.stringify(obj))) {
1703
+ pen.data.push(obj)
1704
+ }
1705
+ } else if (type == 1) {
1706
+ pen.data.push({
1707
+ "key": "kpiAddr",
1708
+ "value": item.kpiId + '_' + item.kpiAddr,
1709
+ "isControlDis": item.isControlDis,
1710
+ "type": item.tagType
1711
+ }, {
1712
+ "key": "指标名称",
1713
+ "value": item.kpiName
1714
+ })
1715
+ } else if (type == 2) {
1716
+ pen.data.push({
1717
+ "key": "assetId",
1718
+ "value": item.id
1719
+ }, {
1720
+ "key": "资产名称",
1721
+ "value": item.name
1722
+ })
1809
1723
  // 绑定悬浮文字
1810
- pen.title = itemNode.bak
1724
+ pen.title = item.bak
1811
1725
  if (pen.subName && pen.subName == 'temp') {
1812
1726
  // 温湿度元件
1813
1727
  // 通讯状态
@@ -1815,19 +1729,23 @@ var Topology = (function (_super) {
1815
1729
  if (index > 0) {
1816
1730
  pen.children[0].text = index + 1 + '#'
1817
1731
  }
1818
- this.bindInfo(itemNode, pen.children[0], type);
1819
- // 温度
1820
- if(item.temperature) {
1821
- pen.children[1].data = [];
1822
- this.bindInfo(item.temperature, pen.children[1], 0);
1823
- }
1824
- // 湿度
1825
- if(item.dampness) {
1826
- pen.children[2].data = []
1827
- this.bindInfo(item.dampness, pen.children[2], 0);
1828
- }
1829
- pen.children.forEach((itemNode) => {
1830
- itemNode.events = [{
1732
+ this.bindInfo(item, pen.children[0], type);
1733
+ // 温度/湿度
1734
+ const _type = 0
1735
+ const ret = await axios.post('/asset/touch_css3000_api/findlist', {assetIds: item.id})
1736
+ ret.data.data.forEach((elem) => {
1737
+ // if(elem.kpiName=='通讯状态'){
1738
+ // }else
1739
+ if (elem.kpiName == '温度') {
1740
+ pen.children[1].data = []
1741
+ this.bindInfo(elem, pen.children[1], _type);
1742
+ } else if (elem.kpiName == '湿度') {
1743
+ pen.children[2].data = []
1744
+ this.bindInfo(elem, pen.children[2], _type);
1745
+ }
1746
+ })
1747
+ pen.children.forEach((item) => {
1748
+ item.events = [{
1831
1749
  "type": 3,
1832
1750
  "action": 2,
1833
1751
  "value": "",
@@ -1835,27 +1753,23 @@ var Topology = (function (_super) {
1835
1753
  }]
1836
1754
  })
1837
1755
  }
1838
- } else if ([3, '3'].includes(type)) {
1839
- bindName = itemNode.name;
1840
- const setAreaId = setAreaIdData(itemNode);
1841
- pen.data.push(...setAreaId);
1842
- }else if ([4, '4'].includes(type)) {
1843
- bindName = itemNode.name;
1844
- const setVarId = setVarValueData(itemNode);
1845
- pen.data.push(...setVarId);
1846
- }else if ([5, '5'].includes(type)) {
1847
- bindName = itemNode.value;
1848
- const setBranch = setBranchAddressData(itemNode);
1849
- pen.data.push(...setBranch);
1850
- }
1851
- if(typeof exite === 'boolean') pen.text = bindName;
1852
- // if([0, 2, '0', '2'].includes(type)) {
1853
- // //用于处理场地监控,点击一个资产类别后,隐藏掉这个类别下的所有元件
1854
- // const setThreeCategory = setThreeCategoryIdData(pen, itemNode);
1855
- //
1856
- // pen.data.push(...setThreeCategory);
1857
- // }
1858
- return pen;
1756
+ } else if (type == 3) {
1757
+ pen.data.push({
1758
+ "key": "areaId",
1759
+ "value": item.id
1760
+ }, {
1761
+ "key": "区域名称",
1762
+ "value": item.name
1763
+ })
1764
+ }
1765
+ // let str = JSON.stringify(pen.events)
1766
+ // pen.events.forEach((_item) => {
1767
+ // if(_item.action==0 && _item.dcimDetailPage && _item.dcimDetailPage != '' && item.devId){
1768
+ // str = str.replace(new RegExp(_item.dcimAssetValue,'g'), item.devId)
1769
+ // }
1770
+ // });
1771
+ // pen.events = JSON.parse(str)
1772
+ return pen
1859
1773
  };
1860
1774
  Topology.prototype.newId = function (node, idMaps) {
1861
1775
  var old = node.id;
@@ -1875,12 +1789,10 @@ var Topology = (function (_super) {
1875
1789
  if (!pens) {
1876
1790
  pens = this.activeLayer.pens;
1877
1791
  }
1878
- let isAnimate = false;
1879
1792
  for (var _i = 0, pens_1 = pens; _i < pens_1.length; _i++) {
1880
1793
  var pen = pens_1[_i];
1881
1794
  if (pen instanceof Node) {
1882
1795
  let isRotateBug = false
1883
- isAnimate = pen.animateFrames && pen.animateFrames.length
1884
1796
  if (pen.rotate === 0) {
1885
1797
  pen.rotate = 360
1886
1798
  isRotateBug = true
@@ -1899,20 +1811,19 @@ var Topology = (function (_super) {
1899
1811
  this.activeLayer.calcControlPoints();
1900
1812
  this.activeLayer.saveNodeRects();
1901
1813
  this.render();
1902
- if(isAnimate) this.animate(true);
1903
1814
  // tslint:disable-next-line: no-unused-expression
1904
1815
  cache && this.cache();
1905
1816
  };
1906
1817
  Topology.prototype.lock = function (lock) {
1907
- this.store.data.locked = lock;
1908
- for (var _i = 0, _a = this.store.data.pens; _i < _a.length; _i++) {
1818
+ this.data.locked = lock;
1819
+ for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
1909
1820
  var item = _a[_i];
1910
1821
  item.addToDiv && item.addToDiv();
1911
1822
  }
1912
- this.dispatch('locked', this.store.data.locked);
1823
+ this.dispatch('locked', this.data.locked);
1913
1824
  };
1914
1825
  Topology.prototype.lockPens = function (pens, lock) {
1915
- for (var _i = 0, _a = this.store.data.pens; _i < _a.length; _i++) {
1826
+ for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
1916
1827
  var item = _a[_i];
1917
1828
  for (var _b = 0, pens_2 = pens; _b < pens_2.length; _b++) {
1918
1829
  var pen = pens_2[_b];
@@ -1930,33 +1841,33 @@ var Topology = (function (_super) {
1930
1841
  };
1931
1842
  Topology.prototype.up = function (pen) {
1932
1843
  var i = this.findIndex(pen);
1933
- if (i > -1 && i !== this.store.data.pens.length - 1) {
1934
- this.store.data.pens.splice(i + 2, 0, this.store.data.pens[i]);
1935
- this.store.data.pens.splice(i, 1);
1844
+ if (i > -1 && i !== this.data.pens.length - 1) {
1845
+ this.data.pens.splice(i + 2, 0, this.data.pens[i]);
1846
+ this.data.pens.splice(i, 1);
1936
1847
  }
1937
1848
  };
1938
1849
  Topology.prototype.top = function (pen) {
1939
1850
  var i = this.findIndex(pen);
1940
1851
  if (i > -1) {
1941
- this.store.data.pens.push(this.store.data.pens[i]);
1942
- this.store.data.pens.splice(i, 1);
1852
+ this.data.pens.push(this.data.pens[i]);
1853
+ this.data.pens.splice(i, 1);
1943
1854
  }
1944
1855
  };
1945
1856
  Topology.prototype.down = function (pen) {
1946
1857
  var i = this.findIndex(pen);
1947
1858
  if (i > -1 && i !== 0) {
1948
- this.store.data.pens.splice(i - 1, 0, this.store.data.pens[i]);
1949
- this.store.data.pens.splice(i + 1, 1);
1859
+ this.data.pens.splice(i - 1, 0, this.data.pens[i]);
1860
+ this.data.pens.splice(i + 1, 1);
1950
1861
  }
1951
1862
  };
1952
1863
  Topology.prototype.bottom = function (pen) {
1953
1864
  var i = this.findIndex(pen);
1954
1865
  if (i > -1) {
1955
- this.store.data.pens.unshift(this.store.data.pens[i]);
1956
- this.store.data.pens.splice(i + 1, 1);
1866
+ this.data.pens.unshift(this.data.pens[i]);
1867
+ this.data.pens.splice(i + 1, 1);
1957
1868
  }
1958
1869
  };
1959
- Topology.prototype.combine = function (pens, stand, temp, rect) {
1870
+ Topology.prototype.combine = function (pens, stand, temp) {
1960
1871
  if (stand === void 0) {
1961
1872
  stand = false;
1962
1873
  }
@@ -1969,7 +1880,7 @@ var Topology = (function (_super) {
1969
1880
  var item = pens_3[_i];
1970
1881
  var i = this.findIndex(item);
1971
1882
  if (i > -1) {
1972
- this.store.data.pens.splice(i, 1);
1883
+ this.data.pens.splice(i, 1);
1973
1884
  }
1974
1885
  }
1975
1886
  var node = new Node({
@@ -1981,8 +1892,6 @@ var Topology = (function (_super) {
1981
1892
  paddingTop: 0,
1982
1893
  paddingBottom: 0,
1983
1894
  strokeStyle: 'transparent',
1984
- visible: true,
1985
- visibleSwitch: true,
1986
1895
  children: [],
1987
1896
  });
1988
1897
  if (temp) {
@@ -1993,14 +1902,10 @@ var Topology = (function (_super) {
1993
1902
  item.stand = stand;
1994
1903
  item.parentId = node.id;
1995
1904
  item.animatePlay = false;
1996
- item.visible = true;
1997
- item.visibleSwitch = true;
1998
1905
  item.calcRectInParent(node);
1999
- this.deleteSelectTabOptionNode(item);
2000
1906
  node.children.push(item);
2001
1907
  }
2002
- node.order = this.store.data.pens.length;
2003
- this.store.data.pens.push(node);
1908
+ this.data.pens.push(node);
2004
1909
  this.activeLayer.setPens([node]);
2005
1910
  this.dispatch('node', node);
2006
1911
  this.cache();
@@ -2013,57 +1918,27 @@ var Topology = (function (_super) {
2013
1918
  return;
2014
1919
  }
2015
1920
  const nodeChildren = JSON.parse(JSON.stringify(node));
2016
- var i = this.findIndex(nodeChildren);
2017
- if (i > -1 && nodeChildren.name === 'combine') {
2018
- this.store.data.pens.splice(i, 1);
2019
- } else {
2020
- nodeChildren.children = null;
2021
- }
2022
1921
  for (var _i = 0, _a = nodeChildren.children; _i < _a.length; _i++) {
2023
1922
  var item = new Node(_a[_i]);
2024
1923
  item.parentId = undefined;
2025
1924
  item.rectInParent = undefined;
2026
1925
  item.locked = Lock.None;
2027
- item.order = this.store.data.pens.length;
2028
- this.addSelectTabOptionNode(item);
2029
- this.store.data.pens.push(item);
1926
+ this.data.pens.push(item);
1927
+ }
1928
+ var i = this.findIndex(nodeChildren);
1929
+ if (i > -1 && nodeChildren.name === 'combine') {
1930
+ this.data.pens.splice(i, 1);
1931
+ } else {
1932
+ nodeChildren.children = null;
2030
1933
  }
2031
- this.deleteSelectTabOptionNode(nodeChildren);
2032
1934
  this.cache();
2033
1935
  this.activeLayer.clear();
2034
1936
  this.hoverLayer.clear();
2035
1937
  };
2036
- Topology.prototype.deleteSelectTabOptionNode = function (node) {
2037
- const tagNode = node.tags.find((t) => {return t.includes('selectOption')});
2038
- if(tagNode){
2039
- // 删除下拉节点关联的这个元件
2040
- const tagArr = tagNode.split('-');
2041
- const parentId = tagArr[1] && tagArr[1].trim();
2042
- if(parentId && this.store.selectTabDataPool[parentId].has(node.id)) this.store.selectTabDataPool[parentId].delete(node.id);
2043
- }
2044
- },
2045
- Topology.prototype.addSelectTabOptionNode = function (node) {
2046
- const tagNode = node.tags.find((t) => {return t.includes('selectOption')});
2047
- if(tagNode){
2048
- // 添加下拉节点关联的这个元件
2049
- const tagArr = tagNode.split('-');
2050
- const parentId = tagArr[1] && tagArr[1].trim();
2051
- if(!parentId) return;
2052
- const params = {
2053
- TID: node.TID,
2054
- id: node.id,
2055
- name: node.name,
2056
- order: node.order,
2057
- visible: node.visible,
2058
- tag: tagNode
2059
- }
2060
- this.store.selectTabDataPool[parentId].set(node.id, params);
2061
- }
2062
- },
2063
1938
  Topology.prototype.find = function (idOrTag, pens) {
2064
1939
  var _this = this;
2065
1940
  if (!pens) {
2066
- pens = this.store.data.pens;
1941
+ pens = this.data.pens;
2067
1942
  }
2068
1943
  var result = [];
2069
1944
  pens.forEach(function (item) {
@@ -2080,28 +1955,28 @@ var Topology = (function (_super) {
2080
1955
  return result;
2081
1956
  };
2082
1957
  Topology.prototype.findIndex = function (pen) {
2083
- for (var i = 0; i < this.store.data.pens.length; ++i) {
2084
- if (pen.id === this.store.data.pens[i].id) {
1958
+ for (var i = 0; i < this.data.pens.length; ++i) {
1959
+ if (pen.id === this.data.pens[i].id) {
2085
1960
  return i;
2086
1961
  }
2087
1962
  }
2088
1963
  return -1;
2089
1964
  };
2090
1965
  Topology.prototype.anchor = function (anchor) {
2091
- this.store.options.hideAnchor = anchor
1966
+ this.options.hideAnchor = anchor
2092
1967
  this.dispatch('hideAnchor', anchor);
2093
1968
  };
2094
1969
  // scale for scaled canvas:
2095
1970
  // > 1, expand
2096
1971
  // < 1, reduce
2097
1972
  Topology.prototype.scale = function (scale, center, w, h) {
2098
- if (this.store.data.scale * scale < this.store.options.minScale ||
2099
- this.store.data.scale * scale > this.store.options.maxScale) {
1973
+ if (this.data.scale * scale < this.options.minScale ||
1974
+ this.data.scale * scale > this.options.maxScale) {
2100
1975
  return;
2101
1976
  }
2102
- this.store.data.scale *= scale;
1977
+ this.data.scale *= scale;
2103
1978
  !center && (center = this.getRect().center);
2104
- for (var _i = 0, _a = this.store.data.pens; _i < _a.length; _i++) {
1979
+ for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
2105
1980
  var item = _a[_i];
2106
1981
  item.scale(scale, center, w, h);
2107
1982
  }
@@ -2110,18 +1985,18 @@ var Topology = (function (_super) {
2110
1985
  pen.scale(scale, center);
2111
1986
  }
2112
1987
  });
2113
- Store.set(this.generateStoreKey('LT:scale'), this.store.data.scale);
1988
+ Store.set(this.generateStoreKey('LT:scale'), this.data.scale);
2114
1989
  this.render();
2115
1990
  this.cache();
2116
- this.dispatch('scale', this.store.data.scale);
1991
+ this.dispatch('scale', this.data.scale);
2117
1992
  };
2118
1993
  // scale for origin canvas:
2119
1994
  Topology.prototype.scaleTo = function (scale) {
2120
- this.scale(scale / this.store.data.scale);
2121
- this.store.data.scale = scale;
1995
+ this.scale(scale / this.data.scale);
1996
+ this.data.scale = scale;
2122
1997
  };
2123
1998
  Topology.prototype.round = function () {
2124
- for (var _i = 0, _a = this.store.data.pens; _i < _a.length; _i++) {
1999
+ for (var _i = 0, _a = this.data.pens; _i < _a.length; _i++) {
2125
2000
  var item = _a[_i];
2126
2001
  if (item instanceof Node) {
2127
2002
  item.round();
@@ -2132,7 +2007,7 @@ var Topology = (function (_super) {
2132
2007
  if (!this.hasView())
2133
2008
  return;
2134
2009
  // 1. 重置画布尺寸为容器尺寸
2135
- var parentElem = this.store.parentElem;
2010
+ var parentElem = this.canvas.parentElem;
2136
2011
  var width = parentElem.offsetWidth, height = parentElem.offsetHeight;
2137
2012
  this.resize({
2138
2013
  width: width,
@@ -2141,7 +2016,7 @@ var Topology = (function (_super) {
2141
2016
  // 2. 图形居中
2142
2017
  this.centerView(viewPadding);
2143
2018
  // 3. 获取设置的留白值
2144
- var padding = formatPadding(viewPadding || this.store.options.viewPadding);
2019
+ var padding = formatPadding(viewPadding || this.options.viewPadding);
2145
2020
  // 4. 获取图形尺寸
2146
2021
  var rect = this.getRect();
2147
2022
  // 6. 计算缩放比
@@ -2154,7 +2029,7 @@ var Topology = (function (_super) {
2154
2029
  this.scale(ratio);
2155
2030
  };
2156
2031
  Topology.prototype.showTipText = function (data, pos) {
2157
- if (this.store.data.locked && data.title) {
2032
+ if (this.data.locked && data.title) {
2158
2033
  this.divLayer.canvas.title = data.title;
2159
2034
  this.tip = data.id;
2160
2035
  }
@@ -2165,15 +2040,15 @@ var Topology = (function (_super) {
2165
2040
  return;
2166
2041
  }
2167
2042
  this.scrolling = true;
2168
- this.store.parentElem.scrollLeft += x;
2169
- this.store.parentElem.scrollTop += y;
2043
+ this.parentElem.scrollLeft += x;
2044
+ this.parentElem.scrollTop += y;
2170
2045
  setTimeout(function () {
2171
2046
  _this.scrolling = false;
2172
2047
  }, 700);
2173
2048
  };
2174
2049
  Topology.prototype.toComponent = function (pens) {
2175
2050
  if (!pens) {
2176
- pens = this.store.data.pens;
2051
+ pens = this.data.pens;
2177
2052
  }
2178
2053
  var rect = this.getRect(pens);
2179
2054
  var node = new Node({
@@ -2214,7 +2089,7 @@ var Topology = (function (_super) {
2214
2089
  attr = 'text';
2215
2090
  }
2216
2091
  var pen;
2217
- this.store.data.pens.forEach(function (item) {
2092
+ this.data.pens.forEach(function (item) {
2218
2093
  if (item.id === idOrTag || item.tags.indexOf(idOrTag) > -1) {
2219
2094
  pen = item;
2220
2095
  }
@@ -2226,7 +2101,7 @@ var Topology = (function (_super) {
2226
2101
  attr = 'text';
2227
2102
  }
2228
2103
  var pen;
2229
- this.store.data.pens.forEach(function (item) {
2104
+ this.data.pens.forEach(function (item) {
2230
2105
  if (item.id === idOrTag || item.tags.indexOf(idOrTag) > -1) {
2231
2106
  pen = item;
2232
2107
  }
@@ -2239,12 +2114,11 @@ var Topology = (function (_super) {
2239
2114
  this.gridElem.style.left = '0';
2240
2115
  this.gridElem.style.top = '0';
2241
2116
  this.gridElem.innerHTML = "<svg class=\"svg-grid\" width=\"100%\" height=\"100%\" style=\"position:absolute;left:0;right:0;top:0;bottom:0\"\n xmlns=\"http://www.w3.org/2000/svg\">\n <defs>\n <pattern id=\"grid\" width=\"10\" height=\"10\" patternUnits=\"userSpaceOnUse\">\n <path d=\"M 10 0 L 0 0 0 10\" fill=\"none\" stroke=\"#f3f3f3\" stroke-width=\"1\" />\n </pattern>\n </defs>\n <rect width=\"100%\" height=\"100%\" fill=\"url(#grid)\" />\n </svg>";
2242
- this.store.parentElem.appendChild(this.gridElem);
2117
+ this.parentElem.appendChild(this.gridElem);
2243
2118
  };
2244
2119
  Topology.prototype.showGrid = function (show) {
2245
- if(!this.store || !this.store.data) return;
2246
2120
  if (show === undefined) {
2247
- show = this.store.data.grid;
2121
+ show = this.data.grid;
2248
2122
  }
2249
2123
  this.gridElem.style.width = this.canvas.width + 'px';
2250
2124
  this.gridElem.style.height = this.canvas.height + 'px';
@@ -2335,7 +2209,7 @@ var Topology = (function (_super) {
2335
2209
  canvas.style.height = 500 + 'px';
2336
2210
  canvas.style.zIndex = 1;
2337
2211
  canvas.setAttribute('id', 'arbitraryCanvas');
2338
- this.store.parentElem.appendChild(canvas)
2212
+ this.parentElem.appendChild(canvas)
2339
2213
  };
2340
2214
  Topology.prototype.createArbitraryGraph = function () {
2341
2215
 
@@ -2392,31 +2266,6 @@ var Topology = (function (_super) {
2392
2266
 
2393
2267
  return true
2394
2268
  };
2395
- Topology.prototype.formOverflowOpen = function (data) {
2396
- this.formOverflowConversionData(data);
2397
- this.overflowView();
2398
- this.render(true);
2399
- }
2400
- Topology.prototype.overflowView = function (data) {
2401
- try {
2402
- var rect = this.getRect();
2403
- let _a = this.canvas;
2404
- if(!_a.width) return;
2405
- let width = _a.width, height = _a.height;
2406
- let rectWidth = rect.width? (rect.ex + 4) : rect.width
2407
- let rectHeight= rect.height? (rect.ey + 4) : rect.height
2408
- if (width < rectWidth) {
2409
- width = rectWidth;
2410
- }
2411
- if (height < rectHeight) {
2412
- height = rectHeight;
2413
- }
2414
- this.resize({width: width, height: height});
2415
- return rect;
2416
- }catch (e){
2417
- console.log('-error--------overflowView---',e)
2418
- }
2419
- }
2420
2269
  return Topology;
2421
2270
  }(Common));
2422
2271