dcim-topology2d 1.1.5 → 2.0.2
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 +88 -96
- package/chart-diagram/src/register.js +3 -3
- package/chart-diagram/src/utils/changeOptions.d.ts +4 -4
- package/chart-diagram/src/utils/changeOptions.js +172 -144
- package/chart-diagram/src/utils/conversion.d.ts +12 -12
- package/chart-diagram/src/utils/conversion.js +278 -137
- package/chart-diagram/src/utils/render.d.ts +5 -0
- package/chart-diagram/src/utils/render.js +107 -0
- package/core/index.d.ts +1 -0
- package/core/index.js +1 -0
- package/core/src/activeLayer.js +0 -6
- package/core/src/calling.js +3 -0
- package/core/src/canvas.js +1 -0
- package/core/src/common.d.ts +1 -2
- package/core/src/common.js +124 -614
- package/core/src/core.js +65 -49
- package/core/src/divLayer.d.ts +0 -3
- package/core/src/divLayer.js +14 -32
- package/core/src/element/common.d.ts +5 -0
- package/core/src/element/common.js +52 -0
- package/core/src/element/iframe.d.ts +3 -0
- package/core/src/element/iframe.js +12 -0
- package/core/src/element/index.d.ts +4 -0
- package/core/src/element/index.js +4 -0
- package/core/src/element/select.d.ts +11 -0
- package/core/src/element/select.js +199 -0
- package/core/src/element/tab.d.ts +1 -0
- package/core/src/element/tab.js +22 -0
- package/core/src/healps/changeData.d.ts +1 -2
- package/core/src/healps/changeData.js +16 -122
- package/core/src/middles/default.js +3 -1
- package/core/src/middles/nodes/arbitrarygraph.js +11 -9
- package/core/src/middles/nodes/formselect.d.ts +2 -0
- package/core/src/middles/nodes/formselect.js +73 -0
- package/core/src/middles/nodes/iframe.js +21 -4
- package/core/src/middles/nodes/index.d.ts +1 -0
- package/core/src/middles/nodes/index.js +1 -0
- package/core/src/models/node.d.ts +4 -0
- package/core/src/models/node.js +25 -22
- package/core/src/models/pen.js +7 -8
- package/core/src/models/rect.js +2 -2
- package/core/src/options.d.ts +1 -0
- package/core/src/preview.js +45 -31
- package/core/src/renderLayer.d.ts +10 -6
- package/core/src/renderLayer.js +36 -43
- package/core/src/store/data.d.ts +19 -17
- package/core/src/store/data.js +38 -12
- package/core/src/utils/assignment.d.ts +6 -0
- package/core/src/utils/assignment.js +138 -0
- package/core/src/utils/construction.d.ts +9 -3
- package/core/src/utils/construction.js +6 -1
- package/core/src/utils/conversion.d.ts +3 -0
- package/core/src/utils/conversion.js +67 -0
- package/core/src/utils/index.d.ts +2 -1
- package/core/src/utils/index.js +2 -1
- package/core/src/utils/math.d.ts +1 -0
- package/core/src/utils/math.js +3 -0
- package/core/src/utils/onmousevent.d.ts +3 -0
- package/core/src/utils/onmousevent.js +28 -7
- package/core/src/utils/params.d.ts +7 -0
- package/core/src/utils/params.js +125 -0
- package/package.json +1 -1
- package/static/echartsDefaultData.js +27 -107
- package/static/element.js +14 -0
- package/static/form.js +11 -0
- package/static/index.js +2 -1
- package/store/actions.js +17 -0
- package/store/clear.js +72 -0
- package/store/index.js +2 -0
- package/style/common.css +18 -0
- package/style/editor.css +13 -0
- package/style/index.css +3 -12
- package/style/select.css +143 -0
- package/core/src/utils/dom.d.ts +0 -9
- package/core/src/utils/dom.js +0 -103
- package/core/src/utils/dom.js.map +0 -1
- package/static/echartsStore.js +0 -14
package/core/src/preview.js
CHANGED
@@ -14,7 +14,18 @@ var __extends = (this && this.__extends) || (function () {
|
|
14
14
|
import {KeyType} from './options';
|
15
15
|
import {Point} from './models';
|
16
16
|
import { Common } from './common'
|
17
|
-
import {
|
17
|
+
import {
|
18
|
+
downDataType,
|
19
|
+
previewType,
|
20
|
+
formatPadding,
|
21
|
+
mousMoveFun,
|
22
|
+
mousDownFun,
|
23
|
+
omouseEventPrototDoWindowFn
|
24
|
+
} from './utils';
|
25
|
+
import {
|
26
|
+
resetSelectInteractiveState,
|
27
|
+
setSelectDropdownInteractiveState
|
28
|
+
} from './element';
|
18
29
|
|
19
30
|
var Preview = (function (_super) {
|
20
31
|
__extends(Preview, _super);
|
@@ -74,7 +85,8 @@ var Preview = (function (_super) {
|
|
74
85
|
if (_this.inputObj) {
|
75
86
|
_this.setNodeText();
|
76
87
|
}
|
77
|
-
|
88
|
+
resetSelectInteractiveState(_this.moveIn.hoverNode);
|
89
|
+
const {eventType, value, staticType} = mousDownFun(_this.store.options.type, _this.moveIn.eventNode);
|
78
90
|
if (_this.moveIn.type == _this.moveInType.Nodes) {
|
79
91
|
_this.setAttributeForCanvasPoint('pointer');
|
80
92
|
switch (eventType) {
|
@@ -91,10 +103,14 @@ var Preview = (function (_super) {
|
|
91
103
|
if (visibleRange == '1') {
|
92
104
|
_this.openCount++
|
93
105
|
}
|
106
|
+
this.render();
|
94
107
|
break;
|
95
108
|
case downDataType.Tabswitch:
|
96
109
|
_this.switchStaticsCheckType(_this.moveIn.hoverNode, _this.moveIn.eventNode);
|
97
110
|
break;
|
111
|
+
case downDataType.Formselect:
|
112
|
+
setSelectDropdownInteractiveState(_this.moveIn.hoverNode, staticType, previewType.Dcim);
|
113
|
+
break;
|
98
114
|
}
|
99
115
|
}
|
100
116
|
};
|
@@ -114,7 +130,7 @@ var Preview = (function (_super) {
|
|
114
130
|
_this.divLayer.canvas.onmousedown = this.onmousedown;
|
115
131
|
_this.divLayer.canvas.onmouseup = this.onmouseup;
|
116
132
|
_this.divLayer.canvas.onwheel = function (event) {
|
117
|
-
if (_this.store.options.disableScale) {
|
133
|
+
if (_this.store.options.disableScale || _this.store.options.type === 'dialog') {
|
118
134
|
return;
|
119
135
|
}
|
120
136
|
switch (_this.store.options.scaleKey) {
|
@@ -162,6 +178,14 @@ var Preview = (function (_super) {
|
|
162
178
|
_this.divLayer.canvas.focus();
|
163
179
|
return false;
|
164
180
|
};
|
181
|
+
window.onresize = function () {
|
182
|
+
const isFullScreen = document.fullscreenElement || document.webkitFullscreenElement || document.mozFullscreenElement;
|
183
|
+
if(!isFullScreen && _this.isFullScreen){
|
184
|
+
_this.moveIn.hoverNode.text = '全屏';
|
185
|
+
_this.fitViewPreview(_this.isFullScreen);
|
186
|
+
_this.isFullScreen = false;
|
187
|
+
}
|
188
|
+
};
|
165
189
|
return _this;
|
166
190
|
}
|
167
191
|
Preview.prototype.setAttributeForCanvasPoint = function (type){
|
@@ -175,43 +199,30 @@ var Preview = (function (_super) {
|
|
175
199
|
};
|
176
200
|
// open - redraw by the data
|
177
201
|
Preview.prototype.open = function (topoJSon, type) {
|
178
|
-
this.conversionData(topoJSon
|
202
|
+
this.conversionData(topoJSon);
|
179
203
|
this.setBKImageRect();
|
180
204
|
this.fitView();
|
181
205
|
this.render(true);
|
182
206
|
this.animate(true);
|
183
207
|
};
|
184
208
|
Preview.prototype.setBKImageRect = function () {
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
209
|
+
if (this.store.data.bkImageRect) {
|
210
|
+
this.store.data.bkImageRect.x = this.store.data.bkImageRect.x ? Number(this.store.data.bkImageRect.x) : 0;
|
211
|
+
this.store.data.bkImageRect.y = this.store.data.bkImageRect.y ? Number(this.store.data.bkImageRect.y) : 0;
|
212
|
+
this.store.data.bkImageRect.width = this.store.data.bkImageRect.width ? Number(this.store.data.bkImageRect.width) : this.canvas.width;
|
213
|
+
this.store.data.bkImageRect.height = this.store.data.bkImageRect.height ? Number(this.store.data.bkImageRect.height) : this.canvas.height;
|
214
|
+
this.store.data.bkImageRect.center = {
|
215
|
+
x: this.store.data.bkImageRect.x + this.store.data.bkImageRect.width / 2,
|
216
|
+
y: this.store.data.bkImageRect.y + this.store.data.bkImageRect.height / 2
|
217
|
+
}
|
193
218
|
}
|
194
|
-
}
|
195
219
|
};
|
196
220
|
Preview.prototype.scale = function (scale, center, w, h) {
|
197
221
|
if (this.store.data.scale * scale < this.store.options.minScale ||
|
198
222
|
this.store.data.scale * scale > this.store.options.maxScale) {
|
199
223
|
return;
|
200
224
|
}
|
201
|
-
const scaleX = w ? w : scale;
|
202
|
-
const scaleY = h ? h : scale;
|
203
225
|
this.store.data.scale *= scale;
|
204
|
-
if(this.isFullScreen) {
|
205
|
-
this.store.ratioCord.ratio *= scale;
|
206
|
-
this.store.ratioCord.scaleX *= scaleX;
|
207
|
-
this.store.ratioCord.scaleY *= scaleY;
|
208
|
-
}else {
|
209
|
-
this.store.ratioCord = {
|
210
|
-
ratio: 1,
|
211
|
-
scaleX: 1,
|
212
|
-
scaleY: 1
|
213
|
-
}
|
214
|
-
}
|
215
226
|
!center && (center = this.getRect().center);
|
216
227
|
for (var _i = 0, _a = this.store.data.pens; _i < _a.length; _i++) {
|
217
228
|
var item = _a[_i];
|
@@ -239,6 +250,11 @@ var Preview = (function (_super) {
|
|
239
250
|
var padding = formatPadding(viewPadding || this.store.options.viewPadding);
|
240
251
|
// 4. 获取图形尺寸
|
241
252
|
var rect = this.getRect();
|
253
|
+
if(!rect.width) {
|
254
|
+
const bkImageRect = this.store.data.bkImageRect;
|
255
|
+
rect.width = bkImageRect && bkImageRect.width ? bkImageRect.width : width;
|
256
|
+
rect.height = bkImageRect && bkImageRect.height ? bkImageRect.height : height;
|
257
|
+
}
|
242
258
|
// 6. 计算缩放比
|
243
259
|
var w = (width - padding[1] - padding[3]) / rect.width;
|
244
260
|
var h = (height - padding[0] - padding[2]) / rect.height;
|
@@ -246,11 +262,8 @@ var Preview = (function (_super) {
|
|
246
262
|
if (w > h) {
|
247
263
|
ratio = h;
|
248
264
|
}
|
249
|
-
|
250
|
-
|
251
|
-
w = 1 / this.store.ratioCord.scaleX;
|
252
|
-
h = 1 / this.store.ratioCord.scaleY;
|
253
|
-
}
|
265
|
+
// 保持缩放后的还原度
|
266
|
+
if(typeof restore === 'boolean' && restore) ratio = w;
|
254
267
|
this.scale(ratio, undefined, w, h);
|
255
268
|
this.canvas.scale(ratio, undefined, w, h);
|
256
269
|
// 7. X抽滚动条隐藏
|
@@ -261,6 +274,7 @@ var Preview = (function (_super) {
|
|
261
274
|
this.onMouseMove = null;
|
262
275
|
this.onmousedown = null;
|
263
276
|
this.onmouseup = null;
|
277
|
+
window.onresize = null;
|
264
278
|
};
|
265
279
|
return Preview;
|
266
280
|
}(Common));
|
@@ -5,12 +5,6 @@ export declare class RenderLayer extends Canvas {
|
|
5
5
|
offscreen: any;
|
6
6
|
bkImg: HTMLImageElement;
|
7
7
|
bkImgRect: {
|
8
|
-
x: number;
|
9
|
-
y: number;
|
10
|
-
width: number;
|
11
|
-
height: number;
|
12
|
-
};
|
13
|
-
bgRect: {
|
14
8
|
center: {
|
15
9
|
x: number;
|
16
10
|
y: number;
|
@@ -20,6 +14,16 @@ export declare class RenderLayer extends Canvas {
|
|
20
14
|
width: number;
|
21
15
|
height: number;
|
22
16
|
};
|
17
|
+
bgRect: {
|
18
|
+
// center: {
|
19
|
+
// x: number;
|
20
|
+
// y: number;
|
21
|
+
// },
|
22
|
+
x: number;
|
23
|
+
y: number;
|
24
|
+
// width: number;
|
25
|
+
// height: number;
|
26
|
+
};
|
23
27
|
constructor(TID: String);
|
24
28
|
loadBkImg(cb?: any): void;
|
25
29
|
clearBkImg(): void;
|
package/core/src/renderLayer.js
CHANGED
@@ -24,6 +24,9 @@ var RenderLayer = /** @class */ (function (_super) {
|
|
24
24
|
_this.initImage = false;
|
25
25
|
_this.coverType = 'container';
|
26
26
|
_this.bgRect = null;
|
27
|
+
_this.scaleX = 1;
|
28
|
+
_this.scaleY = 1;
|
29
|
+
_this.ratio = 1;
|
27
30
|
_this.render = function () {
|
28
31
|
if(!commonStore || !commonStore[TID]) return;
|
29
32
|
if (commonStore[TID].data.bkImage && !_this.initImage) {
|
@@ -50,41 +53,34 @@ var RenderLayer = /** @class */ (function (_super) {
|
|
50
53
|
return _this;
|
51
54
|
}
|
52
55
|
RenderLayer.prototype.scale = function (scale, center, w, h){
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
56
|
+
if(!this.bkImgRect) {
|
57
|
+
this.scaleX = w ? w : scale;
|
58
|
+
this.scaleY = h ? h : scale;
|
59
|
+
this.ratio = scale;
|
60
|
+
return;
|
61
|
+
}
|
58
62
|
if(!center) {
|
59
|
-
center =
|
63
|
+
center = this.bkImgRect.center;
|
60
64
|
}
|
61
65
|
if (!w) {
|
62
66
|
w = scale;
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
this.bgRect.x = center.x - (center.x - this.bgRect.x) * w;
|
67
|
-
}
|
67
|
+
this.bkImgRect.x = center.x - (center.x - this.bkImgRect.x) * scale;
|
68
|
+
}else {
|
69
|
+
this.bkImgRect.x = this.bgRect.x;
|
68
70
|
}
|
69
71
|
if (!h) {
|
70
72
|
h = scale;
|
71
|
-
|
72
|
-
bkImageRect.y = center.y - (center.y - bkImageRect.y) * h;
|
73
|
-
}else {
|
74
|
-
this.bgRect.y = center.y - (center.y - this.bgRect.y) * h;
|
75
|
-
}
|
76
|
-
}
|
77
|
-
if(bkImageRect) {
|
78
|
-
bkImageRect.width *= w;
|
79
|
-
bkImageRect.height *= h;
|
80
|
-
this.bkImgRect = bkImageRect;
|
73
|
+
this.bkImgRect.y = center.y - (center.y - this.bkImgRect.y) * scale;
|
81
74
|
}else {
|
82
|
-
|
83
|
-
this.bgRect.width *= w;
|
84
|
-
this.bgRect.height *= h;
|
85
|
-
}
|
86
|
-
this.bkImgRect = this.bgRect;
|
75
|
+
this.bkImgRect.y = this.bgRect.y;
|
87
76
|
}
|
77
|
+
this.bkImgRect.width *= w;
|
78
|
+
this.bkImgRect.height *= h;
|
79
|
+
this.calcCenter();
|
80
|
+
};
|
81
|
+
RenderLayer.prototype.calcCenter = function () {
|
82
|
+
this.bkImgRect.center.x = this.bkImgRect.x + this.bkImgRect.width / 2;
|
83
|
+
this.bkImgRect.center.y = this.bkImgRect.y + this.bkImgRect.height / 2;
|
88
84
|
};
|
89
85
|
RenderLayer.prototype.loadBkImg = function (cb, pixi) {
|
90
86
|
var _this = this;
|
@@ -98,6 +94,7 @@ var RenderLayer = /** @class */ (function (_super) {
|
|
98
94
|
this.bkImg.onload = function () {
|
99
95
|
if(pixi && !_this.bkImgRect) {
|
100
96
|
_this.bkImgRectResize({width: _this.canvas.width, height: _this.canvas.height});
|
97
|
+
_this.scale(_this.ratio, undefined, _this.scaleX, _this.scaleY);
|
101
98
|
}else {
|
102
99
|
//_this.bkImgRect = _this.coverRect(_this.canvas.width, _this.canvas.height, _this.bkImg.width, _this.bkImg.height);
|
103
100
|
}
|
@@ -105,10 +102,6 @@ var RenderLayer = /** @class */ (function (_super) {
|
|
105
102
|
cb();
|
106
103
|
}
|
107
104
|
_this.initImage = true;
|
108
|
-
_this.bgRect.center.x = _this.width / 2;
|
109
|
-
_this.bgRect.center.y = _this.height / 2;
|
110
|
-
_this.bgRect.width = _this.width;
|
111
|
-
_this.bgRect.height = _this.height;
|
112
105
|
};
|
113
106
|
};
|
114
107
|
RenderLayer.prototype.clearBkImg = function () {
|
@@ -116,14 +109,8 @@ var RenderLayer = /** @class */ (function (_super) {
|
|
116
109
|
this.bkImg = null;
|
117
110
|
this.initImage = false;
|
118
111
|
this.bgRect = {
|
119
|
-
center: {
|
120
|
-
x: this.width / 2,
|
121
|
-
y: this.height / 2
|
122
|
-
},
|
123
112
|
x: 0,
|
124
|
-
y: 0
|
125
|
-
width: this.width,
|
126
|
-
height: this.height
|
113
|
+
y: 0
|
127
114
|
}
|
128
115
|
};
|
129
116
|
RenderLayer.prototype.coverRect = function (canvasWidth, canvasHeight, imgWidth, imgHeight) {
|
@@ -157,13 +144,19 @@ var RenderLayer = /** @class */ (function (_super) {
|
|
157
144
|
let bkWidth = bkImageRect.width ? Number(bkImageRect.width) : width;
|
158
145
|
let bkHeight = bkImageRect.height ? Number(bkImageRect.height) : height;
|
159
146
|
this.bkImgRect = {
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
147
|
+
center: {
|
148
|
+
x: x + bkWidth / 2,
|
149
|
+
y: y + bkHeight / 2
|
150
|
+
},
|
151
|
+
x,
|
152
|
+
y,
|
153
|
+
width: bkWidth,
|
154
|
+
height: bkHeight
|
155
|
+
};
|
156
|
+
this.bgRect = {
|
157
|
+
x,
|
158
|
+
y
|
164
159
|
};
|
165
|
-
}else {
|
166
|
-
this.bkImgRect = this.bgRect;
|
167
160
|
}
|
168
161
|
};
|
169
162
|
|
package/core/src/store/data.d.ts
CHANGED
@@ -40,14 +40,26 @@ export interface visualization2DStore {
|
|
40
40
|
emitter: Emitter;
|
41
41
|
dpiRatio?: number;
|
42
42
|
lastScale?: number; //记录上次模版的scale
|
43
|
-
ratioCord: {
|
44
|
-
ratio?: number;
|
45
|
-
scaleX?: number;
|
46
|
-
scaleY?: number;
|
47
|
-
},
|
48
43
|
parentElem: HTMLElement
|
49
44
|
}
|
50
|
-
|
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;
|
51
63
|
// @ts-ignore
|
52
64
|
export const createStore = () => {
|
53
65
|
return {
|
@@ -71,11 +83,6 @@ export const createStore = () => {
|
|
71
83
|
cacheDatas: [],
|
72
84
|
dpiRatio: 1,
|
73
85
|
lastScale: 1,
|
74
|
-
ratioCord: {
|
75
|
-
ratio: 1,
|
76
|
-
scaleX: 1,
|
77
|
-
scaleY: 1
|
78
|
-
},
|
79
86
|
parentElem: null
|
80
87
|
} as visualization2DStore;
|
81
88
|
};
|
@@ -90,7 +97,7 @@ export const useStore = (id = 'default'): visualization2DStore => {
|
|
90
97
|
};
|
91
98
|
|
92
99
|
// @ts-ignore
|
93
|
-
export const clearStore = (store: visualization2DStore) => {
|
100
|
+
export const clearStore = (store: visualization2DStore, del: string) => {
|
94
101
|
store.data = {
|
95
102
|
bkColor: '',
|
96
103
|
bkImage: '',
|
@@ -118,9 +125,4 @@ export const clearStore = (store: visualization2DStore) => {
|
|
118
125
|
store.cacheDatas = [];
|
119
126
|
store.dpiRatio = 1;
|
120
127
|
store.lastScale = 1;
|
121
|
-
store.ratioCord = {
|
122
|
-
ratio: 1,
|
123
|
-
scaleX: 1,
|
124
|
-
scaleY: 1
|
125
|
-
}
|
126
128
|
};
|
package/core/src/store/data.js
CHANGED
@@ -14,6 +14,35 @@ import { Lock } from '../models';
|
|
14
14
|
import {DefalutOptions} from '../options';
|
15
15
|
import {s8} from '../utils';
|
16
16
|
import { commonStore } from './common'
|
17
|
+
import { clearDataPool, removeAllElement } from '../../../store';
|
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
|
+
}
|
17
46
|
export var createStore = function () {
|
18
47
|
return {
|
19
48
|
id: '',
|
@@ -37,11 +66,6 @@ export var createStore = function () {
|
|
37
66
|
cacheDatas: [],
|
38
67
|
dpiRatio: 1,
|
39
68
|
lastScale: 1,
|
40
|
-
ratioCord: {
|
41
|
-
ratio: 1,
|
42
|
-
scaleX: 1,
|
43
|
-
scaleY: 1
|
44
|
-
},
|
45
69
|
parentElem: null
|
46
70
|
};
|
47
71
|
};
|
@@ -69,14 +93,16 @@ export var clearStore = function (store, del) {
|
|
69
93
|
},
|
70
94
|
dataConstruct: {}
|
71
95
|
};
|
72
|
-
store.pens = {};
|
96
|
+
store.pens = {}; // 先保留,后期优化提取变量用
|
73
97
|
store.cacheDatas = [];
|
74
98
|
store.dpiRatio = 1;
|
75
99
|
store.lastScale = 1;
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
100
|
+
clearDataPool();
|
101
|
+
if(del) {
|
102
|
+
syncMqttData.data = null;
|
103
|
+
syncMqttData.initData = {};
|
104
|
+
clearMqttParams();
|
105
|
+
delete commonStore[store.id];
|
106
|
+
removeAllElement();
|
107
|
+
}
|
82
108
|
};
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import {Node} from '../models';
|
2
|
+
|
3
|
+
export declare function setInitNodeDataValidat(node: any, TID: string, type: string, order: number): void;
|
4
|
+
export declare function initDefaultValidat(node: any, retData: any): void;
|
5
|
+
export declare function setDefaultNodeValidat(node: any, retData: any): any;
|
6
|
+
export declare function initSwitchTabData(node: Node): void;
|
@@ -0,0 +1,138 @@
|
|
1
|
+
// 变量赋值操作
|
2
|
+
import {syncMqttData} from '../store';
|
3
|
+
import { setConfItemNode } from '../healps';
|
4
|
+
import { EventAction } from '../models';
|
5
|
+
import {switchTabDataPool} from "../../../store";
|
6
|
+
|
7
|
+
/**
|
8
|
+
* 在节点注册前初始化node数据
|
9
|
+
* @param node 节点数据
|
10
|
+
* @param TID 数据键
|
11
|
+
* @param type topology类型
|
12
|
+
* @param order 节点序列
|
13
|
+
*/
|
14
|
+
export function setInitNodeDataValidat(node, TID, type, order) {
|
15
|
+
|
16
|
+
const syncData = syncMqttData.data;
|
17
|
+
|
18
|
+
node.TID = TID;
|
19
|
+
|
20
|
+
if(typeof order === "number") node.order = order;
|
21
|
+
if(type !== 'topology') node.selectDropdown = false;
|
22
|
+
|
23
|
+
initDefaultValidat(node, syncData);
|
24
|
+
|
25
|
+
setDefaultNodeValidat(node, syncData);
|
26
|
+
|
27
|
+
if (node.children && node.children.length) {
|
28
|
+
|
29
|
+
node.children.map((_item) => {
|
30
|
+
|
31
|
+
setInitNodeDataValidat(_item, TID, type);
|
32
|
+
|
33
|
+
})
|
34
|
+
|
35
|
+
}
|
36
|
+
}
|
37
|
+
// 初始化默认节点值
|
38
|
+
export function initDefaultValidat(node, retData) {
|
39
|
+
node.defaultFillStyle = node.fillStyle;
|
40
|
+
node.defaultFontColor = node.font.color;
|
41
|
+
if (node.name === 'line') {
|
42
|
+
node.defaultStrokeStyle = node.strokeStyle;
|
43
|
+
}
|
44
|
+
// 变量类型数据展示,不需要实时更新
|
45
|
+
if(Array.isArray(node.data) && retData && retData.varData) {
|
46
|
+
let typeName = '';
|
47
|
+
let imgs = '';
|
48
|
+
const varData = retData.varData;
|
49
|
+
node.data.map((vd) => {
|
50
|
+
if(vd.key.includes('varValue') && varData[vd.value]){
|
51
|
+
const varNode = varData[vd.value];
|
52
|
+
const showType = varNode.showType ? parseInt(varNode.showType) : 1;
|
53
|
+
if(showType === 1 && varNode.value) typeName += typeName ? `,${varNode.value}` : varNode.value;
|
54
|
+
if(showType === 2 && varNode.value) console.log('显示图标>>>');
|
55
|
+
if(showType === 3 && varNode.value) imgs = `/dcim-api${varNode.value}`; //imgs += imgs ? `,${varData.value}` : varData.value;
|
56
|
+
}
|
57
|
+
});
|
58
|
+
if(typeName) node.text = typeName;
|
59
|
+
if(imgs) {
|
60
|
+
node.text = '';
|
61
|
+
node.image = imgs;
|
62
|
+
node.paddingBottom = 0;
|
63
|
+
node.paddingBottomNum = 0;
|
64
|
+
node.paddingLeft = 0;
|
65
|
+
node.paddingLeftNum = 0;
|
66
|
+
node.paddingRight = 0;
|
67
|
+
node.paddingRightNum = 0;
|
68
|
+
node.paddingTop = 0;
|
69
|
+
node.paddingTopNum = 0;
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}
|
73
|
+
// 初始化mqtt实时值
|
74
|
+
export function setDefaultNodeValidat(node, retData) {
|
75
|
+
//const item = JSON.parse(JSON.stringify(node));
|
76
|
+
if (!node.data || !retData) return;
|
77
|
+
//const node = detailData.length > 0 ? detailData : syncData
|
78
|
+
const functionData = node.events.filter((ev) => {
|
79
|
+
return ev.action === EventAction.Function
|
80
|
+
});
|
81
|
+
const dataValue = functionData[0]
|
82
|
+
if (functionData.length > 0 && dataValue.value && retData) {
|
83
|
+
node.data.map((d) => {
|
84
|
+
const {kpiData, tagData} = retData;
|
85
|
+
const key = d.key;
|
86
|
+
const value = d.value;
|
87
|
+
const _syncItem = key === 'tagId' ? tagData[value] : kpiData[value];
|
88
|
+
if ((key === 'tagId' || key === 'kpiAddr') && _syncItem) {
|
89
|
+
const isControl = parseInt(_syncItem.isControlDis); // 是否可控,0可控,1不可控
|
90
|
+
if (!isControl) {
|
91
|
+
d.tagVal = value
|
92
|
+
d.controlParams = _syncItem
|
93
|
+
// delete _syncItem[value]
|
94
|
+
// Object.assign(d, _syncItem)
|
95
|
+
}
|
96
|
+
}
|
97
|
+
})
|
98
|
+
// console.log('定制函数=====')
|
99
|
+
try {
|
100
|
+
const func = new Function('pen', 'params', dataValue.value);
|
101
|
+
func(node, JSON.stringify(retData));
|
102
|
+
}catch (e) {
|
103
|
+
console.log(`自定义函数出错>>>`,);
|
104
|
+
console.log(`目标元件:${node.id}>>>`,);
|
105
|
+
console.log(`目标元件方位:X->${node.rect.x},Y->${node.rect.y}>>>`,);
|
106
|
+
}
|
107
|
+
} else {
|
108
|
+
// console.log('默认函数')
|
109
|
+
setConfItemNode(node, retData);
|
110
|
+
}
|
111
|
+
if (node.animateFrames && node.animateFrames.length) {
|
112
|
+
for (var _a = 0, _af = node.animateFrames; _a < _af.length; _a++) {
|
113
|
+
var ani = _af[_a];
|
114
|
+
ani.state.strokeStyle = node.strokeStyle;
|
115
|
+
ani.state.fillStyle = node.fillStyle;
|
116
|
+
}
|
117
|
+
}
|
118
|
+
//return node;
|
119
|
+
}
|
120
|
+
// 初始化tab节点数据
|
121
|
+
export function initSwitchTabData(node) {
|
122
|
+
if (node.tags && node.tags.length > 0) {
|
123
|
+
const tagTypeData = node.tags.find((t) => {
|
124
|
+
return t === 'statisticType' || t.includes('switchTabType');
|
125
|
+
});
|
126
|
+
if (tagTypeData) {
|
127
|
+
let topologyChangeData = switchTabDataPool;
|
128
|
+
let keyName = node.bindStaticId ? `${tagTypeData}Data` : `${tagTypeData}AreaData`;
|
129
|
+
if (!topologyChangeData[keyName]) topologyChangeData[keyName] = {};
|
130
|
+
topologyChangeData[keyName][node.id] = node;
|
131
|
+
}else {
|
132
|
+
const isTabs = node.events && node.events.find((ev) => ev.action === 8);
|
133
|
+
if(isTabs) {
|
134
|
+
console.log('>>>未能找到绑定的标签数据,请检查绑定的Tabs标签是否包含switchTabType前缀>>>')
|
135
|
+
}
|
136
|
+
}
|
137
|
+
}
|
138
|
+
}
|
@@ -12,20 +12,18 @@ export interface MoveDataType {
|
|
12
12
|
HoverAnchors?: string | number;
|
13
13
|
Rotate?: string | number;
|
14
14
|
}
|
15
|
-
export const moveDataType: MoveDataType;
|
16
15
|
export interface DownDataType {
|
17
16
|
Window?: string | number;
|
18
17
|
Target?: string | number;
|
19
18
|
Showhide?: string | number;
|
20
19
|
Tabswitch?: string | number;
|
20
|
+
Formselect?: string | number;
|
21
21
|
}
|
22
|
-
export const downDataType: DownDataType;
|
23
22
|
export interface PreviewType {
|
24
23
|
Dcim?: string;
|
25
24
|
Topology?: string;
|
26
25
|
Logo?: string;
|
27
26
|
}
|
28
|
-
export const previewType: PreviewType;
|
29
27
|
export interface AnimateType {
|
30
28
|
LeftFlow?: string;
|
31
29
|
RightFlow?: string;
|
@@ -38,4 +36,12 @@ export interface AnimateType {
|
|
38
36
|
Show?: string;
|
39
37
|
Rotate?: string;
|
40
38
|
}
|
39
|
+
export interface SelectStaticType {
|
40
|
+
static?:number;
|
41
|
+
show?:number;
|
42
|
+
}
|
43
|
+
export const moveDataType: MoveDataType;
|
44
|
+
export const downDataType: DownDataType;
|
45
|
+
export const previewType: PreviewType;
|
41
46
|
export const animateType: AnimateType;
|
47
|
+
export const selectStaticType: SelectStaticType;
|
@@ -15,7 +15,8 @@ export const downDataType = {
|
|
15
15
|
Window: 'window',
|
16
16
|
Target: 'target',
|
17
17
|
Showhide: 'showhide',
|
18
|
-
Tabswitch: 'Tabswitch'
|
18
|
+
Tabswitch: 'Tabswitch',
|
19
|
+
Formselect: 'Formselect'
|
19
20
|
};
|
20
21
|
export const previewType = {
|
21
22
|
Dcim: 'dcim',
|
@@ -33,4 +34,8 @@ export const animateType = {
|
|
33
34
|
Error: 'error',
|
34
35
|
Show: 'show',
|
35
36
|
Rotate: 'rotate'
|
37
|
+
};
|
38
|
+
export const selectStaticType = {
|
39
|
+
static: 1,
|
40
|
+
show: 2
|
36
41
|
};
|
@@ -1,7 +1,10 @@
|
|
1
1
|
import {Node} from "../models";
|
2
2
|
|
3
|
+
export declare function getEchartsRealData(node: {}, data: []): void;
|
4
|
+
export declare function setInitConfData(data: object): void;
|
3
5
|
export declare function setTagIdData(data: any): [];
|
4
6
|
export declare function setKpiAddrData(data: any): [];
|
5
7
|
export declare function setAssetIdData(data: any): [];
|
6
8
|
export declare function setAreaIdData(data: any): [];
|
9
|
+
export declare function setVarValueData(data: any): [];
|
7
10
|
export declare function setThreeCategoryIdData(pen: Node, data: any): [];
|