dcim-topology2d 2.0.8 → 2.1.0

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 (46) hide show
  1. package/chart-diagram/src/utils/changeOptions.d.ts +1 -0
  2. package/chart-diagram/src/utils/changeOptions.js +41 -35
  3. package/chart-diagram/src/utils/conversion.js +140 -13
  4. package/chart-diagram/src/utils/formatter.d.ts +1 -1
  5. package/chart-diagram/src/utils/formatter.js +51 -15
  6. package/chart-diagram/src/utils/index.d.ts +1 -0
  7. package/chart-diagram/src/utils/index.js +1 -0
  8. package/chart-diagram/src/utils/render.js +43 -52
  9. package/chart-diagram/src/utils/surfaceParametricConversion.d.ts +3 -0
  10. package/chart-diagram/src/utils/surfaceParametricConversion.js +252 -0
  11. package/core/src/common.js +13 -5
  12. package/core/src/core.d.ts +2 -0
  13. package/core/src/core.js +61 -23
  14. package/core/src/element/common.d.ts +2 -1
  15. package/core/src/element/common.js +15 -15
  16. package/core/src/element/datePicker.d.ts +3 -0
  17. package/core/src/element/datePicker.js +47 -0
  18. package/core/src/element/index.d.ts +2 -1
  19. package/core/src/element/index.js +3 -1
  20. package/core/src/element/select.js +14 -2
  21. package/core/src/element/tab.js +8 -6
  22. package/core/src/element/time.d.ts +3 -0
  23. package/core/src/element/time.js +44 -0
  24. package/core/src/middles/default.js +8 -2
  25. package/core/src/middles/nodes/formDatePicker.d.ts +2 -0
  26. package/core/src/middles/nodes/formDatePicker.js +66 -0
  27. package/core/src/middles/nodes/formselect.js +7 -0
  28. package/core/src/middles/nodes/index.d.ts +3 -1
  29. package/core/src/middles/nodes/index.js +3 -0
  30. package/core/src/middles/nodes/time.d.ts +2 -0
  31. package/core/src/middles/nodes/time.js +98 -0
  32. package/core/src/models/node.js +12 -0
  33. package/core/src/preview.d.ts +1 -0
  34. package/core/src/preview.js +29 -5
  35. package/core/src/store/data.d.ts +5 -0
  36. package/core/src/store/data.js +9 -2
  37. package/core/src/utils/assignment.d.ts +2 -1
  38. package/core/src/utils/assignment.js +23 -11
  39. package/core/src/utils/conversion.d.ts +2 -0
  40. package/core/src/utils/conversion.js +43 -1
  41. package/core/src/utils/params.js +5 -0
  42. package/package.json +1 -1
  43. package/style/common.css +0 -3
  44. package/style/datePicker.css +44 -0
  45. package/style/editor.css +3 -0
  46. package/style/index.css +1 -0
