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
package/core/src/core.js
CHANGED
@@ -28,7 +28,7 @@ import {
|
|
28
28
|
setAreaIdData,
|
29
29
|
setVarValueData,
|
30
30
|
setThreeCategoryIdData,
|
31
|
-
|
31
|
+
setConnectionTagForConf
|
32
32
|
} from './utils';
|
33
33
|
import {setSelectElementPosition} from './element';
|
34
34
|
import {elementType} from '../../static';
|
@@ -999,8 +999,10 @@ var Topology = (function (_super) {
|
|
999
999
|
if (this.store.data.scale !== 1) {
|
1000
1000
|
node.scale(this.store.data.scale);
|
1001
1001
|
}
|
1002
|
+
node.visibleSwitch = true;
|
1003
|
+
node.order = this.store.data.pens.length;
|
1002
1004
|
this.store.data.pens.push(node);
|
1003
|
-
|
1005
|
+
setConnectionTagForConf(node);
|
1004
1006
|
if (focus) {
|
1005
1007
|
this.render();
|
1006
1008
|
this.animate(true);
|
@@ -1105,7 +1107,7 @@ var Topology = (function (_super) {
|
|
1105
1107
|
}
|
1106
1108
|
}
|
1107
1109
|
}
|
1108
|
-
// In active pen.
|
1110
|
+
// In active pen.
|
1109
1111
|
if (!this.store.data.locked) {
|
1110
1112
|
for (var _i = 0, _a = this.activeLayer.pens; _i < _a.length; _i++) {
|
1111
1113
|
var item = _a[_i];
|
@@ -1130,13 +1132,15 @@ var Topology = (function (_super) {
|
|
1130
1132
|
this.divLayer.canvas.style.cursor = 'default';
|
1131
1133
|
var len = this.store.data.pens.length;
|
1132
1134
|
for (var i = len - 1; i > -1; --i) {
|
1133
|
-
if
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1135
|
+
if(this.store.data.pens[i].visible || this.store.data.pens[i].visibleSwitch){
|
1136
|
+
if (this.store.data.pens[i].type === PenType.Node &&
|
1137
|
+
this.inNode(pt, this.store.data.pens[i])) {
|
1138
|
+
return;
|
1139
|
+
} else if (this.store.data.pens[i].type === PenType.Line &&
|
1140
|
+
this.inLine(pt, this.store.data.pens[i])) {
|
1141
|
+
// 需要优先判断十分在节点锚点上
|
1142
|
+
// return;
|
1143
|
+
}
|
1140
1144
|
}
|
1141
1145
|
}
|
1142
1146
|
};
|
@@ -1706,9 +1710,10 @@ var Topology = (function (_super) {
|
|
1706
1710
|
}
|
1707
1711
|
pen.controlPoints = controlPoints;
|
1708
1712
|
}
|
1713
|
+
pen.order = this.store.data.pens.length;
|
1709
1714
|
this.store.data.pens.push(pen);
|
1710
1715
|
this.activeLayer.add(pen);
|
1711
|
-
|
1716
|
+
setConnectionTagForConf(pen);
|
1712
1717
|
}
|
1713
1718
|
this.render();
|
1714
1719
|
this.animate(true);
|
@@ -1924,6 +1929,8 @@ var Topology = (function (_super) {
|
|
1924
1929
|
paddingTop: 0,
|
1925
1930
|
paddingBottom: 0,
|
1926
1931
|
strokeStyle: 'transparent',
|
1932
|
+
visible: true,
|
1933
|
+
visibleSwitch: true,
|
1927
1934
|
children: [],
|
1928
1935
|
});
|
1929
1936
|
if (temp) {
|
@@ -1934,9 +1941,13 @@ var Topology = (function (_super) {
|
|
1934
1941
|
item.stand = stand;
|
1935
1942
|
item.parentId = node.id;
|
1936
1943
|
item.animatePlay = false;
|
1944
|
+
item.visible = true;
|
1945
|
+
item.visibleSwitch = true;
|
1937
1946
|
item.calcRectInParent(node);
|
1947
|
+
this.deleteSelectTabOptionNode(item);
|
1938
1948
|
node.children.push(item);
|
1939
1949
|
}
|
1950
|
+
node.order = this.store.data.pens.length;
|
1940
1951
|
this.store.data.pens.push(node);
|
1941
1952
|
this.activeLayer.setPens([node]);
|
1942
1953
|
this.dispatch('node', node);
|
@@ -1950,23 +1961,53 @@ var Topology = (function (_super) {
|
|
1950
1961
|
return;
|
1951
1962
|
}
|
1952
1963
|
const nodeChildren = JSON.parse(JSON.stringify(node));
|
1964
|
+
var i = this.findIndex(nodeChildren);
|
1965
|
+
if (i > -1 && nodeChildren.name === 'combine') {
|
1966
|
+
this.store.data.pens.splice(i, 1);
|
1967
|
+
} else {
|
1968
|
+
nodeChildren.children = null;
|
1969
|
+
}
|
1953
1970
|
for (var _i = 0, _a = nodeChildren.children; _i < _a.length; _i++) {
|
1954
1971
|
var item = new Node(_a[_i]);
|
1955
1972
|
item.parentId = undefined;
|
1956
1973
|
item.rectInParent = undefined;
|
1957
1974
|
item.locked = Lock.None;
|
1975
|
+
item.order = this.store.data.pens.length;
|
1976
|
+
this.addSelectTabOptionNode(item);
|
1958
1977
|
this.store.data.pens.push(item);
|
1959
1978
|
}
|
1960
|
-
|
1961
|
-
if (i > -1 && nodeChildren.name === 'combine') {
|
1962
|
-
this.store.data.pens.splice(i, 1);
|
1963
|
-
} else {
|
1964
|
-
nodeChildren.children = null;
|
1965
|
-
}
|
1979
|
+
this.deleteSelectTabOptionNode(nodeChildren);
|
1966
1980
|
this.cache();
|
1967
1981
|
this.activeLayer.clear();
|
1968
1982
|
this.hoverLayer.clear();
|
1969
1983
|
};
|
1984
|
+
Topology.prototype.deleteSelectTabOptionNode = function (node) {
|
1985
|
+
const tagNode = node.tags.find((t) => {return t.includes('selectOption')});
|
1986
|
+
if(tagNode){
|
1987
|
+
// 删除下拉节点关联的这个元件
|
1988
|
+
const tagArr = tagNode.split('-');
|
1989
|
+
const parentId = tagArr[1] && tagArr[1].trim();
|
1990
|
+
if(parentId && this.store.selectTabDataPool[parentId].has(node.id)) this.store.selectTabDataPool[parentId].delete(node.id);
|
1991
|
+
}
|
1992
|
+
},
|
1993
|
+
Topology.prototype.addSelectTabOptionNode = function (node) {
|
1994
|
+
const tagNode = node.tags.find((t) => {return t.includes('selectOption')});
|
1995
|
+
if(tagNode){
|
1996
|
+
// 添加下拉节点关联的这个元件
|
1997
|
+
const tagArr = tagNode.split('-');
|
1998
|
+
const parentId = tagArr[1] && tagArr[1].trim();
|
1999
|
+
if(!parentId) return;
|
2000
|
+
const params = {
|
2001
|
+
TID: node.TID,
|
2002
|
+
id: node.id,
|
2003
|
+
name: node.name,
|
2004
|
+
order: node.order,
|
2005
|
+
visible: node.visible,
|
2006
|
+
tag: tagNode
|
2007
|
+
}
|
2008
|
+
this.store.selectTabDataPool[parentId].set(node.id, params);
|
2009
|
+
}
|
2010
|
+
},
|
1970
2011
|
Topology.prototype.find = function (idOrTag, pens) {
|
1971
2012
|
var _this = this;
|
1972
2013
|
if (!pens) {
|
@@ -2299,6 +2340,31 @@ var Topology = (function (_super) {
|
|
2299
2340
|
|
2300
2341
|
return true
|
2301
2342
|
};
|
2343
|
+
Topology.prototype.formOverflowOpen = function (data) {
|
2344
|
+
this.formOverflowConversionData(data);
|
2345
|
+
this.overflowView();
|
2346
|
+
this.render(true);
|
2347
|
+
}
|
2348
|
+
Topology.prototype.overflowView = function (data) {
|
2349
|
+
try {
|
2350
|
+
var rect = this.getRect();
|
2351
|
+
let _a = this.canvas;
|
2352
|
+
if(!_a.width) return;
|
2353
|
+
let width = _a.width, height = _a.height;
|
2354
|
+
let rectWidth = rect.width? (rect.ex + 4) : rect.width
|
2355
|
+
let rectHeight= rect.height? (rect.ey + 4) : rect.height
|
2356
|
+
if (width < rectWidth) {
|
2357
|
+
width = rectWidth;
|
2358
|
+
}
|
2359
|
+
if (height < rectHeight) {
|
2360
|
+
height = rectHeight;
|
2361
|
+
}
|
2362
|
+
this.resize({width: width, height: height});
|
2363
|
+
return rect;
|
2364
|
+
}catch (e){
|
2365
|
+
console.log('-error--------overflowView---',e)
|
2366
|
+
}
|
2367
|
+
}
|
2302
2368
|
return Topology;
|
2303
2369
|
}(Common));
|
2304
2370
|
|
package/core/src/divLayer.js
CHANGED
@@ -76,7 +76,7 @@ var DivLayer = /** @class */ (function (_super) {
|
|
76
76
|
return _this;
|
77
77
|
}
|
78
78
|
DivLayer.prototype.addElement = function (node){
|
79
|
-
if(['iframe', 'echarts'].includes(node.name)) {
|
79
|
+
if(['iframe', 'echarts', 'formOverflow'].includes(node.name)) {
|
80
80
|
this.canvas.parentNode.appendChild(this.elements[node.id]);
|
81
81
|
}else {
|
82
82
|
this.canvas.appendChild(this.elements[node.id]);
|
@@ -97,7 +97,7 @@ var DivLayer = /** @class */ (function (_super) {
|
|
97
97
|
if (item.elementId) {
|
98
98
|
const elementNode = this.elements[item.id];
|
99
99
|
if(elementNode) {
|
100
|
-
|
100
|
+
elementNode.parentNode.removeChild(elementNode);
|
101
101
|
this.elements[item.id] = null;
|
102
102
|
}
|
103
103
|
}
|
@@ -3,9 +3,9 @@ import { Node } from '../models';
|
|
3
3
|
export declare function createSelectElement(node: Node): HTMLDivElement;
|
4
4
|
export declare function createSelectDropdown(node: Node): HTMLDivElement;
|
5
5
|
export declare function createSelectOptions(data: [], node: Node): string;
|
6
|
-
export declare function getSelectedData(e: Event, data: any): void;
|
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:
|
9
|
+
export declare function setSelectDropdownInteractiveState(node: any, staticType: any, type: any): void;
|
10
10
|
export declare function setSelectElementPosition(node: Node, type: string): void;
|
11
11
|
export declare function setSelectElementTheme(node: Node): void;
|
@@ -1,17 +1,15 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
selectDataPool,
|
4
|
-
echartsRealDataPool,
|
5
|
-
echartsOptionsPool
|
6
|
-
} from "../../../store";
|
1
|
+
import {Store} from 'le5le-store';
|
2
|
+
import {commonStore} from "../store";
|
7
3
|
import { setMapDataOptions } from '../../../chart-diagram';
|
8
4
|
import {previewType, selectStaticType} from '../utils';
|
5
|
+
import {setElementSwitchTabState} from './tab';
|
9
6
|
let nodeId = '';
|
10
7
|
let downId = '';
|
11
8
|
// 创建下拉头
|
12
9
|
export function createSelectElement(node) {
|
13
10
|
const selectEle = document.createElement('div');
|
14
|
-
const
|
11
|
+
const order = node.formData.selected && node.formData.selected.order || 0;
|
12
|
+
const inputValue = commonStore[node.TID].selectDataPool[node.id].data[order] && commonStore[node.TID].selectDataPool[node.id].data[order].name;
|
15
13
|
let attrName = 'topology-select-icon-arrow';
|
16
14
|
if(node.selectDropdown) attrName += ' reverse';
|
17
15
|
const children = `<i class="${attrName}"
|
@@ -31,7 +29,7 @@ export function createSelectDropdown(node) {
|
|
31
29
|
const selectDropdownEle = document.createElement('div');
|
32
30
|
let liElements = '';
|
33
31
|
if(node.selectDropdown) {
|
34
|
-
liElements = createSelectOptions(selectDataPool[node.id].data, node);
|
32
|
+
liElements = createSelectOptions(commonStore[node.TID].selectDataPool[node.id].data, node);
|
35
33
|
selectDropdownEle.style.display = 'block';
|
36
34
|
setSelectDropdownPosition(node, selectDropdownEle);
|
37
35
|
}
|
@@ -44,7 +42,7 @@ export function createSelectDropdown(node) {
|
|
44
42
|
}
|
45
43
|
// 创建下拉options列表
|
46
44
|
export function createSelectOptions(data, node) {
|
47
|
-
const selectNode = selectDataPool[node.id];
|
45
|
+
const selectNode = commonStore[node.TID].selectDataPool[node.id];
|
48
46
|
const selectDropdownUl = selectNode.dom.selectDropdownUl;
|
49
47
|
if(selectDropdownUl) selectDropdownUl.innerHTML = '';
|
50
48
|
let leElement = '';
|
@@ -66,35 +64,43 @@ export function createSelectOptions(data, node) {
|
|
66
64
|
}
|
67
65
|
// 配置下拉头的交互状态:展开时三角图标向上,否则向下
|
68
66
|
export function setSelectInteractiveState(selected, node) {
|
69
|
-
const selectNode = selectDataPool[node.id];
|
67
|
+
const selectNode = commonStore[node.TID].selectDataPool[node.id];
|
70
68
|
selectNode.dom.selectIconArrow.style.display = selected ? 'none' : 'block';
|
71
69
|
//selectNode.dom['selectRemove'].style.display = selected ? 'block' : 'none';
|
72
70
|
}
|
73
71
|
// 重置下拉状态
|
74
72
|
export function resetSelectInteractiveState(node) {
|
75
|
-
|
76
|
-
|
73
|
+
const currentStore = commonStore[node.TID];
|
74
|
+
if(!Object.keys(currentStore.selectDataPool).length) return;
|
75
|
+
for (let data of Object.values(currentStore.selectDataPool)) {
|
77
76
|
if(node && node.id !== data.node.id) {
|
78
77
|
if(data.dom.selectIconArrow) data.dom.selectIconArrow.setAttribute('class', 'topology-select-icon-arrow');
|
79
78
|
data.slideState = false;
|
80
|
-
}
|
79
|
+
}
|
81
80
|
}
|
82
81
|
document.querySelector('.topology-select-dropdown').style.display = 'none';
|
83
|
-
elementInteractivePoor.node = null;
|
82
|
+
currentStore.elementInteractivePoor.node = null;
|
84
83
|
}
|
85
|
-
|
84
|
+
|
85
|
+
/**
|
86
|
+
* 配置下拉options容器的交互状态,展开和收起
|
87
|
+
* @param node 下拉元件节点数据
|
88
|
+
* @param staticType 下拉功能类型:1: 数据统计;2:数据展示;3:显示隐藏
|
89
|
+
* @param type 功能作用区域类型:Dcim,Topology,Logo
|
90
|
+
*/
|
86
91
|
export function setSelectDropdownInteractiveState(node, staticType, type) {
|
87
|
-
const
|
92
|
+
const currentStore = commonStore[node.TID];
|
93
|
+
const selectNode = currentStore.selectDataPool[node.id];
|
88
94
|
if(!selectNode.staticType) selectNode.staticType = staticType;
|
89
95
|
if(!selectNode) return;
|
90
96
|
if(downId !== node.id && type === previewType.Dcim) {
|
91
97
|
// 点击的不是同一个下拉则重置交互样式,清空数据
|
92
98
|
resetSelectInteractiveState(node);
|
93
|
-
elementInteractivePoor.options = null;
|
99
|
+
currentStore.elementInteractivePoor.options = null;
|
94
100
|
}
|
95
101
|
downId = node.id;
|
96
|
-
elementInteractivePoor.node = node;
|
97
|
-
selectElementStore(node.id);
|
102
|
+
currentStore.elementInteractivePoor.node = node;
|
103
|
+
selectElementStore(node.id, node.TID);
|
98
104
|
setSelectElementPosition(node);
|
99
105
|
const { selectIconArrow, selectDropdown } = selectNode.dom;
|
100
106
|
selectNode.slideState = !selectNode.slideState || node.selectDropdown; // 下拉展开状态
|
@@ -109,23 +115,23 @@ export function setSelectDropdownInteractiveState(node, staticType, type) {
|
|
109
115
|
// 图标旋转
|
110
116
|
selectIconArrow.setAttribute('class', attrName);
|
111
117
|
// 添加列表数据
|
112
|
-
if(!elementInteractivePoor.options) createSelectOptions(selectNode.data, node);
|
118
|
+
if(!currentStore.elementInteractivePoor.options) createSelectOptions(selectNode.data, node);
|
113
119
|
}
|
114
120
|
// 配置下拉偏移位置
|
115
121
|
export function setSelectElementPosition(node, type) {
|
116
122
|
// 不同元件切换
|
117
|
-
selectElementStore(node.id);
|
118
|
-
const selectNode = selectDataPool[node.id];
|
123
|
+
selectElementStore(node.id, node.TID);
|
124
|
+
const selectNode = commonStore[node.TID].selectDataPool[node.id];
|
119
125
|
if(type === 'down') {
|
120
126
|
if(nodeId === node.id) return;
|
121
|
-
elementInteractivePoor.options = null;
|
127
|
+
commonStore[node.TID].elementInteractivePoor.options = null;
|
122
128
|
createSelectOptions(selectNode.data, node);
|
123
129
|
}
|
124
130
|
nodeId = node.id;
|
125
131
|
setSelectDropdownPosition(node, selectNode.dom.selectDropdown);
|
126
132
|
}
|
127
133
|
function setSelectDropdownPosition(node, selectDropdown) {
|
128
|
-
const selectEle = selectDataPool[node.id].dom.selectEle;
|
134
|
+
const selectEle = commonStore[node.TID].selectDataPool[node.id].dom.selectEle;
|
129
135
|
let left = selectEle.getBoundingClientRect().left; // 获取下拉元素距离窗体左侧位置
|
130
136
|
let top = selectEle.getBoundingClientRect().top + node.rect.height;
|
131
137
|
if(window.location.pathname.includes('workspace')) {
|
@@ -139,57 +145,114 @@ function setSelectDropdownPosition(node, selectDropdown) {
|
|
139
145
|
const themeType = node.formData.theme ? ` theme${node.formData.theme}` : '';
|
140
146
|
selectDropdown.setAttribute('class', `topology-select-dropdown${themeType} documentDefine`);
|
141
147
|
}
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
148
|
+
|
149
|
+
/**
|
150
|
+
* 获取下拉选中的数据
|
151
|
+
* @param e 节点选中事件
|
152
|
+
* @param data 下拉元件节点数据
|
153
|
+
* @param editData 编辑显下拉的数据
|
154
|
+
*/
|
155
|
+
export function getSelectedData(e, data, editData) {
|
156
|
+
const currentStore = commonStore[data.TID];
|
157
|
+
const selectNode = currentStore.selectDataPool[data.id];
|
158
|
+
if(!currentStore.elementInteractivePoor.options && data.selectDropdown) currentStore.elementInteractivePoor.options = selectNode.dom.selectDropdownUl.querySelectorAll('.topology-select-dropdown-item');
|
159
|
+
let order = 0;
|
160
|
+
let staticType = selectNode.staticType;
|
161
|
+
if(!editData) {
|
162
|
+
const parentNode = e.target.parentNode;
|
163
|
+
const type = parentNode.getAttribute('type');
|
164
|
+
if(type !== 'option') return;
|
165
|
+
selectNode.slideState = false;
|
166
|
+
selectNode.dom.selectDropdown.style.display = 'none';
|
167
|
+
// 图标旋转
|
168
|
+
selectNode.dom.selectIconArrow.setAttribute('class', 'topology-select-icon-arrow');
|
149
169
|
// 选中节点操作
|
150
|
-
|
151
|
-
|
152
|
-
|
170
|
+
order = parentNode.getAttribute('data-order');
|
171
|
+
}else {
|
172
|
+
order = editData.order;
|
173
|
+
staticType = editData.staticType;
|
174
|
+
}
|
175
|
+
if(data.selectDropdown) {
|
176
|
+
for(let i = 0, leng = currentStore.elementInteractivePoor.options.length; i < leng; i++) {
|
153
177
|
let name = 'topology-select-dropdown-item';
|
154
178
|
if(i == order) {
|
155
179
|
name += ' selected';
|
156
180
|
}else {
|
157
181
|
name.replace(' selected', '');
|
158
182
|
}
|
159
|
-
elementInteractivePoor.options[i].setAttribute('class', name);
|
183
|
+
currentStore.elementInteractivePoor.options[i].setAttribute('class', name);
|
160
184
|
}
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
185
|
+
}
|
186
|
+
selectNode.optionOrder = order;
|
187
|
+
const node = selectNode.data[order];
|
188
|
+
selectNode.dom.selectEle.querySelector('.topology-select-input').value = node.name;
|
189
|
+
selectNode.node.selected = {
|
190
|
+
order: parseInt(order),
|
191
|
+
id: node.id
|
192
|
+
};
|
193
|
+
if(staticType === selectStaticType.static) {
|
194
|
+
// 数据统计
|
195
|
+
const optionNode = data.formData.bindBlockId && currentStore.echartsOptionsPool[data.formData.bindBlockId];
|
196
|
+
if(!optionNode) return;
|
197
|
+
// 切换数据
|
198
|
+
currentStore.echartsRealDataPool[optionNode.data.id] = currentStore.echartsRealDataPool[node.id];
|
199
|
+
const isInitTable = initTabSwitchPage(data.formData.bindBlockTag, optionNode.data, currentStore);
|
200
|
+
setMapDataOptions(optionNode.option, optionNode.data);
|
201
|
+
if(isInitTable) Store.set(`${data.TID}-LT:render`, true);
|
202
|
+
}
|
203
|
+
if(staticType === selectStaticType.dataShow) {
|
204
|
+
// 数据展示
|
205
|
+
}
|
206
|
+
if(staticType === selectStaticType.visible) {
|
207
|
+
// 显示隐藏
|
208
|
+
const optionsVisibleData = currentStore.selectTabDataPool[data.id];
|
209
|
+
if(!optionsVisibleData || !optionsVisibleData.size) return;
|
210
|
+
for(const [key, value] of optionsVisibleData){
|
211
|
+
const eque = node.id === value.tag;
|
212
|
+
currentStore.data.pens[value.order].visible = eque;
|
213
|
+
currentStore.data.pens[value.order].visibleSwitch = eque;
|
214
|
+
value.visible = eque;
|
215
|
+
setElementSwitchTabState(value);
|
216
|
+
}
|
217
|
+
Store.set(`${data.TID}-LT:render`, true);
|
218
|
+
}
|
219
|
+
}
|
220
|
+
// 初始化Tab页签选中状态
|
221
|
+
function initTabSwitchPage(bindBlockTag, data, currentStore) {
|
222
|
+
if(!bindBlockTag) return false;
|
223
|
+
// 初始化分类选中状态
|
224
|
+
const tabData = currentStore.switchTabDataPool[`${bindBlockTag}Data`]; // 获取Tab组数据
|
225
|
+
if(!tabData) return false;
|
226
|
+
const tabKeys = Object.keys(tabData);
|
227
|
+
const pens = currentStore.data.pens;
|
228
|
+
if(!tabKeys.length || !pens[tabData[tabKeys[0]].order].activeImgeIndex) return false; //Tab默认选中第一个页签就退出程序,不执行初始化状态
|
229
|
+
let tabInit = false;
|
230
|
+
for (let tabNode of Object.values(tabData)) {
|
231
|
+
const penNode = pens[tabNode.order];
|
232
|
+
if(!tabInit) {
|
233
|
+
data.params.tabVisitOrder = 0;
|
234
|
+
data.tabData = {
|
235
|
+
type: '',
|
236
|
+
data: tabNode.tabData
|
177
237
|
};
|
178
|
-
}
|
179
|
-
|
238
|
+
}
|
239
|
+
if(penNode) {
|
240
|
+
penNode.activeImgeIndex = tabInit;
|
241
|
+
tabInit = true;
|
180
242
|
}
|
181
243
|
}
|
244
|
+
return true;
|
182
245
|
}
|
183
246
|
// 配置下拉展示的主题风格
|
184
247
|
export function setSelectElementTheme(node) {
|
185
248
|
const themeType = node.formData.theme ? ` theme${node.formData.theme}` : '';
|
186
|
-
const { selectEle, selectDropdown } = selectDataPool[node.id].dom;
|
249
|
+
const { selectEle, selectDropdown } = commonStore[node.TID].selectDataPool[node.id].dom;
|
187
250
|
selectEle.setAttribute('class', `topology-select${themeType}`);
|
188
251
|
selectDropdown.setAttribute('class', `topology-select-dropdown${themeType} documentDefine`);
|
189
252
|
}
|
190
253
|
// 存储下拉Dom节点
|
191
|
-
function selectElementStore(id) {
|
192
|
-
const selectNode = selectDataPool[id];
|
254
|
+
function selectElementStore(id, TID) {
|
255
|
+
const selectNode = commonStore[TID].selectDataPool[id];
|
193
256
|
if(!selectNode.dom.selectIconArrow) selectNode.dom.selectIconArrow = selectNode.dom.selectEle.querySelector('.topology-select-icon-arrow');
|
194
257
|
if(!selectNode.dom.selectDropdown) {
|
195
258
|
selectNode.dom.selectDropdown = document.querySelector('.topology-select-dropdown');
|
package/core/src/element/tab.js
CHANGED
@@ -1,18 +1,19 @@
|
|
1
|
-
import {
|
2
|
-
echartsDataPool,
|
3
|
-
elementInteractivePoor,
|
4
|
-
selectDataPool
|
5
|
-
} from '../../../store';
|
6
1
|
import {jsonLength} from '../utils';
|
2
|
+
import {commonStore} from "../store";
|
7
3
|
// 设置tab切换显示隐藏时的 Dom元件状态
|
8
4
|
export function setElementSwitchTabState(node) {
|
9
|
-
if(
|
10
|
-
|
5
|
+
if(node.name !== 'echarts' && (!node.children || !node.children.length)) return;
|
6
|
+
if(typeof commonStore[node.TID].elementInteractivePoor.elementDataLength !== 'number') {
|
7
|
+
commonStore[node.TID].elementInteractivePoor.elementDataLength = jsonLength(commonStore[node.TID].echartsDataPool) || jsonLength(commonStore[node.TID].selectDataPool);
|
8
|
+
}
|
9
|
+
if(!commonStore[node.TID].elementInteractivePoor.elementDataLength) return;
|
10
|
+
const ele = commonStore[node.TID].echartsDataPool[node.id] && commonStore[node.TID].echartsDataPool[node.id].div ||
|
11
|
+
commonStore[node.TID].selectDataPool[node.id] && commonStore[node.TID].selectDataPool[node.id].dom.selectEle;
|
12
|
+
if(ele) {
|
13
|
+
ele.style.display = !node.visible ? 'none': 'block';
|
14
|
+
}else {
|
15
|
+
commonStore[node.TID].data.dataResize = 1;
|
11
16
|
}
|
12
|
-
if(!elementInteractivePoor.elementDataLength) return;
|
13
|
-
const ele = echartsDataPool[node.id] && echartsDataPool[node.id].div ||
|
14
|
-
selectDataPool[node.id] && selectDataPool[node.id].dom.selectEle;
|
15
|
-
if(ele) ele.style.display = !node.visible ? 'none': 'block';
|
16
17
|
if(node.children && node.children.length) {
|
17
18
|
node.children.map((ch) => {
|
18
19
|
ch.visible = node.visible;
|
@@ -1,10 +1,20 @@
|
|
1
1
|
//let DETAILDATA = null;
|
2
2
|
import {commonStore} from '../store';
|
3
|
-
import {echartsRealDataPool} from '../../../store';
|
4
3
|
import { getEchartsRealData } from '../utils/conversion';
|
5
4
|
export function setConfItemNode(pen, syn_synata) {
|
5
|
+
const entranceGuard = pen.events.find((ev) => {
|
6
|
+
return ev.value === 'entranceGuard';
|
7
|
+
});
|
8
|
+
if(entranceGuard) {
|
9
|
+
// 绑定门禁的元件实时数据
|
10
|
+
const nullUndefinedRegex = /^(?:null|undefined|\s*)$/;
|
11
|
+
const doorData = syn_synata.doorData && syn_synata.doorData[entranceGuard.params];
|
12
|
+
const doorState = doorData && !nullUndefinedRegex.test(doorData.state) && parseInt(doorData.state);
|
13
|
+
pen.text = doorState === 1 ? '开门' : '关门'; // 1-开门,其他值为关门
|
14
|
+
}
|
6
15
|
if (!pen.data) return;
|
7
16
|
if(commonStore[pen.TID]) commonStore[pen.TID].data.dataResize = 1;
|
17
|
+
let isAlarm = false; // 判断元件绑定的数据中是否有告警发生,用于九所项目服务器自身监控功能
|
8
18
|
if(pen.data instanceof Array) {
|
9
19
|
let _syn = null;
|
10
20
|
let isResetVal = false;
|
@@ -62,9 +72,11 @@ export function setConfItemNode(pen, syn_synata) {
|
|
62
72
|
switch (state) {
|
63
73
|
case 0: // 正常告警
|
64
74
|
color = '#FF0000';
|
75
|
+
isAlarm = true;
|
65
76
|
break;
|
66
77
|
case 1: // 离线告警, 通讯开关告警
|
67
78
|
color = '#6d6d6d';
|
79
|
+
isAlarm = true;
|
68
80
|
break;
|
69
81
|
case 2: // 未告警
|
70
82
|
case 3: // 无告警
|
@@ -94,18 +106,20 @@ export function setConfItemNode(pen, syn_synata) {
|
|
94
106
|
if (name === 'electricFan') setFanData(pen, _syn)
|
95
107
|
}else {
|
96
108
|
if (pen.elementRendered) pen.elementRendered = false;
|
97
|
-
if(pen.data.echarts) {
|
98
|
-
const {
|
109
|
+
if (pen.data.echarts) {
|
110
|
+
const {echartDataValue} = syn_synata;
|
99
111
|
const seriesData = echartDataValue;
|
100
112
|
const realData = pen.data.params && seriesData && Object.keys(seriesData).length && seriesData[pen.data.params.id];
|
101
113
|
if (Array.isArray(realData)) {
|
102
114
|
getEchartsRealData(pen, realData);
|
103
|
-
}else {
|
104
|
-
echartsRealDataPool[pen.id] = realData;
|
115
|
+
} else {
|
116
|
+
commonStore[pen.TID].echartsRealDataPool[pen.id] = realData;
|
105
117
|
}
|
106
118
|
}
|
107
119
|
}
|
108
|
-
return
|
120
|
+
return {
|
121
|
+
monitorAlarm: isAlarm
|
122
|
+
}
|
109
123
|
}
|
110
124
|
|
111
125
|
export function setNodeEvents(item, pen) {
|
@@ -0,0 +1,61 @@
|
|
1
|
+
// import {} from './rectangle';
|
2
|
+
import {rectangle, createDiv, s8, Topology} from '../../../../core';
|
3
|
+
import {commonStore} from "../../store";
|
4
|
+
|
5
|
+
export async function formOverflow(ctx, node) {
|
6
|
+
// 绘制一个底图,类似于占位符。
|
7
|
+
rectangle(ctx, node)
|
8
|
+
console.log('绘制滚动组件--')
|
9
|
+
// 添加当前节点到div层
|
10
|
+
if (!node.elementId) {
|
11
|
+
node.elementId = s8()
|
12
|
+
}
|
13
|
+
let formoverData = commonStore[node.TID].formoverDataPool[node.id];
|
14
|
+
let id = node.formData.detailPageId
|
15
|
+
const color = node.formData.scrollbarColor? node.formData.scrollbarColor: 'auto'
|
16
|
+
const colorBg = node.formData.scrollbarColorBg? node.formData.scrollbarColorBg: 'auto'
|
17
|
+
const scrollbarColor = color + ' ' + colorBg
|
18
|
+
|
19
|
+
if (!node.elementLoaded && !formoverData) {
|
20
|
+
console.log('是否存在--formoverData--0-',formoverData)
|
21
|
+
if(!formoverData) {
|
22
|
+
formoverData = {
|
23
|
+
div: createDiv(node)
|
24
|
+
};
|
25
|
+
}else {
|
26
|
+
formoverData.div = createDiv(node);
|
27
|
+
}
|
28
|
+
formoverData.div.setAttribute('class', 'topoOverflow');
|
29
|
+
formoverData.div.style.setProperty('scrollbar-color', scrollbarColor);
|
30
|
+
formoverData.div.style.setProperty('scrollbar-width', 'thin');
|
31
|
+
|
32
|
+
node.elementLoaded = true
|
33
|
+
document.body.appendChild(formoverData.div)
|
34
|
+
// 添加当前节点到div层
|
35
|
+
node.addToDiv()
|
36
|
+
commonStore[node.TID].formoverDataPool[node.id] = formoverData;
|
37
|
+
|
38
|
+
|
39
|
+
console.log('请求子页面接口-----id =',id)
|
40
|
+
let canvas = new Topology(node.id, {
|
41
|
+
rotateCursor: '/img/rotate.cur',
|
42
|
+
})
|
43
|
+
canvas.formOverflowOpen(node.formData.detailPageData)
|
44
|
+
commonStore[node.TID].formoverCanvasDataPool[node.id] = canvas
|
45
|
+
}else if(formoverData && id){
|
46
|
+
console.log('是否存在--formoverData--1-',formoverData)
|
47
|
+
formoverData.div.style.setProperty('scrollbar-color', scrollbarColor);
|
48
|
+
formOverflowChange(node)
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
// 更新滚动组件中子页面
|
53
|
+
export function formOverflowChange(node) {
|
54
|
+
//绘制画布
|
55
|
+
console.log('更新滚动组件中子页面-',node)
|
56
|
+
let canvas = commonStore[node.TID].formoverCanvasDataPool[node.id]
|
57
|
+
let data = node.formData.detailPageData
|
58
|
+
console.log('改变滚动组件中子页面-',data)
|
59
|
+
canvas.formOverflowOpen(data)
|
60
|
+
}
|
61
|
+
|