dcim-topology2d 2.0.7 → 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.
- package/chart-diagram/src/echarts/index.js +4 -1
- package/chart-diagram/src/utils/changeOptions.d.ts +1 -0
- package/chart-diagram/src/utils/changeOptions.js +49 -35
- package/chart-diagram/src/utils/conversion.d.ts +1 -0
- package/chart-diagram/src/utils/conversion.js +182 -22
- package/chart-diagram/src/utils/formatter.d.ts +1 -1
- package/chart-diagram/src/utils/formatter.js +96 -19
- 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.d.ts +1 -1
- package/chart-diagram/src/utils/render.js +47 -27
- package/chart-diagram/src/utils/surfaceParametricConversion.d.ts +3 -0
- package/chart-diagram/src/utils/surfaceParametricConversion.js +252 -0
- package/core/src/canvas.js +4 -3
- package/core/src/common.js +16 -10
- package/core/src/core.d.ts +2 -0
- package/core/src/core.js +61 -23
- package/core/src/element/common.d.ts +2 -1
- package/core/src/element/common.js +15 -15
- package/core/src/element/datePicker.d.ts +3 -0
- package/core/src/element/datePicker.js +47 -0
- package/core/src/element/index.d.ts +2 -1
- package/core/src/element/index.js +3 -1
- package/core/src/element/select.js +14 -2
- package/core/src/element/tab.js +14 -12
- package/core/src/element/time.d.ts +3 -0
- package/core/src/element/time.js +44 -0
- package/core/src/middles/default.js +8 -2
- package/core/src/middles/nodes/formDatePicker.d.ts +2 -0
- package/core/src/middles/nodes/formDatePicker.js +66 -0
- package/core/src/middles/nodes/formselect.js +7 -0
- package/core/src/middles/nodes/index.d.ts +3 -1
- package/core/src/middles/nodes/index.js +3 -0
- package/core/src/middles/nodes/time.d.ts +2 -0
- package/core/src/middles/nodes/time.js +98 -0
- package/core/src/models/node.js +27 -4
- package/core/src/preview.d.ts +1 -0
- package/core/src/preview.js +30 -6
- package/core/src/renderLayer.js +13 -2
- package/core/src/store/data.d.ts +10 -2
- package/core/src/store/data.js +14 -5
- package/core/src/utils/assignment.d.ts +2 -1
- package/core/src/utils/assignment.js +29 -12
- package/core/src/utils/conversion.d.ts +3 -1
- package/core/src/utils/conversion.js +46 -3
- package/core/src/utils/onmousevent.js +15 -12
- package/core/src/utils/params.js +5 -0
- package/package.json +1 -1
- package/static/echartsDefaultData.js +15 -4
- package/style/common.css +0 -3
- package/style/datePicker.css +44 -0
- package/style/editor.css +3 -0
- package/style/index.css +1 -0
@@ -5,8 +5,9 @@ import {echartsColorData} from "../../../static";
|
|
5
5
|
* @param option 图表配置数据
|
6
6
|
* @param params 绑定的图表参数
|
7
7
|
* @param data 实时图表数据
|
8
|
+
* @param appearance 配置参数
|
8
9
|
*/
|
9
|
-
export function lineBarDataAuto(option, params, data) {
|
10
|
+
export function lineBarDataAuto(option, params, data, appearance) {
|
10
11
|
const seriesNodes = option.series;
|
11
12
|
if(data && data.XData) option.xAxis[0].data = data.XData;
|
12
13
|
if(!(data && data.seriesData && data.seriesData.length)) return;
|
@@ -17,33 +18,52 @@ export function lineBarDataAuto(option, params, data) {
|
|
17
18
|
if(realSeriesNode.name) seriesNodes[0].name = realSeriesNode.name;
|
18
19
|
return;
|
19
20
|
}
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
21
|
+
const realSeriesData = data.seriesData;
|
22
|
+
// 双轴曲线间距配置
|
23
|
+
if(option.yAxis.length > 1 && appearance.yAxisValueAuto) {
|
24
|
+
if(!appearance.yAxisMaxIntervalue) appearance.yAxisMaxIntervalue = 1;
|
25
|
+
// 双轴曲线,且曲线值为自适应
|
26
|
+
const dataGroup = {
|
27
|
+
data1: realSeriesData[0] && realSeriesData[0].data || [],
|
28
|
+
data2: realSeriesData[1] && realSeriesData[1].data || []
|
29
|
+
};
|
30
|
+
const newData = [...dataGroup.data1, ...dataGroup.data2];
|
31
|
+
let min = Math.min(...newData);
|
32
|
+
let max = Math.max(...newData);
|
33
|
+
const power = Math.floor(Math.log10(min));
|
34
|
+
for (let i = 0; i < option.yAxis.length; i++) {
|
35
|
+
const currentData = dataGroup[`data${i + 1}`];
|
36
|
+
if(min < 0 && Math.max(...currentData) < max) max *= appearance.yAxisMaxIntervalue;
|
37
|
+
if(min > 0 && Math.max(...currentData) < max) min = Math.pow(10, power);
|
38
|
+
option.yAxis[i].min = Math.ceil(min);
|
39
|
+
option.yAxis[i].max = Math.ceil(max);
|
40
|
+
}
|
41
|
+
}
|
42
|
+
let legendChange = false;
|
43
|
+
let seriesData = [];
|
44
|
+
const legendData = [];
|
45
|
+
for (let i = 0; i < realSeriesData.length; i++){
|
46
|
+
const realSeriesNode = realSeriesData[i];
|
47
|
+
let currSeriesNode = {};
|
48
|
+
const seriesItem = seriesNodes[i];
|
49
|
+
if(seriesItem) {
|
50
|
+
currSeriesNode = seriesItem;
|
51
|
+
}else {
|
52
|
+
const newSeriesItem = JSON.parse(JSON.stringify(seriesNodes[0]));
|
53
|
+
newSeriesItem.itemStyle.normal.lineStyle.color = echartsColorData[i];
|
54
|
+
newSeriesItem.itemStyle.normal.color = echartsColorData[i];
|
55
|
+
currSeriesNode = newSeriesItem;
|
56
|
+
}
|
57
|
+
if(realSeriesNode.name) {
|
58
|
+
currSeriesNode.name = realSeriesNode.name;
|
59
|
+
legendData.push(realSeriesNode.name);
|
60
|
+
legendChange = true;
|
44
61
|
}
|
45
|
-
|
62
|
+
currSeriesNode.data = realSeriesNode.data;
|
63
|
+
seriesData.push(currSeriesNode);
|
46
64
|
}
|
65
|
+
if(option.legend && legendChange) option.legend.data = legendData; // 为角标数据赋值
|
66
|
+
option.series = seriesData;
|
47
67
|
}
|
48
68
|
|
49
69
|
export function barPileStaticDataAuto(option, data, appearance) {
|
@@ -53,7 +73,7 @@ export function barPileStaticDataAuto(option, data, appearance) {
|
|
53
73
|
option.series[0].data = seriesData;
|
54
74
|
const data2 = [];
|
55
75
|
for (let i = 0; i < seriesData.length; i++) {
|
56
|
-
const dr = appearance.total[i] - Number(seriesData[i]);
|
76
|
+
const dr = appearance.total[i] ? appearance.total[i].value - Number(seriesData[i]) : data.seriesData[1].data[i];
|
57
77
|
data2.push(dr);
|
58
78
|
}
|
59
79
|
option.series[1].data = data2;
|
@@ -0,0 +1,3 @@
|
|
1
|
+
export declare function getPie3D(internalDiameterRatio: Number, type: String, appearance: {}, labelLineData: any, realData: any): {};
|
2
|
+
export declare function getParametricEquation(startRatio: Number, endRatio: Number, isSelected: Boolean, isHovered: Boolean, k: any, h: Number): {};
|
3
|
+
export declare function set3DPieMouseHover(myChart: object, type: String, option: {}, valueData: any): void;
|
@@ -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/canvas.js
CHANGED
@@ -62,9 +62,10 @@ var Canvas = /** @class */ (function (_super) {
|
|
62
62
|
}
|
63
63
|
this.canvas.style.width = this.width + 'px';
|
64
64
|
this.canvas.style.height = this.height + 'px';
|
65
|
-
|
66
|
-
this.canvas.
|
67
|
-
this.canvas.
|
65
|
+
const dpr = window.devicePixelRatio || 1;
|
66
|
+
this.canvas.width = (this.width * dpr) | 0;
|
67
|
+
this.canvas.height = (this.height * dpr) | 0;
|
68
|
+
this.canvas.getContext('2d').scale(dpr, dpr);
|
68
69
|
Store.set(this.generateStoreKey('LT:size'), { width: this.canvas.width, height: this.canvas.height });
|
69
70
|
};
|
70
71
|
Canvas.prototype.render = function () {
|
package/core/src/common.js
CHANGED
@@ -14,12 +14,10 @@ import {
|
|
14
14
|
setInitConfData,
|
15
15
|
getParams,
|
16
16
|
tabHideShowOperation,
|
17
|
-
tabStaticOperation
|
18
|
-
echartsStaticType
|
17
|
+
tabStaticOperation
|
19
18
|
} from './utils';
|
20
19
|
import {useStore, clearStore, commonStore} from './store'
|
21
20
|
import * as mqtt from './mqtt.min';
|
22
|
-
import {setElementSwitchTabState} from './element';
|
23
21
|
var MoveInType;
|
24
22
|
(function (MoveInType) {
|
25
23
|
MoveInType[MoveInType["None"] = 0] = "None";
|
@@ -188,6 +186,7 @@ var Common = /** @class */ (function () {
|
|
188
186
|
if (this.store.mqttParams.echartAssemblyData.length) params.echartAssemblyData = [...this.store.mqttParams.echartAssemblyData];
|
189
187
|
if(assetId) {
|
190
188
|
params.varValueIds = this.store.mqttParams.varVaule.join(",");
|
189
|
+
params.branchAddrs = this.store.mqttParams.branchValue.join(",");
|
191
190
|
}else {
|
192
191
|
if(this.store.mqttParams.assetIds.length && this.store.mqttParams.varVaule.length) {
|
193
192
|
const assetId = this.store.mqttParams.assetIds[this.store.mqttParams.assetIds.length -1];
|
@@ -221,6 +220,13 @@ var Common = /** @class */ (function () {
|
|
221
220
|
})
|
222
221
|
this.store.mqttParams.varVaule = ids;
|
223
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
|
+
};
|
224
230
|
// 固定资产详情数据赋值
|
225
231
|
Common.prototype.renderForAssetPoperties = function (asset, data){
|
226
232
|
if(!Object.keys(asset).length) return;
|
@@ -250,8 +256,8 @@ var Common = /** @class */ (function () {
|
|
250
256
|
}
|
251
257
|
let data = JSON.parse(JSON.stringify(obj));
|
252
258
|
Object.assign(this.store.data, data);
|
253
|
-
//
|
254
|
-
if(this.store.options.type !== 'topology'
|
259
|
+
// topology编辑器下跳出程序
|
260
|
+
if(this.store.options.type !== 'topology') {
|
255
261
|
const screenWidth = window.screen.width < 1920 ? 1920 : window.screen.width;
|
256
262
|
const zoom = window.innerWidth < screenWidth ? document.documentElement.clientWidth / screenWidth : 1;
|
257
263
|
this.store.data.pageZoom = zoom;
|
@@ -259,7 +265,7 @@ var Common = /** @class */ (function () {
|
|
259
265
|
this.store.parentElem.style.transformOrigin = '0 0';
|
260
266
|
this.store.parentElem.parentElement.style.overflow = 'hidden';
|
261
267
|
Store.set('PAGE:zoom', zoom);
|
262
|
-
}
|
268
|
+
}
|
263
269
|
this.store.data.pens = [];
|
264
270
|
this.openCount = 0
|
265
271
|
const type = this.store.options.type;
|
@@ -487,7 +493,7 @@ var Common = /** @class */ (function () {
|
|
487
493
|
if(!switchTabData) return;
|
488
494
|
const topologyChangeData = commonStore[node.TID].switchTabDataPool; // 获取所有按钮组和按类型统计图组数据
|
489
495
|
const changeNode = topologyChangeData[`${switchTabData}Data`]; // 分别获取按钮组数据
|
490
|
-
if(!changeNode[node.id]) return;
|
496
|
+
if(!changeNode || !changeNode[node.id]) return;
|
491
497
|
// 如果存在按钮组节点数据
|
492
498
|
const tabAreaData = topologyChangeData[`${switchTabData}AreaData`];
|
493
499
|
let tabIndex = 0;
|
@@ -504,7 +510,7 @@ var Common = /** @class */ (function () {
|
|
504
510
|
}
|
505
511
|
penNode.activeImgeIndex = isActive;
|
506
512
|
tabIndex++;
|
507
|
-
if(staticType === 'SH') tabHideShowOperation(switchNode, tabAreaData); // 对显示隐藏的功能进行交互处理
|
513
|
+
if(staticType === 'SH') tabHideShowOperation(switchNode, tabAreaData, isActive); // 对显示隐藏的功能进行交互处理
|
508
514
|
}
|
509
515
|
// 对绑定的图表进行数据处理
|
510
516
|
tabStaticOperation(staticType, node, tabAreaData, visitParams);
|
@@ -700,10 +706,10 @@ var Common = /** @class */ (function () {
|
|
700
706
|
this.divLayer.canvas.title = '';
|
701
707
|
this.tip = '';
|
702
708
|
};
|
703
|
-
Common.prototype.dispatch = function (event, data) {
|
709
|
+
Common.prototype.dispatch = function (event, node, data) {
|
704
710
|
if(!this.store || !this.store.options) return;
|
705
711
|
if (this.store.options.on) {
|
706
|
-
this.store.options.on(event, data);
|
712
|
+
this.store.options.on(event, node, data);
|
707
713
|
}
|
708
714
|
// 先注释掉
|
709
715
|
// if (event === 'node' && data.name == 'tablePagination' && this.store.options.type !== 'topology') {
|
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,14 @@ 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 ? 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
|
-
//
|
5
|
+
// @ts-ignore
|
6
|
+
export declare function loadJS(url: string): Promise;
|