@@ -0,0 +1,252 @@
1
+ import {echartsColorData} from '../../../static';
2
+
3
+ /**
4
+ *
5
+ * @param startRatio 开始绘制位置
6
+ * @param endRatio 结束绘制位置
7
+ * @param isSelected 是否选中
8
+ * @param isHovered 鼠标悬浮在图表之上?
9
+ * @param k 内廷半径
10
+ * @param h 高
11
+ * @returns {{u: {min: number, max: number, step: number}, v: {min: number, max: number, step: number}, x: ((function(*, *): *)|*), y: ((function(*, *): *)|*), z: ((function(*, *): (number|number))|*)}}
12
+ */
13
+ export function getParametricEquation(startRatio, endRatio, isSelected, isHovered, k, h){
14
+ // 计算
15
+ let midRatio = (startRatio + endRatio) / 2;
16
+ let startRadian = startRatio * Math.PI * 2;
17
+ let endRadian = endRatio * Math.PI * 2;
18
+ let midRadian = midRatio * Math.PI * 2;
19
+ isSelected = false;
20
+ // 如果只有一个扇形,则不实现选中效果。
21
+ if (startRatio === 0 && endRatio === 1) {
22
+ isSelected = true;
23
+ }
24
+ // 通过扇形内径/外径的值,换算出辅助参数 k(默认值 1/3)
25
+ k = typeof k !== 'undefined' ? k : 1 / 3;
26
+ // 计算选中效果分别在 x 轴、y 轴方向上的位移(未选中,则位移均为 0)
27
+ let offsetX = isSelected ? Math.cos(midRadian) * 0.1 : 0;
28
+ let offsetY = isSelected ? Math.sin(midRadian) * 0.1 : 0;
29
+ // 计算高亮效果的放大比例(未高亮,则比例为 1)
30
+ let hoverRate = isHovered ? 1.05 : 1;
31
+ // 返回曲面参数方程
32
+ return {
33
+ u: {
34
+ min: -Math.PI,
35
+ max: Math.PI * 3,
36
+ step: Math.PI / 32,
37
+ },
38
+ v: {
39
+ min: 0,
40
+ max: Math.PI * 2,
41
+ step: Math.PI / 20,
42
+ },
43
+ x: function(u, v) {
44
+ if (u < startRadian) {
45
+ return offsetX + Math.cos(startRadian) * (1 + Math.cos(v) * k) * hoverRate;
46
+ }
47
+ if (u > endRadian) {
48
+ return offsetX + Math.cos(endRadian) * (1 + Math.cos(v) * k) * hoverRate;
49
+ }
50
+ return offsetX + Math.cos(u) * (1 + Math.cos(v) * k) * hoverRate;
51
+ },
52
+ y: function(u, v) {
53
+ if (u < startRadian) {
54
+ return offsetY + Math.sin(startRadian) * (1 + Math.cos(v) * k) * hoverRate;
55
+ }
56
+ if (u > endRadian) {
57
+ return offsetY + Math.sin(endRadian) * (1 + Math.cos(v) * k) * hoverRate;
58
+ }
59
+ return offsetY + Math.sin(u) * (1 + Math.cos(v) * k) * hoverRate;
60
+ },
61
+ z: function(u, v) {
62
+ if (u < -Math.PI * 0.5) {
63
+ return Math.sin(u);
64
+ }
65
+ if (u > Math.PI * 2.5) {
66
+ return Math.sin(u) * h * 0.1;
67
+ }
68
+ return Math.sin(v) > 0 ? 1 * h * 0.1 : -1;
69
+ }
70
+ };
71
+ }
72
+ /**
73
+ * 获取3D饼图数据
74
+ * @param internalDiameterRatio 透明的空心占比
75
+ * @param type 'pie':饼图;'ring':环形图
76
+ * @param appearance 配置数据
77
+ * @param labelLineData 引线静态数据
78
+ * @param realData 实时数据
79
+ * @returns {{series: *[], legendData: *[]}}
80
+ */
81
+ export function getPie3D(internalDiameterRatio, type, appearance, labelLineData, realData){
82
+ const { seriesStyleData, chartData, labelLine, grid } = appearance;
83
+ let k = typeof internalDiameterRatio !== "undefined" ?
84
+ (1 - internalDiameterRatio) / (1 + internalDiameterRatio) :
85
+ 1 / 3; // 3d 环形图
86
+ const pieData = realData && realData.length ? realData : chartData;
87
+ if(type === 'pie'){
88
+ // 3d 饼图
89
+ k = 1;
90
+ pieData.sort((a, b) => {
91
+ return b.value - a.value;
92
+ });
93
+ }
94
+
95
+ let sumValue = pieData.reduce((total, obj) => total + obj.value, 0);
96
+ let startValue = 0;
97
+ let endValue = 0;
98
+ let total = 0;
99
+ let boxHeight = (grid.boxHeight * 25) / pieData[0].value;
100
+ let legendData = [];
101
+ let series = [];
102
+ let node = {};
103
+ const lineData = [];
104
+ // 为每一个饼图数据,生成一个 series-surface 配置
105
+ for (let i = 0; i < pieData.length; i++) {
106
+ const {name, value, itemColor, itemOpacity} = pieData[i];
107
+ const pieDataItem = chartData[i];
108
+ const seriesItemColor = itemColor || pieDataItem && pieDataItem.itemColor || echartsColorData[i];
109
+ endValue = startValue + value;
110
+ let hv = seriesStyleData && seriesStyleData[i] || value;
111
+ let pk = 1 / 10;
112
+ if(type === 'pie') {
113
+ hv = value;
114
+ pk = k;
115
+ if(labelLine.data[i]) {
116
+ const lineItem = labelLine.data[i];
117
+ lineItem.valueColor = seriesItemColor;
118
+ lineItem.unitColor = seriesItemColor;
119
+ }
120
+ }else {
121
+ total += value;
122
+ node[name] = {
123
+ order: i,
124
+ value
125
+ };
126
+ }
127
+ const newStartRatio = startValue / sumValue;
128
+ const newEndRatio = endValue / sumValue;
129
+ // 向每个 series-surface 传入不同的参数方程 series-surface.parametricEquation,也就是实现每一个扇形
130
+ const parametricEquation = getParametricEquation(newStartRatio, newEndRatio, false, false, k, hv);
131
+ let seriesItem = {
132
+ name: typeof name === 'undefined' ? `series${i}` : name,
133
+ type: 'surface',
134
+ parametric: true,
135
+ wireframe: {
136
+ show: false,
137
+ },
138
+ pieData: {
139
+ name,
140
+ value,
141
+ startRatio: newStartRatio,
142
+ endRatio: newEndRatio
143
+ },
144
+ pieStatus: {
145
+ selected: false,
146
+ hovered: false,
147
+ k: pk,
148
+ },
149
+ parametricEquation,
150
+ itemStyle: {
151
+ color: seriesItemColor,
152
+ opacity: itemOpacity || pieDataItem && pieDataItem.itemOpacity || 1
153
+ }
154
+ };
155
+ startValue = endValue;
156
+ legendData.push(seriesItem.name);
157
+ series.push(seriesItem);
158
+ if(labelLineData) {
159
+ const lineStyleNode = labelLineData.data[i] || labelLineData.data[0];
160
+ lineStyleNode.lineStyle.color = seriesItemColor;
161
+ const labelLineItem = {
162
+ name,
163
+ value,
164
+ labelLine: {...lineStyleNode}
165
+ };
166
+ lineData.push(labelLineItem);
167
+ }
168
+ }
169
+ if(lineData.length) {
170
+ labelLineData.data = lineData;
171
+ series.push(labelLineData);
172
+ }
173
+ return {
174
+ legendData,
175
+ series,
176
+ node,
177
+ total,
178
+ boxHeight
179
+ };
180
+ }
181
+ export function set3DPieMouseHover(myChart, type, option, valueData){
182
+ let selectedIndex = '';
183
+ let hoveredIndex = '';
184
+ let isSelected;
185
+ let isHovered;
186
+ let startRatio;
187
+ let endRatio;
188
+ let k;
189
+ // 监听 mouseover,近似实现高亮(放大)效果
190
+ myChart.on('mouseover', function(params) {
191
+ // 如果触发 mouseover 的扇形当前已高亮,则不做操作
192
+ if (hoveredIndex === params.seriesIndex) return;
193
+ // 如果当前有高亮的扇形,取消其高亮状态(对 option 更新)
194
+ if (hoveredIndex !== '') {
195
+ const value = type === 'pie' ? option.series[hoveredIndex].pieData.value : valueData[hoveredIndex];
196
+ // 从 option.series 中读取重新渲染扇形所需的参数,将是否高亮设置为 false。
197
+ isSelected = option.series[hoveredIndex].pieStatus.selected;
198
+ isHovered = false;
199
+ startRatio = option.series[hoveredIndex].pieData.startRatio;
200
+ endRatio = option.series[hoveredIndex].pieData.endRatio;
201
+ k = option.series[hoveredIndex].pieStatus.k;
202
+
203
+ // 对当前点击的扇形,执行取消高亮操作(对 option 更新)
204
+ option.series[hoveredIndex].parametricEquation = getParametricEquation(startRatio, endRatio, isSelected, isHovered, k, value);
205
+ option.series[hoveredIndex].pieStatus.hovered = isHovered;
206
+
207
+ // 将此前记录的上次选中的扇形对应的系列号 seriesIndex 清空
208
+ hoveredIndex = '';
209
+ }
210
+
211
+ // 如果触发 mouseover 的扇形不是透明圆环,将其高亮(对 option 更新)
212
+ if (params.seriesName !== 'mouseoutSeries') {
213
+ // 从 option.series 中读取重新渲染扇形所需的参数,将是否高亮设置为 true。
214
+ const pieStatus = option.series[params.seriesIndex].pieStatus;
215
+ if(!pieStatus) return; // 先退出,后期若有hover引线时,图形联动的需求时再做逻辑处理
216
+ const value = type === 'pie' ? option.series[params.seriesIndex].pieData.value : valueData[params.seriesIndex];
217
+ isSelected = option.series[params.seriesIndex].pieStatus.selected;
218
+ isHovered = true;
219
+ startRatio = option.series[params.seriesIndex].pieData.startRatio;
220
+ endRatio = option.series[params.seriesIndex].pieData.endRatio;
221
+ k = option.series[params.seriesIndex].pieStatus.k;
222
+ // 对当前点击的扇形,执行高亮操作(对 option 更新)
223
+ option.series[params.seriesIndex].parametricEquation = getParametricEquation(startRatio, endRatio, isSelected, isHovered, k, value + 5);
224
+ option.series[params.seriesIndex].pieStatus.hovered = isHovered;
225
+
226
+ // 记录上次高亮的扇形对应的系列号 seriesIndex
227
+ hoveredIndex = params.seriesIndex;
228
+ }
229
+ // 使用更新后的 option,渲染图表
230
+ myChart.setOption(option);
231
+ });
232
+ // 修正取消高亮失败的 bug
233
+ myChart.on('globalout', function(params) {
234
+ if (hoveredIndex !== '') {
235
+ const value = type === 'pie' ? option.series[hoveredIndex].pieData.value : valueData[hoveredIndex];
236
+ // 从 option.series 中读取重新渲染扇形所需的参数,将是否高亮设置为 true。
237
+ isSelected = option.series[hoveredIndex].pieStatus.selected;
238
+ isHovered = false;
239
+ k = option.series[hoveredIndex].pieStatus.k;
240
+ startRatio = option.series[hoveredIndex].pieData.startRatio;
241
+ endRatio = option.series[hoveredIndex].pieData.endRatio;
242
+
243
+ // 对当前点击的扇形,执行取消高亮操作(对 option 更新)
244
+ option.series[hoveredIndex].parametricEquation = getParametricEquation(startRatio, endRatio, isSelected, isHovered, k, value);
245
+ option.series[hoveredIndex].pieStatus.hovered = isHovered;
246
+ // 将此前记录的上次选中的扇形对应的系列号 seriesIndex 清空
247
+ hoveredIndex = '';
248
+ }
249
+ // 使用更新后的 option,渲染图表
250
+ myChart.setOption(option);
251
+ });
252
+ }
@@ -186,6 +186,7 @@ var Common = /** @class */ (function () {
186
186
  if (this.store.mqttParams.echartAssemblyData.length) params.echartAssemblyData = [...this.store.mqttParams.echartAssemblyData];
187
187
  if(assetId) {
188
188
  params.varValueIds = this.store.mqttParams.varVaule.join(",");
189
+ params.branchAddrs = this.store.mqttParams.branchValue.join(",");
189
190
  }else {
190
191
  if(this.store.mqttParams.assetIds.length && this.store.mqttParams.varVaule.length) {
191
192
  const assetId = this.store.mqttParams.assetIds[this.store.mqttParams.assetIds.length -1];
@@ -219,6 +220,13 @@ var Common = /** @class */ (function () {
219
220
  })
220
221
  this.store.mqttParams.varVaule = ids;
221
222
  };
223
+ Common.prototype.getBranchValueIdsForBranchsData = function (data){
224
+ const ids = [];
225
+ data.map((item) => {
226
+ if(item.branchAddr) ids.push(`${item.assetId}_${item.branchAddr}`);
227
+ })
228
+ this.store.mqttParams.branchValue = ids;
229
+ };
222
230
  // 固定资产详情数据赋值
223
231
  Common.prototype.renderForAssetPoperties = function (asset, data){
224
232
  if(!Object.keys(asset).length) return;
@@ -248,8 +256,8 @@ var Common = /** @class */ (function () {
248
256
  }
249
257
  let data = JSON.parse(JSON.stringify(obj));
250
258
  Object.assign(this.store.data, data);
251
- // pageZoomOnly 表示topology页面只全局缩放,不对局部缩放进行调整
252
- if(this.store.options.type !== 'topology' && this.store.options.type !== 'pageZoomOnly') {
259
+ // topology编辑器下跳出程序
260
+ if(this.store.options.type !== 'topology') {
253
261
  const screenWidth = window.screen.width < 1920 ? 1920 : window.screen.width;
254
262
  const zoom = window.innerWidth < screenWidth ? document.documentElement.clientWidth / screenWidth : 1;
255
263
  this.store.data.pageZoom = zoom;
@@ -485,7 +493,7 @@ var Common = /** @class */ (function () {
485
493
  if(!switchTabData) return;
486
494
  const topologyChangeData = commonStore[node.TID].switchTabDataPool; // 获取所有按钮组和按类型统计图组数据
487
495
  const changeNode = topologyChangeData[`${switchTabData}Data`]; // 分别获取按钮组数据
488
- if(!changeNode[node.id]) return;
496
+ if(!changeNode || !changeNode[node.id]) return;
489
497
  // 如果存在按钮组节点数据
490
498
  const tabAreaData = topologyChangeData[`${switchTabData}AreaData`];
491
499
  let tabIndex = 0;
@@ -698,10 +706,10 @@ var Common = /** @class */ (function () {
698
706
  this.divLayer.canvas.title = '';
699
707
  this.tip = '';
700
708
  };
701
- Common.prototype.dispatch = function (event, data) {
709
+ Common.prototype.dispatch = function (event, node, data) {
702
710
  if(!this.store || !this.store.options) return;
703
711
  if (this.store.options.on) {
704
- this.store.options.on(event, data);
712
+ this.store.options.on(event, node, data);
705
713
  }
706
714
  // 先注释掉
707
715
  // if (event === 'node' && data.name == 'tablePagination' && this.store.options.type !== 'topology') {
@@ -19,6 +19,8 @@ export declare class Topology extends Common{
19
19
  lastHoverNode: Node;
20
20
  lastHoverLine: Line;
21
21
  needCache: boolean;
22
+ isTabHideShow: boolean;
23
+ nodeId: string; // 元件的id,一般用来做新旧数据对比
22
24
  gridElem: HTMLElement;
23
25
  private scheduledAnimationFrame;
24
26
  hoverLayer: HoverLayer;
package/core/src/core.js CHANGED
@@ -27,8 +27,11 @@ import {
27
27
  setAssetIdData,
28
28
  setAreaIdData,
29
29
  setVarValueData,
30
+ setBranchAddressData,
30
31
  setThreeCategoryIdData,
31
- setConnectionTagForConf
32
+ setConnectionTagForConf,
33
+ setConnectionTabsData,
34
+ getTabConnectSHConf
32
35
  } from './utils';
33
36
  import {setSelectElementPosition} from './element';
34
37
  import {elementType} from '../../static';
@@ -48,8 +51,10 @@ var Topology = (function (_super) {
48
51
  index: 0,
49
52
  list: [],
50
53
  };
54
+ _this.isTabHideShow = false;
51
55
  _this.needCache = false;
52
56
  _this.addingArbitraryGraph = false;
57
+ _this.nodeId = '';
53
58
  _this.arbitrarygGraphData = {
54
59
  points: [],
55
60
  circles: [],
@@ -107,6 +112,7 @@ var Topology = (function (_super) {
107
112
  _this.dispatch('translate', {x, y});
108
113
  return false;
109
114
  }
115
+
110
116
  }
111
117
  if (_this.store.data.locked && _this.mouseDown) {
112
118
  return;
@@ -363,8 +369,7 @@ var Topology = (function (_super) {
363
369
  };
364
370
  _this.onmousedown = function (e) {
365
371
  _this.store.data.dataResize = 0;
366
- if (e.button !== 0)
367
- return;
372
+ if (e.button !== 0) return;
368
373
  var canvasPos = _this.divLayer.canvas.getBoundingClientRect();
369
374
  _this.mouseDown = {x: e.x - canvasPos.x, y: e.y - canvasPos.y};
370
375
  if (e.altKey) {
@@ -481,6 +486,7 @@ var Topology = (function (_super) {
481
486
  if (activeNode.paginationData.targetPageLocal.hide) _this.targetPageInputHandle(activeNode, e);
482
487
  }
483
488
  }else {
489
+ _this.changeTabsState(activeNode);
484
490
  _this.dispatch('node', activeNode);
485
491
  }
486
492
  }
@@ -779,23 +785,23 @@ var Topology = (function (_super) {
779
785
  }
780
786
  }
781
787
  event.preventDefault();
782
- if (event.deltaY < 0) {
783
- if (event.layerX && event.layerY) {
784
- _this.scale(1.1, {x: event.layerX, y: event.layerY});
785
- _this.canvas.scale(1.1, {x: event.layerX, y: event.layerY});
786
- } else {
787
- _this.scale(1.1);
788
- _this.canvas.scale(1.1);
789
- }
790
- } else {
791
- if (event.layerX && event.layerY) {
792
- _this.scale(0.9, {x: event.layerX, y: event.layerY});
793
- _this.canvas.scale(0.9, {x: event.layerX, y: event.layerY});
794
- } else {
795
- _this.scale(0.9);
796
- _this.canvas.scale(0.9);
797
- }
798
- }
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
+ // }
799
805
  _this.divLayer.canvas.focus();
800
806
  return false;
801
807
  };
@@ -914,6 +920,20 @@ var Topology = (function (_super) {
914
920
  item.clearChildrenIds();
915
921
  return item;
916
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
+ };
917
937
  // 添加温湿度元件
918
938
  Topology.prototype.dropTempNode = function(json) {
919
939
  const nodeChildren = json.children;
@@ -1565,7 +1585,14 @@ var Topology = (function (_super) {
1565
1585
  };
1566
1586
  Topology.prototype.delete = function (force, nodes) {
1567
1587
  var pens = [];
1568
- const deleteNodes = nodes ? nodes : this.activeLayer.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 ? nodes : this.activeLayer.pens;
1595
+ }
1569
1596
  for (var i = 0; i < deleteNodes.length; i++) {
1570
1597
  var pen = deleteNodes[i];
1571
1598
  if (!force && pen.locked) {
@@ -1738,16 +1765,18 @@ var Topology = (function (_super) {
1738
1765
  for (var _i = 0, _a = this.activeLayer.pens; _i < _a.length; _i++) {
1739
1766
  var pen = _a[_i];
1740
1767
  pen.data = [];
1741
- this.bindInfo(item, pen, dataType, index);
1768
+ this.bindInfo(item, pen, dataType, index, exite);
1742
1769
  this.clipboard.pens.push(pen.clone());
1743
1770
  }
1744
1771
  if (exite == true) {
1745
1772
  this.paste();
1746
1773
  }
1747
1774
  };
1748
- Topology.prototype.bindInfo = async function (item, pen, type, index) {
1775
+ Topology.prototype.bindInfo = async function (item, pen, type, index, exite) {
1749
1776
  const itemNode = item && item.default || item;
1777
+ let bindName = '';
1750
1778
  if ([0, '0'].includes(type)) {
1779
+ bindName = itemNode.tagName;
1751
1780
  const setTagId = setTagIdData(itemNode);
1752
1781
  pen.data.push(...setTagId);
1753
1782
  // 绑定悬浮文字
@@ -1756,9 +1785,11 @@ var Topology = (function (_super) {
1756
1785
  const setThreeCategory = setThreeCategoryIdData(pen, itemNode);
1757
1786
  pen.data.push(...setThreeCategory);
1758
1787
  } else if ([1, '1'].includes(type)) {
1788
+ bindName = itemNode.kpiName;
1759
1789
  const setKpiAddr = setKpiAddrData(itemNode);
1760
1790
  pen.data.push(...setKpiAddr);
1761
1791
  } else if ([2, '2'].includes(type)) {
1792
+ bindName = itemNode.name;
1762
1793
  const setAssetId = setAssetIdData(itemNode);
1763
1794
  pen.data.push(...setAssetId);
1764
1795
  // 绑定悬浮文字
@@ -1791,12 +1822,19 @@ var Topology = (function (_super) {
1791
1822
  })
1792
1823
  }
1793
1824
  } else if ([3, '3'].includes(type)) {
1825
+ bindName = itemNode.name;
1794
1826
  const setAreaId = setAreaIdData(itemNode);
1795
1827
  pen.data.push(...setAreaId);
1796
1828
  }else if ([4, '4'].includes(type)) {
1829
+ bindName = itemNode.name;
1797
1830
  const setVarId = setVarValueData(itemNode);
1798
1831
  pen.data.push(...setVarId);
1832
+ }else if ([5, '5'].includes(type)) {
1833
+ bindName = itemNode.value;
1834
+ const setBranch = setBranchAddressData(itemNode);
1835
+ pen.data.push(...setBranch);
1799
1836
  }
1837
+ if(typeof exite === 'boolean') pen.text = bindName;
1800
1838
  // if([0, 2, '0', '2'].includes(type)) {
1801
1839
  // //用于处理场地监控,点击一个资产类别后,隐藏掉这个类别下的所有元件
1802
1840
  // const setThreeCategory = setThreeCategoryIdData(pen, itemNode);
@@ -2,4 +2,5 @@ import { Node } from '../models';
2
2
  import { visualization2DStore } from '../store';
3
3
  export declare function setStyleForElementIdDiv(node: Node, elem: HTMLElement, data: visualization2DStore): void;
4
4
  export declare function createDiv(node: Node): HTMLDivElement;
5
- // export declare function loadJS(url: string, callback?: () => void, render?: boolean): void;
5
+ // @ts-ignore
6
+ export declare function loadJS(url: string): Promise;
@@ -35,20 +35,20 @@ export function createDiv(node) {
35
35
  return div;
36
36
  }
37
37
 
38
- // export function loadJS(url, callback, render) {
39
- // var loaderScript = document.createElement('script');
40
- // loaderScript.type = 'text/javascript';
41
- // loaderScript.src = url;
42
- // loaderScript.addEventListener('load', function () {
43
- // if (callback) {
44
- // callback();
45
- // }
46
- // // how to do
47
- // if (render) {
48
- // Store.set('LT:render', true);
49
- // }
50
- // });
51
- // document.body.appendChild(loaderScript);
52
- // }
38
+ export function loadJS(url) {
39
+ var loaderScript = document.createElement('script');
40
+ loaderScript.type = 'text/javascript';
41
+ loaderScript.src = url;
42
+ document.body.appendChild(loaderScript);
43
+ window.datePickerRegister = true;
44
+ return new Promise((resolve, reject) => {
45
+ loaderScript.onload = function () {
46
+ resolve(true);
47
+ };
48
+ loaderScript.onerror = (e) => {
49
+ reject(e);
50
+ };
51
+ });
52
+ }
53
53
 
54
54
  //# sourceMappingURL=dom.js.map
@@ -0,0 +1,3 @@
1
+ import { Node } from '../models';
2
+ export declare function createDatePickerElement(node: Node): HTMLElement;
3
+ export declare function setDataPickerElementStyle(node: Node): void;
@@ -0,0 +1,47 @@
1
+ import {commonStore} from "../store";
2
+ // 创建datePicker依赖DOM
3
+ export function createDatePickerElement(node) {
4
+ const pickerBarEle = document.createElement('div');
5
+ pickerBarEle.setAttribute('id', node.id);
6
+ pickerBarEle.setAttribute('class', 'topology-datePicker');
7
+ pickerBarEle.innerHTML = `<svg class="icon-date" viewBox="0 0 14 14" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="14.000000" height="14.000000" fill="none" customFrame="#000000">
8
+ \t<path id="icon-日历" d="M13.4167 1.16667L10.5 1.16667L10.5 0L9.33333 0L9.33333 1.16667L4.66667 1.16667L4.66667 0L3.5 0L3.5 1.16667L0.583333 1.16667C0.2625 1.16667 0 1.42917 0 1.75L0 13.4167C0 13.7375 0.2625 14 0.583333 14L13.4167 14C13.7375 14 14 13.7375 14 13.4167L14 1.75C14 1.42917 13.7375 1.16667 13.4167 1.16667ZM12.8333 12.8333L1.16667 12.8333L1.16667 4.66667L12.8333 4.66667L12.8333 12.8333ZM4.66667 7L2.33333 7L2.33333 5.83333L4.66667 5.83333L4.66667 7ZM8.16667 7L5.83333 7L5.83333 5.83333L8.16667 5.83333L8.16667 7ZM11.6667 7L9.33333 7L9.33333 5.83333L11.6667 5.83333L11.6667 7ZM4.66667 9.33333L2.33333 9.33333L2.33333 8.16667L4.66667 8.16667L4.66667 9.33333ZM8.16667 9.33333L5.83333 9.33333L5.83333 8.16667L8.16667 8.16667L8.16667 9.33333ZM11.6667 9.33333L9.33333 9.33333L9.33333 8.16667L11.6667 8.16667L11.6667 9.33333ZM4.66667 11.6667L2.33333 11.6667L2.33333 10.5L4.66667 10.5L4.66667 11.6667ZM8.16667 11.6667L5.83333 11.6667L5.83333 10.5L8.16667 10.5L8.16667 11.6667Z" fill="rgb(64,244,255)" fill-rule="nonzero" />
9
+ </svg>
10
+ <svg class="icon-arrow" viewBox="0 0 10 6" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="10.000000" height="6.000000" fill="none" customFrame="#000000">
11
+ <path id="箭头" d="M5 0C5.14734 0 5.28865 0.0632141 5.39284 0.175736L9.83728 4.97574C10.0542 5.21005 10.0542 5.58995 9.83728 5.82426C9.62032 6.05858 9.26857 6.05858 9.05161 5.82426L5 1.44853L0.948393 5.82426C0.731435 6.05858 0.379676 6.05858 0.162718 5.82426C-0.0542395 5.58995 -0.0542395 5.21005 0.162718 4.97574L4.60716 0.175736C4.71135 0.0632141 4.85266 0 5 0Z" fill="rgb(23,206,230)" fill-rule="evenodd" transform="matrix(1,0,0,-1,0,6)" />
12
+ </svg>
13
+ <input id='picker${node.id}' class="dataPickerInput" type="text" name='dataPicker${node.id}' placeholder="请选择" readonly />`;
14
+
15
+ return pickerBarEle;
16
+ }
17
+
18
+ // datePicker样式配置
19
+ export function setDataPickerElementStyle(node) {
20
+ const {pickerDataPool, data} = commonStore[node.TID];
21
+ const pickerDom = pickerDataPool[node.id].dom;
22
+
23
+ pickerDom.container.style.border = `${node.lineWidth}px solid ${node.strokeStyle}`;
24
+ pickerDom.container.style.borderRadius = `${node.borderRadius * 100}px`;
25
+ pickerDom.container.style.padding = `${node.paddingTop}px ${node.paddingRight}px ${node.paddingBottom}px ${node.paddingLeft}px`;
26
+
27
+ if (!pickerDom.iconDate) pickerDom.iconDate = pickerDom.container.querySelector('.icon-date');
28
+ if (!pickerDom.iconArrow) pickerDom.iconArrow = pickerDom.container.querySelector('.icon-arrow');
29
+ if (!pickerDom.input) pickerDom.input = pickerDom.container.querySelector('.dataPickerInput');
30
+
31
+ const round = `${node.font.fontSize + data.scale * 2}px`;
32
+ const parts = node.strokeStyle.match(/([\d.]+)/g);
33
+ const fillColor = parts ? `rgba(${parts[0]},${parts[1]},${parts[2]},1)` : node.strokeStyle;
34
+
35
+ pickerDom.iconDate.style.width = round;
36
+ pickerDom.iconDate.style.height = round;
37
+ pickerDom.iconDate.style.left = `${node.font.fontSize}px`;
38
+ pickerDom.iconDate.querySelector('path').style.fill = fillColor;
39
+
40
+ pickerDom.iconArrow.style.width = `${node.font.fontSize - data.scale * 2}px`;
41
+ pickerDom.iconArrow.style.height = `${node.font.fontSize - data.scale * 6}px`;
42
+ pickerDom.iconArrow.style.right = `${node.font.fontSize - data.scale * 2}px`;
43
+ pickerDom.iconArrow.querySelector('path').style.fill = fillColor;
44
+
45
+ pickerDom.input.style.fontSize = `${node.font.fontSize}px`;
46
+ pickerDom.input.style.color = node.font.color;
47
+ };
@@ -1,4 +1,5 @@
1
1
  export * from './common';
2
2
  export * from './iframe';
3
3
  export * from './select';
4
- export * from './tab';
4
+ export * from './tab';
5
+ export * from './datePicker';
@@ -1,4 +1,6 @@
1
1
  export * from './common';
2
2
  export * from './iframe';
3
3
  export * from './select';
4
- export * from './tab';
4
+ export * from './tab';
5
+ export * from './time';
6
+ export * from './datePicker';
@@ -206,14 +206,26 @@ export function getSelectedData(e, data, editData) {
206
206
  }
207
207
  if(staticType === selectStaticType.visible) {
208
208
  // 显示隐藏
209
+ const optionNode = data.formData.bindBlockId && currentStore.echartsOptionsPool[data.formData.bindBlockId];
210
+ if(optionNode) {
211
+ // 有绑定图表则切换图表数据
212
+ const selecteRealData = currentStore.selectRealDataPool[optionNode.data.id];
213
+
214
+ selectNode.node.selected.id = selecteRealData && selecteRealData[order] && selecteRealData[order].id;
215
+
216
+ currentStore.echartsRealDataPool[optionNode.data.id] = currentStore.echartsRealDataPool[node.id];
217
+
218
+ setMapDataOptions(optionNode.option, optionNode.data);
219
+ }
209
220
  const optionsVisibleData = currentStore.selectTabDataPool[data.id];
210
221
  if(!optionsVisibleData || !optionsVisibleData.size) return;
211
222
  for(const [key, value] of optionsVisibleData){
212
- const eque = node.id === value.tag;
223
+ const optionId = node.optionId || node.id;
224
+ const eque = optionId === value.tag;
213
225
  currentStore.data.pens[value.order].visible = eque;
214
226
  currentStore.data.pens[value.order].visibleSwitch = eque;
215
227
  value.visible = eque;
216
- setElementSwitchTabState(value);
228
+ setElementSwitchTabState(currentStore.data.pens[value.order]);
217
229
  }
218
230
  Store.set(`${data.TID}-LT:render`, true);
219
231
  }