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
@@ -1,8 +1,7 @@
|
|
1
1
|
// 变量赋值操作
|
2
|
-
import {
|
2
|
+
import {commonStore} from '../store';
|
3
3
|
import { setConfItemNode } from '../healps';
|
4
4
|
import { EventAction } from '../models';
|
5
|
-
import {switchTabDataPool} from "../../../store";
|
6
5
|
|
7
6
|
/**
|
8
7
|
* 在节点注册前初始化node数据
|
@@ -13,10 +12,12 @@ import {switchTabDataPool} from "../../../store";
|
|
13
12
|
*/
|
14
13
|
export function setInitNodeDataValidat(node, TID, type, order) {
|
15
14
|
|
16
|
-
const syncData =
|
15
|
+
const syncData = commonStore[TID].mqttData;
|
17
16
|
|
18
17
|
node.TID = TID;
|
19
18
|
|
19
|
+
node.visibleSwitch = type === 'topology' && node.visibleSwitch;
|
20
|
+
|
20
21
|
if(typeof order === "number") node.order = order;
|
21
22
|
if(type !== 'topology') node.selectDropdown = false;
|
22
23
|
|
@@ -73,14 +74,14 @@ export function initDefaultValidat(node, retData) {
|
|
73
74
|
// 初始化mqtt实时值
|
74
75
|
export function setDefaultNodeValidat(node, retData) {
|
75
76
|
//const item = JSON.parse(JSON.stringify(node));
|
76
|
-
if (!
|
77
|
+
if (!retData) return;
|
77
78
|
//const node = detailData.length > 0 ? detailData : syncData
|
78
79
|
const functionData = node.events.filter((ev) => {
|
79
80
|
return ev.action === EventAction.Function
|
80
81
|
});
|
81
82
|
const dataValue = functionData[0]
|
82
|
-
if (functionData.length
|
83
|
-
node.data.map((d) => {
|
83
|
+
if (functionData.length && dataValue.value && retData) {
|
84
|
+
if(node.data && node.data.length) node.data.map((d) => {
|
84
85
|
const {kpiData, tagData} = retData;
|
85
86
|
const key = d.key;
|
86
87
|
const value = d.value;
|
@@ -98,7 +99,13 @@ export function setDefaultNodeValidat(node, retData) {
|
|
98
99
|
// console.log('定制函数=====')
|
99
100
|
try {
|
100
101
|
const func = new Function('pen', 'params', dataValue.value);
|
101
|
-
func(node, JSON.stringify(retData));
|
102
|
+
const funcData = func(node, JSON.stringify(retData));
|
103
|
+
/**
|
104
|
+
* 此方式在九所的 服务器状态监测功能中用到
|
105
|
+
* 全局报警标记,代表正在访问的这个topology文件中是否有告警发生
|
106
|
+
* 需要注意:自定义函数中要通过 return {monitorAlarm: boolean}的格式将元件告警状态返回
|
107
|
+
*/
|
108
|
+
if(funcData && funcData.monitorAlarm && commonStore[node.TID]) commonStore[node.TID].monitorAlarm = true;
|
102
109
|
}catch (e) {
|
103
110
|
console.log(`自定义函数出错>>>`,);
|
104
111
|
console.log(`目标元件:${node.id}>>>`,);
|
@@ -106,7 +113,8 @@ export function setDefaultNodeValidat(node, retData) {
|
|
106
113
|
}
|
107
114
|
} else {
|
108
115
|
// console.log('默认函数')
|
109
|
-
setConfItemNode(node, retData);
|
116
|
+
const newData = setConfItemNode(node, retData);
|
117
|
+
if(newData && newData.monitorAlarm && commonStore[node.TID]) commonStore[node.TID].monitorAlarm = true;
|
110
118
|
}
|
111
119
|
if (node.animateFrames && node.animateFrames.length) {
|
112
120
|
for (var _a = 0, _af = node.animateFrames; _a < _af.length; _a++) {
|
@@ -117,22 +125,44 @@ export function setDefaultNodeValidat(node, retData) {
|
|
117
125
|
}
|
118
126
|
//return node;
|
119
127
|
}
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
128
|
+
|
129
|
+
/**
|
130
|
+
* 配置与元件关联的tag数据
|
131
|
+
* @param node 元件节点数据
|
132
|
+
*/
|
133
|
+
export function setConnectionTagForConf(node) {
|
134
|
+
if(!node.tags || node.tags && !node.tags.length) return;
|
135
|
+
let setType = '';
|
136
|
+
node.tags.map((t) => {
|
137
|
+
if(t === 'statisticType' || t.includes('switchTabType')) setType = 'tab';
|
138
|
+
if(t.includes('selectOption')) setType = 'selectShow';
|
139
|
+
});
|
140
|
+
const isTabs = node.events && node.events.find((ev) => ev.action === 8);
|
141
|
+
if(!setType && isTabs) console.log('>>>未能找到绑定的标签数据,请检查绑定的Tabs标签是否包含switchTabType前缀>>>');
|
142
|
+
if(setType === 'tab'){
|
143
|
+
// tab切换
|
144
|
+
const tagData = node.tags[0];
|
145
|
+
let topologyChangeData = commonStore[node.TID].switchTabDataPool;
|
146
|
+
let keyName = node.bindStaticId ? `${tagData}Data` : `${tagData}AreaData`;
|
147
|
+
if (!topologyChangeData[keyName]) topologyChangeData[keyName] = {};
|
148
|
+
topologyChangeData[keyName][node.id] = node;
|
149
|
+
}
|
150
|
+
if(setType === 'selectShow'){
|
151
|
+
// 下拉显示隐藏
|
152
|
+
const tagData = node.tags[0].split('-');
|
153
|
+
const parentId = tagData[1] && tagData[1].trim();
|
154
|
+
if(!parentId) return console.log('>>>请检查select节点ID是否设置正确【selectOption+其他任意字符-下拉元件ID】>>>');
|
155
|
+
if(parentId) {
|
156
|
+
const params = {
|
157
|
+
TID: node.TID,
|
158
|
+
id: node.id,
|
159
|
+
name: node.name,
|
160
|
+
order: node.order,
|
161
|
+
visible: node.visible,
|
162
|
+
tag: node.tags[0].trim()
|
135
163
|
}
|
164
|
+
if(!commonStore[node.TID].selectTabDataPool[parentId]) commonStore[node.TID].selectTabDataPool[parentId] = new Map();
|
165
|
+
commonStore[node.TID].selectTabDataPool[parentId].set(node.id, params);
|
136
166
|
}
|
137
167
|
}
|
138
168
|
}
|
@@ -1,4 +1,6 @@
|
|
1
1
|
// @ts-ignore
|
2
|
+
export declare const echartsStaticType: Array<string> = [];
|
3
|
+
// @ts-ignore
|
2
4
|
export declare const winEventActionFns: Array<string> = [];
|
3
5
|
export interface MoveDataType {
|
4
6
|
None?: string | number;
|
@@ -38,7 +40,8 @@ export interface AnimateType {
|
|
38
40
|
}
|
39
41
|
export interface SelectStaticType {
|
40
42
|
static?:number;
|
41
|
-
|
43
|
+
dataShow?:number;
|
44
|
+
visible?:number;
|
42
45
|
}
|
43
46
|
export const moveDataType: MoveDataType;
|
44
47
|
export const downDataType: DownDataType;
|
@@ -1,3 +1,4 @@
|
|
1
|
+
export const echartsStaticType = ['DAY', 'WEEK', 'MONTH', 'YEAR', 'REALTIME'];
|
1
2
|
export const winEventActionFns = ['Link', 'DoAnimate', 'DoFn', 'DoWindowFn', 'openImg'];
|
2
3
|
export const moveDataType = {
|
3
4
|
None: 0,
|
@@ -37,5 +38,6 @@ export const animateType = {
|
|
37
38
|
};
|
38
39
|
export const selectStaticType = {
|
39
40
|
static: 1,
|
40
|
-
|
41
|
+
dataShow: 2,
|
42
|
+
visible: 3
|
41
43
|
};
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import {Node} from "../models";
|
2
|
-
|
2
|
+
export declare function tabStaticOperation(type: string, node: Node, areaData: any, params: object): void;
|
3
|
+
export declare function tabHideShowOperation(node: any, areaData: any): void;
|
3
4
|
export declare function getEchartsRealData(node: {}, data: []): void;
|
4
|
-
export declare function setInitConfData(data: object): void;
|
5
|
+
export declare function setInitConfData(id: string, data: object): void;
|
5
6
|
export declare function setTagIdData(data: any): [];
|
6
7
|
export declare function setKpiAddrData(data: any): [];
|
7
8
|
export declare function setAssetIdData(data: any): [];
|
@@ -1,18 +1,64 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
|
4
|
-
selectRealDataPool,
|
5
|
-
echartsDataPool,
|
6
|
-
selectDataPool
|
7
|
-
} from "../../../store";
|
1
|
+
import {commonStore} from '../store';
|
2
|
+
import {setElementSwitchTabState} from '../element';
|
3
|
+
import {echartsStaticType} from '../utils';
|
8
4
|
|
5
|
+
/**
|
6
|
+
* Tab 数据统计
|
7
|
+
* @param type 统计类型
|
8
|
+
* @param node 元件数据
|
9
|
+
* @param areaData tab展示区域数据
|
10
|
+
* @param params Tab 切换选中参数
|
11
|
+
*/
|
12
|
+
export function tabStaticOperation(type, node, areaData, params) {
|
13
|
+
if(!node.bindStaticId || !(echartsStaticType.includes(type) || type === 'OTHER')) return;
|
14
|
+
const curentEchart = areaData && areaData[node.bindStaticId]; // 获取当前点中的节点绑定的统计图表数据
|
15
|
+
if(!curentEchart || !curentEchart.data.params) return console.log('未能找到匹配的echarts图表>>>');
|
16
|
+
const currentStore = commonStore[node.TID];
|
17
|
+
const echartNode = currentStore.data.pens[curentEchart.order]; // 获取tab 绑定的图表元件数据
|
18
|
+
if(type === 'OTHER') {
|
19
|
+
const tabCorrelationType = currentStore.echartsDataPool[node.bindStaticId].tabCorrelationType; // 获取select与tab关联的标识
|
20
|
+
const optionNode = currentStore.echartsOptionsPool[node.bindStaticId];
|
21
|
+
if(tabCorrelationType === 'select') {
|
22
|
+
// tab类型为包含在select下的切换则执行下面的逻辑
|
23
|
+
echartNode.data.params['tabVisitOrder'] = params.order;
|
24
|
+
}else {
|
25
|
+
// 非 年、月、日、周、实时类型的切换
|
26
|
+
const groupData = currentStore.selectRealDataPool[node.bindStaticId];
|
27
|
+
if (optionNode) currentStore.echartsRealDataPool[optionNode.data.id] = currentStore.echartsRealDataPool[groupData[params.order].id];
|
28
|
+
}
|
29
|
+
if(optionNode) optionNode.data.tabData = {
|
30
|
+
type,
|
31
|
+
data: params.data
|
32
|
+
};
|
33
|
+
}
|
34
|
+
echartNode.data.params['staticForType'] = type
|
35
|
+
echartNode.elementRendered = false;
|
36
|
+
}
|
37
|
+
/**
|
38
|
+
* Tab 显示/隐藏切换
|
39
|
+
* @param node tab页签数据
|
40
|
+
* @param areaData // tab展示区域数据
|
41
|
+
*/
|
42
|
+
export function tabHideShowOperation(node, areaData) {
|
43
|
+
const confIds = node.bindStaticId && node.bindStaticId.split(',') || [];
|
44
|
+
const pens = commonStore[node.TID].data.pens;
|
45
|
+
for (let i = 0; i < confIds.length; i++) {
|
46
|
+
const confid = confIds[i];
|
47
|
+
const areaNode = areaData[confid];
|
48
|
+
if(!(areaNode && pens[areaNode.order])) return;
|
49
|
+
const tagNode = pens[areaNode.order];
|
50
|
+
tagNode.visible = !(node.id !== node.id);
|
51
|
+
setElementSwitchTabState(tagNode);
|
52
|
+
}
|
53
|
+
}
|
9
54
|
/**
|
10
55
|
* 获取echarts和select实时数据
|
11
56
|
* @param node 节点
|
12
57
|
* @param data 实时数据
|
13
58
|
*/
|
14
59
|
export function getEchartsRealData(node, data){
|
15
|
-
|
60
|
+
const currentStore = commonStore[node.TID];
|
61
|
+
if(!currentStore.selectRealDataPool[node.id]) {
|
16
62
|
const selectData = [];
|
17
63
|
let currentData = null;
|
18
64
|
data.map((item, index) => {
|
@@ -21,23 +67,23 @@ export function getEchartsRealData(node, data){
|
|
21
67
|
id: item.id,
|
22
68
|
name: item.aliasName
|
23
69
|
});
|
24
|
-
echartsRealDataPool[item.id] = item;
|
70
|
+
currentStore.echartsRealDataPool[item.id] = item;
|
25
71
|
});
|
26
|
-
echartsRealDataPool[node.id] = currentData;
|
27
|
-
selectRealDataPool[node.id] = selectData;
|
72
|
+
currentStore.echartsRealDataPool[node.id] = currentData;
|
73
|
+
currentStore.selectRealDataPool[node.id] = selectData;
|
28
74
|
}else {
|
29
|
-
const selectId = echartsDataPool[node.id] && echartsDataPool[node.id].bindId;
|
30
|
-
const selected = selectId && selectDataPool[selectId] && selectDataPool[selectId].node.selected;
|
75
|
+
const selectId = currentStore.echartsDataPool[node.id] && currentStore.echartsDataPool[node.id].bindId;
|
76
|
+
const selected = selectId && currentStore.selectDataPool[selectId] && currentStore.selectDataPool[selectId].node.selected;
|
31
77
|
if(selected && selected.id) {
|
32
78
|
// 如有选中的数据
|
33
|
-
echartsRealDataPool[node.id] = echartsRealDataPool[selected.id];
|
79
|
+
currentStore.echartsRealDataPool[node.id] = currentStore.echartsRealDataPool[selected.id];
|
34
80
|
}else {
|
35
|
-
echartsRealDataPool[node.id] = data[0];
|
81
|
+
currentStore.echartsRealDataPool[node.id] = data[0];
|
36
82
|
}
|
37
83
|
}
|
38
84
|
}
|
39
|
-
export function setInitConfData(data){
|
40
|
-
if(
|
85
|
+
export function setInitConfData(id, data){
|
86
|
+
if(commonStore[id].initConfNode[data.id]) return;
|
41
87
|
const bindMqttNode = data.events.find((ev) => {return ev.type === 3});
|
42
88
|
if(!bindMqttNode) return;
|
43
89
|
const initNode = {
|
@@ -51,7 +97,7 @@ export function setInitConfData(data){
|
|
51
97
|
leakageStart: data.leakageStart
|
52
98
|
}
|
53
99
|
if(data.name === 'echarts') initNode.data = data.data;
|
54
|
-
|
100
|
+
commonStore[id].initConfNode[data.id] = initNode;
|
55
101
|
}
|
56
102
|
export function setTagIdData(data) {
|
57
103
|
return [{
|
@@ -111,7 +157,7 @@ export function setVarValueData(data) {
|
|
111
157
|
export function setThreeCategoryIdData(pen, data) {
|
112
158
|
let params = [];
|
113
159
|
const hasThreeCategoryId = pen.data.find((tc) => {
|
114
|
-
return tc.key === 'threeCategoryId' && tc.value
|
160
|
+
return tc.key === 'threeCategoryId' && tc.value === data.threeCategoryId;
|
115
161
|
});
|
116
162
|
if(!hasThreeCategoryId) params = [{
|
117
163
|
"key": "threeCategoryId",
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import {Node} from '../models';
|
2
2
|
|
3
|
-
export declare function setEventListener(e: Event, node: Node): any;
|
3
|
+
export declare function setEventListener(e: Event, TID: string, node: Node): any;
|
4
4
|
export declare function mousMoveFun(type: string, data: any): object;
|
5
5
|
export declare function mousDownFun(type: string, eventNode: object): object;
|
6
6
|
export declare function omouseEventPrototDoWindowFn(eventNode: object, node: object): string;
|
@@ -1,20 +1,19 @@
|
|
1
1
|
import { ptInPolyXY } from './math';
|
2
2
|
import { moveDataType, downDataType } from './construction';
|
3
3
|
import { Node } from '../models';
|
4
|
-
import {elementInteractivePoor} from '../../../store';
|
5
4
|
import {elementType} from "../../../static";
|
6
5
|
import {getSelectedData} from '../element';
|
6
|
+
import {commonStore} from "../store";
|
7
7
|
// 配置鼠标事件监听 监听样式 documentDefine
|
8
8
|
// 凡是类名为documentDefine的Dom元素都自动注册下面的监听
|
9
|
-
export function setEventListener(e) {
|
9
|
+
export function setEventListener(e, TID) {
|
10
10
|
e.preventDefault();
|
11
11
|
const documentDefine = document.querySelector('.documentDefine');
|
12
12
|
if(!documentDefine) return;
|
13
|
-
const currentNode = elementInteractivePoor.node; // 当前点击的元件节点数据
|
13
|
+
const currentNode = commonStore[TID].elementInteractivePoor.node; // 当前点击的元件节点数据
|
14
14
|
if(currentNode && currentNode.name === elementType.select) {
|
15
15
|
// select 下拉 option选中操作
|
16
16
|
getSelectedData(e, currentNode);
|
17
|
-
//Store.set(`${currentNode.TID}-LT:render`, true);
|
18
17
|
}
|
19
18
|
}
|
20
19
|
// 执行window函数
|
@@ -75,7 +74,7 @@ export function mousDownFun(type, eventNode) {
|
|
75
74
|
params.eventType = downDataType.Tabswitch; // Tab切换
|
76
75
|
}else if(action === 11) {
|
77
76
|
params.eventType = downDataType.Formselect; // select下拉切换
|
78
|
-
params.staticType = eventNode.dcimStaticForType; // 1: 数据统计;2
|
77
|
+
params.staticType = eventNode.dcimStaticForType; // 1: 数据统计;2:数据展示;3:显示隐藏
|
79
78
|
}else {
|
80
79
|
// action === 5 远程控制比较特殊,无论是否绑定远程控制事件,只要数据中有远程控制属性且值为0都会认定为远程控制
|
81
80
|
params.eventType = downDataType.Target; // 链接跳转
|
@@ -1,7 +1,2 @@
|
|
1
|
-
export declare function
|
2
|
-
export declare function
|
3
|
-
export declare function getParams(data: []): void;
|
4
|
-
export declare function filterParams(node: any): void;
|
5
|
-
export declare function getTagIdsForKpiAddrs(data: []): void;
|
6
|
-
export declare function getVarValueIdsForVarData(data: []): void;
|
7
|
-
export declare function renderForAssetPoperties(asset: any, data: []): void;
|
1
|
+
export declare function getParams(id: string, data: []): void;
|
2
|
+
export declare function filterParams(node: any): void;
|
package/core/src/utils/params.js
CHANGED
@@ -1,46 +1,18 @@
|
|
1
|
-
import {
|
2
|
-
export function categoryDataParams(data) {
|
3
|
-
clearMqttParams();
|
4
|
-
getParams(data);
|
5
|
-
}
|
6
|
-
export function setParams(assetId) {
|
7
|
-
const params = {
|
8
|
-
tagIds: syncMqttData.params.tagIds.join(","),
|
9
|
-
assetIds: syncMqttData.params.assetIds.join(","),
|
10
|
-
areaIds: syncMqttData.params.areaIds.join(","),
|
11
|
-
routingkey: syncMqttData.params.routingkey,
|
12
|
-
echart: syncMqttData.params.tagEcharts.join(","),
|
13
|
-
echartData: syncMqttData.params.echartData
|
14
|
-
}
|
15
|
-
if (syncMqttData.params.echartAssemblyData && syncMqttData.params.echartAssemblyData.length) {
|
16
|
-
params.echartAssemblyData = syncMqttData.params.echartAssemblyData;
|
17
|
-
}
|
18
|
-
if(assetId) {
|
19
|
-
params.varValueIds = syncMqttData.params.varVaule.join(",");
|
20
|
-
}else {
|
21
|
-
if(syncMqttData.params.assetIds.length && syncMqttData.params.varVaule.length) {
|
22
|
-
const assetId = syncMqttData.params.assetIds[syncMqttData.params.assetIds.length -1];
|
23
|
-
for(let va = 0; va < syncMqttData.params.varVaule.length; va++) {
|
24
|
-
syncMqttData.params.varVaule[va] = `${assetId}_${syncMqttData.params.varVaule[va]}`;
|
25
|
-
}
|
26
|
-
params.varValueIds = syncMqttData.params.varVaule.join(",");
|
27
|
-
}else {
|
28
|
-
params.varVaule = syncMqttData.params.varVaule.join(",");
|
29
|
-
}
|
30
|
-
}
|
31
|
-
return params;
|
32
|
-
}
|
1
|
+
import {commonStore} from '../store';
|
33
2
|
// 获取绑定数据的参数
|
34
|
-
export function getParams(data) {
|
3
|
+
export function getParams(id, data) {
|
35
4
|
data.map((item) => {
|
36
|
-
filterParams(item);
|
5
|
+
filterParams(id, item);
|
37
6
|
if (item.children && item.children.length) {
|
38
|
-
getParams(item.children);
|
7
|
+
getParams(id, item.children);
|
8
|
+
}
|
9
|
+
if (item.formData && item.formData.detailPageData && item.formData.detailPageData.pens && item.formData.detailPageData.pens.length) {
|
10
|
+
getParams(id, item.formData.detailPageData.pens);
|
39
11
|
}
|
40
12
|
});
|
41
13
|
}
|
42
14
|
// 过滤出参数
|
43
|
-
export function filterParams(node) {
|
15
|
+
export function filterParams(id, node) {
|
44
16
|
let tagIds = [];
|
45
17
|
let kpiAddrs = [];
|
46
18
|
let assetIds = [];
|
@@ -48,7 +20,13 @@ export function filterParams(node) {
|
|
48
20
|
let tagEcharts = [];
|
49
21
|
let echartData = [];
|
50
22
|
let varVaule = [];
|
51
|
-
let
|
23
|
+
let doorIds = [];
|
24
|
+
let isMqttEventType = false;
|
25
|
+
node.events.map((ev) => {
|
26
|
+
if(ev.value && ev.value === 'entranceGuard') doorIds.push(ev.params); // 门禁参数
|
27
|
+
if(ev.type === 3) isMqttEventType = true;
|
28
|
+
});
|
29
|
+
if(doorIds.length) commonStore[id].mqttParams.doorIds = [...commonStore[id].mqttParams.doorIds, ...doorIds];
|
52
30
|
if(!isMqttEventType) return;
|
53
31
|
if (node.data && Array.isArray(node.data) && node.data.length) {
|
54
32
|
node.data.map((item) => {
|
@@ -72,54 +50,11 @@ export function filterParams(node) {
|
|
72
50
|
if (node.data && Object.prototype.toString.call(node.data) === '[object Object]' && node.data.params && node.data.params.id) {
|
73
51
|
echartData.push(node.data.params.id);
|
74
52
|
}
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
}
|
83
|
-
// 根据指标地址数据获取测点数据
|
84
|
-
export function getTagIdsForKpiAddrs(data) {
|
85
|
-
let tagIds = [];
|
86
|
-
if (data && data.length > 0) {
|
87
|
-
data.map((item) => {
|
88
|
-
tagIds.push(item.tagId);
|
89
|
-
})
|
90
|
-
// syncMqttData.params.detailAssetData = data;
|
91
|
-
}
|
92
|
-
syncMqttData.params.tagIds = tagIds;
|
93
|
-
syncMqttData.params.echartAssemblyData = data.echartAssemblyData;
|
94
|
-
}
|
95
|
-
// 获取绑定值类型参数
|
96
|
-
export function getVarValueIdsForVarData(data) {
|
97
|
-
const ids = [];
|
98
|
-
if(data && data.length) {
|
99
|
-
data.map((item) => {
|
100
|
-
if(item.varVal) ids.push(item.assetVarIds);
|
101
|
-
})
|
102
|
-
}
|
103
|
-
syncMqttData.params.varVaule = ids;
|
104
|
-
}
|
105
|
-
// 固定资产详情数据赋值
|
106
|
-
export function renderForAssetPoperties(asset, data) {
|
107
|
-
if(!(asset && Object.keys(asset).length)) return;
|
108
|
-
data.map((node) => {
|
109
|
-
if (node.data && Array.isArray(node.data) && node.data.length) {
|
110
|
-
node.data.map((item) => {
|
111
|
-
if (item.key === 'assetKey' && asset[item.value]) {
|
112
|
-
if (['imgUrl', 'principleImg'].includes(item.value)) {
|
113
|
-
node.text = '';
|
114
|
-
node.image = `${syncMqttData.params.pathRewrite}${asset[item.value]}`;
|
115
|
-
} else {
|
116
|
-
node.text = asset[item.value];
|
117
|
-
}
|
118
|
-
}
|
119
|
-
})
|
120
|
-
}
|
121
|
-
if (node.children && node.children.length) {
|
122
|
-
renderForAssetPoperties(asset, node.children);
|
123
|
-
}
|
124
|
-
});
|
53
|
+
commonStore[id].mqttParams.tagIds = [...commonStore[id].mqttParams.tagIds, ...tagIds];
|
54
|
+
commonStore[id].mqttParams.kpiAddrs = [...commonStore[id].mqttParams.kpiAddrs, ...kpiAddrs];
|
55
|
+
commonStore[id].mqttParams.assetIds = [...commonStore[id].mqttParams.assetIds, ...assetIds];
|
56
|
+
commonStore[id].mqttParams.areaIds = [...commonStore[id].mqttParams.areaIds, ...areaIds];
|
57
|
+
commonStore[id].mqttParams.varVaule = [...commonStore[id].mqttParams.varVaule, ...varVaule];
|
58
|
+
commonStore[id].mqttParams.tagEcharts = [...commonStore[id].mqttParams.tagEcharts, ...tagEcharts];
|
59
|
+
commonStore[id].mqttParams.echartData = [...commonStore[id].mqttParams.echartData, ...echartData];
|
125
60
|
}
|
@@ -1,5 +1,7 @@
|
|
1
1
|
// 源码版写法
|
2
2
|
import { registerNode } from '../core'
|
3
|
+
import { formOverflow } from '../core/src/middles/nodes/formoverflow'
|
4
|
+
|
3
5
|
|
4
6
|
// 组件版写法和bundle一致
|
5
7
|
// window.Le5leTopology.registerNode
|
@@ -191,6 +193,7 @@ export function registerMyShape() {
|
|
191
193
|
registerNode('electricFan', electricFan);
|
192
194
|
registerNode('pool', pool);
|
193
195
|
registerNode('thermometer', thermometer);
|
196
|
+
registerNode('formOverflow', formOverflow);
|
194
197
|
}
|
195
198
|
|
196
199
|
// src\views\data.ts 里面加载到工具栏,第一个就是此自定义图形库
|
package/package.json
CHANGED
package/store/actions.js
CHANGED
@@ -1,17 +1 @@
|
|
1
|
-
|
2
|
-
export const elementInteractivePoor = {};
|
3
|
-
// echarts
|
4
|
-
export const echartsDataPool = {}; // echarts Dom节点数据
|
5
|
-
export const echartsOptionsPool = {}; // echarts options节点数据
|
6
|
-
export const echartsRealDataPool = {}; // echarts 实时数据
|
7
|
-
|
8
|
-
// tabs
|
9
|
-
export const switchTabDataPool = {};
|
10
|
-
|
11
|
-
// form
|
12
|
-
export const tableDataPool = {};
|
13
|
-
export const selectDataPool = {};
|
14
|
-
export const selectRealDataPool = {};
|
15
|
-
|
16
|
-
// iframe
|
17
|
-
export const iframeDataPool = {};
|
1
|
+
export const plugsPool = {};
|
package/store/clear.js
CHANGED
@@ -1,66 +1,4 @@
|
|
1
|
-
import {
|
2
|
-
echartsDataPool,
|
3
|
-
echartsOptionsPool,
|
4
|
-
echartsRealDataPool,
|
5
|
-
switchTabDataPool,
|
6
|
-
tableDataPool,
|
7
|
-
selectDataPool,
|
8
|
-
elementInteractivePoor,
|
9
|
-
selectRealDataPool,
|
10
|
-
iframeDataPool
|
11
|
-
} from './actions';
|
12
1
|
import {setEventListener} from "../core";
|
13
|
-
|
14
|
-
export const clearDataPool = function (){
|
15
|
-
for (let [key, node] of Object.entries(echartsDataPool)) {
|
16
|
-
if(node) {
|
17
|
-
clearInterval(node.timeTicket);
|
18
|
-
if(node.chart) {
|
19
|
-
node.chart.off('mouseover');
|
20
|
-
node.chart.off('mouseout');
|
21
|
-
node.chart.dispose();
|
22
|
-
}
|
23
|
-
if(node.div && node.div.parentNode) node.div.parentNode.removeChild(node.div);
|
24
|
-
}
|
25
|
-
delete echartsDataPool[key];
|
26
|
-
}
|
27
|
-
for (let key of Object.keys(echartsOptionsPool)) {
|
28
|
-
delete echartsOptionsPool[key];
|
29
|
-
}
|
30
|
-
for (let key of Object.keys(echartsRealDataPool)) {
|
31
|
-
delete echartsRealDataPool[key];
|
32
|
-
}
|
33
|
-
for (let key of Object.keys(switchTabDataPool)) {
|
34
|
-
delete switchTabDataPool[key];
|
35
|
-
}
|
36
|
-
for (let key of Object.keys(tableDataPool)) {
|
37
|
-
delete tableDataPool[key];
|
38
|
-
}
|
39
|
-
if(Object.keys(selectDataPool).length) {
|
40
|
-
let dropdownEle = null,
|
41
|
-
dropdownListEle = null;
|
42
|
-
for (let [key, node] of Object.entries(selectDataPool)) {
|
43
|
-
if(!dropdownEle) {
|
44
|
-
dropdownEle = node.dom.selectDropdown;
|
45
|
-
dropdownListEle = node.dom.selectDropdownUl;
|
46
|
-
}
|
47
|
-
if(node.dom.selectEle && node.dom.selectEle.parentNode) node.dom.selectEle.parentNode.removeChild(node.dom.selectEle);
|
48
|
-
delete selectDataPool[key];
|
49
|
-
}
|
50
|
-
if(dropdownEle) dropdownEle.style.display = 'none';
|
51
|
-
if(dropdownListEle) dropdownListEle.innerHTML = '';
|
52
|
-
}
|
53
|
-
for (let key of Object.keys(elementInteractivePoor)) {
|
54
|
-
delete elementInteractivePoor[key];
|
55
|
-
}
|
56
|
-
for (let key of Object.keys(selectRealDataPool)) {
|
57
|
-
delete selectRealDataPool[key];
|
58
|
-
}
|
59
|
-
for (let [key, node] of Object.entries(iframeDataPool)) {
|
60
|
-
node.iframe.parentNode.removeChild(node.iframe);
|
61
|
-
delete iframeDataPool[key];
|
62
|
-
}
|
63
|
-
}
|
64
2
|
export const removeAllElement = function (){
|
65
3
|
const documentDefineEle = document.querySelectorAll('.documentDefine');
|
66
4
|
if(documentDefineEle) {
|
package/core/src/poll.js
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
// 轮询
|
2
|
-
var POLL = /** @class */ (function () {
|
3
|
-
function POLL(data, message, val) {
|
4
|
-
this.data = data;
|
5
|
-
this.client = message;
|
6
|
-
this.val = val;
|
7
|
-
this.init();
|
8
|
-
};
|
9
|
-
POLL.prototype.init = function () {
|
10
|
-
let topics = ''
|
11
|
-
this.getPen(this.data.pens, topics, JSON.stringify(this.client))
|
12
|
-
};
|
13
|
-
POLL.prototype.getPen = function (pens, topics, message) {
|
14
|
-
const _this = this;
|
15
|
-
pens.forEach((pen)=>{
|
16
|
-
if(pen.children != undefined){
|
17
|
-
_this.getPen(pen.children, topics, message)
|
18
|
-
}else{
|
19
|
-
var item = pen;
|
20
|
-
for (var _b = 0, _c = item.events; _b < _c.length; _b++) {
|
21
|
-
var event_1 = _c[_b];
|
22
|
-
// if (event_1.type === EventType.Poll) {
|
23
|
-
if ((event_1.type ===3 && this.val === 'Mqtt') || (event_1.type ===4 && this.val === 'Poll')
|
24
|
-
|| (event_1.type ===5 && this.val === 'Poll1') || (event_1.type ===6 && this.val === 'Poll2')) {
|
25
|
-
event_1.name = topics;
|
26
|
-
if(message){
|
27
|
-
item.doSocketMqtt(event_1, message.toString());
|
28
|
-
}
|
29
|
-
}
|
30
|
-
}
|
31
|
-
}
|
32
|
-
})
|
33
|
-
};
|
34
|
-
return POLL;
|
35
|
-
}());
|
36
|
-
export { POLL };
|
37
|
-
//# sourceMappingURL=mqtt.js.map
|
File without changes
|