dcim-topology2d 2.1.0 → 2.2.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/index.d.ts +1 -1
- package/chart-diagram/index.js +1 -1
- package/chart-diagram/src/echarts/index.js +112 -109
- package/chart-diagram/src/utils/changeOptions.d.ts +8 -8
- package/chart-diagram/src/utils/changeOptions.js +8 -2
- package/chart-diagram/src/utils/conversion.d.ts +19 -19
- package/chart-diagram/src/utils/conversion.js +601 -559
- package/chart-diagram/src/utils/drawGraphic.d.ts +3 -3
- package/chart-diagram/src/utils/drawGraphic.js +97 -97
- package/chart-diagram/src/utils/index.d.ts +5 -5
- package/chart-diagram/src/utils/index.js +5 -5
- package/chart-diagram/src/utils/render.js +4 -0
- package/core/index.js +1 -19
- package/core/src/activeLayer.js +23 -23
- package/core/src/calling.js +32 -33
- package/core/src/common.d.ts +1 -0
- package/core/src/common.js +115 -83
- package/core/src/core.js +15 -1
- package/core/src/element/common.js +12 -4
- package/core/src/element/datePicker.js +13 -16
- package/core/src/element/select.d.ts +1 -1
- package/core/src/element/select.js +1 -3
- package/core/src/element/tab.js +3 -8
- package/core/src/healps/changeData.js +64 -41
- package/core/src/middles/default.js +49 -43
- package/core/src/middles/index.d.ts +1 -2
- package/core/src/middles/index.js +3 -2
- package/core/src/middles/nodes/formDatePicker.js +54 -12
- package/core/src/middles/nodes/formoverflow.js +17 -16
- package/core/src/middles/nodes/formselect.js +14 -5
- package/core/src/middles/nodes/index.d.ts +3 -1
- package/core/src/middles/nodes/index.js +2 -0
- package/core/src/middles/nodes/progress.d.ts +2 -0
- package/core/src/middles/nodes/progress.js +63 -0
- package/core/src/middles/nodes/progress.js.map +1 -0
- package/core/src/middles/nodes/rectangle.js +54 -15
- package/core/src/middles/nodes/switchs.d.ts +2 -0
- package/core/src/middles/nodes/switchs.js +46 -0
- package/core/src/models/line.js +7 -7
- package/core/src/models/node.js +90 -81
- package/core/src/models/pen.js +21 -12
- package/core/src/offscreen.js +19 -19
- package/core/src/preview.js +75 -40
- package/core/src/store/data.d.ts +11 -0
- package/core/src/store/data.js +11 -0
- package/core/src/utils/assignment.d.ts +1 -1
- package/core/src/utils/assignment.js +50 -6
- package/core/src/utils/construction.d.ts +24 -0
- package/core/src/utils/construction.js +22 -1
- package/core/src/utils/conversion.d.ts +2 -0
- package/core/src/utils/conversion.js +109 -0
- package/core/src/utils/math.d.ts +0 -1
- package/core/src/utils/math.js +0 -3
- package/core/src/utils/onmousevent.js +1 -1
- package/core/src/utils/params.d.ts +1 -0
- package/core/src/utils/params.js +75 -4
- package/package.json +1 -1
- package/static/echartsDefaultData.js +178 -178
- package/store/actions.js +2 -1
- package/store/clear.js +4 -0
- package/store/default.js +22 -0
- package/store/index.js +2 -1
- /package/myShape-diagram/{index.ts → index.d.ts} +0 -0
package/core/src/common.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {Store} from 'le5le-store';
|
|
2
|
-
import {DivLayer} from './divLayer';
|
|
3
|
-
import {AnimateLayer} from './animateLayer';
|
|
4
|
-
import {RenderLayer} from './renderLayer';
|
|
5
|
-
import {Offscreen} from './offscreen';
|
|
6
|
-
import {Line, Node, Point} from './models';
|
|
1
|
+
import { Store } from 'le5le-store';
|
|
2
|
+
import { DivLayer } from './divLayer';
|
|
3
|
+
import { AnimateLayer } from './animateLayer';
|
|
4
|
+
import { RenderLayer } from './renderLayer';
|
|
5
|
+
import { Offscreen } from './offscreen';
|
|
6
|
+
import { Line, Node, Point } from './models';
|
|
7
7
|
import {
|
|
8
8
|
s8,
|
|
9
9
|
formatPadding,
|
|
@@ -14,10 +14,11 @@ import {
|
|
|
14
14
|
setInitConfData,
|
|
15
15
|
getParams,
|
|
16
16
|
tabHideShowOperation,
|
|
17
|
-
tabStaticOperation
|
|
17
|
+
tabStaticOperation, pageZoom
|
|
18
18
|
} from './utils';
|
|
19
|
-
import {useStore, clearStore, commonStore} from './store'
|
|
19
|
+
import { useStore, clearStore, commonStore } from './store'
|
|
20
20
|
import * as mqtt from './mqtt.min';
|
|
21
|
+
import { tabsPageContentData } from "../../store";
|
|
21
22
|
var MoveInType;
|
|
22
23
|
(function (MoveInType) {
|
|
23
24
|
MoveInType[MoveInType["None"] = 0] = "None";
|
|
@@ -35,6 +36,7 @@ var Common = /** @class */ (function () {
|
|
|
35
36
|
function Common(parent, options) {
|
|
36
37
|
var _this = this;
|
|
37
38
|
_this.moveInType = MoveInType;
|
|
39
|
+
this.tabsContentOptions = {};
|
|
38
40
|
this.mouseDown = null;
|
|
39
41
|
this.renderTimer = 0;
|
|
40
42
|
this.lastRender = 0;
|
|
@@ -102,24 +104,24 @@ var Common = /** @class */ (function () {
|
|
|
102
104
|
if (_this.moveIn.hoverNode) {
|
|
103
105
|
_this.dispatch('dblclick', _this.moveIn.hoverNode);
|
|
104
106
|
if (_this.moveIn.hoverNode
|
|
105
|
-
|
|
106
|
-
|
|
107
|
+
.getTextRect()
|
|
108
|
+
.hit(new Point(e.x - canvasPos.x, e.y - canvasPos.y))) {
|
|
107
109
|
_this.showInput(_this.moveIn.hoverNode);
|
|
108
110
|
}
|
|
109
111
|
_this.moveIn.hoverNode.dblclick();
|
|
110
112
|
} else if (_this.moveIn.hoverLine) {
|
|
111
113
|
_this.dispatch('dblclick', _this.moveIn.hoverLine);
|
|
112
114
|
if (!_this.moveIn.hoverLine.text ||
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
115
|
+
_this.moveIn.hoverLine
|
|
116
|
+
.getTextRect()
|
|
117
|
+
.hit(new Point(e.x - canvasPos.x, e.y - canvasPos.y))) {
|
|
116
118
|
_this.showInput(_this.moveIn.hoverLine);
|
|
117
119
|
}
|
|
118
120
|
_this.moveIn.hoverLine.dblclick();
|
|
119
121
|
}
|
|
120
122
|
};
|
|
121
123
|
this.openCount = 0;
|
|
122
|
-
this.lastTranlated = {x: 0, y: 0};
|
|
124
|
+
this.lastTranlated = { x: 0, y: 0 };
|
|
123
125
|
this.moveIn = {
|
|
124
126
|
type: 'None',
|
|
125
127
|
order: 0,
|
|
@@ -170,10 +172,10 @@ var Common = /** @class */ (function () {
|
|
|
170
172
|
this.createMarkdownTip();
|
|
171
173
|
window.topology = this;
|
|
172
174
|
}
|
|
173
|
-
Common.prototype.categoryDataParams = function (data){
|
|
175
|
+
Common.prototype.categoryDataParams = function (data) {
|
|
174
176
|
getParams(this.id, data);
|
|
175
177
|
};
|
|
176
|
-
Common.prototype.getParams = function (assetId){
|
|
178
|
+
Common.prototype.getParams = function (assetId) {
|
|
177
179
|
const params = {
|
|
178
180
|
doorIds: this.store.mqttParams.doorIds,
|
|
179
181
|
tagIds: this.store.mqttParams.tagIds.join(","),
|
|
@@ -181,31 +183,32 @@ var Common = /** @class */ (function () {
|
|
|
181
183
|
areaIds: this.store.mqttParams.areaIds.join(","),
|
|
182
184
|
routingkey: this.store.mqttParams.routingkey,
|
|
183
185
|
echart: this.store.mqttParams.tagEcharts.join(","),
|
|
184
|
-
echartData: this.store.mqttParams.echartData
|
|
186
|
+
echartData: this.store.mqttParams.echartData,
|
|
187
|
+
dataConfig: this.store.mqttParams.dataConfig.data
|
|
185
188
|
}
|
|
186
189
|
if (this.store.mqttParams.echartAssemblyData.length) params.echartAssemblyData = [...this.store.mqttParams.echartAssemblyData];
|
|
187
|
-
if(assetId) {
|
|
190
|
+
if (assetId) {
|
|
188
191
|
params.varValueIds = this.store.mqttParams.varVaule.join(",");
|
|
189
192
|
params.branchAddrs = this.store.mqttParams.branchValue.join(",");
|
|
190
|
-
}else {
|
|
191
|
-
if(this.store.mqttParams.assetIds.length && this.store.mqttParams.varVaule.length) {
|
|
192
|
-
const assetId = this.store.mqttParams.assetIds[this.store.mqttParams.assetIds.length -1];
|
|
193
|
-
for(let va = 0; va < this.store.mqttParams.varVaule.length; va++) {
|
|
193
|
+
} else {
|
|
194
|
+
if (this.store.mqttParams.assetIds.length && this.store.mqttParams.varVaule.length) {
|
|
195
|
+
const assetId = this.store.mqttParams.assetIds[this.store.mqttParams.assetIds.length - 1];
|
|
196
|
+
for (let va = 0; va < this.store.mqttParams.varVaule.length; va++) {
|
|
194
197
|
this.store.mqttParams.varVaule[va] = `${assetId}_${this.store.mqttParams.varVaule[va]}`;
|
|
195
198
|
}
|
|
196
199
|
params.varValueIds = this.store.mqttParams.varVaule.join(",");
|
|
197
|
-
}else {
|
|
200
|
+
} else {
|
|
198
201
|
params.varVaule = this.store.mqttParams.varVaule.join(",");
|
|
199
202
|
}
|
|
200
203
|
}
|
|
201
204
|
return params;
|
|
202
205
|
};
|
|
203
206
|
// 根据图表id数据获取测点数据
|
|
204
|
-
Common.prototype.getTagIdsForEchartsIds = function (data){
|
|
207
|
+
Common.prototype.getTagIdsForEchartsIds = function (data) {
|
|
205
208
|
this.store.mqttParams.echartAssemblyData = data;
|
|
206
209
|
};
|
|
207
210
|
// 根据指标地址数据获取测点数据
|
|
208
|
-
Common.prototype.getTagIdsForKpiAddrs = function (data){
|
|
211
|
+
Common.prototype.getTagIdsForKpiAddrs = function (data) {
|
|
209
212
|
let tagIds = [];
|
|
210
213
|
data.map((item) => {
|
|
211
214
|
tagIds.push(item.tagId);
|
|
@@ -213,23 +216,23 @@ var Common = /** @class */ (function () {
|
|
|
213
216
|
this.store.mqttParams.tagIds = tagIds;
|
|
214
217
|
};
|
|
215
218
|
// 获取绑定值类型参数
|
|
216
|
-
Common.prototype.getVarValueIdsForVarData = function (data){
|
|
219
|
+
Common.prototype.getVarValueIdsForVarData = function (data) {
|
|
217
220
|
const ids = [];
|
|
218
221
|
data.map((item) => {
|
|
219
|
-
if(item.varVal) ids.push(item.assetVarIds);
|
|
222
|
+
if (item.varVal) ids.push(item.assetVarIds);
|
|
220
223
|
})
|
|
221
224
|
this.store.mqttParams.varVaule = ids;
|
|
222
225
|
};
|
|
223
|
-
Common.prototype.getBranchValueIdsForBranchsData = function (data){
|
|
226
|
+
Common.prototype.getBranchValueIdsForBranchsData = function (data) {
|
|
224
227
|
const ids = [];
|
|
225
228
|
data.map((item) => {
|
|
226
|
-
if(item.branchAddr) ids.push(`${item.assetId}_${item.branchAddr}`);
|
|
229
|
+
if (item.branchAddr) ids.push(`${item.assetId}_${item.branchAddr}`);
|
|
227
230
|
})
|
|
228
231
|
this.store.mqttParams.branchValue = ids;
|
|
229
232
|
};
|
|
230
233
|
// 固定资产详情数据赋值
|
|
231
|
-
Common.prototype.renderForAssetPoperties = function (asset, data){
|
|
232
|
-
if(!Object.keys(asset).length) return;
|
|
234
|
+
Common.prototype.renderForAssetPoperties = function (asset, data) {
|
|
235
|
+
if (!Object.keys(asset).length) return;
|
|
233
236
|
data.map((node) => {
|
|
234
237
|
if (node.data && Array.isArray(node.data) && node.data.length) {
|
|
235
238
|
node.data.map((item) => {
|
|
@@ -252,16 +255,15 @@ var Common = /** @class */ (function () {
|
|
|
252
255
|
Common.prototype.conversionData = function (obj) {
|
|
253
256
|
this.clear();
|
|
254
257
|
if (!obj) {
|
|
255
|
-
obj = {pens: []};
|
|
258
|
+
obj = { pens: [] };
|
|
256
259
|
}
|
|
257
260
|
let data = JSON.parse(JSON.stringify(obj));
|
|
258
261
|
Object.assign(this.store.data, data);
|
|
259
262
|
// topology编辑器下跳出程序
|
|
260
|
-
if(this.store.options.type !== 'topology') {
|
|
261
|
-
const
|
|
262
|
-
const zoom = window.innerWidth < screenWidth ? document.documentElement.clientWidth / screenWidth : 1;
|
|
263
|
+
if (this.store.options.type !== 'topology') {
|
|
264
|
+
const zoom = pageZoom();
|
|
263
265
|
this.store.data.pageZoom = zoom;
|
|
264
|
-
this.store.parentElem.style.transform = `scale(${1/zoom})`;
|
|
266
|
+
this.store.parentElem.style.transform = `scale(${1 / zoom})`;
|
|
265
267
|
this.store.parentElem.style.transformOrigin = '0 0';
|
|
266
268
|
this.store.parentElem.parentElement.style.overflow = 'hidden';
|
|
267
269
|
Store.set('PAGE:zoom', zoom);
|
|
@@ -270,27 +272,28 @@ var Common = /** @class */ (function () {
|
|
|
270
272
|
this.openCount = 0
|
|
271
273
|
const type = this.store.options.type;
|
|
272
274
|
// for old data.
|
|
273
|
-
if (data.nodes) {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
}
|
|
275
|
+
// if (data.nodes) {
|
|
276
|
+
// for (var _i = 0, _a = data.nodes; _i < _a.length; _i++) {
|
|
277
|
+
// setInitNodeDataValidat(_a[_i], this.id, type, _i);
|
|
278
|
+
// const item = new Node(_a[_i]);
|
|
279
|
+
// this.store.data.pens.push(item);
|
|
280
|
+
// ///this.store.pens[item.id] = item;
|
|
281
|
+
// setConnectionTagForConf(item);
|
|
282
|
+
// }
|
|
283
|
+
// for (var _b = 0, _c = data.lines; _b < _c.length; _b++) {
|
|
284
|
+
// _c[_b].TID = this.id;
|
|
285
|
+
// const item = new Line(_c[_b]);
|
|
286
|
+
// this.store.data.pens.push(item);
|
|
287
|
+
// //this.store.pens[item.id] = item;
|
|
288
|
+
// }
|
|
289
|
+
// }
|
|
290
|
+
this.conversionTabsPageData();
|
|
288
291
|
// end.
|
|
289
292
|
if (data.pens) {
|
|
290
293
|
for (var _d = 0, _e = data.pens; _d < _e.length; _d++) {
|
|
291
294
|
const item = _e[_d];
|
|
292
295
|
if (!item.from) {
|
|
293
|
-
setInitNodeDataValidat(item, this.id, type, _d);
|
|
296
|
+
setInitNodeDataValidat(item, this.id, type, _d, this.tabsContentOptions);
|
|
294
297
|
const node = new Node(item);
|
|
295
298
|
this.store.data.pens.push(node);
|
|
296
299
|
//this.store.pens[item.id] = node;
|
|
@@ -303,7 +306,28 @@ var Common = /** @class */ (function () {
|
|
|
303
306
|
}
|
|
304
307
|
}
|
|
305
308
|
};
|
|
306
|
-
|
|
309
|
+
//
|
|
310
|
+
Common.prototype.conversionTabsPageData = function () {
|
|
311
|
+
// tabs页面切换,页面数据更新
|
|
312
|
+
const pageId = this.tabsContentOptions.pageId;
|
|
313
|
+
if (!pageId) return;
|
|
314
|
+
const tabsPageMasterData = this.store.tabsPageMasterData.get('main');
|
|
315
|
+
for (let i = 0; i < tabsPageMasterData.length; i++) {
|
|
316
|
+
const node = tabsPageMasterData[i];
|
|
317
|
+
const eventNode = node.events[0];
|
|
318
|
+
if (eventNode && eventNode.dcimDetailPage) node.activeImgeIndex = eventNode.dcimDetailPage !== pageId;
|
|
319
|
+
this.store.data.pens.push(new Node(node));
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
Common.prototype.clearTabsPageData = function () {
|
|
323
|
+
if (!this.store.tabsPageMasterData.size) return;
|
|
324
|
+
this.store.tabsPageMasterData.clear();
|
|
325
|
+
this.tabsContentOptions = {};
|
|
326
|
+
for (let key of Object.keys(tabsPageContentData)) {
|
|
327
|
+
delete tabsPageContentData[key];
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
Common.prototype.clear = function (del) {
|
|
307
331
|
clearStore(this.store, del);
|
|
308
332
|
this.canvas.clearBkImg();
|
|
309
333
|
this.divLayer.clear();
|
|
@@ -316,7 +340,7 @@ var Common = /** @class */ (function () {
|
|
|
316
340
|
//this.canvas.bkImgRectResize(size);
|
|
317
341
|
this.offscreen.resize(size);
|
|
318
342
|
this.divLayer.resize(size);
|
|
319
|
-
}catch (err) {
|
|
343
|
+
} catch (err) {
|
|
320
344
|
//console.log('resize-----', err)
|
|
321
345
|
}
|
|
322
346
|
};
|
|
@@ -342,7 +366,7 @@ var Common = /** @class */ (function () {
|
|
|
342
366
|
this.offscreen.render();
|
|
343
367
|
this.canvas.render();
|
|
344
368
|
this.rendering = false;
|
|
345
|
-
}catch (e) {
|
|
369
|
+
} catch (e) {
|
|
346
370
|
//console.log(e)
|
|
347
371
|
}
|
|
348
372
|
};
|
|
@@ -370,7 +394,7 @@ var Common = /** @class */ (function () {
|
|
|
370
394
|
};
|
|
371
395
|
// 监听表格数据变化
|
|
372
396
|
Common.prototype.subcribeSyncTableData = function (data) {
|
|
373
|
-
const {tableNodes, paginationNodes} = Store.get('FORM:tableData').data;
|
|
397
|
+
const { tableNodes, paginationNodes } = Store.get('FORM:tableData').data;
|
|
374
398
|
if (data && Object.keys(tableNodes).length > 0) {
|
|
375
399
|
const updateNodes = [];
|
|
376
400
|
for (let key of Object.keys(data)) {
|
|
@@ -485,15 +509,16 @@ var Common = /** @class */ (function () {
|
|
|
485
509
|
};
|
|
486
510
|
Common.prototype.switchStaticsCheckType = function (node, staticTypeNode) {
|
|
487
511
|
const staticType = staticTypeNode.dcimStaticForType;
|
|
488
|
-
if(
|
|
512
|
+
if (staticType === 'PAGE') return this.dispatch('change', node, { id: staticTypeNode.dcimDetailPage, type: 'tabs:page' });
|
|
513
|
+
if (!staticType || staticType === 'NONE') return;
|
|
489
514
|
// 点击切换统计图统计类别
|
|
490
515
|
const switchTabData = node.tags.find((t) => {
|
|
491
516
|
return t.includes('switchTabType');
|
|
492
517
|
}); // 获取按钮组类型
|
|
493
|
-
if(!switchTabData) return;
|
|
518
|
+
if (!switchTabData) return;
|
|
494
519
|
const topologyChangeData = commonStore[node.TID].switchTabDataPool; // 获取所有按钮组和按类型统计图组数据
|
|
495
520
|
const changeNode = topologyChangeData[`${switchTabData}Data`]; // 分别获取按钮组数据
|
|
496
|
-
if(!changeNode || !changeNode[node.id]) return;
|
|
521
|
+
if (!changeNode || !changeNode[node.id]) return;
|
|
497
522
|
// 如果存在按钮组节点数据
|
|
498
523
|
const tabAreaData = topologyChangeData[`${switchTabData}AreaData`];
|
|
499
524
|
let tabIndex = 0;
|
|
@@ -502,15 +527,15 @@ var Common = /** @class */ (function () {
|
|
|
502
527
|
};
|
|
503
528
|
for (let switchNode of Object.values(changeNode)) {
|
|
504
529
|
const penNode = this.store.data.pens[switchNode.order];
|
|
505
|
-
if(!penNode) return;
|
|
530
|
+
if (!penNode) return;
|
|
506
531
|
const isActive = switchNode.id !== node.id;
|
|
507
|
-
if(!isActive) {
|
|
532
|
+
if (!isActive) {
|
|
508
533
|
visitParams.order = tabIndex;
|
|
509
534
|
visitParams.data = switchNode.tabData;
|
|
510
535
|
}
|
|
511
536
|
penNode.activeImgeIndex = isActive;
|
|
512
537
|
tabIndex++;
|
|
513
|
-
if(staticType === 'SH') tabHideShowOperation(switchNode, tabAreaData, isActive); // 对显示隐藏的功能进行交互处理
|
|
538
|
+
if (staticType === 'SH') tabHideShowOperation(switchNode, tabAreaData, isActive); // 对显示隐藏的功能进行交互处理
|
|
514
539
|
}
|
|
515
540
|
// 对绑定的图表进行数据处理
|
|
516
541
|
tabStaticOperation(staticType, node, tabAreaData, visitParams);
|
|
@@ -531,9 +556,9 @@ var Common = /** @class */ (function () {
|
|
|
531
556
|
};
|
|
532
557
|
Common.prototype.showInput = function (item) {
|
|
533
558
|
if (this.store.data.locked ||
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
559
|
+
item.locked ||
|
|
560
|
+
item.hideInput ||
|
|
561
|
+
this.store.options.hideInput) {
|
|
537
562
|
return;
|
|
538
563
|
}
|
|
539
564
|
this.inputObj = item;
|
|
@@ -626,12 +651,13 @@ var Common = /** @class */ (function () {
|
|
|
626
651
|
this.tipMarkdown.style.borderRadius = '6px';
|
|
627
652
|
this.tipMarkdown.style.whiteSpace = 'nowrap';
|
|
628
653
|
this.tipMarkdown.id = 'tipMarkdownBytopo'
|
|
654
|
+
this.tipMarkdown.className = 'tipMarkdownBytopo'
|
|
629
655
|
document.body.appendChild(this.tipMarkdown);
|
|
630
656
|
};
|
|
631
657
|
Common.prototype.showTip = function (data, pos) {
|
|
632
658
|
if (!data ||
|
|
633
|
-
|
|
634
|
-
|
|
659
|
+
(!data.markdown && !data.tipId && !data.title) || !data.title ||
|
|
660
|
+
data.id === this.tip) {
|
|
635
661
|
return;
|
|
636
662
|
}
|
|
637
663
|
data.markdown = data.title
|
|
@@ -707,7 +733,7 @@ var Common = /** @class */ (function () {
|
|
|
707
733
|
this.tip = '';
|
|
708
734
|
};
|
|
709
735
|
Common.prototype.dispatch = function (event, node, data) {
|
|
710
|
-
if(!this.store || !this.store.options) return;
|
|
736
|
+
if (!this.store || !this.store.options) return;
|
|
711
737
|
if (this.store.options.on) {
|
|
712
738
|
this.store.options.on(event, node, data);
|
|
713
739
|
}
|
|
@@ -725,8 +751,8 @@ var Common = /** @class */ (function () {
|
|
|
725
751
|
// }
|
|
726
752
|
};
|
|
727
753
|
Common.prototype.onContent = function (resetDCIM, data) {
|
|
728
|
-
if(!data) data = this.store.data;
|
|
729
|
-
let connectParams =
|
|
754
|
+
if (!data) data = this.store.data;
|
|
755
|
+
let connectParams = {
|
|
730
756
|
mqttUrl: data.mqttUrl,
|
|
731
757
|
username: data.mqttOptions.username,
|
|
732
758
|
password: data.mqttOptions.password,
|
|
@@ -739,19 +765,19 @@ var Common = /** @class */ (function () {
|
|
|
739
765
|
connectParams.password = resetDCIM.mqttPassword;
|
|
740
766
|
}
|
|
741
767
|
// 连接测试,MQTT
|
|
742
|
-
this.openMqtt(connectParams);
|
|
768
|
+
this.openMqtt(connectParams, resetDCIM.mqttDebug);
|
|
743
769
|
};
|
|
744
|
-
Common.prototype.openMqtt = function (connectParams) {
|
|
770
|
+
Common.prototype.openMqtt = function (connectParams, debug) {
|
|
745
771
|
const _this = this;
|
|
746
772
|
_this.closeMqtt();
|
|
747
|
-
if(!connectParams.mqttUrl) return;
|
|
773
|
+
if (!connectParams.mqttUrl) return;
|
|
748
774
|
_this.isEnd = false;
|
|
749
775
|
const url = connectParams.mqttUrl.replace('ip', location.hostname);
|
|
750
776
|
_this.mqttClient = mqtt.connect(url, connectParams);
|
|
751
777
|
_this.mqttClient.on('message', function (topic, message) {
|
|
752
|
-
|
|
778
|
+
if (debug) console.info('mqttClientTopic>>>', topic, connectParams.mqttTopics)
|
|
753
779
|
if (!topic || topic != connectParams.mqttTopics) return;
|
|
754
|
-
if (!this.isEnd) _this.doMqttDrow(message.toString());
|
|
780
|
+
if (!this.isEnd) _this.doMqttDrow(message.toString(), debug);
|
|
755
781
|
});
|
|
756
782
|
const topics = connectParams.mqttTopics;
|
|
757
783
|
if (topics) {
|
|
@@ -764,17 +790,17 @@ var Common = /** @class */ (function () {
|
|
|
764
790
|
this.mqttClient.end();
|
|
765
791
|
}
|
|
766
792
|
};
|
|
767
|
-
Common.prototype.doMqttDrow = function (ret) {
|
|
793
|
+
Common.prototype.doMqttDrow = function (ret, debug) {
|
|
768
794
|
let canvasData = this.store.data;
|
|
769
795
|
ret = JSON.parse(ret);
|
|
796
|
+
if (debug) console.info('mqttClientMessage>>>', ret)
|
|
770
797
|
//console.log('处理消息', ret)
|
|
771
798
|
this.mqttDataDrawing(canvasData.pens, ret)
|
|
772
799
|
};
|
|
773
800
|
Common.prototype.mqttDataDrawing = function (data, retData) {
|
|
774
|
-
// console.log('收到消息', syncData)
|
|
775
801
|
this.store.monitorAlarm = false;
|
|
776
802
|
data.map((item) => {
|
|
777
|
-
if(this.store.options.type === 'topology') setInitConfData(this.id, item);
|
|
803
|
+
if (this.store.options.type === 'topology') setInitConfData(this.id, item);
|
|
778
804
|
setDefaultNodeValidat(item, retData);
|
|
779
805
|
if (item.children && item.children.length) {
|
|
780
806
|
this.mqttDataDrawing(item.children, retData);
|
|
@@ -787,7 +813,7 @@ var Common = /** @class */ (function () {
|
|
|
787
813
|
this.render();
|
|
788
814
|
this.animate(true);
|
|
789
815
|
// 九所的 服务器状态监测功能中用到
|
|
790
|
-
if(this.store.options.storeSubscribe) Store.set(this.generateStoreKey('M:monitor'), this.store.monitorAlarm);
|
|
816
|
+
if (this.store.options.storeSubscribe) Store.set(this.generateStoreKey('M:monitor'), this.store.monitorAlarm);
|
|
791
817
|
return data
|
|
792
818
|
};
|
|
793
819
|
Common.prototype.hidePenByTag = function (pens, val) {
|
|
@@ -847,7 +873,7 @@ var Common = /** @class */ (function () {
|
|
|
847
873
|
};
|
|
848
874
|
Common.prototype.formOverflowConversionData = function (obj) {
|
|
849
875
|
if (!obj) {
|
|
850
|
-
obj = {pens: []};
|
|
876
|
+
obj = { pens: [] };
|
|
851
877
|
}
|
|
852
878
|
let data = JSON.parse(JSON.stringify(obj));
|
|
853
879
|
Object.assign(this.store.data, data);
|
|
@@ -858,6 +884,8 @@ var Common = /** @class */ (function () {
|
|
|
858
884
|
for (var _d = 0, _e = data.pens; _d < _e.length; _d++) {
|
|
859
885
|
const item = _e[_d];
|
|
860
886
|
if (!item.from) {
|
|
887
|
+
// 初次绘制画布时this.id替换item.TID
|
|
888
|
+
setInitNodeDataValidat(item, this.id, type, _d, item.PTID);
|
|
861
889
|
const node = new Node(item);
|
|
862
890
|
this.store.data.pens.push(node);
|
|
863
891
|
} else {
|
|
@@ -866,6 +894,7 @@ var Common = /** @class */ (function () {
|
|
|
866
894
|
}
|
|
867
895
|
}
|
|
868
896
|
}
|
|
897
|
+
Store.set(this.generateStoreKey('LT:conversionDataOverflow'), data);
|
|
869
898
|
};
|
|
870
899
|
Common.prototype.destroyStatic = function () {
|
|
871
900
|
this.clear('destroy');
|
|
@@ -894,7 +923,10 @@ var Common = /** @class */ (function () {
|
|
|
894
923
|
pageRelevTableNodes: {}
|
|
895
924
|
}
|
|
896
925
|
});
|
|
897
|
-
document.
|
|
926
|
+
let tipMarkdown = document.querySelectorAll(".tipMarkdownBytopo");
|
|
927
|
+
tipMarkdown.forEach(item => {
|
|
928
|
+
document.body.removeChild(item);
|
|
929
|
+
})
|
|
898
930
|
if (this.paginationPageListBox) this.paginationPageListBox.removeEventListener('click', this.paginationPageListNode);
|
|
899
931
|
if (this.pagenationPageInput) this.pagenationPageInput.removeEventListener('click', this.pagenationPageInputNode);
|
|
900
932
|
//优化
|
|
@@ -912,10 +944,10 @@ var Common = /** @class */ (function () {
|
|
|
912
944
|
this[item] = null;
|
|
913
945
|
|
|
914
946
|
})
|
|
915
|
-
//end
|
|
947
|
+
//end dcimStaticForType
|
|
916
948
|
window.topology = null;
|
|
917
949
|
};
|
|
918
950
|
// Render or redraw
|
|
919
951
|
return Common;
|
|
920
952
|
}());
|
|
921
|
-
export {Common};
|
|
953
|
+
export { Common };
|
package/core/src/core.js
CHANGED
|
@@ -1591,8 +1591,9 @@ var Topology = (function (_super) {
|
|
|
1591
1591
|
deleteNodes = getTabConnectSHConf(this.activeLayer.pens[0]);
|
|
1592
1592
|
this.activeLayer.pens = [];
|
|
1593
1593
|
}else {
|
|
1594
|
-
deleteNodes = nodes
|
|
1594
|
+
deleteNodes = nodes || this.activeLayer.pens;
|
|
1595
1595
|
}
|
|
1596
|
+
let dateIds = '';
|
|
1596
1597
|
for (var i = 0; i < deleteNodes.length; i++) {
|
|
1597
1598
|
var pen = deleteNodes[i];
|
|
1598
1599
|
if (!force && pen.locked) {
|
|
@@ -1600,6 +1601,7 @@ var Topology = (function (_super) {
|
|
|
1600
1601
|
}
|
|
1601
1602
|
var found = this.findIndex(pen);
|
|
1602
1603
|
if (found > -1) {
|
|
1604
|
+
if(pen.pickerOptions) dateIds += `${pen.id},`;
|
|
1603
1605
|
if (this.store.data.pens[found].type === PenType.Node) {
|
|
1604
1606
|
this.divLayer.removeDiv(this.store.data.pens[found]);
|
|
1605
1607
|
}
|
|
@@ -1612,6 +1614,7 @@ var Topology = (function (_super) {
|
|
|
1612
1614
|
}
|
|
1613
1615
|
this.animateLayer.pens.delete(pen.id);
|
|
1614
1616
|
}
|
|
1617
|
+
if(dateIds) this.resetAssociateDateData(dateIds);
|
|
1615
1618
|
if (!pens.length) {
|
|
1616
1619
|
return;
|
|
1617
1620
|
}
|
|
@@ -1619,6 +1622,17 @@ var Topology = (function (_super) {
|
|
|
1619
1622
|
this.cache();
|
|
1620
1623
|
this.dispatch('delete', pens);
|
|
1621
1624
|
};
|
|
1625
|
+
Topology.prototype.resetAssociateDateData = function (dateIds) {
|
|
1626
|
+
// 重置关联日期数据的元件属性值
|
|
1627
|
+
const pens = this.store.data.pens;
|
|
1628
|
+
for (var i = 0, length = pens.length; i < length; ++i) {
|
|
1629
|
+
const pen = pens[i];
|
|
1630
|
+
if(pen.formData && dateIds.includes(pen.formData.dateId)){
|
|
1631
|
+
pen.events = pen.events.filter((ev) => { return ev.type !== 4 });
|
|
1632
|
+
pen.formData = null;
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1635
|
+
};
|
|
1622
1636
|
Topology.prototype.delEmptyLines = function (deleteedId) {
|
|
1623
1637
|
for (var i = 0; i < this.store.data.pens.length; i++) {
|
|
1624
1638
|
if (this.store.data.pens[i].type !== PenType.Line) {
|
|
@@ -2,13 +2,22 @@ import {Lock} from '../models';
|
|
|
2
2
|
import {commonStore} from '../store';
|
|
3
3
|
export function setStyleForElementIdDiv(node, elem, data) {
|
|
4
4
|
if (!elem) return;
|
|
5
|
-
|
|
5
|
+
node.attribute = 'dom';
|
|
6
|
+
const currentStore = commonStore[node.TID];
|
|
7
|
+
if(!currentStore.elementInteractivePoor.dom) currentStore.elementInteractivePoor.dom = {};
|
|
8
|
+
currentStore.elementInteractivePoor.dom[node.id] = elem;
|
|
9
|
+
let width = node.rect.width;
|
|
10
|
+
let height = node.rect.height;
|
|
11
|
+
if(node.name === 'echarts') {
|
|
12
|
+
width /= currentStore.data.pageZoom;
|
|
13
|
+
height /= currentStore.data.pageZoom;
|
|
14
|
+
}
|
|
6
15
|
elem.style.position = 'absolute';
|
|
7
16
|
elem.style.outline = 'none';
|
|
8
17
|
elem.style.left = node.rect.x + 'px';
|
|
9
18
|
elem.style.top = node.rect.y + 'px';
|
|
10
|
-
elem.style.width =
|
|
11
|
-
elem.style.height =
|
|
19
|
+
elem.style.width = width + 'px';
|
|
20
|
+
elem.style.height = height + 'px';
|
|
12
21
|
if (node.rotate || node.offsetRotate) {
|
|
13
22
|
elem.style.transform = "rotate(" + (node.rotate + node.offsetRotate) + "deg)";
|
|
14
23
|
}
|
|
@@ -40,7 +49,6 @@ export function loadJS(url) {
|
|
|
40
49
|
loaderScript.type = 'text/javascript';
|
|
41
50
|
loaderScript.src = url;
|
|
42
51
|
document.body.appendChild(loaderScript);
|
|
43
|
-
window.datePickerRegister = true;
|
|
44
52
|
return new Promise((resolve, reject) => {
|
|
45
53
|
loaderScript.onload = function () {
|
|
46
54
|
resolve(true);
|
|
@@ -10,7 +10,7 @@ export function createDatePickerElement(node) {
|
|
|
10
10
|
<svg class="icon-arrow" viewBox="0 0 10 6" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="10.000000" height="6.000000" fill="none" customFrame="#000000">
|
|
11
11
|
<path id="箭头" d="M5 0C5.14734 0 5.28865 0.0632141 5.39284 0.175736L9.83728 4.97574C10.0542 5.21005 10.0542 5.58995 9.83728 5.82426C9.62032 6.05858 9.26857 6.05858 9.05161 5.82426L5 1.44853L0.948393 5.82426C0.731435 6.05858 0.379676 6.05858 0.162718 5.82426C-0.0542395 5.58995 -0.0542395 5.21005 0.162718 4.97574L4.60716 0.175736C4.71135 0.0632141 4.85266 0 5 0Z" fill="rgb(23,206,230)" fill-rule="evenodd" transform="matrix(1,0,0,-1,0,6)" />
|
|
12
12
|
</svg>
|
|
13
|
-
<input id='picker${node.id}' class="dataPickerInput" type="text" name='dataPicker${node.id}' placeholder="请选择" readonly />`;
|
|
13
|
+
<input id='picker${node.id}' class="dataPickerInput" type="text" name='dataPicker${node.id}' value='${node.pickerOptions.value}' placeholder="请选择" readonly />`;
|
|
14
14
|
|
|
15
15
|
return pickerBarEle;
|
|
16
16
|
}
|
|
@@ -19,10 +19,9 @@ export function createDatePickerElement(node) {
|
|
|
19
19
|
export function setDataPickerElementStyle(node) {
|
|
20
20
|
const {pickerDataPool, data} = commonStore[node.TID];
|
|
21
21
|
const pickerDom = pickerDataPool[node.id].dom;
|
|
22
|
-
|
|
23
|
-
pickerDom.container.style
|
|
24
|
-
pickerDom.container.style.
|
|
25
|
-
pickerDom.container.style.padding = `${node.paddingTop}px ${node.paddingRight}px ${node.paddingBottom}px ${node.paddingLeft}px`;
|
|
22
|
+
const padding = `${node.paddingTop}px ${node.paddingRight}px ${node.paddingBottom}px ${node.paddingLeft}px`;
|
|
23
|
+
const containerStyle = pickerDom.container.getAttribute('style');
|
|
24
|
+
pickerDom.container.style.cssText =`${containerStyle}padding: ${padding}`;
|
|
26
25
|
|
|
27
26
|
if (!pickerDom.iconDate) pickerDom.iconDate = pickerDom.container.querySelector('.icon-date');
|
|
28
27
|
if (!pickerDom.iconArrow) pickerDom.iconArrow = pickerDom.container.querySelector('.icon-arrow');
|
|
@@ -31,17 +30,15 @@ export function setDataPickerElementStyle(node) {
|
|
|
31
30
|
const round = `${node.font.fontSize + data.scale * 2}px`;
|
|
32
31
|
const parts = node.strokeStyle.match(/([\d.]+)/g);
|
|
33
32
|
const fillColor = parts ? `rgba(${parts[0]},${parts[1]},${parts[2]},1)` : node.strokeStyle;
|
|
34
|
-
|
|
35
|
-
pickerDom.iconDate.style.
|
|
36
|
-
pickerDom.iconDate.style.height = round;
|
|
37
|
-
pickerDom.iconDate.style.left = `${node.font.fontSize}px`;
|
|
33
|
+
|
|
34
|
+
pickerDom.iconDate.style.cssText = `width: ${round};height: ${round};left: ${node.font.fontSize}px`;
|
|
38
35
|
pickerDom.iconDate.querySelector('path').style.fill = fillColor;
|
|
39
36
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
const width = node.font.fontSize - data.scale * 2;
|
|
38
|
+
const height = node.font.fontSize - data.scale * 6;
|
|
39
|
+
|
|
40
|
+
pickerDom.iconArrow.style.cssText = `width: ${width}px;height: ${height}px;right: ${width}px`;
|
|
43
41
|
pickerDom.iconArrow.querySelector('path').style.fill = fillColor;
|
|
44
|
-
|
|
45
|
-
pickerDom.input.style.
|
|
46
|
-
|
|
47
|
-
};
|
|
42
|
+
|
|
43
|
+
pickerDom.input.style.cssText = `font-size: ${node.font.fontSize}px;color: ${node.font.color}`;
|
|
44
|
+
}
|
|
@@ -6,6 +6,6 @@ export declare function createSelectOptions(data: [], node: Node): string;
|
|
|
6
6
|
export declare function getSelectedData(e: Event, data: any, editData: any): void;
|
|
7
7
|
export declare function setSelectInteractiveState(selected: any, node: Node): void;
|
|
8
8
|
export declare function resetSelectInteractiveState(node: Node): void;
|
|
9
|
-
export declare function setSelectDropdownInteractiveState(node: any,
|
|
9
|
+
export declare function setSelectDropdownInteractiveState(node: any, type: any): void;
|
|
10
10
|
export declare function setSelectElementPosition(node: Node, type: string): void;
|
|
11
11
|
export declare function setSelectElementTheme(node: Node): void;
|
|
@@ -86,13 +86,11 @@ export function resetSelectInteractiveState(node) {
|
|
|
86
86
|
/**
|
|
87
87
|
* 配置下拉options容器的交互状态,展开和收起
|
|
88
88
|
* @param node 下拉元件节点数据
|
|
89
|
-
* @param staticType 下拉功能类型:1: 数据统计;2:数据展示;3:显示隐藏
|
|
90
89
|
* @param type 功能作用区域类型:Dcim,Topology,Logo
|
|
91
90
|
*/
|
|
92
|
-
export function setSelectDropdownInteractiveState(node,
|
|
91
|
+
export function setSelectDropdownInteractiveState(node, type) {
|
|
93
92
|
const currentStore = commonStore[node.TID];
|
|
94
93
|
const selectNode = currentStore.selectDataPool[node.id];
|
|
95
|
-
if(!selectNode.staticType) selectNode.staticType = staticType;
|
|
96
94
|
if(!selectNode) return;
|
|
97
95
|
if(downId !== node.id && type === previewType.Dcim) {
|
|
98
96
|
// 点击的不是同一个下拉则重置交互样式,清空数据
|
package/core/src/element/tab.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import {jsonLength} from '../utils';
|
|
2
1
|
import {commonStore} from "../store";
|
|
3
2
|
// 设置tab切换显示隐藏时的 Dom元件状态
|
|
4
3
|
export function setElementSwitchTabState(node) {
|
|
@@ -9,14 +8,10 @@ export function setElementSwitchTabState(node) {
|
|
|
9
8
|
setElementSwitchTabState(ch);
|
|
10
9
|
})
|
|
11
10
|
}
|
|
12
|
-
if(
|
|
11
|
+
if(node.attribute !== 'dom') return;
|
|
13
12
|
const currentStore = commonStore[node.TID];
|
|
14
|
-
if(
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
if(!currentStore.elementInteractivePoor.elementDataLength) return;
|
|
18
|
-
const ele = currentStore.echartsDataPool[node.id] && currentStore.echartsDataPool[node.id].div ||
|
|
19
|
-
currentStore.selectDataPool[node.id] && currentStore.selectDataPool[node.id].dom.selectEle;
|
|
13
|
+
if(!currentStore.elementInteractivePoor.dom) return;
|
|
14
|
+
const ele = currentStore.elementInteractivePoor.dom[node.id];
|
|
20
15
|
if(ele) {
|
|
21
16
|
ele.style.display = !node.visible ? 'none': 'block';
|
|
22
17
|
}else {
|