dcim-topology2d 1.1.6 → 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 +88 -96
- package/chart-diagram/src/register.js +3 -3
- package/chart-diagram/src/utils/changeOptions.d.ts +7 -4
- package/chart-diagram/src/utils/changeOptions.js +228 -144
- package/chart-diagram/src/utils/conversion.d.ts +12 -12
- package/chart-diagram/src/utils/conversion.js +263 -137
- package/chart-diagram/src/utils/render.d.ts +6 -0
- package/chart-diagram/src/utils/render.js +124 -0
- package/core/index.d.ts +1 -0
- package/core/index.js +1 -0
- package/core/src/activeLayer.js +0 -6
- package/core/src/canvas.js +1 -0
- package/core/src/common.d.ts +1 -2
- package/core/src/common.js +197 -541
- package/core/src/core.js +116 -60
- package/core/src/divLayer.d.ts +0 -3
- package/core/src/divLayer.js +13 -34
- package/core/src/element/common.d.ts +5 -0
- package/core/src/element/common.js +52 -0
- package/core/src/element/iframe.d.ts +3 -0
- package/core/src/element/iframe.js +12 -0
- package/core/src/element/index.d.ts +4 -0
- package/core/src/element/index.js +4 -0
- package/core/src/element/select.d.ts +11 -0
- package/core/src/element/select.js +234 -0
- package/core/src/element/tab.d.ts +1 -0
- package/core/src/element/tab.js +19 -0
- package/core/src/healps/changeData.d.ts +1 -2
- package/core/src/healps/changeData.js +33 -125
- package/core/src/middles/default.js +3 -1
- package/core/src/middles/nodes/arbitrarygraph.js +11 -9
- package/core/src/middles/nodes/formselect.d.ts +2 -0
- package/core/src/middles/nodes/formselect.js +87 -0
- package/core/src/middles/nodes/iframe.js +21 -4
- package/core/src/middles/nodes/index.d.ts +1 -0
- package/core/src/middles/nodes/index.js +1 -0
- package/core/src/models/node.d.ts +4 -0
- package/core/src/models/node.js +24 -22
- package/core/src/models/pen.js +3 -52
- package/core/src/models/rect.js +2 -2
- package/core/src/options.d.ts +2 -0
- package/core/src/options.js +2 -1
- package/core/src/preview.js +51 -32
- package/core/src/renderLayer.d.ts +10 -6
- package/core/src/renderLayer.js +36 -43
- package/core/src/store/data.d.ts +71 -21
- package/core/src/store/data.js +93 -17
- package/core/src/utils/assignment.d.ts +6 -3
- package/core/src/utils/assignment.js +120 -21
- package/core/src/utils/construction.d.ts +10 -3
- package/core/src/utils/construction.js +7 -1
- package/core/src/utils/conversion.d.ts +3 -0
- package/core/src/utils/conversion.js +62 -1
- package/core/src/utils/index.d.ts +1 -1
- package/core/src/utils/index.js +1 -1
- package/core/src/utils/math.d.ts +1 -0
- package/core/src/utils/math.js +3 -0
- package/core/src/utils/onmousevent.d.ts +3 -0
- package/core/src/utils/onmousevent.js +27 -7
- package/core/src/utils/params.d.ts +2 -0
- package/core/src/utils/params.js +57 -0
- package/myShape-diagram/index.js +196 -0
- package/package.json +1 -1
- package/static/echartsDefaultData.js +27 -107
- package/static/element.js +14 -0
- package/static/form.js +11 -0
- package/static/index.js +2 -1
- package/store/actions.js +1 -0
- package/store/clear.js +10 -0
- package/store/index.js +2 -0
- package/style/common.css +18 -0
- package/style/editor.css +13 -0
- package/style/index.css +3 -12
- package/style/select.css +143 -0
- package/core/src/poll.js +0 -37
- package/core/src/utils/dom.d.ts +0 -9
- package/core/src/utils/dom.js +0 -103
- package/core/src/utils/dom.js.map +0 -1
- package/myShape-diagram/myShape.js +0 -196
- package/static/echartsStore.js +0 -14
- /package/myShape-diagram/{myShape.ts → index.ts} +0 -0
package/core/src/store/data.d.ts
CHANGED
@@ -28,29 +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
|
43
|
-
|
44
|
-
ratio?: number;
|
45
|
-
scaleX?: number;
|
46
|
-
scaleY?: number;
|
47
|
-
},
|
69
|
+
monitorAlarm?:boolean; // 全局报警标记,代表正在访问的这个topology文件中是否有告警发生
|
48
70
|
parentElem: HTMLElement
|
49
71
|
}
|
50
|
-
export interface mqttData {
|
51
|
-
data: null
|
52
|
-
}
|
53
|
-
export const syncMqttData: mqttData;
|
54
72
|
// @ts-ignore
|
55
73
|
export const createStore = () => {
|
56
74
|
return {
|
@@ -68,17 +86,38 @@ export const createStore = () => {
|
|
68
86
|
},
|
69
87
|
dataConstruct: {}
|
70
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
|
+
},
|
71
104
|
pens: {},
|
72
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
|
73
116
|
emitter: mitt(),
|
74
117
|
cacheDatas: [],
|
75
118
|
dpiRatio: 1,
|
76
119
|
lastScale: 1,
|
77
|
-
|
78
|
-
ratio: 1,
|
79
|
-
scaleX: 1,
|
80
|
-
scaleY: 1
|
81
|
-
},
|
120
|
+
monitorAlarm: false,
|
82
121
|
parentElem: null
|
83
122
|
} as visualization2DStore;
|
84
123
|
};
|
@@ -91,9 +130,9 @@ export const useStore = (id = 'default'): visualization2DStore => {
|
|
91
130
|
}
|
92
131
|
return commonStore[id];
|
93
132
|
};
|
94
|
-
|
133
|
+
export declare function clearElementDataPool(data: {}): void;
|
95
134
|
// @ts-ignore
|
96
|
-
export const clearStore = (store: visualization2DStore) => {
|
135
|
+
export const clearStore = (store: visualization2DStore, del: string) => {
|
97
136
|
store.data = {
|
98
137
|
bkColor: '',
|
99
138
|
bkImage: '',
|
@@ -115,15 +154,26 @@ export const clearStore = (store: visualization2DStore) => {
|
|
115
154
|
},
|
116
155
|
dataConstruct: {}
|
117
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
|
+
};
|
118
172
|
store.lastScale = store.data.scale;
|
119
173
|
store.pens = {};
|
120
174
|
store.options = {};
|
121
175
|
store.cacheDatas = [];
|
122
176
|
store.dpiRatio = 1;
|
123
177
|
store.lastScale = 1;
|
124
|
-
store.
|
125
|
-
ratio: 1,
|
126
|
-
scaleX: 1,
|
127
|
-
scaleY: 1
|
128
|
-
}
|
178
|
+
store.monitorAlarm = false;
|
129
179
|
};
|
package/core/src/store/data.js
CHANGED
@@ -13,10 +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
|
-
|
18
|
-
data: null
|
19
|
-
}
|
16
|
+
import {commonStore} from './common'
|
17
|
+
import {removeAllElement} from '../../../store';
|
20
18
|
export var createStore = function () {
|
21
19
|
return {
|
22
20
|
id: '',
|
@@ -34,17 +32,38 @@ export var createStore = function () {
|
|
34
32
|
},
|
35
33
|
dataConstruct: {}
|
36
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
|
+
},
|
37
50
|
pens: {},
|
38
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
|
39
62
|
emitter: mitt(),
|
40
63
|
cacheDatas: [],
|
41
64
|
dpiRatio: 1,
|
42
65
|
lastScale: 1,
|
43
|
-
|
44
|
-
ratio: 1,
|
45
|
-
scaleX: 1,
|
46
|
-
scaleY: 1
|
47
|
-
},
|
66
|
+
monitorAlarm: false,// 全局报警标记,代表正在访问的这个topology文件中是否有告警发生
|
48
67
|
parentElem: null
|
49
68
|
};
|
50
69
|
};
|
@@ -56,6 +75,39 @@ export var useStore = function (id) {
|
|
56
75
|
}
|
57
76
|
return commonStore[id];
|
58
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
|
+
}
|
59
111
|
export var clearStore = function (store, del) {
|
60
112
|
store.lastScale = store.data.scale;
|
61
113
|
store.data = {
|
@@ -72,15 +124,39 @@ export var clearStore = function (store, del) {
|
|
72
124
|
},
|
73
125
|
dataConstruct: {}
|
74
126
|
};
|
75
|
-
store.
|
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
|
+
};
|
141
|
+
store.pens = {}; // 先保留,后期优化提取变量用
|
76
142
|
store.cacheDatas = [];
|
77
143
|
store.dpiRatio = 1;
|
78
144
|
store.lastScale = 1;
|
79
|
-
store.
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
};
|
84
|
-
|
85
|
-
|
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
|
+
});
|
158
|
+
if(del) {
|
159
|
+
delete commonStore[store.id];
|
160
|
+
removeAllElement();
|
161
|
+
}
|
86
162
|
};
|
@@ -1,3 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
export declare function
|
1
|
+
import {Node} from '../models';
|
2
|
+
|
3
|
+
export declare function setInitNodeDataValidat(node: any, TID: string, type: string, order: number): void;
|
4
|
+
export declare function initDefaultValidat(node: any, retData: any): void;
|
5
|
+
export declare function setDefaultNodeValidat(node: any, retData: any): any;
|
6
|
+
export declare function setConnectionTagForConf(node: Node): void;
|
@@ -1,38 +1,87 @@
|
|
1
1
|
// 变量赋值操作
|
2
|
-
import {
|
2
|
+
import {commonStore} from '../store';
|
3
3
|
import { setConfItemNode } from '../healps';
|
4
4
|
import { EventAction } from '../models';
|
5
|
-
|
6
|
-
|
5
|
+
|
6
|
+
/**
|
7
|
+
* 在节点注册前初始化node数据
|
8
|
+
* @param node 节点数据
|
9
|
+
* @param TID 数据键
|
10
|
+
* @param type topology类型
|
11
|
+
* @param order 节点序列
|
12
|
+
*/
|
13
|
+
export function setInitNodeDataValidat(node, TID, type, order) {
|
14
|
+
|
15
|
+
const syncData = commonStore[TID].mqttData;
|
16
|
+
|
17
|
+
node.TID = TID;
|
18
|
+
|
19
|
+
node.visibleSwitch = type === 'topology' && node.visibleSwitch;
|
20
|
+
|
21
|
+
if(typeof order === "number") node.order = order;
|
22
|
+
if(type !== 'topology') node.selectDropdown = false;
|
23
|
+
|
24
|
+
initDefaultValidat(node, syncData);
|
25
|
+
|
26
|
+
setDefaultNodeValidat(node, syncData);
|
27
|
+
|
7
28
|
if (node.children && node.children.length) {
|
29
|
+
|
8
30
|
node.children.map((_item) => {
|
9
|
-
|
10
|
-
|
11
|
-
|
31
|
+
|
32
|
+
setInitNodeDataValidat(_item, TID, type);
|
33
|
+
|
12
34
|
})
|
13
|
-
|
14
|
-
node.TID = TID;
|
15
|
-
setDefaultColorValidat(node);
|
16
|
-
setDefaultNodeValidat(node, syncData);
|
35
|
+
|
17
36
|
}
|
18
37
|
}
|
19
|
-
|
38
|
+
// 初始化默认节点值
|
39
|
+
export function initDefaultValidat(node, retData) {
|
20
40
|
node.defaultFillStyle = node.fillStyle;
|
21
41
|
node.defaultFontColor = node.font.color;
|
22
42
|
if (node.name === 'line') {
|
23
|
-
node.defaultStrokeStyle = node.
|
43
|
+
node.defaultStrokeStyle = node.strokeStyle;
|
44
|
+
}
|
45
|
+
// 变量类型数据展示,不需要实时更新
|
46
|
+
if(Array.isArray(node.data) && retData && retData.varData) {
|
47
|
+
let typeName = '';
|
48
|
+
let imgs = '';
|
49
|
+
const varData = retData.varData;
|
50
|
+
node.data.map((vd) => {
|
51
|
+
if(vd.key.includes('varValue') && varData[vd.value]){
|
52
|
+
const varNode = varData[vd.value];
|
53
|
+
const showType = varNode.showType ? parseInt(varNode.showType) : 1;
|
54
|
+
if(showType === 1 && varNode.value) typeName += typeName ? `,${varNode.value}` : varNode.value;
|
55
|
+
if(showType === 2 && varNode.value) console.log('显示图标>>>');
|
56
|
+
if(showType === 3 && varNode.value) imgs = `/dcim-api${varNode.value}`; //imgs += imgs ? `,${varData.value}` : varData.value;
|
57
|
+
}
|
58
|
+
});
|
59
|
+
if(typeName) node.text = typeName;
|
60
|
+
if(imgs) {
|
61
|
+
node.text = '';
|
62
|
+
node.image = imgs;
|
63
|
+
node.paddingBottom = 0;
|
64
|
+
node.paddingBottomNum = 0;
|
65
|
+
node.paddingLeft = 0;
|
66
|
+
node.paddingLeftNum = 0;
|
67
|
+
node.paddingRight = 0;
|
68
|
+
node.paddingRightNum = 0;
|
69
|
+
node.paddingTop = 0;
|
70
|
+
node.paddingTopNum = 0;
|
71
|
+
}
|
24
72
|
}
|
25
73
|
}
|
74
|
+
// 初始化mqtt实时值
|
26
75
|
export function setDefaultNodeValidat(node, retData) {
|
27
76
|
//const item = JSON.parse(JSON.stringify(node));
|
28
|
-
if (!
|
77
|
+
if (!retData) return;
|
29
78
|
//const node = detailData.length > 0 ? detailData : syncData
|
30
79
|
const functionData = node.events.filter((ev) => {
|
31
80
|
return ev.action === EventAction.Function
|
32
|
-
})
|
81
|
+
});
|
33
82
|
const dataValue = functionData[0]
|
34
|
-
if (functionData.length
|
35
|
-
node.data.map((d) => {
|
83
|
+
if (functionData.length && dataValue.value && retData) {
|
84
|
+
if(node.data && node.data.length) node.data.map((d) => {
|
36
85
|
const {kpiData, tagData} = retData;
|
37
86
|
const key = d.key;
|
38
87
|
const value = d.value;
|
@@ -49,14 +98,23 @@ export function setDefaultNodeValidat(node, retData) {
|
|
49
98
|
})
|
50
99
|
// console.log('定制函数=====')
|
51
100
|
try {
|
52
|
-
const func = new Function('pen', 'params', dataValue.value)
|
53
|
-
func(node, JSON.stringify(retData))
|
101
|
+
const func = new Function('pen', 'params', dataValue.value);
|
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;
|
54
109
|
}catch (e) {
|
55
|
-
console.log(
|
110
|
+
console.log(`自定义函数出错>>>`,);
|
111
|
+
console.log(`目标元件:${node.id}>>>`,);
|
112
|
+
console.log(`目标元件方位:X->${node.rect.x},Y->${node.rect.y}>>>`,);
|
56
113
|
}
|
57
114
|
} else {
|
58
115
|
// console.log('默认函数')
|
59
|
-
setConfItemNode(node, retData);
|
116
|
+
const newData = setConfItemNode(node, retData);
|
117
|
+
if(newData && newData.monitorAlarm) commonStore[node.TID].monitorAlarm = true;
|
60
118
|
}
|
61
119
|
if (node.animateFrames && node.animateFrames.length) {
|
62
120
|
for (var _a = 0, _af = node.animateFrames; _a < _af.length; _a++) {
|
@@ -66,4 +124,45 @@ export function setDefaultNodeValidat(node, retData) {
|
|
66
124
|
}
|
67
125
|
}
|
68
126
|
//return node;
|
69
|
-
}
|
127
|
+
}
|
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()
|
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);
|
166
|
+
}
|
167
|
+
}
|
168
|
+
}
|
@@ -12,20 +12,18 @@ export interface MoveDataType {
|
|
12
12
|
HoverAnchors?: string | number;
|
13
13
|
Rotate?: string | number;
|
14
14
|
}
|
15
|
-
export const moveDataType: MoveDataType;
|
16
15
|
export interface DownDataType {
|
17
16
|
Window?: string | number;
|
18
17
|
Target?: string | number;
|
19
18
|
Showhide?: string | number;
|
20
19
|
Tabswitch?: string | number;
|
20
|
+
Formselect?: string | number;
|
21
21
|
}
|
22
|
-
export const downDataType: DownDataType;
|
23
22
|
export interface PreviewType {
|
24
23
|
Dcim?: string;
|
25
24
|
Topology?: string;
|
26
25
|
Logo?: string;
|
27
26
|
}
|
28
|
-
export const previewType: PreviewType;
|
29
27
|
export interface AnimateType {
|
30
28
|
LeftFlow?: string;
|
31
29
|
RightFlow?: string;
|
@@ -38,4 +36,13 @@ export interface AnimateType {
|
|
38
36
|
Show?: string;
|
39
37
|
Rotate?: string;
|
40
38
|
}
|
39
|
+
export interface SelectStaticType {
|
40
|
+
static?:number;
|
41
|
+
dataShow?:number;
|
42
|
+
visible?:number;
|
43
|
+
}
|
44
|
+
export const moveDataType: MoveDataType;
|
45
|
+
export const downDataType: DownDataType;
|
46
|
+
export const previewType: PreviewType;
|
41
47
|
export const animateType: AnimateType;
|
48
|
+
export const selectStaticType: SelectStaticType;
|
@@ -15,7 +15,8 @@ export const downDataType = {
|
|
15
15
|
Window: 'window',
|
16
16
|
Target: 'target',
|
17
17
|
Showhide: 'showhide',
|
18
|
-
Tabswitch: 'Tabswitch'
|
18
|
+
Tabswitch: 'Tabswitch',
|
19
|
+
Formselect: 'Formselect'
|
19
20
|
};
|
20
21
|
export const previewType = {
|
21
22
|
Dcim: 'dcim',
|
@@ -33,4 +34,9 @@ export const animateType = {
|
|
33
34
|
Error: 'error',
|
34
35
|
Show: 'show',
|
35
36
|
Rotate: 'rotate'
|
37
|
+
};
|
38
|
+
export const selectStaticType = {
|
39
|
+
static: 1,
|
40
|
+
dataShow: 2,
|
41
|
+
visible: 3
|
36
42
|
};
|
@@ -1,7 +1,10 @@
|
|
1
1
|
import {Node} from "../models";
|
2
2
|
|
3
|
+
export declare function getEchartsRealData(node: {}, data: []): void;
|
4
|
+
export declare function setInitConfData(id: string, data: object): void;
|
3
5
|
export declare function setTagIdData(data: any): [];
|
4
6
|
export declare function setKpiAddrData(data: any): [];
|
5
7
|
export declare function setAssetIdData(data: any): [];
|
6
8
|
export declare function setAreaIdData(data: any): [];
|
9
|
+
export declare function setVarValueData(data: any): [];
|
7
10
|
export declare function setThreeCategoryIdData(pen: Node, data: any): [];
|
@@ -1,3 +1,52 @@
|
|
1
|
+
import {commonStore} from '../store';
|
2
|
+
/**
|
3
|
+
* 获取echarts和select实时数据
|
4
|
+
* @param node 节点
|
5
|
+
* @param data 实时数据
|
6
|
+
*/
|
7
|
+
export function getEchartsRealData(node, data){
|
8
|
+
const currentStore = commonStore[node.TID];
|
9
|
+
if(!currentStore.selectRealDataPool[node.id]) {
|
10
|
+
const selectData = [];
|
11
|
+
let currentData = null;
|
12
|
+
data.map((item, index) => {
|
13
|
+
if(index === 0) currentData = item;
|
14
|
+
selectData.push({
|
15
|
+
id: item.id,
|
16
|
+
name: item.aliasName
|
17
|
+
});
|
18
|
+
currentStore.echartsRealDataPool[item.id] = item;
|
19
|
+
});
|
20
|
+
currentStore.echartsRealDataPool[node.id] = currentData;
|
21
|
+
currentStore.selectRealDataPool[node.id] = selectData;
|
22
|
+
}else {
|
23
|
+
const selectId = currentStore.echartsDataPool[node.id] && currentStore.echartsDataPool[node.id].bindId;
|
24
|
+
const selected = selectId && currentStore.selectDataPool[selectId] && currentStore.selectDataPool[selectId].node.selected;
|
25
|
+
if(selected && selected.id) {
|
26
|
+
// 如有选中的数据
|
27
|
+
currentStore.echartsRealDataPool[node.id] = currentStore.echartsRealDataPool[selected.id];
|
28
|
+
}else {
|
29
|
+
currentStore.echartsRealDataPool[node.id] = data[0];
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
33
|
+
export function setInitConfData(id, data){
|
34
|
+
if(commonStore[id].initConfNode[data.id]) return;
|
35
|
+
const bindMqttNode = data.events.find((ev) => {return ev.type === 3});
|
36
|
+
if(!bindMqttNode) return;
|
37
|
+
const initNode = {
|
38
|
+
text: data.text,
|
39
|
+
font: data.font,
|
40
|
+
strokeStyle: data.strokeStyle,
|
41
|
+
fillStyle: data.fillStyle,
|
42
|
+
image: data.image,
|
43
|
+
leakageEnd: data.leakageEnd,
|
44
|
+
leakageFillStyle: data.leakageFillStyle,
|
45
|
+
leakageStart: data.leakageStart
|
46
|
+
}
|
47
|
+
if(data.name === 'echarts') initNode.data = data.data;
|
48
|
+
commonStore[id].initConfNode[data.id] = initNode;
|
49
|
+
}
|
1
50
|
export function setTagIdData(data) {
|
2
51
|
return [{
|
3
52
|
"key": "tagId",
|
@@ -41,10 +90,22 @@ export function setAreaIdData(data) {
|
|
41
90
|
"value": data.name
|
42
91
|
}];
|
43
92
|
}
|
93
|
+
export function setVarValueData(data) {
|
94
|
+
return [{
|
95
|
+
"key": "varId",
|
96
|
+
"value": data.id
|
97
|
+
},{
|
98
|
+
"key": "varValue",
|
99
|
+
"value": data.value
|
100
|
+
}, {
|
101
|
+
"key": "变量类型名称",
|
102
|
+
"value": data.name
|
103
|
+
}];
|
104
|
+
}
|
44
105
|
export function setThreeCategoryIdData(pen, data) {
|
45
106
|
let params = [];
|
46
107
|
const hasThreeCategoryId = pen.data.find((tc) => {
|
47
|
-
return tc.key === 'threeCategoryId' && tc.value
|
108
|
+
return tc.key === 'threeCategoryId' && tc.value === data.threeCategoryId;
|
48
109
|
});
|
49
110
|
if(!hasThreeCategoryId) params = [{
|
50
111
|
"key": "threeCategoryId",
|
@@ -1,5 +1,4 @@
|
|
1
1
|
export * from './canvas';
|
2
|
-
export * from './dom';
|
3
2
|
export * from './math';
|
4
3
|
export * from './rect';
|
5
4
|
export * from './uuid';
|
@@ -8,3 +7,4 @@ export * from './construction';
|
|
8
7
|
export * from './onmousevent';
|
9
8
|
export * from './conversion';
|
10
9
|
export * from './assignment';
|
10
|
+
export * from './params';
|
package/core/src/utils/index.js
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
export * from './canvas';
|
2
|
-
export * from './dom';
|
3
2
|
export * from './math';
|
4
3
|
export * from './rect';
|
5
4
|
export * from './uuid';
|
@@ -8,4 +7,5 @@ export * from './construction';
|
|
8
7
|
export * from './onmousevent';
|
9
8
|
export * from './conversion';
|
10
9
|
export * from './assignment';
|
10
|
+
export * from './params';
|
11
11
|
//# sourceMappingURL=index.js.map
|
package/core/src/utils/math.d.ts
CHANGED
package/core/src/utils/math.js
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
import {Node} from '../models';
|
2
|
+
|
3
|
+
export declare function setEventListener(e: Event, TID: string, node: Node): any;
|
1
4
|
export declare function mousMoveFun(type: string, data: any): object;
|
2
5
|
export declare function mousDownFun(type: string, eventNode: object): object;
|
3
6
|
export declare function omouseEventPrototDoWindowFn(eventNode: object, node: object): string;
|