dcim-topology2d 2.0.5 → 2.0.7
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 +21 -13
- package/chart-diagram/src/utils/changeOptions.js +7 -1
- package/chart-diagram/src/utils/conversion.d.ts +1 -0
- package/chart-diagram/src/utils/conversion.js +117 -23
- package/chart-diagram/src/utils/formatter.d.ts +1 -0
- package/chart-diagram/src/utils/formatter.js +129 -0
- 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 +3 -1
- package/chart-diagram/src/utils/render.js +83 -8
- package/core/src/common.js +53 -18
- package/core/src/core.js +25 -0
- package/core/src/divLayer.js +1 -1
- package/core/src/element/common.js +4 -2
- package/core/src/element/select.js +29 -0
- package/core/src/element/tab.js +5 -1
- package/core/src/healps/changeData.js +1 -1
- package/core/src/middles/nodes/formoverflow.js +61 -0
- package/core/src/middles/nodes/formselect.js +16 -8
- package/core/src/middles/nodes/index.d.ts +2 -1
- package/core/src/middles/nodes/index.js +1 -0
- package/core/src/models/node.js +7 -0
- package/core/src/options.d.ts +1 -1
- package/core/src/preview.js +28 -1
- package/core/src/store/data.d.ts +7 -0
- package/core/src/store/data.js +17 -1
- package/core/src/utils/assignment.js +2 -2
- package/core/src/utils/construction.d.ts +2 -0
- package/core/src/utils/construction.js +1 -0
- package/core/src/utils/conversion.d.ts +2 -1
- package/core/src/utils/conversion.js +52 -0
- package/core/src/utils/params.js +3 -0
- package/myShape-diagram/index.js +155 -152
- package/package.json +1 -1
- package/static/echartsDefaultData.js +11 -3
package/core/src/common.js
CHANGED
@@ -13,6 +13,9 @@ import {
|
|
13
13
|
setConnectionTagForConf,
|
14
14
|
setInitConfData,
|
15
15
|
getParams,
|
16
|
+
tabHideShowOperation,
|
17
|
+
tabStaticOperation,
|
18
|
+
echartsStaticType
|
16
19
|
} from './utils';
|
17
20
|
import {useStore, clearStore, commonStore} from './store'
|
18
21
|
import * as mqtt from './mqtt.min';
|
@@ -37,6 +40,8 @@ var Common = /** @class */ (function () {
|
|
37
40
|
this.mouseDown = null;
|
38
41
|
this.renderTimer = 0;
|
39
42
|
this.lastRender = 0;
|
43
|
+
this.pageResizeTim = null;
|
44
|
+
this.isResize = false;
|
40
45
|
this.id = s8();
|
41
46
|
this.store = useStore(this.id);
|
42
47
|
if (typeof parent === 'string') {
|
@@ -233,7 +238,7 @@ var Common = /** @class */ (function () {
|
|
233
238
|
})
|
234
239
|
}
|
235
240
|
if (node.children && node.children.length) {
|
236
|
-
renderForAssetPoperties(asset, node.children);
|
241
|
+
this.renderForAssetPoperties(asset, node.children);
|
237
242
|
}
|
238
243
|
});
|
239
244
|
};
|
@@ -245,6 +250,16 @@ var Common = /** @class */ (function () {
|
|
245
250
|
}
|
246
251
|
let data = JSON.parse(JSON.stringify(obj));
|
247
252
|
Object.assign(this.store.data, data);
|
253
|
+
// pageZoomOnly 表示topology页面只全局缩放,不对局部缩放进行调整
|
254
|
+
if(this.store.options.type !== 'topology' && this.store.options.type !== 'pageZoomOnly') {
|
255
|
+
const screenWidth = window.screen.width < 1920 ? 1920 : window.screen.width;
|
256
|
+
const zoom = window.innerWidth < screenWidth ? document.documentElement.clientWidth / screenWidth : 1;
|
257
|
+
this.store.data.pageZoom = zoom;
|
258
|
+
this.store.parentElem.style.transform = `scale(${1/zoom})`;
|
259
|
+
this.store.parentElem.style.transformOrigin = '0 0';
|
260
|
+
this.store.parentElem.parentElement.style.overflow = 'hidden';
|
261
|
+
Store.set('PAGE:zoom', zoom);
|
262
|
+
};
|
248
263
|
this.store.data.pens = [];
|
249
264
|
this.openCount = 0
|
250
265
|
const type = this.store.options.type;
|
@@ -475,29 +490,24 @@ var Common = /** @class */ (function () {
|
|
475
490
|
if(!changeNode[node.id]) return;
|
476
491
|
// 如果存在按钮组节点数据
|
477
492
|
const tabAreaData = topologyChangeData[`${switchTabData}AreaData`];
|
493
|
+
let tabIndex = 0;
|
494
|
+
const visitParams = {
|
495
|
+
order: 0
|
496
|
+
};
|
478
497
|
for (let switchNode of Object.values(changeNode)) {
|
479
498
|
const penNode = this.store.data.pens[switchNode.order];
|
480
499
|
if(!penNode) return;
|
481
|
-
|
482
|
-
if(
|
483
|
-
|
484
|
-
|
485
|
-
if(areaNode && this.store.data.pens[areaNode.order]) {
|
486
|
-
const tagNode = this.store.data.pens[areaNode.order];
|
487
|
-
tagNode.visible = !(switchNode.id !== node.id);
|
488
|
-
setElementSwitchTabState(tagNode);
|
489
|
-
}
|
500
|
+
const isActive = switchNode.id !== node.id;
|
501
|
+
if(!isActive) {
|
502
|
+
visitParams.order = tabIndex;
|
503
|
+
visitParams.data = switchNode.tabData;
|
490
504
|
}
|
505
|
+
penNode.activeImgeIndex = isActive;
|
506
|
+
tabIndex++;
|
507
|
+
if(staticType === 'SH') tabHideShowOperation(switchNode, tabAreaData); // 对显示隐藏的功能进行交互处理
|
491
508
|
}
|
492
509
|
// 对绑定的图表进行数据处理
|
493
|
-
|
494
|
-
const findCurentEchart = tabAreaData[node.bindStaticId]; // 获取当前点中的节点绑定的统计图表数据
|
495
|
-
if (findCurentEchart && findCurentEchart.data.params) {
|
496
|
-
const cn = this.store.data.pens[findCurentEchart.order];
|
497
|
-
cn.data.params['staticForType'] = staticType; // 统计类型赋值
|
498
|
-
cn.elementRendered = false;
|
499
|
-
}
|
500
|
-
}
|
510
|
+
tabStaticOperation(staticType, node, tabAreaData, visitParams);
|
501
511
|
this.store.data.dataResize = 1;
|
502
512
|
this.render();
|
503
513
|
};
|
@@ -763,6 +773,9 @@ var Common = /** @class */ (function () {
|
|
763
773
|
if (item.children && item.children.length) {
|
764
774
|
this.mqttDataDrawing(item.children, retData);
|
765
775
|
}
|
776
|
+
if (item.formData && item.formData.detailPageData && item.formData.detailPageData.pens && item.formData.detailPageData.pens.length) {
|
777
|
+
this.mqttDataDrawing(item.formData.detailPageData.pens, retData);
|
778
|
+
}
|
766
779
|
});
|
767
780
|
//console.log('执行完毕-----', this.store.data.pens)
|
768
781
|
this.render();
|
@@ -826,6 +839,28 @@ var Common = /** @class */ (function () {
|
|
826
839
|
}
|
827
840
|
}
|
828
841
|
};
|
842
|
+
Common.prototype.formOverflowConversionData = function (obj) {
|
843
|
+
if (!obj) {
|
844
|
+
obj = {pens: []};
|
845
|
+
}
|
846
|
+
let data = JSON.parse(JSON.stringify(obj));
|
847
|
+
Object.assign(this.store.data, data);
|
848
|
+
this.store.data.pens = [];
|
849
|
+
this.openCount = 0
|
850
|
+
const type = this.store.options.type;
|
851
|
+
if (data.pens) {
|
852
|
+
for (var _d = 0, _e = data.pens; _d < _e.length; _d++) {
|
853
|
+
const item = _e[_d];
|
854
|
+
if (!item.from) {
|
855
|
+
const node = new Node(item);
|
856
|
+
this.store.data.pens.push(node);
|
857
|
+
} else {
|
858
|
+
const linNode = new Line(item);
|
859
|
+
this.store.data.pens.push(linNode);
|
860
|
+
}
|
861
|
+
}
|
862
|
+
}
|
863
|
+
};
|
829
864
|
Common.prototype.destroyStatic = function () {
|
830
865
|
this.clear('destroy');
|
831
866
|
//this.closeSocket();
|
package/core/src/core.js
CHANGED
@@ -2340,6 +2340,31 @@ var Topology = (function (_super) {
|
|
2340
2340
|
|
2341
2341
|
return true
|
2342
2342
|
};
|
2343
|
+
Topology.prototype.formOverflowOpen = function (data) {
|
2344
|
+
this.formOverflowConversionData(data);
|
2345
|
+
this.overflowView();
|
2346
|
+
this.render(true);
|
2347
|
+
}
|
2348
|
+
Topology.prototype.overflowView = function (data) {
|
2349
|
+
try {
|
2350
|
+
var rect = this.getRect();
|
2351
|
+
let _a = this.canvas;
|
2352
|
+
if(!_a.width) return;
|
2353
|
+
let width = _a.width, height = _a.height;
|
2354
|
+
let rectWidth = rect.width? (rect.ex + 4) : rect.width
|
2355
|
+
let rectHeight= rect.height? (rect.ey + 4) : rect.height
|
2356
|
+
if (width < rectWidth) {
|
2357
|
+
width = rectWidth;
|
2358
|
+
}
|
2359
|
+
if (height < rectHeight) {
|
2360
|
+
height = rectHeight;
|
2361
|
+
}
|
2362
|
+
this.resize({width: width, height: height});
|
2363
|
+
return rect;
|
2364
|
+
}catch (e){
|
2365
|
+
console.log('-error--------overflowView---',e)
|
2366
|
+
}
|
2367
|
+
}
|
2343
2368
|
return Topology;
|
2344
2369
|
}(Common));
|
2345
2370
|
|
package/core/src/divLayer.js
CHANGED
@@ -76,7 +76,7 @@ var DivLayer = /** @class */ (function (_super) {
|
|
76
76
|
return _this;
|
77
77
|
}
|
78
78
|
DivLayer.prototype.addElement = function (node){
|
79
|
-
if(['iframe', 'echarts'].includes(node.name)) {
|
79
|
+
if(['iframe', 'echarts', 'formOverflow'].includes(node.name)) {
|
80
80
|
this.canvas.parentNode.appendChild(this.elements[node.id]);
|
81
81
|
}else {
|
82
82
|
this.canvas.appendChild(this.elements[node.id]);
|
@@ -1,12 +1,14 @@
|
|
1
1
|
import {Lock} from '../models';
|
2
|
+
import {commonStore} from '../store';
|
2
3
|
export function setStyleForElementIdDiv(node, elem, data) {
|
3
4
|
if (!elem) return;
|
5
|
+
const store = commonStore[node.TID].data;
|
4
6
|
elem.style.position = 'absolute';
|
5
7
|
elem.style.outline = 'none';
|
6
8
|
elem.style.left = node.rect.x + 'px';
|
7
9
|
elem.style.top = node.rect.y + 'px';
|
8
|
-
elem.style.width = node.rect.width + 'px';
|
9
|
-
elem.style.height = node.rect.height + 'px';
|
10
|
+
elem.style.width = node.rect.width / store.pageZoom + 'px';
|
11
|
+
elem.style.height = node.rect.height / store.pageZoom + 'px';
|
10
12
|
if (node.rotate || node.offsetRotate) {
|
11
13
|
elem.style.transform = "rotate(" + (node.rotate + node.offsetRotate) + "deg)";
|
12
14
|
}
|
@@ -70,6 +70,7 @@ export function setSelectInteractiveState(selected, node) {
|
|
70
70
|
}
|
71
71
|
// 重置下拉状态
|
72
72
|
export function resetSelectInteractiveState(node) {
|
73
|
+
if(!node || !node.TID) return;
|
73
74
|
const currentStore = commonStore[node.TID];
|
74
75
|
if(!Object.keys(currentStore.selectDataPool).length) return;
|
75
76
|
for (let data of Object.values(currentStore.selectDataPool)) {
|
@@ -196,7 +197,9 @@ export function getSelectedData(e, data, editData) {
|
|
196
197
|
if(!optionNode) return;
|
197
198
|
// 切换数据
|
198
199
|
currentStore.echartsRealDataPool[optionNode.data.id] = currentStore.echartsRealDataPool[node.id];
|
200
|
+
const isInitTable = initTabSwitchPage(data.formData.bindBlockTag, optionNode.data, currentStore);
|
199
201
|
setMapDataOptions(optionNode.option, optionNode.data);
|
202
|
+
if(isInitTable) Store.set(`${data.TID}-LT:render`, true);
|
200
203
|
}
|
201
204
|
if(staticType === selectStaticType.dataShow) {
|
202
205
|
// 数据展示
|
@@ -215,6 +218,32 @@ export function getSelectedData(e, data, editData) {
|
|
215
218
|
Store.set(`${data.TID}-LT:render`, true);
|
216
219
|
}
|
217
220
|
}
|
221
|
+
// 初始化Tab页签选中状态
|
222
|
+
function initTabSwitchPage(bindBlockTag, data, currentStore) {
|
223
|
+
if(!bindBlockTag) return false;
|
224
|
+
// 初始化分类选中状态
|
225
|
+
const tabData = currentStore.switchTabDataPool[`${bindBlockTag}Data`]; // 获取Tab组数据
|
226
|
+
if(!tabData) return false;
|
227
|
+
const tabKeys = Object.keys(tabData);
|
228
|
+
const pens = currentStore.data.pens;
|
229
|
+
if(!tabKeys.length || !pens[tabData[tabKeys[0]].order].activeImgeIndex) return false; //Tab默认选中第一个页签就退出程序,不执行初始化状态
|
230
|
+
let tabInit = false;
|
231
|
+
for (let tabNode of Object.values(tabData)) {
|
232
|
+
const penNode = pens[tabNode.order];
|
233
|
+
if(!tabInit) {
|
234
|
+
data.params.tabVisitOrder = 0;
|
235
|
+
data.tabData = {
|
236
|
+
type: '',
|
237
|
+
data: tabNode.tabData
|
238
|
+
};
|
239
|
+
}
|
240
|
+
if(penNode) {
|
241
|
+
penNode.activeImgeIndex = tabInit;
|
242
|
+
tabInit = true;
|
243
|
+
}
|
244
|
+
}
|
245
|
+
return true;
|
246
|
+
}
|
218
247
|
// 配置下拉展示的主题风格
|
219
248
|
export function setSelectElementTheme(node) {
|
220
249
|
const themeType = node.formData.theme ? ` theme${node.formData.theme}` : '';
|
package/core/src/element/tab.js
CHANGED
@@ -9,7 +9,11 @@ export function setElementSwitchTabState(node) {
|
|
9
9
|
if(!commonStore[node.TID].elementInteractivePoor.elementDataLength) return;
|
10
10
|
const ele = commonStore[node.TID].echartsDataPool[node.id] && commonStore[node.TID].echartsDataPool[node.id].div ||
|
11
11
|
commonStore[node.TID].selectDataPool[node.id] && commonStore[node.TID].selectDataPool[node.id].dom.selectEle;
|
12
|
-
if(ele)
|
12
|
+
if(ele) {
|
13
|
+
ele.style.display = !node.visible ? 'none': 'block';
|
14
|
+
}else {
|
15
|
+
commonStore[node.TID].data.dataResize = 1;
|
16
|
+
}
|
13
17
|
if(node.children && node.children.length) {
|
14
18
|
node.children.map((ch) => {
|
15
19
|
ch.visible = node.visible;
|
@@ -110,7 +110,7 @@ export function setConfItemNode(pen, syn_synata) {
|
|
110
110
|
const {echartDataValue} = syn_synata;
|
111
111
|
const seriesData = echartDataValue;
|
112
112
|
const realData = pen.data.params && seriesData && Object.keys(seriesData).length && seriesData[pen.data.params.id];
|
113
|
-
if (Array.isArray(realData)) {
|
113
|
+
if (Array.isArray(realData) && pen.data.params && pen.data.params.displayMode !== 7) {
|
114
114
|
getEchartsRealData(pen, realData);
|
115
115
|
} else {
|
116
116
|
commonStore[pen.TID].echartsRealDataPool[pen.id] = realData;
|
@@ -0,0 +1,61 @@
|
|
1
|
+
// import {} from './rectangle';
|
2
|
+
import {rectangle, createDiv, s8, Topology} from '../../../../core';
|
3
|
+
import {commonStore} from "../../store";
|
4
|
+
|
5
|
+
export async function formOverflow(ctx, node) {
|
6
|
+
// 绘制一个底图,类似于占位符。
|
7
|
+
rectangle(ctx, node)
|
8
|
+
console.log('绘制滚动组件--')
|
9
|
+
// 添加当前节点到div层
|
10
|
+
if (!node.elementId) {
|
11
|
+
node.elementId = s8()
|
12
|
+
}
|
13
|
+
let formoverData = commonStore[node.TID].formoverDataPool[node.id];
|
14
|
+
let id = node.formData.detailPageId
|
15
|
+
const color = node.formData.scrollbarColor? node.formData.scrollbarColor: 'auto'
|
16
|
+
const colorBg = node.formData.scrollbarColorBg? node.formData.scrollbarColorBg: 'auto'
|
17
|
+
const scrollbarColor = color + ' ' + colorBg
|
18
|
+
|
19
|
+
if (!node.elementLoaded && !formoverData) {
|
20
|
+
console.log('是否存在--formoverData--0-',formoverData)
|
21
|
+
if(!formoverData) {
|
22
|
+
formoverData = {
|
23
|
+
div: createDiv(node)
|
24
|
+
};
|
25
|
+
}else {
|
26
|
+
formoverData.div = createDiv(node);
|
27
|
+
}
|
28
|
+
formoverData.div.setAttribute('class', 'topoOverflow');
|
29
|
+
formoverData.div.style.setProperty('scrollbar-color', scrollbarColor);
|
30
|
+
formoverData.div.style.setProperty('scrollbar-width', 'thin');
|
31
|
+
|
32
|
+
node.elementLoaded = true
|
33
|
+
document.body.appendChild(formoverData.div)
|
34
|
+
// 添加当前节点到div层
|
35
|
+
node.addToDiv()
|
36
|
+
commonStore[node.TID].formoverDataPool[node.id] = formoverData;
|
37
|
+
|
38
|
+
|
39
|
+
console.log('请求子页面接口-----id =',id)
|
40
|
+
let canvas = new Topology(node.id, {
|
41
|
+
rotateCursor: '/img/rotate.cur',
|
42
|
+
})
|
43
|
+
canvas.formOverflowOpen(node.formData.detailPageData)
|
44
|
+
commonStore[node.TID].formoverCanvasDataPool[node.id] = canvas
|
45
|
+
}else if(formoverData && id){
|
46
|
+
console.log('是否存在--formoverData--1-',formoverData)
|
47
|
+
formoverData.div.style.setProperty('scrollbar-color', scrollbarColor);
|
48
|
+
formOverflowChange(node)
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
// 更新滚动组件中子页面
|
53
|
+
export function formOverflowChange(node) {
|
54
|
+
//绘制画布
|
55
|
+
console.log('更新滚动组件中子页面-',node)
|
56
|
+
let canvas = commonStore[node.TID].formoverCanvasDataPool[node.id]
|
57
|
+
let data = node.formData.detailPageData
|
58
|
+
console.log('改变滚动组件中子页面-',data)
|
59
|
+
canvas.formOverflowOpen(data)
|
60
|
+
}
|
61
|
+
|
@@ -25,19 +25,27 @@ export function formSelect(ctx, node) {
|
|
25
25
|
},
|
26
26
|
dom: {}
|
27
27
|
};
|
28
|
-
|
28
|
+
let bindBlockId = '';
|
29
|
+
if(node.formData.bindBlockId) {
|
30
|
+
// 去空格重新赋值
|
31
|
+
bindBlockId = node.formData.bindBlockId.trim();
|
32
|
+
node.formData.bindBlockId = bindBlockId;
|
33
|
+
}
|
34
|
+
if(node.formData.bindBlockTag) {
|
35
|
+
// 去空格重新赋值
|
36
|
+
node.formData.bindBlockTag = node.formData.bindBlockTag.trim();
|
37
|
+
}
|
29
38
|
let selectRealData = bindBlockId && currentStore.selectRealDataPool[bindBlockId];
|
30
39
|
if(bindBlockId && selectRealData) {
|
31
40
|
// select与echarts互相关联
|
32
41
|
currentStore.selectDataPool[node.id].data = selectRealData;
|
33
42
|
const echartsData = currentStore.echartsDataPool[bindBlockId];
|
34
|
-
|
35
|
-
|
36
|
-
}
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
}
|
43
|
+
echartsData ? echartsData.bindId = node.id : currentStore.echartsDataPool[bindBlockId] = {
|
44
|
+
bindId: node.id
|
45
|
+
};
|
46
|
+
// select与Tab关联
|
47
|
+
const bindBlockTagData = currentStore.switchTabDataPool[`${node.formData.bindBlockTag}Data`];
|
48
|
+
if(bindBlockTagData) currentStore.echartsDataPool[bindBlockId].tabCorrelationType = 'select';
|
41
49
|
}else {
|
42
50
|
if(node.formData.ids) {
|
43
51
|
const optionIds = node.formData.ids.split(',');
|
package/core/src/models/node.js
CHANGED
@@ -48,6 +48,13 @@ var Node = /** @class */ (function (_super) {
|
|
48
48
|
_this.iconSize = +json.iconSize;
|
49
49
|
_this.iconColor = json.iconColor;
|
50
50
|
_this.image = json.image;
|
51
|
+
_this.tabData = json.tabData || {
|
52
|
+
state: false,
|
53
|
+
name: '℃',
|
54
|
+
min: 0,
|
55
|
+
max: 60,
|
56
|
+
interval: 20
|
57
|
+
};
|
51
58
|
_this.floorImageIndex = json.floorImageIndex || false;
|
52
59
|
_this.formData = json.formData || null;
|
53
60
|
_this.formStyle = json.formStyle || null;
|
package/core/src/options.d.ts
CHANGED
@@ -45,7 +45,7 @@ export interface Options {
|
|
45
45
|
alwaysAnchor?: boolean;
|
46
46
|
disableEmptyLine?: boolean;
|
47
47
|
disableRepeatLine?: boolean;
|
48
|
-
disableScale?: boolean;
|
48
|
+
disableScale?: boolean; // 禁止缩放
|
49
49
|
disableMoveOutParent?: boolean;
|
50
50
|
disableDockLine?: boolean;
|
51
51
|
playIcon?: string;
|
package/core/src/preview.js
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
import {Store} from "le5le-store";
|
2
|
+
|
1
3
|
var __extends = (this && this.__extends) || (function () {
|
2
4
|
var extendStatics = function (d, b) {
|
3
5
|
extendStatics = Object.setPrototypeOf ||
|
@@ -184,6 +186,27 @@ var Preview = (function (_super) {
|
|
184
186
|
_this.moveIn.hoverNode.text = '全屏';
|
185
187
|
_this.fitViewPreview(_this.isFullScreen);
|
186
188
|
_this.isFullScreen = false;
|
189
|
+
}else {
|
190
|
+
// pageZoomOnly 表示topology页面只全局缩放,不对局部缩放进行调整,不执行render重绘。通常用于无任何操作事件的topology驾驶舱
|
191
|
+
if(_this.store.options.type === 'topology' || _this.store.options.type === 'pageZoomOnly') return;
|
192
|
+
const screenWidth = window.screen.width < 1920 ? 1920 : window.screen.width;
|
193
|
+
const zoom = window.innerWidth < screenWidth ? document.documentElement.clientWidth / screenWidth : 1;
|
194
|
+
_this.isResize = true;
|
195
|
+
clearTimeout(_this.pageResizeTim);
|
196
|
+
_this.pageResizeTim = setTimeout(() => {
|
197
|
+
if(_this.isResize){
|
198
|
+
const pageZoom = 1/zoom;
|
199
|
+
_this.store.data.pageZoom = zoom;
|
200
|
+
_this.store.parentElem.style.transform = `scale(${pageZoom})`;
|
201
|
+
_this.store.parentElem.style.transformOrigin = '0 0';
|
202
|
+
_this.store.parentElem.parentElement.style.overflow = 'hidden';
|
203
|
+
_this.store.data.dataResize = 1;
|
204
|
+
_this.isResize = false;
|
205
|
+
Store.set('PAGE:zoom', zoom);
|
206
|
+
_this.fitView();
|
207
|
+
_this.render();
|
208
|
+
}
|
209
|
+
}, 1000);
|
187
210
|
}
|
188
211
|
};
|
189
212
|
return _this;
|
@@ -227,6 +250,8 @@ var Preview = (function (_super) {
|
|
227
250
|
for (var _i = 0, _a = this.store.data.pens; _i < _a.length; _i++) {
|
228
251
|
var item = _a[_i];
|
229
252
|
item.scale(scale, center, w, h);
|
253
|
+
// 驾驶舱底部区域元件,用于控制底部区域Dom宽高等元素自由变换,后期会删除
|
254
|
+
if(item.tags && item.tags[0] && item.tags[0].includes('contromRoomBottom')) this.store.pens['contromRoomBottom'] = item;
|
230
255
|
}
|
231
256
|
};
|
232
257
|
Preview.prototype.scaleTo = function (scale) {
|
@@ -245,6 +270,8 @@ var Preview = (function (_super) {
|
|
245
270
|
width = this.store.options.width;
|
246
271
|
height = this.store.options.height;
|
247
272
|
}
|
273
|
+
width *= this.store.data.pageZoom;
|
274
|
+
height *= this.store.data.pageZoom;
|
248
275
|
this.canvasResize({
|
249
276
|
width: width,
|
250
277
|
height: height,
|
@@ -261,7 +288,7 @@ var Preview = (function (_super) {
|
|
261
288
|
rect.height = bkImageRect && bkImageRect.height ? bkImageRect.height : height;
|
262
289
|
}
|
263
290
|
// 6. 计算缩放比
|
264
|
-
var w = (width - padding[1] - padding[3]) / rect.width;
|
291
|
+
var w = (width - padding[1] - padding[3]) / rect.width ;
|
265
292
|
var h = (height - padding[0] - padding[2]) / rect.height;
|
266
293
|
var ratio = w;
|
267
294
|
if (w > h) {
|
package/core/src/store/data.d.ts
CHANGED
@@ -11,6 +11,7 @@ export interface visualization2DData {
|
|
11
11
|
fromArrowType: string;
|
12
12
|
toArrowType: string;
|
13
13
|
scale: number;
|
14
|
+
pageZoom: number,
|
14
15
|
locked: Lock;
|
15
16
|
bkImage: string;
|
16
17
|
bkColor: string;
|
@@ -63,6 +64,8 @@ export interface visualization2DStore {
|
|
63
64
|
selectRealDataPool: {}; // form select
|
64
65
|
selectTabDataPool: {}; // form select
|
65
66
|
iframeDataPool: {}; // iframe
|
67
|
+
formoverDataPool: {}; // 滚动组件 Dom节点数据
|
68
|
+
formoverCanvasDataPool: {}; // 滚动组件 画布节点数据
|
66
69
|
emitter: Emitter;
|
67
70
|
dpiRatio?: number;
|
68
71
|
lastScale?: number; //记录上次模版的scale
|
@@ -79,6 +82,7 @@ export const createStore = () => {
|
|
79
82
|
fromArrowType: '',
|
80
83
|
toArrowType: 'triangleSolid',
|
81
84
|
scale: 1,
|
85
|
+
pageZoom: 1,
|
82
86
|
locked: Lock.None,
|
83
87
|
bkImageRect: null,
|
84
88
|
mqttOptions: {
|
@@ -113,6 +117,8 @@ export const createStore = () => {
|
|
113
117
|
selectRealDataPool: {}, // form select
|
114
118
|
selectTabDataPool: {}, // form select
|
115
119
|
iframeDataPool: {}, // iframe
|
120
|
+
formoverDataPool: {}, // 滚动组件 Dom节点数据
|
121
|
+
formoverCanvasDataPool: {}, // 滚动组件 画布节点数据
|
116
122
|
emitter: mitt(),
|
117
123
|
cacheDatas: [],
|
118
124
|
dpiRatio: 1,
|
@@ -147,6 +153,7 @@ export const clearStore = (store: visualization2DStore, del: string) => {
|
|
147
153
|
fromArrowType: '',
|
148
154
|
toArrowType: 'triangleSolid',
|
149
155
|
scale: 1,
|
156
|
+
pageZoom: 1,
|
150
157
|
locked: Lock.None,
|
151
158
|
bkImageRect: null,
|
152
159
|
mqttOptions: {
|
package/core/src/store/data.js
CHANGED
@@ -27,6 +27,7 @@ export var createStore = function () {
|
|
27
27
|
locked: Lock.None,
|
28
28
|
dataResize: 1, // 数据是否加载,1是,0否
|
29
29
|
bkImageRect: null,
|
30
|
+
pageZoom: 1,
|
30
31
|
mqttOptions: {
|
31
32
|
clientId: s8()
|
32
33
|
},
|
@@ -59,6 +60,8 @@ export var createStore = function () {
|
|
59
60
|
selectRealDataPool: {}, // form select
|
60
61
|
selectTabDataPool: {}, // form select
|
61
62
|
iframeDataPool: {}, // iframe
|
63
|
+
formoverDataPool: {}, // 滚动组件 Dom节点数据
|
64
|
+
formoverCanvasDataPool: {}, // 滚动组件 画布节点数据
|
62
65
|
emitter: mitt(),
|
63
66
|
cacheDatas: [],
|
64
67
|
dpiRatio: 1,
|
@@ -76,7 +79,7 @@ export var useStore = function (id) {
|
|
76
79
|
return commonStore[id];
|
77
80
|
};
|
78
81
|
export function clearElementDataPool(data) {
|
79
|
-
const { echartsDataPool, selectDataPool, iframeDataPool} = data;
|
82
|
+
const { echartsDataPool, selectDataPool, iframeDataPool, formoverDataPool, formoverCanvasDataPool} = data;
|
80
83
|
for (let [key, node] of Object.entries(echartsDataPool)) {
|
81
84
|
if(node) {
|
82
85
|
clearInterval(node.timeTicket);
|
@@ -107,6 +110,16 @@ export function clearElementDataPool(data) {
|
|
107
110
|
node.iframe.parentNode.removeChild(node.iframe);
|
108
111
|
delete data.iframeDataPool[key];
|
109
112
|
}
|
113
|
+
for (let key of Object.keys(formoverDataPool)) {
|
114
|
+
delete formoverDataPool[key];
|
115
|
+
}
|
116
|
+
for (let key of Object.keys(formoverCanvasDataPool)) {
|
117
|
+
const elementNode = document.getElementById(key);
|
118
|
+
if(elementNode) {
|
119
|
+
elementNode.parentNode.removeChild(elementNode);
|
120
|
+
}
|
121
|
+
delete formoverCanvasDataPool[key];
|
122
|
+
}
|
110
123
|
}
|
111
124
|
export var clearStore = function (store, del) {
|
112
125
|
store.lastScale = store.data.scale;
|
@@ -116,6 +129,7 @@ export var clearStore = function (store, del) {
|
|
116
129
|
fromArrowType: '',
|
117
130
|
toArrowType: 'triangleSolid',
|
118
131
|
scale: 1,
|
132
|
+
pageZoom: 1,
|
119
133
|
locked: Lock.None,
|
120
134
|
dataResize: 1, // 数据是否加载,1是,0否
|
121
135
|
bkImageRect: null,
|
@@ -154,6 +168,8 @@ export var clearStore = function (store, del) {
|
|
154
168
|
echartsDataPool: store.echartsDataPool,
|
155
169
|
selectDataPool: store.selectDataPool,
|
156
170
|
iframeDataPool: store.iframeDataPool,
|
171
|
+
formoverDataPool: store.formoverDataPool,
|
172
|
+
formoverCanvasDataPool: store.formoverCanvasDataPool,
|
157
173
|
});
|
158
174
|
if(del) {
|
159
175
|
delete commonStore[store.id];
|
@@ -105,7 +105,7 @@ export function setDefaultNodeValidat(node, retData) {
|
|
105
105
|
* 全局报警标记,代表正在访问的这个topology文件中是否有告警发生
|
106
106
|
* 需要注意:自定义函数中要通过 return {monitorAlarm: boolean}的格式将元件告警状态返回
|
107
107
|
*/
|
108
|
-
if(funcData && funcData.monitorAlarm) commonStore[node.TID].monitorAlarm = true;
|
108
|
+
if(funcData && funcData.monitorAlarm && commonStore[node.TID]) commonStore[node.TID].monitorAlarm = true;
|
109
109
|
}catch (e) {
|
110
110
|
console.log(`自定义函数出错>>>`,);
|
111
111
|
console.log(`目标元件:${node.id}>>>`,);
|
@@ -114,7 +114,7 @@ export function setDefaultNodeValidat(node, retData) {
|
|
114
114
|
} else {
|
115
115
|
// console.log('默认函数')
|
116
116
|
const newData = setConfItemNode(node, retData);
|
117
|
-
if(newData && newData.monitorAlarm) commonStore[node.TID].monitorAlarm = true;
|
117
|
+
if(newData && newData.monitorAlarm && commonStore[node.TID]) commonStore[node.TID].monitorAlarm = true;
|
118
118
|
}
|
119
119
|
if (node.animateFrames && node.animateFrames.length) {
|
120
120
|
for (var _a = 0, _af = node.animateFrames; _a < _af.length; _a++) {
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import {Node} from "../models";
|
2
|
-
|
2
|
+
export declare function tabStaticOperation(type: string, node: Node, areaData: any, params: object): void;
|
3
|
+
export declare function tabHideShowOperation(node: any, areaData: any): void;
|
3
4
|
export declare function getEchartsRealData(node: {}, data: []): void;
|
4
5
|
export declare function setInitConfData(id: string, data: object): void;
|
5
6
|
export declare function setTagIdData(data: any): [];
|
@@ -1,4 +1,56 @@
|
|
1
1
|
import {commonStore} from '../store';
|
2
|
+
import {setElementSwitchTabState} from '../element';
|
3
|
+
import {echartsStaticType} from '../utils';
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Tab 数据统计
|
7
|
+
* @param type 统计类型
|
8
|
+
* @param node 元件数据
|
9
|
+
* @param areaData tab展示区域数据
|
10
|
+
* @param params Tab 切换选中参数
|
11
|
+
*/
|
12
|
+
export function tabStaticOperation(type, node, areaData, params) {
|
13
|
+
if(!node.bindStaticId || !(echartsStaticType.includes(type) || type === 'OTHER')) return;
|
14
|
+
const curentEchart = areaData && areaData[node.bindStaticId]; // 获取当前点中的节点绑定的统计图表数据
|
15
|
+
if(!curentEchart || !curentEchart.data.params) return console.log('未能找到匹配的echarts图表>>>');
|
16
|
+
const currentStore = commonStore[node.TID];
|
17
|
+
const echartNode = currentStore.data.pens[curentEchart.order]; // 获取tab 绑定的图表元件数据
|
18
|
+
if(type === 'OTHER') {
|
19
|
+
const tabCorrelationType = currentStore.echartsDataPool[node.bindStaticId].tabCorrelationType; // 获取select与tab关联的标识
|
20
|
+
const optionNode = currentStore.echartsOptionsPool[node.bindStaticId];
|
21
|
+
if(tabCorrelationType === 'select') {
|
22
|
+
// tab类型为包含在select下的切换则执行下面的逻辑
|
23
|
+
echartNode.data.params['tabVisitOrder'] = params.order;
|
24
|
+
}else {
|
25
|
+
// 非 年、月、日、周、实时类型的切换
|
26
|
+
const groupData = currentStore.selectRealDataPool[node.bindStaticId];
|
27
|
+
if (optionNode) currentStore.echartsRealDataPool[optionNode.data.id] = currentStore.echartsRealDataPool[groupData[params.order].id];
|
28
|
+
}
|
29
|
+
if(optionNode) optionNode.data.tabData = {
|
30
|
+
type,
|
31
|
+
data: params.data
|
32
|
+
};
|
33
|
+
}
|
34
|
+
echartNode.data.params['staticForType'] = type
|
35
|
+
echartNode.elementRendered = false;
|
36
|
+
}
|
37
|
+
/**
|
38
|
+
* Tab 显示/隐藏切换
|
39
|
+
* @param node tab页签数据
|
40
|
+
* @param areaData // tab展示区域数据
|
41
|
+
*/
|
42
|
+
export function tabHideShowOperation(node, areaData) {
|
43
|
+
const confIds = node.bindStaticId && node.bindStaticId.split(',') || [];
|
44
|
+
const pens = commonStore[node.TID].data.pens;
|
45
|
+
for (let i = 0; i < confIds.length; i++) {
|
46
|
+
const confid = confIds[i];
|
47
|
+
const areaNode = areaData[confid];
|
48
|
+
if(!(areaNode && pens[areaNode.order])) return;
|
49
|
+
const tagNode = pens[areaNode.order];
|
50
|
+
tagNode.visible = !(node.id !== node.id);
|
51
|
+
setElementSwitchTabState(tagNode);
|
52
|
+
}
|
53
|
+
}
|
2
54
|
/**
|
3
55
|
* 获取echarts和select实时数据
|
4
56
|
* @param node 节点
|