dcim-topology2d 2.0.2 → 2.0.5
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 +6 -6
- 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 +56 -0
- package/chart-diagram/src/utils/conversion.js +22 -37
- package/chart-diagram/src/utils/render.d.ts +1 -0
- package/chart-diagram/src/utils/render.js +17 -0
- package/core/src/common.js +81 -8
- package/core/src/core.js +58 -17
- package/core/src/divLayer.js +1 -1
- package/core/src/element/select.d.ts +2 -2
- package/core/src/element/select.js +92 -57
- package/core/src/element/tab.js +7 -10
- package/core/src/healps/changeData.js +20 -6
- package/core/src/middles/nodes/formselect.js +26 -12
- package/core/src/middles/nodes/iframe.js +5 -5
- package/core/src/models/pen.js +2 -50
- package/core/src/options.d.ts +1 -0
- package/core/src/options.js +2 -1
- package/core/src/preview.js +6 -1
- package/core/src/store/data.d.ts +70 -19
- package/core/src/store/data.js +88 -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 +2 -1
- package/core/src/utils/construction.js +2 -1
- package/core/src/utils/conversion.d.ts +1 -1
- package/core/src/utils/conversion.js +14 -20
- 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 +19 -87
- package/myShape-diagram/index.js +196 -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.js +0 -196
- /package/myShape-diagram/{myShape.ts → index.ts} +0 -0
package/core/src/store/data.d.ts
CHANGED
@@ -28,38 +28,47 @@ export interface visualization2DData {
|
|
28
28
|
data?: any;
|
29
29
|
bkImageRect?: any;
|
30
30
|
}
|
31
|
+
export interface paramsData {
|
32
|
+
doorIds?: [],
|
33
|
+
tagIds?: [],
|
34
|
+
kpiAddrs?: [],
|
35
|
+
tagEcharts?: [],
|
36
|
+
assetIds?: [],
|
37
|
+
areaIds?: [],
|
38
|
+
varVaule?: [],
|
39
|
+
echartData?: [],
|
40
|
+
echartAssemblyData?: [],
|
41
|
+
routingkey?: string,
|
42
|
+
pathRewrite?: string
|
43
|
+
}
|
31
44
|
// 2D可视化使用到的数据仓库
|
32
45
|
export interface visualization2DStore {
|
33
46
|
id: string;
|
34
47
|
data: visualization2DData;
|
48
|
+
mqttData?: null; // mqtt实时数据
|
49
|
+
initConfNode: {}; // 初始化元件节点数据
|
50
|
+
mqttParams: paramsData; // mqtt参数
|
35
51
|
pens: { [key: string]: Pen };
|
36
52
|
options: Options;
|
37
53
|
cacheDatas?: {
|
38
54
|
data: visualization2DData;
|
39
55
|
}[];
|
56
|
+
elementInteractivePoor: {}; // element 交互过渡数据
|
57
|
+
echartsDataPool: {}; // echarts Dom节点数据
|
58
|
+
echartsOptionsPool: {}; // echarts options节点数据
|
59
|
+
echartsRealDataPool: {}; // echarts 实时数据
|
60
|
+
switchTabDataPool: {}; // tabs
|
61
|
+
tableDataPool: {}; // form table
|
62
|
+
selectDataPool: {}; // form select
|
63
|
+
selectRealDataPool: {}; // form select
|
64
|
+
selectTabDataPool: {}; // form select
|
65
|
+
iframeDataPool: {}; // iframe
|
40
66
|
emitter: Emitter;
|
41
67
|
dpiRatio?: number;
|
42
68
|
lastScale?: number; //记录上次模版的scale
|
69
|
+
monitorAlarm?:boolean; // 全局报警标记,代表正在访问的这个topology文件中是否有告警发生
|
43
70
|
parentElem: HTMLElement
|
44
71
|
}
|
45
|
-
export interface mqttData {
|
46
|
-
data: null,
|
47
|
-
initData: {},
|
48
|
-
params: {
|
49
|
-
tagIds?: [],
|
50
|
-
kpiAddrs?: [],
|
51
|
-
tagEcharts?: [],
|
52
|
-
assetIds?: [],
|
53
|
-
areaIds?: [],
|
54
|
-
varVaule?: [],
|
55
|
-
echartData?: [],
|
56
|
-
echartAssemblyData?: [],
|
57
|
-
routingkey?: string,
|
58
|
-
pathRewrite?: string
|
59
|
-
}
|
60
|
-
}
|
61
|
-
export const syncMqttData: mqttData;
|
62
|
-
export declare function clearMqttParams(): void;
|
63
72
|
// @ts-ignore
|
64
73
|
export const createStore = () => {
|
65
74
|
return {
|
@@ -77,12 +86,38 @@ export const createStore = () => {
|
|
77
86
|
},
|
78
87
|
dataConstruct: {}
|
79
88
|
},
|
89
|
+
mqttData: null,
|
90
|
+
initConfNode: {},
|
91
|
+
mqttParams: {
|
92
|
+
doorIds: [],
|
93
|
+
tagIds: [],
|
94
|
+
kpiAddrs: [],
|
95
|
+
tagEcharts: [],
|
96
|
+
assetIds: [],
|
97
|
+
areaIds: [],
|
98
|
+
varVaule: [],
|
99
|
+
echartData: [],
|
100
|
+
echartAssemblyData: [],
|
101
|
+
routingkey: '',
|
102
|
+
pathRewrite: ''
|
103
|
+
},
|
80
104
|
pens: {},
|
81
105
|
options: { ...DefalutOptions },
|
106
|
+
elementInteractivePoor: {}, // element 交互过渡数据
|
107
|
+
echartsDataPool: {}, // echarts Dom节点数据
|
108
|
+
echartsOptionsPool: {}, // echarts options节点数据
|
109
|
+
echartsRealDataPool: {}, // echarts 实时数据
|
110
|
+
switchTabDataPool: {}, // tabs
|
111
|
+
tableDataPool: {}, // form table
|
112
|
+
selectDataPool: {}, // form select
|
113
|
+
selectRealDataPool: {}, // form select
|
114
|
+
selectTabDataPool: {}, // form select
|
115
|
+
iframeDataPool: {}, // iframe
|
82
116
|
emitter: mitt(),
|
83
117
|
cacheDatas: [],
|
84
118
|
dpiRatio: 1,
|
85
119
|
lastScale: 1,
|
120
|
+
monitorAlarm: false,
|
86
121
|
parentElem: null
|
87
122
|
} as visualization2DStore;
|
88
123
|
};
|
@@ -95,7 +130,7 @@ export const useStore = (id = 'default'): visualization2DStore => {
|
|
95
130
|
}
|
96
131
|
return commonStore[id];
|
97
132
|
};
|
98
|
-
|
133
|
+
export declare function clearElementDataPool(data: {}): void;
|
99
134
|
// @ts-ignore
|
100
135
|
export const clearStore = (store: visualization2DStore, del: string) => {
|
101
136
|
store.data = {
|
@@ -119,10 +154,26 @@ export const clearStore = (store: visualization2DStore, del: string) => {
|
|
119
154
|
},
|
120
155
|
dataConstruct: {}
|
121
156
|
};
|
157
|
+
store.mqttData = null;
|
158
|
+
store.initConfNode = {};
|
159
|
+
store.mqttParams = {
|
160
|
+
doorIds: [],
|
161
|
+
tagIds: [],
|
162
|
+
kpiAddrs: [],
|
163
|
+
tagEcharts: [],
|
164
|
+
assetIds: [],
|
165
|
+
areaIds: [],
|
166
|
+
varVaule: [],
|
167
|
+
echartData: [],
|
168
|
+
echartAssemblyData: [],
|
169
|
+
routingkey: '',
|
170
|
+
pathRewrite: ''
|
171
|
+
};
|
122
172
|
store.lastScale = store.data.scale;
|
123
173
|
store.pens = {};
|
124
174
|
store.options = {};
|
125
175
|
store.cacheDatas = [];
|
126
176
|
store.dpiRatio = 1;
|
127
177
|
store.lastScale = 1;
|
178
|
+
store.monitorAlarm = false;
|
128
179
|
};
|
package/core/src/store/data.js
CHANGED
@@ -13,36 +13,8 @@ import { default as mitt } from 'mitt';
|
|
13
13
|
import { Lock } from '../models';
|
14
14
|
import {DefalutOptions} from '../options';
|
15
15
|
import {s8} from '../utils';
|
16
|
-
import {
|
17
|
-
import {
|
18
|
-
export const syncMqttData = {
|
19
|
-
data: null, // 实时值
|
20
|
-
initData: {}, // 初始值
|
21
|
-
params: {
|
22
|
-
tagIds: [],
|
23
|
-
kpiAddrs: [],
|
24
|
-
tagEcharts: [],
|
25
|
-
assetIds: [],
|
26
|
-
areaIds: [],
|
27
|
-
varVaule: [],
|
28
|
-
echartData: [],
|
29
|
-
echartAssemblyData: [],
|
30
|
-
routingkey: '',
|
31
|
-
pathRewrite: ''
|
32
|
-
}
|
33
|
-
}
|
34
|
-
export const clearMqttParams = function () {
|
35
|
-
syncMqttData.params.tagIds = [];
|
36
|
-
syncMqttData.params.kpiAddrs = [];
|
37
|
-
syncMqttData.params.tagEcharts = [];
|
38
|
-
syncMqttData.params.assetIds = [];
|
39
|
-
syncMqttData.params.areaIds = [];
|
40
|
-
syncMqttData.params.varVaule = [];
|
41
|
-
syncMqttData.params.echartData = [];//统计图表组件类型ID
|
42
|
-
syncMqttData.params.echartAssemblyData = [];//统计图表组件类型ID
|
43
|
-
syncMqttData.params.routingkey = '';
|
44
|
-
syncMqttData.params.pathRewrite = '';
|
45
|
-
}
|
16
|
+
import {commonStore} from './common'
|
17
|
+
import {removeAllElement} from '../../../store';
|
46
18
|
export var createStore = function () {
|
47
19
|
return {
|
48
20
|
id: '',
|
@@ -60,12 +32,38 @@ export var createStore = function () {
|
|
60
32
|
},
|
61
33
|
dataConstruct: {}
|
62
34
|
},
|
35
|
+
mqttData: null,
|
36
|
+
initConfNode: {},
|
37
|
+
mqttParams: {
|
38
|
+
doorIds: [],
|
39
|
+
tagIds: [],
|
40
|
+
kpiAddrs: [],
|
41
|
+
tagEcharts: [],
|
42
|
+
assetIds: [],
|
43
|
+
areaIds: [],
|
44
|
+
varVaule: [],
|
45
|
+
echartData: [],
|
46
|
+
echartAssemblyData: [],
|
47
|
+
routingkey: '',
|
48
|
+
pathRewrite: ''
|
49
|
+
},
|
63
50
|
pens: {},
|
64
51
|
options: { ...DefalutOptions },
|
52
|
+
elementInteractivePoor: {}, // element 交互过渡数据
|
53
|
+
echartsDataPool: {}, // echarts Dom节点数据
|
54
|
+
echartsOptionsPool: {}, // echarts options节点数据
|
55
|
+
echartsRealDataPool: {}, // echarts 实时数据
|
56
|
+
switchTabDataPool: {}, // tabs
|
57
|
+
tableDataPool: {}, // form table
|
58
|
+
selectDataPool: {}, // form select
|
59
|
+
selectRealDataPool: {}, // form select
|
60
|
+
selectTabDataPool: {}, // form select
|
61
|
+
iframeDataPool: {}, // iframe
|
65
62
|
emitter: mitt(),
|
66
63
|
cacheDatas: [],
|
67
64
|
dpiRatio: 1,
|
68
65
|
lastScale: 1,
|
66
|
+
monitorAlarm: false,// 全局报警标记,代表正在访问的这个topology文件中是否有告警发生
|
69
67
|
parentElem: null
|
70
68
|
};
|
71
69
|
};
|
@@ -77,6 +75,39 @@ export var useStore = function (id) {
|
|
77
75
|
}
|
78
76
|
return commonStore[id];
|
79
77
|
};
|
78
|
+
export function clearElementDataPool(data) {
|
79
|
+
const { echartsDataPool, selectDataPool, iframeDataPool} = data;
|
80
|
+
for (let [key, node] of Object.entries(echartsDataPool)) {
|
81
|
+
if(node) {
|
82
|
+
clearInterval(node.timeTicket);
|
83
|
+
if(node.chart) {
|
84
|
+
node.chart.off('mouseover');
|
85
|
+
node.chart.off('mouseout');
|
86
|
+
node.chart.dispose();
|
87
|
+
}
|
88
|
+
if(node.div && node.div.parentNode) node.div.parentNode.removeChild(node.div);
|
89
|
+
}
|
90
|
+
delete data.echartsDataPool[key];
|
91
|
+
}
|
92
|
+
if(Object.keys(selectDataPool).length) {
|
93
|
+
let dropdownEle = null,
|
94
|
+
dropdownListEle = null;
|
95
|
+
for (let [key, node] of Object.entries(selectDataPool)) {
|
96
|
+
if(!dropdownEle) {
|
97
|
+
dropdownEle = node.dom.selectDropdown;
|
98
|
+
dropdownListEle = node.dom.selectDropdownUl;
|
99
|
+
}
|
100
|
+
if(node.dom.selectEle && node.dom.selectEle.parentNode) node.dom.selectEle.parentNode.removeChild(node.dom.selectEle);
|
101
|
+
delete data.selectDataPool[key];
|
102
|
+
}
|
103
|
+
if(dropdownEle) dropdownEle.style.display = 'none';
|
104
|
+
if(dropdownListEle) dropdownListEle.innerHTML = '';
|
105
|
+
}
|
106
|
+
for (let [key, node] of Object.entries(iframeDataPool)) {
|
107
|
+
node.iframe.parentNode.removeChild(node.iframe);
|
108
|
+
delete data.iframeDataPool[key];
|
109
|
+
}
|
110
|
+
}
|
80
111
|
export var clearStore = function (store, del) {
|
81
112
|
store.lastScale = store.data.scale;
|
82
113
|
store.data = {
|
@@ -93,15 +124,38 @@ export var clearStore = function (store, del) {
|
|
93
124
|
},
|
94
125
|
dataConstruct: {}
|
95
126
|
};
|
127
|
+
store.initConfNode = {};
|
128
|
+
store.mqttParams = {
|
129
|
+
doorIds: [],
|
130
|
+
tagIds: [],
|
131
|
+
kpiAddrs: [],
|
132
|
+
tagEcharts: [],
|
133
|
+
assetIds: [],
|
134
|
+
areaIds: [],
|
135
|
+
varVaule: [],
|
136
|
+
echartData: [],
|
137
|
+
echartAssemblyData: [],
|
138
|
+
routingkey: '',
|
139
|
+
pathRewrite: ''
|
140
|
+
};
|
96
141
|
store.pens = {}; // 先保留,后期优化提取变量用
|
97
142
|
store.cacheDatas = [];
|
98
143
|
store.dpiRatio = 1;
|
99
144
|
store.lastScale = 1;
|
100
|
-
|
145
|
+
store.monitorAlarm = false;
|
146
|
+
store.elementInteractivePoor = {};
|
147
|
+
store.echartsOptionsPool = {};
|
148
|
+
store.echartsRealDataPool = {};
|
149
|
+
store.switchTabDataPool = {};
|
150
|
+
store.tableDataPool = {};
|
151
|
+
store.selectRealDataPool = {};
|
152
|
+
store.selectTabDataPool = {};
|
153
|
+
clearElementDataPool({
|
154
|
+
echartsDataPool: store.echartsDataPool,
|
155
|
+
selectDataPool: store.selectDataPool,
|
156
|
+
iframeDataPool: store.iframeDataPool,
|
157
|
+
});
|
101
158
|
if(del) {
|
102
|
-
syncMqttData.data = null;
|
103
|
-
syncMqttData.initData = {};
|
104
|
-
clearMqttParams();
|
105
159
|
delete commonStore[store.id];
|
106
160
|
removeAllElement();
|
107
161
|
}
|
@@ -3,4 +3,4 @@ import {Node} from '../models';
|
|
3
3
|
export declare function setInitNodeDataValidat(node: any, TID: string, type: string, order: number): void;
|
4
4
|
export declare function initDefaultValidat(node: any, retData: any): void;
|
5
5
|
export declare function setDefaultNodeValidat(node: any, retData: any): any;
|
6
|
-
export declare function
|
6
|
+
export declare function setConnectionTagForConf(node: Node): void;
|
@@ -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].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].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,7 +1,7 @@
|
|
1
1
|
import {Node} from "../models";
|
2
2
|
|
3
3
|
export declare function getEchartsRealData(node: {}, data: []): void;
|
4
|
-
export declare function setInitConfData(data: object): void;
|
4
|
+
export declare function setInitConfData(id: string, data: object): void;
|
5
5
|
export declare function setTagIdData(data: any): [];
|
6
6
|
export declare function setKpiAddrData(data: any): [];
|
7
7
|
export declare function setAssetIdData(data: any): [];
|
@@ -1,18 +1,12 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
echartsRealDataPool,
|
4
|
-
selectRealDataPool,
|
5
|
-
echartsDataPool,
|
6
|
-
selectDataPool
|
7
|
-
} from "../../../store";
|
8
|
-
|
1
|
+
import {commonStore} from '../store';
|
9
2
|
/**
|
10
3
|
* 获取echarts和select实时数据
|
11
4
|
* @param node 节点
|
12
5
|
* @param data 实时数据
|
13
6
|
*/
|
14
7
|
export function getEchartsRealData(node, data){
|
15
|
-
|
8
|
+
const currentStore = commonStore[node.TID];
|
9
|
+
if(!currentStore.selectRealDataPool[node.id]) {
|
16
10
|
const selectData = [];
|
17
11
|
let currentData = null;
|
18
12
|
data.map((item, index) => {
|
@@ -21,23 +15,23 @@ export function getEchartsRealData(node, data){
|
|
21
15
|
id: item.id,
|
22
16
|
name: item.aliasName
|
23
17
|
});
|
24
|
-
echartsRealDataPool[item.id] = item;
|
18
|
+
currentStore.echartsRealDataPool[item.id] = item;
|
25
19
|
});
|
26
|
-
echartsRealDataPool[node.id] = currentData;
|
27
|
-
selectRealDataPool[node.id] = selectData;
|
20
|
+
currentStore.echartsRealDataPool[node.id] = currentData;
|
21
|
+
currentStore.selectRealDataPool[node.id] = selectData;
|
28
22
|
}else {
|
29
|
-
const selectId = echartsDataPool[node.id] && echartsDataPool[node.id].bindId;
|
30
|
-
const selected = selectId && selectDataPool[selectId] && selectDataPool[selectId].node.selected;
|
23
|
+
const selectId = currentStore.echartsDataPool[node.id] && currentStore.echartsDataPool[node.id].bindId;
|
24
|
+
const selected = selectId && currentStore.selectDataPool[selectId] && currentStore.selectDataPool[selectId].node.selected;
|
31
25
|
if(selected && selected.id) {
|
32
26
|
// 如有选中的数据
|
33
|
-
echartsRealDataPool[node.id] = echartsRealDataPool[selected.id];
|
27
|
+
currentStore.echartsRealDataPool[node.id] = currentStore.echartsRealDataPool[selected.id];
|
34
28
|
}else {
|
35
|
-
echartsRealDataPool[node.id] = data[0];
|
29
|
+
currentStore.echartsRealDataPool[node.id] = data[0];
|
36
30
|
}
|
37
31
|
}
|
38
32
|
}
|
39
|
-
export function setInitConfData(data){
|
40
|
-
if(
|
33
|
+
export function setInitConfData(id, data){
|
34
|
+
if(commonStore[id].initConfNode[data.id]) return;
|
41
35
|
const bindMqttNode = data.events.find((ev) => {return ev.type === 3});
|
42
36
|
if(!bindMqttNode) return;
|
43
37
|
const initNode = {
|
@@ -51,7 +45,7 @@ export function setInitConfData(data){
|
|
51
45
|
leakageStart: data.leakageStart
|
52
46
|
}
|
53
47
|
if(data.name === 'echarts') initNode.data = data.data;
|
54
|
-
|
48
|
+
commonStore[id].initConfNode[data.id] = initNode;
|
55
49
|
}
|
56
50
|
export function setTagIdData(data) {
|
57
51
|
return [{
|
@@ -111,7 +105,7 @@ export function setVarValueData(data) {
|
|
111
105
|
export function setThreeCategoryIdData(pen, data) {
|
112
106
|
let params = [];
|
113
107
|
const hasThreeCategoryId = pen.data.find((tc) => {
|
114
|
-
return tc.key === 'threeCategoryId' && tc.value
|
108
|
+
return tc.key === 'threeCategoryId' && tc.value === data.threeCategoryId;
|
115
109
|
});
|
116
110
|
if(!hasThreeCategoryId) params = [{
|
117
111
|
"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;
|