dcim-topology2d 2.0.2 → 2.0.6
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/index.d.ts +1 -1
- package/chart-diagram/index.js +1 -1
- package/chart-diagram/src/echarts/index.js +17 -11
- package/chart-diagram/src/register.js +2 -2
- package/chart-diagram/src/utils/changeOptions.d.ts +3 -0
- package/chart-diagram/src/utils/changeOptions.js +61 -1
- package/chart-diagram/src/utils/conversion.d.ts +1 -0
- package/chart-diagram/src/utils/conversion.js +63 -41
- package/chart-diagram/src/utils/render.d.ts +1 -0
- package/chart-diagram/src/utils/render.js +24 -0
- package/core/src/common.js +121 -25
- package/core/src/core.js +83 -17
- package/core/src/divLayer.js +2 -2
- package/core/src/element/select.d.ts +2 -2
- package/core/src/element/select.js +119 -56
- package/core/src/element/tab.js +12 -11
- package/core/src/healps/changeData.js +20 -6
- package/core/src/middles/nodes/formoverflow.js +61 -0
- package/core/src/middles/nodes/formselect.js +40 -18
- package/core/src/middles/nodes/iframe.js +5 -5
- 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/models/pen.js +2 -50
- package/core/src/options.d.ts +2 -1
- package/core/src/options.js +2 -1
- package/core/src/preview.js +6 -1
- package/core/src/store/data.d.ts +74 -19
- package/core/src/store/data.js +102 -34
- package/core/src/utils/assignment.d.ts +1 -1
- package/core/src/utils/assignment.js +53 -23
- package/core/src/utils/construction.d.ts +4 -1
- package/core/src/utils/construction.js +3 -1
- package/core/src/utils/conversion.d.ts +3 -2
- package/core/src/utils/conversion.js +65 -19
- package/core/src/utils/onmousevent.d.ts +1 -1
- package/core/src/utils/onmousevent.js +4 -5
- package/core/src/utils/params.d.ts +2 -7
- package/core/src/utils/params.js +22 -87
- package/myShape-diagram/{myShape.js → index.js} +3 -0
- package/package.json +1 -1
- package/store/actions.js +1 -17
- package/store/clear.js +0 -62
- package/core/src/poll.js +0 -37
- /package/myShape-diagram/{myShape.ts → index.ts} +0 -0
@@ -5,43 +5,65 @@ import {
|
|
5
5
|
import {
|
6
6
|
setEventListener,
|
7
7
|
s8} from '../../utils';
|
8
|
-
import {echartsDataPool, selectDataPool, selectRealDataPool} from '../../../../store';
|
9
8
|
import {selectDefaultData} from '../../../../static';
|
9
|
+
import {commonStore} from "../../store";
|
10
10
|
|
11
11
|
export function formSelect(ctx, node) {
|
12
12
|
// 绘制一个底图,类似于占位符。
|
13
13
|
rectangle(ctx, node);
|
14
|
-
if (!selectDataPool[node.id]) {
|
14
|
+
if (!commonStore[node.TID].selectDataPool[node.id]) {
|
15
|
+
const currentStore = commonStore[node.TID];
|
15
16
|
node.elementId = s8();
|
16
17
|
node.dash = 4;
|
17
|
-
selectDataPool[node.id] = {
|
18
|
+
currentStore.selectDataPool[node.id] = {
|
18
19
|
slideState: node.selectDropdown,
|
19
20
|
node: {
|
20
21
|
id: node.id,
|
21
22
|
color: node.font.color,
|
22
23
|
fontSize: node.font.fontSize,
|
23
|
-
selected: null
|
24
|
+
selected: node.formData.selected || null
|
24
25
|
},
|
25
26
|
dom: {}
|
26
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
|
+
}
|
38
|
+
let selectRealData = bindBlockId && currentStore.selectRealDataPool[bindBlockId];
|
29
39
|
if(bindBlockId && selectRealData) {
|
30
40
|
// select与echarts互相关联
|
31
|
-
selectDataPool[node.id].data = selectRealData;
|
32
|
-
const echartsData = echartsDataPool[bindBlockId];
|
33
|
-
|
34
|
-
|
35
|
-
}
|
36
|
-
|
37
|
-
|
41
|
+
currentStore.selectDataPool[node.id].data = selectRealData;
|
42
|
+
const echartsData = currentStore.echartsDataPool[bindBlockId];
|
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';
|
49
|
+
}else {
|
50
|
+
if(node.formData.ids) {
|
51
|
+
const optionIds = node.formData.ids.split(',');
|
52
|
+
const optionNames = node.formData.names.split(',');
|
53
|
+
const optionsData = [];
|
54
|
+
for (let i = 0; i < optionIds.length; i++) {
|
55
|
+
optionsData.push({
|
56
|
+
id: optionIds[i],
|
57
|
+
name: optionNames[i]
|
58
|
+
});
|
38
59
|
}
|
60
|
+
currentStore.selectDataPool[node.id].data = optionsData;
|
61
|
+
}else {
|
62
|
+
currentStore.selectDataPool[node.id].data = JSON.parse(JSON.stringify(selectDefaultData));
|
39
63
|
}
|
40
|
-
}else {
|
41
|
-
selectDataPool[node.id].data = JSON.parse(JSON.stringify(selectDefaultData));
|
42
64
|
}
|
43
65
|
const select = createSelectElement(node);
|
44
|
-
selectDataPool[node.id].dom.selectEle = select;
|
66
|
+
currentStore.selectDataPool[node.id].dom.selectEle = select;
|
45
67
|
document.body.appendChild(select);
|
46
68
|
let selectDropdownEle = document.querySelector('.topology-select-dropdown');
|
47
69
|
if(!selectDropdownEle) {
|
@@ -50,13 +72,13 @@ export function formSelect(ctx, node) {
|
|
50
72
|
parentEle.appendChild(selectDropdownEle);
|
51
73
|
// 鼠标按下
|
52
74
|
selectDropdownEle.addEventListener('mousedown', (e) => {
|
53
|
-
setEventListener(e);
|
75
|
+
setEventListener(e, node.TID);
|
54
76
|
});
|
55
77
|
}
|
56
78
|
// 添加当前节点到div层
|
57
79
|
node.addToDiv();
|
58
80
|
}else {
|
59
|
-
const selectNode = selectDataPool[node.id];
|
81
|
+
const selectNode = commonStore[node.TID].selectDataPool[node.id];
|
60
82
|
if(selectNode.node.color === node.font.color && selectNode.node.fontSize === node.font.fontSize) return;
|
61
83
|
const selectDom = selectNode.dom;
|
62
84
|
if(!selectDom.selectInput) selectDom.selectInput = selectDom.selectEle.querySelector('.topology-select-input');
|
@@ -1,28 +1,28 @@
|
|
1
1
|
import {rectangle} from './rectangle';
|
2
|
-
import {iframeDataPool} from '../../../../store';
|
3
2
|
import {s8} from "../../utils";
|
4
3
|
import {createIframeElement} from "../../element";
|
4
|
+
import {commonStore} from "../../store";
|
5
5
|
|
6
6
|
export function iframePrimeval(ctx, node) {
|
7
7
|
//console.log('iframePrimeval############', node)
|
8
8
|
// 绘制一个底图,类似于占位符。
|
9
9
|
rectangle(ctx, node);
|
10
|
-
if (!iframeDataPool[node.id]) {
|
10
|
+
if (!commonStore[node.TID].iframeDataPool[node.id]) {
|
11
11
|
node.elementId = s8();
|
12
|
-
iframeDataPool[node.id] = {
|
12
|
+
commonStore[node.TID].iframeDataPool[node.id] = {
|
13
13
|
node: {
|
14
14
|
id: node.id,
|
15
15
|
src: node.iframe
|
16
16
|
}
|
17
17
|
};
|
18
18
|
const iframe = createIframeElement(node);
|
19
|
-
iframeDataPool[node.id].iframe = iframe;
|
19
|
+
commonStore[node.TID].iframeDataPool[node.id].iframe = iframe;
|
20
20
|
const parentEle = window.location.pathname.includes('workspace') ? document.getElementById('topology-canvas') : document.body;
|
21
21
|
parentEle.appendChild(iframe);
|
22
22
|
// 添加当前节点到div层
|
23
23
|
node.addToDiv();
|
24
24
|
}else {
|
25
|
-
const iframeNode = iframeDataPool[node.id];
|
25
|
+
const iframeNode = commonStore[node.TID].iframeDataPool[node.id];
|
26
26
|
if(iframeNode.node.src === node.iframe) return;
|
27
27
|
iframeNode.iframe.src = node.iframe;
|
28
28
|
}
|
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/models/pen.js
CHANGED
@@ -3,7 +3,6 @@ import { s8 } from '../utils/uuid';
|
|
3
3
|
import { Rect } from './rect';
|
4
4
|
import { pointInRect } from '../utils/canvas';
|
5
5
|
import { EventType, EventAction } from './event';
|
6
|
-
import { setConfItemNode } from '../healps/changeData';
|
7
6
|
export var PenType;
|
8
7
|
(function (PenType) {
|
9
8
|
PenType[PenType["Node"] = 0] = "Node";
|
@@ -108,6 +107,7 @@ var Pen = /** @class */ (function () {
|
|
108
107
|
this.tipId = json.tipId;
|
109
108
|
this.title = json.title;
|
110
109
|
this.visible = json.visible !== false;
|
110
|
+
this.visibleSwitch = !!json.visibleSwitch; // 元件显示隐藏的开关量
|
111
111
|
this.defaultFillStyle = json.defaultFillStyle || '';
|
112
112
|
this.defaultFontColor = json.defaultFontColor || '';
|
113
113
|
this.defaultStrokeStyle = json.defaultStrokeStyle || '';
|
@@ -131,7 +131,7 @@ var Pen = /** @class */ (function () {
|
|
131
131
|
}
|
132
132
|
}
|
133
133
|
Pen.prototype.render = function (ctx) {
|
134
|
-
if (!this.visible && !
|
134
|
+
if (!this.visible && !this.visibleSwitch){
|
135
135
|
return;
|
136
136
|
}
|
137
137
|
if (this.from && !this.to) {
|
@@ -248,54 +248,6 @@ var Pen = /** @class */ (function () {
|
|
248
248
|
this[this.eventFns[item.action]] && this[this.eventFns[item.action]](item.value, item.params);
|
249
249
|
}
|
250
250
|
};
|
251
|
-
Pen.prototype.doSocketMqtt = function (item, msg, client) {
|
252
|
-
if (item.action < EventAction.Function) {
|
253
|
-
this[this.eventFns[item.action]](msg.value || msg || item.value, msg.params || item.params, client);
|
254
|
-
}
|
255
|
-
else if (item.action < EventAction.SetProps) {
|
256
|
-
if (item.action === EventAction.Function && item.value) return this[this.eventFns[item.action]](item.value, msg || item.params, client);
|
257
|
-
let jsonNode = msg;
|
258
|
-
if (typeof msg === 'string') {
|
259
|
-
try {
|
260
|
-
jsonNode = JSON.parse(msg);
|
261
|
-
}catch (error) { }
|
262
|
-
}
|
263
|
-
console.log('doSocketMqtt-------------', jsonNode)
|
264
|
-
//const { areaData, assetData, data } = jsonNode
|
265
|
-
if (!this.data && this.data.length <= 0 && typeof this.data !== 'object') return
|
266
|
-
// const subscribeObj = {
|
267
|
-
// areaData, assetData, data,
|
268
|
-
// asset: ''
|
269
|
-
// }
|
270
|
-
jsonNode.asset = ''
|
271
|
-
Object.assign(this, setConfItemNode(this, jsonNode))
|
272
|
-
}
|
273
|
-
else if (item.action === EventAction.SetProps) {
|
274
|
-
var props = [];
|
275
|
-
var data = msg;
|
276
|
-
if (typeof msg === 'string') {
|
277
|
-
try {
|
278
|
-
data = JSON.parse(msg);
|
279
|
-
}
|
280
|
-
catch (error) { }
|
281
|
-
}
|
282
|
-
if (Array.isArray(data)) {
|
283
|
-
props = data;
|
284
|
-
}
|
285
|
-
for (var _i = 0, props_1 = props; _i < props_1.length; _i++) {
|
286
|
-
var prop = props_1[_i];
|
287
|
-
if (prop.key) {
|
288
|
-
if (typeof prop.value === 'object') {
|
289
|
-
this[prop.key] = Object.assign(this[prop.key], prop.value);
|
290
|
-
}
|
291
|
-
else {
|
292
|
-
this[prop.key] = prop.value;
|
293
|
-
}
|
294
|
-
}
|
295
|
-
}
|
296
|
-
Store.set(this.generateStoreKey('LT:render'), true);
|
297
|
-
}
|
298
|
-
};
|
299
251
|
Pen.prototype.show = function () {
|
300
252
|
this.visible = true;
|
301
253
|
return this;
|
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;
|
@@ -60,6 +60,7 @@ export interface Options {
|
|
60
60
|
keydown?: KeydownType;
|
61
61
|
viewPadding?: Padding;
|
62
62
|
on?: (event: string, data: any) => void;
|
63
|
+
storeSubscribe?: boolean
|
63
64
|
}
|
64
65
|
export declare const DefalutOptions: Options;
|
65
66
|
|
package/core/src/options.js
CHANGED
package/core/src/preview.js
CHANGED
@@ -239,7 +239,12 @@ var Preview = (function (_super) {
|
|
239
239
|
return;
|
240
240
|
// 1. 重置画布尺寸为容器尺寸
|
241
241
|
var parentElem = this.store.parentElem;
|
242
|
-
var width = parentElem.offsetWidth,
|
242
|
+
var width = parentElem.offsetWidth,
|
243
|
+
height = parentElem.offsetHeight;
|
244
|
+
if(this.store.options.storeSubscribe) {
|
245
|
+
width = this.store.options.width;
|
246
|
+
height = this.store.options.height;
|
247
|
+
}
|
243
248
|
this.canvasResize({
|
244
249
|
width: width,
|
245
250
|
height: height,
|
package/core/src/store/data.d.ts
CHANGED
@@ -28,38 +28,49 @@ export interface visualization2DData {
|
|
28
28
|
data?: any;
|
29
29
|
bkImageRect?: any;
|
30
30
|
}
|
31
|
+
export interface paramsData {
|
32
|
+
doorIds?: [],
|
33
|
+
tagIds?: [],
|
34
|
+
kpiAddrs?: [],
|
35
|
+
tagEcharts?: [],
|
36
|
+
assetIds?: [],
|
37
|
+
areaIds?: [],
|
38
|
+
varVaule?: [],
|
39
|
+
echartData?: [],
|
40
|
+
echartAssemblyData?: [],
|
41
|
+
routingkey?: string,
|
42
|
+
pathRewrite?: string
|
43
|
+
}
|
31
44
|
// 2D可视化使用到的数据仓库
|
32
45
|
export interface visualization2DStore {
|
33
46
|
id: string;
|
34
47
|
data: visualization2DData;
|
48
|
+
mqttData?: null; // mqtt实时数据
|
49
|
+
initConfNode: {}; // 初始化元件节点数据
|
50
|
+
mqttParams: paramsData; // mqtt参数
|
35
51
|
pens: { [key: string]: Pen };
|
36
52
|
options: Options;
|
37
53
|
cacheDatas?: {
|
38
54
|
data: visualization2DData;
|
39
55
|
}[];
|
56
|
+
elementInteractivePoor: {}; // element 交互过渡数据
|
57
|
+
echartsDataPool: {}; // echarts Dom节点数据
|
58
|
+
echartsOptionsPool: {}; // echarts options节点数据
|
59
|
+
echartsRealDataPool: {}; // echarts 实时数据
|
60
|
+
switchTabDataPool: {}; // tabs
|
61
|
+
tableDataPool: {}; // form table
|
62
|
+
selectDataPool: {}; // form select
|
63
|
+
selectRealDataPool: {}; // form select
|
64
|
+
selectTabDataPool: {}; // form select
|
65
|
+
iframeDataPool: {}; // iframe
|
66
|
+
formoverDataPool: {}; // 滚动组件 Dom节点数据
|
67
|
+
formoverCanvasDataPool: {}; // 滚动组件 画布节点数据
|
40
68
|
emitter: Emitter;
|
41
69
|
dpiRatio?: number;
|
42
70
|
lastScale?: number; //记录上次模版的scale
|
71
|
+
monitorAlarm?:boolean; // 全局报警标记,代表正在访问的这个topology文件中是否有告警发生
|
43
72
|
parentElem: HTMLElement
|
44
73
|
}
|
45
|
-
export interface mqttData {
|
46
|
-
data: null,
|
47
|
-
initData: {},
|
48
|
-
params: {
|
49
|
-
tagIds?: [],
|
50
|
-
kpiAddrs?: [],
|
51
|
-
tagEcharts?: [],
|
52
|
-
assetIds?: [],
|
53
|
-
areaIds?: [],
|
54
|
-
varVaule?: [],
|
55
|
-
echartData?: [],
|
56
|
-
echartAssemblyData?: [],
|
57
|
-
routingkey?: string,
|
58
|
-
pathRewrite?: string
|
59
|
-
}
|
60
|
-
}
|
61
|
-
export const syncMqttData: mqttData;
|
62
|
-
export declare function clearMqttParams(): void;
|
63
74
|
// @ts-ignore
|
64
75
|
export const createStore = () => {
|
65
76
|
return {
|
@@ -77,12 +88,40 @@ export const createStore = () => {
|
|
77
88
|
},
|
78
89
|
dataConstruct: {}
|
79
90
|
},
|
91
|
+
mqttData: null,
|
92
|
+
initConfNode: {},
|
93
|
+
mqttParams: {
|
94
|
+
doorIds: [],
|
95
|
+
tagIds: [],
|
96
|
+
kpiAddrs: [],
|
97
|
+
tagEcharts: [],
|
98
|
+
assetIds: [],
|
99
|
+
areaIds: [],
|
100
|
+
varVaule: [],
|
101
|
+
echartData: [],
|
102
|
+
echartAssemblyData: [],
|
103
|
+
routingkey: '',
|
104
|
+
pathRewrite: ''
|
105
|
+
},
|
80
106
|
pens: {},
|
81
107
|
options: { ...DefalutOptions },
|
108
|
+
elementInteractivePoor: {}, // element 交互过渡数据
|
109
|
+
echartsDataPool: {}, // echarts Dom节点数据
|
110
|
+
echartsOptionsPool: {}, // echarts options节点数据
|
111
|
+
echartsRealDataPool: {}, // echarts 实时数据
|
112
|
+
switchTabDataPool: {}, // tabs
|
113
|
+
tableDataPool: {}, // form table
|
114
|
+
selectDataPool: {}, // form select
|
115
|
+
selectRealDataPool: {}, // form select
|
116
|
+
selectTabDataPool: {}, // form select
|
117
|
+
iframeDataPool: {}, // iframe
|
118
|
+
formoverDataPool: {}, // 滚动组件 Dom节点数据
|
119
|
+
formoverCanvasDataPool: {}, // 滚动组件 画布节点数据
|
82
120
|
emitter: mitt(),
|
83
121
|
cacheDatas: [],
|
84
122
|
dpiRatio: 1,
|
85
123
|
lastScale: 1,
|
124
|
+
monitorAlarm: false,
|
86
125
|
parentElem: null
|
87
126
|
} as visualization2DStore;
|
88
127
|
};
|
@@ -95,7 +134,7 @@ export const useStore = (id = 'default'): visualization2DStore => {
|
|
95
134
|
}
|
96
135
|
return commonStore[id];
|
97
136
|
};
|
98
|
-
|
137
|
+
export declare function clearElementDataPool(data: {}): void;
|
99
138
|
// @ts-ignore
|
100
139
|
export const clearStore = (store: visualization2DStore, del: string) => {
|
101
140
|
store.data = {
|
@@ -119,10 +158,26 @@ export const clearStore = (store: visualization2DStore, del: string) => {
|
|
119
158
|
},
|
120
159
|
dataConstruct: {}
|
121
160
|
};
|
161
|
+
store.mqttData = null;
|
162
|
+
store.initConfNode = {};
|
163
|
+
store.mqttParams = {
|
164
|
+
doorIds: [],
|
165
|
+
tagIds: [],
|
166
|
+
kpiAddrs: [],
|
167
|
+
tagEcharts: [],
|
168
|
+
assetIds: [],
|
169
|
+
areaIds: [],
|
170
|
+
varVaule: [],
|
171
|
+
echartData: [],
|
172
|
+
echartAssemblyData: [],
|
173
|
+
routingkey: '',
|
174
|
+
pathRewrite: ''
|
175
|
+
};
|
122
176
|
store.lastScale = store.data.scale;
|
123
177
|
store.pens = {};
|
124
178
|
store.options = {};
|
125
179
|
store.cacheDatas = [];
|
126
180
|
store.dpiRatio = 1;
|
127
181
|
store.lastScale = 1;
|
182
|
+
store.monitorAlarm = false;
|
128
183
|
};
|
package/core/src/store/data.js
CHANGED
@@ -13,36 +13,8 @@ import { default as mitt } from 'mitt';
|
|
13
13
|
import { Lock } from '../models';
|
14
14
|
import {DefalutOptions} from '../options';
|
15
15
|
import {s8} from '../utils';
|
16
|
-
import {
|
17
|
-
import {
|
18
|
-
export const syncMqttData = {
|
19
|
-
data: null, // 实时值
|
20
|
-
initData: {}, // 初始值
|
21
|
-
params: {
|
22
|
-
tagIds: [],
|
23
|
-
kpiAddrs: [],
|
24
|
-
tagEcharts: [],
|
25
|
-
assetIds: [],
|
26
|
-
areaIds: [],
|
27
|
-
varVaule: [],
|
28
|
-
echartData: [],
|
29
|
-
echartAssemblyData: [],
|
30
|
-
routingkey: '',
|
31
|
-
pathRewrite: ''
|
32
|
-
}
|
33
|
-
}
|
34
|
-
export const clearMqttParams = function () {
|
35
|
-
syncMqttData.params.tagIds = [];
|
36
|
-
syncMqttData.params.kpiAddrs = [];
|
37
|
-
syncMqttData.params.tagEcharts = [];
|
38
|
-
syncMqttData.params.assetIds = [];
|
39
|
-
syncMqttData.params.areaIds = [];
|
40
|
-
syncMqttData.params.varVaule = [];
|
41
|
-
syncMqttData.params.echartData = [];//统计图表组件类型ID
|
42
|
-
syncMqttData.params.echartAssemblyData = [];//统计图表组件类型ID
|
43
|
-
syncMqttData.params.routingkey = '';
|
44
|
-
syncMqttData.params.pathRewrite = '';
|
45
|
-
}
|
16
|
+
import {commonStore} from './common'
|
17
|
+
import {removeAllElement} from '../../../store';
|
46
18
|
export var createStore = function () {
|
47
19
|
return {
|
48
20
|
id: '',
|
@@ -60,12 +32,40 @@ export var createStore = function () {
|
|
60
32
|
},
|
61
33
|
dataConstruct: {}
|
62
34
|
},
|
35
|
+
mqttData: null,
|
36
|
+
initConfNode: {},
|
37
|
+
mqttParams: {
|
38
|
+
doorIds: [],
|
39
|
+
tagIds: [],
|
40
|
+
kpiAddrs: [],
|
41
|
+
tagEcharts: [],
|
42
|
+
assetIds: [],
|
43
|
+
areaIds: [],
|
44
|
+
varVaule: [],
|
45
|
+
echartData: [],
|
46
|
+
echartAssemblyData: [],
|
47
|
+
routingkey: '',
|
48
|
+
pathRewrite: ''
|
49
|
+
},
|
63
50
|
pens: {},
|
64
51
|
options: { ...DefalutOptions },
|
52
|
+
elementInteractivePoor: {}, // element 交互过渡数据
|
53
|
+
echartsDataPool: {}, // echarts Dom节点数据
|
54
|
+
echartsOptionsPool: {}, // echarts options节点数据
|
55
|
+
echartsRealDataPool: {}, // echarts 实时数据
|
56
|
+
switchTabDataPool: {}, // tabs
|
57
|
+
tableDataPool: {}, // form table
|
58
|
+
selectDataPool: {}, // form select
|
59
|
+
selectRealDataPool: {}, // form select
|
60
|
+
selectTabDataPool: {}, // form select
|
61
|
+
iframeDataPool: {}, // iframe
|
62
|
+
formoverDataPool: {}, // 滚动组件 Dom节点数据
|
63
|
+
formoverCanvasDataPool: {}, // 滚动组件 画布节点数据
|
65
64
|
emitter: mitt(),
|
66
65
|
cacheDatas: [],
|
67
66
|
dpiRatio: 1,
|
68
67
|
lastScale: 1,
|
68
|
+
monitorAlarm: false,// 全局报警标记,代表正在访问的这个topology文件中是否有告警发生
|
69
69
|
parentElem: null
|
70
70
|
};
|
71
71
|
};
|
@@ -77,6 +77,49 @@ export var useStore = function (id) {
|
|
77
77
|
}
|
78
78
|
return commonStore[id];
|
79
79
|
};
|
80
|
+
export function clearElementDataPool(data) {
|
81
|
+
const { echartsDataPool, selectDataPool, iframeDataPool, formoverDataPool, formoverCanvasDataPool} = data;
|
82
|
+
for (let [key, node] of Object.entries(echartsDataPool)) {
|
83
|
+
if(node) {
|
84
|
+
clearInterval(node.timeTicket);
|
85
|
+
if(node.chart) {
|
86
|
+
node.chart.off('mouseover');
|
87
|
+
node.chart.off('mouseout');
|
88
|
+
node.chart.dispose();
|
89
|
+
}
|
90
|
+
if(node.div && node.div.parentNode) node.div.parentNode.removeChild(node.div);
|
91
|
+
}
|
92
|
+
delete data.echartsDataPool[key];
|
93
|
+
}
|
94
|
+
if(Object.keys(selectDataPool).length) {
|
95
|
+
let dropdownEle = null,
|
96
|
+
dropdownListEle = null;
|
97
|
+
for (let [key, node] of Object.entries(selectDataPool)) {
|
98
|
+
if(!dropdownEle) {
|
99
|
+
dropdownEle = node.dom.selectDropdown;
|
100
|
+
dropdownListEle = node.dom.selectDropdownUl;
|
101
|
+
}
|
102
|
+
if(node.dom.selectEle && node.dom.selectEle.parentNode) node.dom.selectEle.parentNode.removeChild(node.dom.selectEle);
|
103
|
+
delete data.selectDataPool[key];
|
104
|
+
}
|
105
|
+
if(dropdownEle) dropdownEle.style.display = 'none';
|
106
|
+
if(dropdownListEle) dropdownListEle.innerHTML = '';
|
107
|
+
}
|
108
|
+
for (let [key, node] of Object.entries(iframeDataPool)) {
|
109
|
+
node.iframe.parentNode.removeChild(node.iframe);
|
110
|
+
delete data.iframeDataPool[key];
|
111
|
+
}
|
112
|
+
for (let key of Object.keys(formoverDataPool)) {
|
113
|
+
delete formoverDataPool[key];
|
114
|
+
}
|
115
|
+
for (let key of Object.keys(formoverCanvasDataPool)) {
|
116
|
+
const elementNode = document.getElementById(key);
|
117
|
+
if(elementNode) {
|
118
|
+
elementNode.parentNode.removeChild(elementNode);
|
119
|
+
}
|
120
|
+
delete formoverCanvasDataPool[key];
|
121
|
+
}
|
122
|
+
}
|
80
123
|
export var clearStore = function (store, del) {
|
81
124
|
store.lastScale = store.data.scale;
|
82
125
|
store.data = {
|
@@ -93,15 +136,40 @@ export var clearStore = function (store, del) {
|
|
93
136
|
},
|
94
137
|
dataConstruct: {}
|
95
138
|
};
|
139
|
+
store.initConfNode = {};
|
140
|
+
store.mqttParams = {
|
141
|
+
doorIds: [],
|
142
|
+
tagIds: [],
|
143
|
+
kpiAddrs: [],
|
144
|
+
tagEcharts: [],
|
145
|
+
assetIds: [],
|
146
|
+
areaIds: [],
|
147
|
+
varVaule: [],
|
148
|
+
echartData: [],
|
149
|
+
echartAssemblyData: [],
|
150
|
+
routingkey: '',
|
151
|
+
pathRewrite: ''
|
152
|
+
};
|
96
153
|
store.pens = {}; // 先保留,后期优化提取变量用
|
97
154
|
store.cacheDatas = [];
|
98
155
|
store.dpiRatio = 1;
|
99
156
|
store.lastScale = 1;
|
100
|
-
|
157
|
+
store.monitorAlarm = false;
|
158
|
+
store.elementInteractivePoor = {};
|
159
|
+
store.echartsOptionsPool = {};
|
160
|
+
store.echartsRealDataPool = {};
|
161
|
+
store.switchTabDataPool = {};
|
162
|
+
store.tableDataPool = {};
|
163
|
+
store.selectRealDataPool = {};
|
164
|
+
store.selectTabDataPool = {};
|
165
|
+
clearElementDataPool({
|
166
|
+
echartsDataPool: store.echartsDataPool,
|
167
|
+
selectDataPool: store.selectDataPool,
|
168
|
+
iframeDataPool: store.iframeDataPool,
|
169
|
+
formoverDataPool: store.formoverDataPool,
|
170
|
+
formoverCanvasDataPool: store.formoverCanvasDataPool,
|
171
|
+
});
|
101
172
|
if(del) {
|
102
|
-
syncMqttData.data = null;
|
103
|
-
syncMqttData.initData = {};
|
104
|
-
clearMqttParams();
|
105
173
|
delete commonStore[store.id];
|
106
174
|
removeAllElement();
|
107
175
|
}
|
@@ -3,4 +3,4 @@ import {Node} from '../models';
|
|
3
3
|
export declare function setInitNodeDataValidat(node: any, TID: string, type: string, order: number): void;
|
4
4
|
export declare function initDefaultValidat(node: any, retData: any): void;
|
5
5
|
export declare function setDefaultNodeValidat(node: any, retData: any): any;
|
6
|
-
export declare function
|
6
|
+
export declare function setConnectionTagForConf(node: Node): void;
|