dcim-topology2d 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chart-diagram/src/echarts/index.js +6 -3
- package/chart-diagram/src/utils/conversion.d.ts +1 -1
- package/chart-diagram/src/utils/conversion.js +6 -5
- package/core/src/common.js +11 -10
- package/core/src/core.js +15 -1
- package/core/src/element/common.js +12 -3
- 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 +61 -41
- package/core/src/middles/default.js +47 -43
- package/core/src/middles/nodes/formDatePicker.js +53 -12
- package/core/src/middles/nodes/formselect.js +14 -5
- package/core/src/middles/nodes/index.d.ts +2 -1
- package/core/src/middles/nodes/index.js +1 -0
- 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 +83 -81
- package/core/src/models/pen.js +11 -11
- package/core/src/offscreen.js +19 -19
- package/core/src/preview.js +16 -7
- package/core/src/store/data.d.ts +2 -0
- package/core/src/store/data.js +6 -0
- package/core/src/utils/assignment.js +33 -2
- 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/store/default.js +22 -0
- package/store/index.js +2 -1
@@ -9,7 +9,7 @@ import {
|
|
9
9
|
setMapTopOptions,
|
10
10
|
setMapGlobalOptions,
|
11
11
|
setMapDataOptions,
|
12
|
-
|
12
|
+
initBindCorrelationSetting
|
13
13
|
} from '../utils';
|
14
14
|
import {echartsTypeMap} from '../../../static';
|
15
15
|
|
@@ -67,8 +67,9 @@ export function echarts(ctx, node) {
|
|
67
67
|
echartsData.div.style.transformOrigin = '0 0';
|
68
68
|
if(node.data.params) node.data.params.tabCorrelationType = echartsData.tabCorrelationType || ''; // 统计图与Tab关联
|
69
69
|
const isLocked = currentStore.data.locked;
|
70
|
-
|
71
|
-
|
70
|
+
const echartsOptionsData = currentStore.echartsOptionsPool[node.id];
|
71
|
+
if (!isLocked || !echartsOptionsData) {
|
72
|
+
const tabData = initBindCorrelationSetting(node); // 初始化图表与其他组件关联的配置数据
|
72
73
|
// 【未锁定(编辑)状态, options未初始化的状态】
|
73
74
|
if (!appearance.type) appearance.type = echartsTypeMap[`type_${option.displayMode}`]; // 兼容旧数据配置
|
74
75
|
// 公共配置 Top排行榜散点图跳过公共属性配置
|
@@ -87,8 +88,10 @@ export function echarts(ctx, node) {
|
|
87
88
|
if (appearance.type.includes('TOP')) setMapTopOptions(option, node);
|
88
89
|
//option.title = appearance.title;
|
89
90
|
option.backgroundColor = appearance.backgroundColor;
|
91
|
+
const correlationData = echartsOptionsData && echartsOptionsData.correlationData || null;
|
90
92
|
currentStore.echartsOptionsPool[node.id] = {
|
91
93
|
option: JSON.parse(JSON.stringify(option)),
|
94
|
+
correlationData,
|
92
95
|
data: {
|
93
96
|
TID: node.TID,
|
94
97
|
appearance,
|
@@ -6,7 +6,7 @@ interface echartsOptions {
|
|
6
6
|
tooltip: null
|
7
7
|
}
|
8
8
|
export declare function getXYAxisLabelVal(index: number, intervalNum: number, value: any): string;
|
9
|
-
export declare function
|
9
|
+
export declare function initBindCorrelationSetting(node: any): string;
|
10
10
|
export declare function setMapScatterOptions(option: echartsOptions, node: any): void;
|
11
11
|
export declare function setMapLineBarOptions(option: echartsOptions, node: any): void;
|
12
12
|
export declare function setMapGaugeOptions(option: echartsOptions, node: any): void;
|
@@ -33,23 +33,24 @@ export function getXYAxisLabelVal(index, intervalNum, value) {
|
|
33
33
|
}
|
34
34
|
|
35
35
|
/**
|
36
|
-
*
|
36
|
+
* 初始化图表与其他组件关联的配置数据
|
37
37
|
* @param node 元件节点
|
38
38
|
*/
|
39
|
-
export function
|
39
|
+
export function initBindCorrelationSetting(node) {
|
40
|
+
if(!node.data.params || node.data.params.staticForType !== 'OTHER') return null;
|
40
41
|
const tabStaticKey = node.tags && node.tags.find((tag) => {return tag.includes('switchTabType')});
|
42
|
+
if(!tabStaticKey) return null; // 与tabs关联?
|
41
43
|
const switchTabData = tabStaticKey && commonStore[node.TID].switchTabDataPool[`${tabStaticKey}Data`];
|
42
44
|
if(switchTabData) {
|
43
45
|
const tabNode = Object.values(switchTabData)[0];
|
44
46
|
const tabEventNode = tabNode.events.find((ev) => {return ev.action === 8});
|
45
47
|
const tabStaticType = tabEventNode && tabEventNode.dcimStaticForType || '';
|
46
|
-
|
48
|
+
node.data.params.staticForType = tabStaticType;
|
47
49
|
return {
|
48
50
|
type: tabStaticType,
|
49
51
|
data: tabNode.tabData
|
50
52
|
};
|
51
53
|
}
|
52
|
-
return null;
|
53
54
|
}
|
54
55
|
|
55
56
|
// 自动滑动展示数据
|
@@ -509,7 +510,7 @@ export function setMapDataOptions(option, node) {
|
|
509
510
|
}
|
510
511
|
}
|
511
512
|
}
|
512
|
-
if(option.series[0].pieData) {
|
513
|
+
if(option.series[0] && option.series[0].pieData) {
|
513
514
|
// 3D饼图图例初始化
|
514
515
|
const labelLineData = currentStore.echartsDataPool[node.id].labelLineData;
|
515
516
|
dataDictionary = set3DPieOptions(option, appearance, labelLineData);
|
package/core/src/common.js
CHANGED
@@ -14,7 +14,7 @@ import {
|
|
14
14
|
setInitConfData,
|
15
15
|
getParams,
|
16
16
|
tabHideShowOperation,
|
17
|
-
tabStaticOperation
|
17
|
+
tabStaticOperation, pageZoom
|
18
18
|
} from './utils';
|
19
19
|
import {useStore, clearStore, commonStore} from './store'
|
20
20
|
import * as mqtt from './mqtt.min';
|
@@ -181,7 +181,8 @@ var Common = /** @class */ (function () {
|
|
181
181
|
areaIds: this.store.mqttParams.areaIds.join(","),
|
182
182
|
routingkey: this.store.mqttParams.routingkey,
|
183
183
|
echart: this.store.mqttParams.tagEcharts.join(","),
|
184
|
-
echartData: this.store.mqttParams.echartData
|
184
|
+
echartData: this.store.mqttParams.echartData,
|
185
|
+
dataConfig: this.store.mqttParams.dataConfig.data
|
185
186
|
}
|
186
187
|
if (this.store.mqttParams.echartAssemblyData.length) params.echartAssemblyData = [...this.store.mqttParams.echartAssemblyData];
|
187
188
|
if(assetId) {
|
@@ -258,8 +259,7 @@ var Common = /** @class */ (function () {
|
|
258
259
|
Object.assign(this.store.data, data);
|
259
260
|
// topology编辑器下跳出程序
|
260
261
|
if(this.store.options.type !== 'topology') {
|
261
|
-
const
|
262
|
-
const zoom = window.innerWidth < screenWidth ? document.documentElement.clientWidth / screenWidth : 1;
|
262
|
+
const zoom = pageZoom();
|
263
263
|
this.store.data.pageZoom = zoom;
|
264
264
|
this.store.parentElem.style.transform = `scale(${1/zoom})`;
|
265
265
|
this.store.parentElem.style.transformOrigin = '0 0';
|
@@ -739,9 +739,9 @@ var Common = /** @class */ (function () {
|
|
739
739
|
connectParams.password = resetDCIM.mqttPassword;
|
740
740
|
}
|
741
741
|
// 连接测试,MQTT
|
742
|
-
this.openMqtt(connectParams);
|
742
|
+
this.openMqtt(connectParams, resetDCIM.mqttDebug);
|
743
743
|
};
|
744
|
-
Common.prototype.openMqtt = function (connectParams) {
|
744
|
+
Common.prototype.openMqtt = function (connectParams, debug) {
|
745
745
|
const _this = this;
|
746
746
|
_this.closeMqtt();
|
747
747
|
if(!connectParams.mqttUrl) return;
|
@@ -749,9 +749,9 @@ var Common = /** @class */ (function () {
|
|
749
749
|
const url = connectParams.mqttUrl.replace('ip', location.hostname);
|
750
750
|
_this.mqttClient = mqtt.connect(url, connectParams);
|
751
751
|
_this.mqttClient.on('message', function (topic, message) {
|
752
|
-
|
752
|
+
if(debug) console.log('mqttClientTopic>>>', topic, connectParams.mqttTopics)
|
753
753
|
if (!topic || topic != connectParams.mqttTopics) return;
|
754
|
-
if (!this.isEnd) _this.doMqttDrow(message.toString());
|
754
|
+
if (!this.isEnd) _this.doMqttDrow(message.toString(), debug);
|
755
755
|
});
|
756
756
|
const topics = connectParams.mqttTopics;
|
757
757
|
if (topics) {
|
@@ -764,9 +764,10 @@ var Common = /** @class */ (function () {
|
|
764
764
|
this.mqttClient.end();
|
765
765
|
}
|
766
766
|
};
|
767
|
-
Common.prototype.doMqttDrow = function (ret) {
|
767
|
+
Common.prototype.doMqttDrow = function (ret, debug) {
|
768
768
|
let canvasData = this.store.data;
|
769
769
|
ret = JSON.parse(ret);
|
770
|
+
if(debug) console.log('mqttClientMessage>>>', ret)
|
770
771
|
//console.log('处理消息', ret)
|
771
772
|
this.mqttDataDrawing(canvasData.pens, ret)
|
772
773
|
};
|
@@ -912,7 +913,7 @@ var Common = /** @class */ (function () {
|
|
912
913
|
this[item] = null;
|
913
914
|
|
914
915
|
})
|
915
|
-
//end
|
916
|
+
//end dcimStaticForType
|
916
917
|
window.topology = null;
|
917
918
|
};
|
918
919
|
// Render or redraw
|
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
|
}
|
@@ -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 {
|
@@ -1,11 +1,11 @@
|
|
1
1
|
//let DETAILDATA = null;
|
2
|
-
import {commonStore} from '../store';
|
2
|
+
import { commonStore } from '../store';
|
3
3
|
import { getEchartsRealData } from '../utils/conversion';
|
4
4
|
export function setConfItemNode(pen, syn_synata) {
|
5
5
|
const entranceGuard = pen.events.find((ev) => {
|
6
6
|
return ev.value === 'entranceGuard';
|
7
7
|
});
|
8
|
-
if(entranceGuard) {
|
8
|
+
if (entranceGuard) {
|
9
9
|
// 绑定门禁的元件实时数据
|
10
10
|
const nullUndefinedRegex = /^(?:null|undefined|\s*)$/;
|
11
11
|
const doorData = syn_synata.doorData && syn_synata.doorData[entranceGuard.params];
|
@@ -13,59 +13,64 @@ export function setConfItemNode(pen, syn_synata) {
|
|
13
13
|
pen.text = doorState === 1 ? '开门' : '关门'; // 1-开门,其他值为关门
|
14
14
|
}
|
15
15
|
if (!pen.data) return;
|
16
|
-
if(commonStore[pen.TID]) commonStore[pen.TID].data.dataResize = 1;
|
16
|
+
if (commonStore[pen.TID]) commonStore[pen.TID].data.dataResize = 1;
|
17
17
|
let isAlarm = false; // 判断元件绑定的数据中是否有告警发生,用于九所项目服务器自身监控功能
|
18
|
-
if(pen.data instanceof Array) {
|
18
|
+
if (pen.data instanceof Array) {
|
19
19
|
let _syn = null;
|
20
20
|
let isResetVal = false;
|
21
|
-
const {areaData, assetData, kpiData, tagData, asset} = syn_synata
|
21
|
+
const { areaData, assetData, componentData, kpiData, tagData, asset } = syn_synata;
|
22
|
+
const comData = componentData && componentData[pen.id];
|
22
23
|
pen.data.map((d) => {
|
23
24
|
const key = d.key;
|
24
25
|
let value = d.value;
|
25
|
-
|
26
|
-
const areaItem = areaData[value];
|
27
|
-
const kpiItem = kpiData[value];
|
28
|
-
if(key === 'tagId') value = d.tagId ? d.tagId : d.value;
|
29
|
-
const tagItem = tagData[value];
|
26
|
+
if (key === 'tagId') value = d.tagId ? d.tagId : d.value;
|
30
27
|
//console.log('key===========', d)
|
31
28
|
if (key === 'assetKey' && d.value === 'assetName' && asset) {
|
29
|
+
|
32
30
|
pen.text = asset.assetName;
|
33
|
-
|
34
|
-
|
31
|
+
|
32
|
+
} else if (key === 'assetId') {
|
33
|
+
|
34
|
+
_syn = comData || assetData[value];
|
35
|
+
|
35
36
|
// if(value === '264'){console.log('_syn',_syn,pen.name,parseInt(_syn.state))}
|
36
|
-
}else if (key === 'areaId'
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
37
|
+
} else if (key === 'areaId') {
|
38
|
+
|
39
|
+
_syn = comData || areaData[value];
|
40
|
+
|
41
|
+
} else if (key === 'tagId' && (comData || tagData[value])) {
|
42
|
+
|
43
|
+
_syn = comData || tagData[value];
|
44
|
+
|
45
|
+
if (_syn.kpiName !== '通讯状态' || pen.name !== 'circle') {
|
41
46
|
isResetVal = true;
|
42
47
|
}
|
43
|
-
const isControl = parseInt(
|
48
|
+
const isControl = parseInt(_syn.isControlDis); // 是否可控,0可控,1不可控
|
44
49
|
//d.isControlDis = isControlDis
|
45
|
-
if(!isControl) {
|
50
|
+
if (!isControl) {
|
46
51
|
d.tagVal = value
|
47
|
-
d.controlParams =
|
52
|
+
d.controlParams = _syn
|
48
53
|
//Object.assign(d, tagItem)
|
49
54
|
}
|
50
|
-
}else if (key === 'kpiAddr' &&
|
51
|
-
_syn =
|
55
|
+
} else if (key === 'kpiAddr' && (comData || kpiData[value])) {
|
56
|
+
_syn = comData || kpiData[value];
|
52
57
|
isResetVal = true
|
53
|
-
const isControl = parseInt(
|
58
|
+
const isControl = parseInt(_syn.isControlDis); // 是否可控,0可控,1不可控
|
54
59
|
//d.isControlDis = isControlDis
|
55
|
-
if(!isControl) {
|
60
|
+
if (!isControl) {
|
56
61
|
d.tagVal = value
|
57
|
-
d.controlParams =
|
62
|
+
d.controlParams = _syn
|
58
63
|
// delete kpiItem[value]
|
59
64
|
// Object.assign(d, kpiItem)
|
60
65
|
}
|
61
66
|
}
|
62
67
|
})
|
63
|
-
if(!_syn) return;
|
68
|
+
if (!_syn) return;
|
64
69
|
// const type = parseInt(_syn.type) // 是否是开关量
|
65
70
|
// 显示的值
|
66
71
|
if (isResetVal) pen.text = `${_syn.value}${_syn.unit}`;
|
67
72
|
const state = parseInt(_syn.state)
|
68
|
-
if(!state && state !== 0) return
|
73
|
+
if (!state && state !== 0) return
|
69
74
|
const name = pen.name
|
70
75
|
// 显示的颜色
|
71
76
|
let color = ''
|
@@ -83,9 +88,9 @@ export function setConfItemNode(pen, syn_synata) {
|
|
83
88
|
let defaulColor = ''
|
84
89
|
if (name === 'text') {
|
85
90
|
defaulColor = 'defaultFontColor'
|
86
|
-
}else if(name === 'line') {
|
91
|
+
} else if (name === 'line') {
|
87
92
|
defaulColor = 'defaultStrokeStyle'
|
88
|
-
}else {
|
93
|
+
} else {
|
89
94
|
defaulColor = 'defaultFillStyle'
|
90
95
|
}
|
91
96
|
color = pen[defaulColor]
|
@@ -97,17 +102,24 @@ export function setConfItemNode(pen, syn_synata) {
|
|
97
102
|
// 显示的属性
|
98
103
|
if (name === 'text') {
|
99
104
|
pen.font.color = color
|
100
|
-
}else if(name === 'line') {
|
105
|
+
} else if (name === 'line') {
|
101
106
|
pen.strokeStyle = color
|
102
107
|
pen.text = ''
|
103
|
-
}else {
|
108
|
+
} else if (name === 'switchs') {
|
109
|
+
//获取值说明中的开值 默认为第一个值为开
|
110
|
+
let openValue = getOpenValue(_syn.valExplain)
|
111
|
+
pen.isOpen = _syn.v == openValue;
|
112
|
+
pen.fillStyle = pen.isOpen ? pen.visitStrokeStyle : pen.strokeStyle;
|
113
|
+
pen.text = '';
|
114
|
+
}
|
115
|
+
else {
|
104
116
|
pen.fillStyle = color
|
105
117
|
}
|
106
118
|
if (name === 'electricFan') setFanData(pen, _syn)
|
107
|
-
}else {
|
119
|
+
} else {
|
108
120
|
if (pen.elementRendered) pen.elementRendered = false;
|
109
121
|
if (pen.data.echarts) {
|
110
|
-
const {echartDataValue} = syn_synata;
|
122
|
+
const { echartDataValue } = syn_synata;
|
111
123
|
const seriesData = echartDataValue;
|
112
124
|
const realData = pen.data.params && seriesData && Object.keys(seriesData).length && seriesData[pen.data.params.id];
|
113
125
|
if (Array.isArray(realData) && pen.data.params && pen.data.params.displayMode !== 7) {
|
@@ -137,24 +149,24 @@ export function setFanData(pen, syncData) {
|
|
137
149
|
let runState = false
|
138
150
|
let percentage = 1
|
139
151
|
const value = parseInt(syncData.v)
|
140
|
-
if(pen.fanValType == '1'){
|
141
|
-
if(value > pen.fanMinVal
|
152
|
+
if (pen.fanValType == '1') {
|
153
|
+
if (value > pen.fanMinVal && value <= pen.fanMaxVal) {
|
142
154
|
runState = true
|
143
|
-
percentage = value/(pen.fanMaxVal-pen.fanMinVal)
|
155
|
+
percentage = value / (pen.fanMaxVal - pen.fanMinVal)
|
144
156
|
}
|
145
|
-
}else if(pen.fanValType == '2'){
|
146
|
-
if(pen.fanNorVal === value) runState = true
|
157
|
+
} else if (pen.fanValType == '2') {
|
158
|
+
if (pen.fanNorVal === value) runState = true
|
147
159
|
}
|
148
|
-
if(runState){
|
160
|
+
if (runState) {
|
149
161
|
addAnimateByRevolve(pen, percentage)
|
150
162
|
pen.animatePlay = true
|
151
|
-
}else{
|
163
|
+
} else {
|
152
164
|
pen.animatePlay = false
|
153
165
|
}
|
154
166
|
}
|
155
167
|
|
156
168
|
export function addAnimateByRevolve(pen, percentage) {
|
157
|
-
let time = 200/pen.fanSpeed/percentage
|
169
|
+
let time = 200 / pen.fanSpeed / percentage
|
158
170
|
const state = JSON.parse(JSON.stringify(pen))
|
159
171
|
delete state.TID
|
160
172
|
delete state.animateFrames
|
@@ -169,3 +181,11 @@ export function addAnimateByRevolve(pen, percentage) {
|
|
169
181
|
pen.animateDuration = time;
|
170
182
|
|
171
183
|
}
|
184
|
+
|
185
|
+
export function getOpenValue(explain) {
|
186
|
+
let value = 1
|
187
|
+
if (!explain) return value
|
188
|
+
value = explain.split(',')[0].split('=')[0];
|
189
|
+
return value
|
190
|
+
|
191
|
+
}
|
@@ -1,51 +1,51 @@
|
|
1
1
|
import {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
2
|
+
arrowAnchors,
|
3
|
+
leftArrow, leftArrowIconRect, leftArrowTextRect,
|
4
|
+
rightArrow, rightArrowIconRect, rightArrowTextRect,
|
5
|
+
twowayArrow, twowayArrowIconRect, twowayArrowTextRect,
|
6
|
+
rectangle, rectangleIconRect, rectangleTextRect,
|
7
|
+
diamond, diamondIconRect, diamondTextRect,
|
8
|
+
text, file, formtable, tablePagination, iframePrimeval, formSelect, fromDatePicker,
|
9
|
+
line as nodeLine, lineAnchors, lineIconRect, lineTextRect,
|
10
|
+
circle, circleIconRect, circleTextRect, circleAnchors,
|
11
|
+
triangle, triangleIconRect, triangleTextRect, triangleAnchors,
|
12
|
+
pentagon, pentagonIconRect, pentagonTextRect, pentagonAnchors,
|
13
|
+
hexagon, hexagonAnchors, hexagonIconRect, hexagonTextRect,
|
14
|
+
pentagram, pentagramAnchors, pentagramIconRect, pentagramTextRect,
|
15
|
+
cloud, cloudAnchors, cloudIconRect, cloudTextRect,
|
16
|
+
message, messageIconRect, messageTextRect, messageAnchors,
|
17
|
+
imageIconRect, imageTextRect,
|
18
|
+
cube, cubeAnchors, cubeIconRect, cubeTextRect,
|
19
|
+
people, peopleIconRect, peopleTextRect,
|
20
|
+
arbitraryGraph, arbitraryGraphAnchors, time, switchs
|
21
21
|
} from './nodes';
|
22
22
|
import {
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
23
|
+
line,
|
24
|
+
lineControlPoints,
|
25
|
+
calcLineControlPoints,
|
26
|
+
polyline,
|
27
|
+
polylineControlPoints,
|
28
|
+
pointInPolyline,
|
29
|
+
calcPolylineControlPoints,
|
30
|
+
dockPolylineControlPoint,
|
31
|
+
curve,
|
32
|
+
curveControlPoints,
|
33
|
+
pointInCurve,
|
34
|
+
calcCurveControlPoints,
|
35
|
+
mind,
|
36
|
+
calcMindControlPoints,
|
37
|
+
mindControlPoints,
|
38
|
+
pointInMind
|
39
39
|
} from './lines';
|
40
40
|
import {
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
41
|
+
triangleSolid,
|
42
|
+
triangle as arrowTriangle,
|
43
|
+
diamondSolid,
|
44
|
+
diamond as arrowDiamond,
|
45
|
+
circleSolid, circle as arrowCircle,
|
46
|
+
lineUp,
|
47
|
+
lineDown,
|
48
|
+
line as arrowLine
|
49
49
|
} from './arrows';
|
50
50
|
// Functions of drawing a node.
|
51
51
|
export var drawNodeFns = {};
|
@@ -205,6 +205,10 @@ function init() {
|
|
205
205
|
drawNodeFns.time = time;
|
206
206
|
iconRectFns.time = rectangleIconRect;
|
207
207
|
textRectFns.time = rectangleTextRect;
|
208
|
+
// 开关
|
209
|
+
drawNodeFns.switchs = switchs;
|
210
|
+
iconRectFns.switchs = rectangleIconRect;
|
211
|
+
textRectFns.switchs = rectangleTextRect;
|
208
212
|
}
|
209
213
|
init();
|
210
214
|
// registerNode: Register a custom node.
|