dcim-topology2d 2.0.8 → 2.2.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.
- package/chart-diagram/src/echarts/index.js +6 -3
- package/chart-diagram/src/utils/changeOptions.d.ts +1 -0
- package/chart-diagram/src/utils/changeOptions.js +41 -35
- package/chart-diagram/src/utils/conversion.d.ts +1 -1
- package/chart-diagram/src/utils/conversion.js +143 -15
- package/chart-diagram/src/utils/formatter.d.ts +1 -1
- package/chart-diagram/src/utils/formatter.js +51 -15
- package/chart-diagram/src/utils/index.d.ts +1 -0
- package/chart-diagram/src/utils/index.js +1 -0
- package/chart-diagram/src/utils/render.js +43 -52
- package/chart-diagram/src/utils/surfaceParametricConversion.d.ts +3 -0
- package/chart-diagram/src/utils/surfaceParametricConversion.js +252 -0
- package/core/src/common.js +24 -15
- package/core/src/core.d.ts +2 -0
- package/core/src/core.js +75 -23
- package/core/src/element/common.d.ts +2 -1
- package/core/src/element/common.js +27 -18
- package/core/src/element/datePicker.d.ts +3 -0
- package/core/src/element/datePicker.js +44 -0
- package/core/src/element/index.d.ts +2 -1
- package/core/src/element/index.js +3 -1
- package/core/src/element/select.d.ts +1 -1
- package/core/src/element/select.js +15 -5
- package/core/src/element/tab.js +6 -9
- package/core/src/element/time.d.ts +3 -0
- package/core/src/element/time.js +44 -0
- package/core/src/healps/changeData.js +61 -41
- package/core/src/middles/default.js +53 -43
- package/core/src/middles/nodes/formDatePicker.d.ts +2 -0
- package/core/src/middles/nodes/formDatePicker.js +107 -0
- package/core/src/middles/nodes/formselect.js +20 -4
- package/core/src/middles/nodes/index.d.ts +4 -1
- package/core/src/middles/nodes/index.js +4 -0
- package/core/src/middles/nodes/switchs.d.ts +2 -0
- package/core/src/middles/nodes/switchs.js +46 -0
- package/core/src/middles/nodes/time.d.ts +2 -0
- package/core/src/middles/nodes/time.js +98 -0
- package/core/src/models/line.js +7 -7
- package/core/src/models/node.js +88 -74
- package/core/src/models/pen.js +11 -11
- package/core/src/offscreen.js +19 -19
- package/core/src/preview.d.ts +1 -0
- package/core/src/preview.js +44 -11
- package/core/src/store/data.d.ts +7 -0
- package/core/src/store/data.js +15 -2
- package/core/src/utils/assignment.d.ts +2 -1
- package/core/src/utils/assignment.js +55 -12
- package/core/src/utils/construction.d.ts +24 -0
- package/core/src/utils/construction.js +22 -1
- package/core/src/utils/conversion.d.ts +4 -0
- package/core/src/utils/conversion.js +151 -0
- package/core/src/utils/math.d.ts +0 -1
- package/core/src/utils/math.js +0 -3
- package/core/src/utils/onmousevent.js +1 -1
- package/core/src/utils/params.d.ts +1 -0
- package/core/src/utils/params.js +80 -4
- package/package.json +1 -1
- package/store/default.js +22 -0
- package/store/index.js +2 -1
- package/style/common.css +0 -3
- package/style/datePicker.css +44 -0
- package/style/editor.css +3 -0
- 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
|
+
}
|
package/core/src/common.js
CHANGED
@@ -14,7 +14,7 @@ import {
|
|
14
14
|
setInitConfData,
|
15
15
|
getParams,
|
16
16
|
tabHideShowOperation,
|
17
|
-
tabStaticOperation
|
17
|
+
tabStaticOperation, pageZoom
|
18
18
|
} from './utils';
|
19
19
|
import {useStore, clearStore, commonStore} from './store'
|
20
20
|
import * as mqtt from './mqtt.min';
|
@@ -181,11 +181,13 @@ var Common = /** @class */ (function () {
|
|
181
181
|
areaIds: this.store.mqttParams.areaIds.join(","),
|
182
182
|
routingkey: this.store.mqttParams.routingkey,
|
183
183
|
echart: this.store.mqttParams.tagEcharts.join(","),
|
184
|
-
echartData: this.store.mqttParams.echartData
|
184
|
+
echartData: this.store.mqttParams.echartData,
|
185
|
+
dataConfig: this.store.mqttParams.dataConfig.data
|
185
186
|
}
|
186
187
|
if (this.store.mqttParams.echartAssemblyData.length) params.echartAssemblyData = [...this.store.mqttParams.echartAssemblyData];
|
187
188
|
if(assetId) {
|
188
189
|
params.varValueIds = this.store.mqttParams.varVaule.join(",");
|
190
|
+
params.branchAddrs = this.store.mqttParams.branchValue.join(",");
|
189
191
|
}else {
|
190
192
|
if(this.store.mqttParams.assetIds.length && this.store.mqttParams.varVaule.length) {
|
191
193
|
const assetId = this.store.mqttParams.assetIds[this.store.mqttParams.assetIds.length -1];
|
@@ -219,6 +221,13 @@ var Common = /** @class */ (function () {
|
|
219
221
|
})
|
220
222
|
this.store.mqttParams.varVaule = ids;
|
221
223
|
};
|
224
|
+
Common.prototype.getBranchValueIdsForBranchsData = function (data){
|
225
|
+
const ids = [];
|
226
|
+
data.map((item) => {
|
227
|
+
if(item.branchAddr) ids.push(`${item.assetId}_${item.branchAddr}`);
|
228
|
+
})
|
229
|
+
this.store.mqttParams.branchValue = ids;
|
230
|
+
};
|
222
231
|
// 固定资产详情数据赋值
|
223
232
|
Common.prototype.renderForAssetPoperties = function (asset, data){
|
224
233
|
if(!Object.keys(asset).length) return;
|
@@ -248,10 +257,9 @@ var Common = /** @class */ (function () {
|
|
248
257
|
}
|
249
258
|
let data = JSON.parse(JSON.stringify(obj));
|
250
259
|
Object.assign(this.store.data, data);
|
251
|
-
//
|
252
|
-
if(this.store.options.type !== 'topology'
|
253
|
-
const
|
254
|
-
const zoom = window.innerWidth < screenWidth ? document.documentElement.clientWidth / screenWidth : 1;
|
260
|
+
// topology编辑器下跳出程序
|
261
|
+
if(this.store.options.type !== 'topology') {
|
262
|
+
const zoom = pageZoom();
|
255
263
|
this.store.data.pageZoom = zoom;
|
256
264
|
this.store.parentElem.style.transform = `scale(${1/zoom})`;
|
257
265
|
this.store.parentElem.style.transformOrigin = '0 0';
|
@@ -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') {
|
@@ -731,9 +739,9 @@ var Common = /** @class */ (function () {
|
|
731
739
|
connectParams.password = resetDCIM.mqttPassword;
|
732
740
|
}
|
733
741
|
// 连接测试,MQTT
|
734
|
-
this.openMqtt(connectParams);
|
742
|
+
this.openMqtt(connectParams, resetDCIM.mqttDebug);
|
735
743
|
};
|
736
|
-
Common.prototype.openMqtt = function (connectParams) {
|
744
|
+
Common.prototype.openMqtt = function (connectParams, debug) {
|
737
745
|
const _this = this;
|
738
746
|
_this.closeMqtt();
|
739
747
|
if(!connectParams.mqttUrl) return;
|
@@ -741,9 +749,9 @@ var Common = /** @class */ (function () {
|
|
741
749
|
const url = connectParams.mqttUrl.replace('ip', location.hostname);
|
742
750
|
_this.mqttClient = mqtt.connect(url, connectParams);
|
743
751
|
_this.mqttClient.on('message', function (topic, message) {
|
744
|
-
|
752
|
+
if(debug) console.log('mqttClientTopic>>>', topic, connectParams.mqttTopics)
|
745
753
|
if (!topic || topic != connectParams.mqttTopics) return;
|
746
|
-
if (!this.isEnd) _this.doMqttDrow(message.toString());
|
754
|
+
if (!this.isEnd) _this.doMqttDrow(message.toString(), debug);
|
747
755
|
});
|
748
756
|
const topics = connectParams.mqttTopics;
|
749
757
|
if (topics) {
|
@@ -756,9 +764,10 @@ var Common = /** @class */ (function () {
|
|
756
764
|
this.mqttClient.end();
|
757
765
|
}
|
758
766
|
};
|
759
|
-
Common.prototype.doMqttDrow = function (ret) {
|
767
|
+
Common.prototype.doMqttDrow = function (ret, debug) {
|
760
768
|
let canvasData = this.store.data;
|
761
769
|
ret = JSON.parse(ret);
|
770
|
+
if(debug) console.log('mqttClientMessage>>>', ret)
|
762
771
|
//console.log('处理消息', ret)
|
763
772
|
this.mqttDataDrawing(canvasData.pens, ret)
|
764
773
|
};
|
@@ -904,7 +913,7 @@ var Common = /** @class */ (function () {
|
|
904
913
|
this[item] = null;
|
905
914
|
|
906
915
|
})
|
907
|
-
//end
|
916
|
+
//end dcimStaticForType
|
908
917
|
window.topology = null;
|
909
918
|
};
|
910
919
|
// Render or redraw
|
package/core/src/core.d.ts
CHANGED
@@ -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
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
} else {
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
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,15 @@ var Topology = (function (_super) {
|
|
1565
1585
|
};
|
1566
1586
|
Topology.prototype.delete = function (force, nodes) {
|
1567
1587
|
var pens = [];
|
1568
|
-
|
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 = '';
|
1569
1597
|
for (var i = 0; i < deleteNodes.length; i++) {
|
1570
1598
|
var pen = deleteNodes[i];
|
1571
1599
|
if (!force && pen.locked) {
|
@@ -1573,6 +1601,7 @@ var Topology = (function (_super) {
|
|
1573
1601
|
}
|
1574
1602
|
var found = this.findIndex(pen);
|
1575
1603
|
if (found > -1) {
|
1604
|
+
if(pen.pickerOptions) dateIds += `${pen.id},`;
|
1576
1605
|
if (this.store.data.pens[found].type === PenType.Node) {
|
1577
1606
|
this.divLayer.removeDiv(this.store.data.pens[found]);
|
1578
1607
|
}
|
@@ -1585,6 +1614,7 @@ var Topology = (function (_super) {
|
|
1585
1614
|
}
|
1586
1615
|
this.animateLayer.pens.delete(pen.id);
|
1587
1616
|
}
|
1617
|
+
if(dateIds) this.resetAssociateDateData(dateIds);
|
1588
1618
|
if (!pens.length) {
|
1589
1619
|
return;
|
1590
1620
|
}
|
@@ -1592,6 +1622,17 @@ var Topology = (function (_super) {
|
|
1592
1622
|
this.cache();
|
1593
1623
|
this.dispatch('delete', pens);
|
1594
1624
|
};
|
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
|
+
};
|
1595
1636
|
Topology.prototype.delEmptyLines = function (deleteedId) {
|
1596
1637
|
for (var i = 0; i < this.store.data.pens.length; i++) {
|
1597
1638
|
if (this.store.data.pens[i].type !== PenType.Line) {
|
@@ -1738,16 +1779,18 @@ var Topology = (function (_super) {
|
|
1738
1779
|
for (var _i = 0, _a = this.activeLayer.pens; _i < _a.length; _i++) {
|
1739
1780
|
var pen = _a[_i];
|
1740
1781
|
pen.data = [];
|
1741
|
-
this.bindInfo(item, pen, dataType, index);
|
1782
|
+
this.bindInfo(item, pen, dataType, index, exite);
|
1742
1783
|
this.clipboard.pens.push(pen.clone());
|
1743
1784
|
}
|
1744
1785
|
if (exite == true) {
|
1745
1786
|
this.paste();
|
1746
1787
|
}
|
1747
1788
|
};
|
1748
|
-
Topology.prototype.bindInfo = async function (item, pen, type, index) {
|
1789
|
+
Topology.prototype.bindInfo = async function (item, pen, type, index, exite) {
|
1749
1790
|
const itemNode = item && item.default || item;
|
1791
|
+
let bindName = '';
|
1750
1792
|
if ([0, '0'].includes(type)) {
|
1793
|
+
bindName = itemNode.tagName;
|
1751
1794
|
const setTagId = setTagIdData(itemNode);
|
1752
1795
|
pen.data.push(...setTagId);
|
1753
1796
|
// 绑定悬浮文字
|
@@ -1756,9 +1799,11 @@ var Topology = (function (_super) {
|
|
1756
1799
|
const setThreeCategory = setThreeCategoryIdData(pen, itemNode);
|
1757
1800
|
pen.data.push(...setThreeCategory);
|
1758
1801
|
} else if ([1, '1'].includes(type)) {
|
1802
|
+
bindName = itemNode.kpiName;
|
1759
1803
|
const setKpiAddr = setKpiAddrData(itemNode);
|
1760
1804
|
pen.data.push(...setKpiAddr);
|
1761
1805
|
} else if ([2, '2'].includes(type)) {
|
1806
|
+
bindName = itemNode.name;
|
1762
1807
|
const setAssetId = setAssetIdData(itemNode);
|
1763
1808
|
pen.data.push(...setAssetId);
|
1764
1809
|
// 绑定悬浮文字
|
@@ -1791,12 +1836,19 @@ var Topology = (function (_super) {
|
|
1791
1836
|
})
|
1792
1837
|
}
|
1793
1838
|
} else if ([3, '3'].includes(type)) {
|
1839
|
+
bindName = itemNode.name;
|
1794
1840
|
const setAreaId = setAreaIdData(itemNode);
|
1795
1841
|
pen.data.push(...setAreaId);
|
1796
1842
|
}else if ([4, '4'].includes(type)) {
|
1843
|
+
bindName = itemNode.name;
|
1797
1844
|
const setVarId = setVarValueData(itemNode);
|
1798
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);
|
1799
1850
|
}
|
1851
|
+
if(typeof exite === 'boolean') pen.text = bindName;
|
1800
1852
|
// if([0, 2, '0', '2'].includes(type)) {
|
1801
1853
|
// //用于处理场地监控,点击一个资产类别后,隐藏掉这个类别下的所有元件
|
1802
1854
|
// 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
|
-
//
|
5
|
+
// @ts-ignore
|
6
|
+
export declare function loadJS(url: string): Promise;
|
@@ -2,13 +2,22 @@ import {Lock} from '../models';
|
|
2
2
|
import {commonStore} from '../store';
|
3
3
|
export function setStyleForElementIdDiv(node, elem, data) {
|
4
4
|
if (!elem) return;
|
5
|
-
|
5
|
+
node.attribute = 'dom';
|
6
|
+
const currentStore = commonStore[node.TID];
|
7
|
+
if(!currentStore.elementInteractivePoor.dom) currentStore.elementInteractivePoor.dom = {};
|
8
|
+
currentStore.elementInteractivePoor.dom[node.id] = elem;
|
9
|
+
let width = node.rect.width;
|
10
|
+
let height = node.rect.height;
|
11
|
+
if(node.name === 'echarts') {
|
12
|
+
width /= currentStore.data.pageZoom;
|
13
|
+
height /= currentStore.data.pageZoom;
|
14
|
+
}
|
6
15
|
elem.style.position = 'absolute';
|
7
16
|
elem.style.outline = 'none';
|
8
17
|
elem.style.left = node.rect.x + 'px';
|
9
18
|
elem.style.top = node.rect.y + 'px';
|
10
|
-
elem.style.width =
|
11
|
-
elem.style.height =
|
19
|
+
elem.style.width = width + 'px';
|
20
|
+
elem.style.height = height + 'px';
|
12
21
|
if (node.rotate || node.offsetRotate) {
|
13
22
|
elem.style.transform = "rotate(" + (node.rotate + node.offsetRotate) + "deg)";
|
14
23
|
}
|
@@ -35,20 +44,20 @@ export function createDiv(node) {
|
|
35
44
|
return div;
|
36
45
|
}
|
37
46
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
47
|
+
export function loadJS(url) {
|
48
|
+
var loaderScript = document.createElement('script');
|
49
|
+
loaderScript.type = 'text/javascript';
|
50
|
+
loaderScript.src = url;
|
51
|
+
document.body.appendChild(loaderScript);
|
52
|
+
window.datePickerRegister = true;
|
53
|
+
return new Promise((resolve, reject) => {
|
54
|
+
loaderScript.onload = function () {
|
55
|
+
resolve(true);
|
56
|
+
};
|
57
|
+
loaderScript.onerror = (e) => {
|
58
|
+
reject(e);
|
59
|
+
};
|
60
|
+
});
|
61
|
+
}
|
53
62
|
|
54
63
|
//# sourceMappingURL=dom.js.map
|