dcim-topology2d 2.0.8 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chart-diagram/src/echarts/index.js +6 -3
- package/chart-diagram/src/utils/changeOptions.d.ts +1 -0
- package/chart-diagram/src/utils/changeOptions.js +41 -35
- package/chart-diagram/src/utils/conversion.d.ts +1 -1
- package/chart-diagram/src/utils/conversion.js +143 -15
- package/chart-diagram/src/utils/formatter.d.ts +1 -1
- package/chart-diagram/src/utils/formatter.js +51 -15
- package/chart-diagram/src/utils/index.d.ts +1 -0
- package/chart-diagram/src/utils/index.js +1 -0
- package/chart-diagram/src/utils/render.js +43 -52
- package/chart-diagram/src/utils/surfaceParametricConversion.d.ts +3 -0
- package/chart-diagram/src/utils/surfaceParametricConversion.js +252 -0
- package/core/src/common.js +24 -15
- package/core/src/core.d.ts +2 -0
- package/core/src/core.js +75 -23
- package/core/src/element/common.d.ts +2 -1
- package/core/src/element/common.js +27 -18
- package/core/src/element/datePicker.d.ts +3 -0
- package/core/src/element/datePicker.js +44 -0
- package/core/src/element/index.d.ts +2 -1
- package/core/src/element/index.js +3 -1
- package/core/src/element/select.d.ts +1 -1
- package/core/src/element/select.js +15 -5
- package/core/src/element/tab.js +6 -9
- package/core/src/element/time.d.ts +3 -0
- package/core/src/element/time.js +44 -0
- package/core/src/healps/changeData.js +61 -41
- package/core/src/middles/default.js +53 -43
- package/core/src/middles/nodes/formDatePicker.d.ts +2 -0
- package/core/src/middles/nodes/formDatePicker.js +107 -0
- package/core/src/middles/nodes/formselect.js +20 -4
- package/core/src/middles/nodes/index.d.ts +4 -1
- package/core/src/middles/nodes/index.js +4 -0
- package/core/src/middles/nodes/switchs.d.ts +2 -0
- package/core/src/middles/nodes/switchs.js +46 -0
- package/core/src/middles/nodes/time.d.ts +2 -0
- package/core/src/middles/nodes/time.js +98 -0
- package/core/src/models/line.js +7 -7
- package/core/src/models/node.js +88 -74
- package/core/src/models/pen.js +11 -11
- package/core/src/offscreen.js +19 -19
- package/core/src/preview.d.ts +1 -0
- package/core/src/preview.js +44 -11
- package/core/src/store/data.d.ts +7 -0
- package/core/src/store/data.js +15 -2
- package/core/src/utils/assignment.d.ts +2 -1
- package/core/src/utils/assignment.js +55 -12
- package/core/src/utils/construction.d.ts +24 -0
- package/core/src/utils/construction.js +22 -1
- package/core/src/utils/conversion.d.ts +4 -0
- package/core/src/utils/conversion.js +151 -0
- package/core/src/utils/math.d.ts +0 -1
- package/core/src/utils/math.js +0 -3
- package/core/src/utils/onmousevent.js +1 -1
- package/core/src/utils/params.d.ts +1 -0
- package/core/src/utils/params.js +80 -4
- package/package.json +1 -1
- package/store/default.js +22 -0
- package/store/index.js +2 -1
- package/style/common.css +0 -3
- package/style/datePicker.css +44 -0
- package/style/editor.css +3 -0
- package/style/index.css +1 -0
package/core/src/models/pen.js
CHANGED
@@ -131,7 +131,7 @@ var Pen = /** @class */ (function () {
|
|
131
131
|
}
|
132
132
|
}
|
133
133
|
Pen.prototype.render = function (ctx) {
|
134
|
-
if (!this.visible && !this.visibleSwitch){
|
134
|
+
if (!this.visible && !this.visibleSwitch) {
|
135
135
|
return;
|
136
136
|
}
|
137
137
|
if (this.from && !this.to) {
|
@@ -150,9 +150,9 @@ var Pen = /** @class */ (function () {
|
|
150
150
|
if (this.lineWidth > 1) {
|
151
151
|
ctx.lineWidth = this.lineWidth;
|
152
152
|
}
|
153
|
-
if(this.dash === 4) {
|
153
|
+
if (this.dash === 4) {
|
154
154
|
ctx.strokeStyle = 'transparent';
|
155
|
-
}else {
|
155
|
+
} else {
|
156
156
|
const staticStrokeStyle = this.strokeStyle || '#222';
|
157
157
|
ctx.strokeStyle = !this.activeImgeIndex ? this.visitStrokeStyle || staticStrokeStyle : this.defaultStrokeStyle || staticStrokeStyle;
|
158
158
|
}
|
@@ -219,19 +219,19 @@ var Pen = /** @class */ (function () {
|
|
219
219
|
}
|
220
220
|
for (var _i = 0, _a = this.events; _i < _a.length; _i++) {
|
221
221
|
var item = _a[_i];
|
222
|
-
if (item.type !== EventType.Click
|
222
|
+
if (item.type !== EventType.Click) {
|
223
223
|
continue;
|
224
224
|
}
|
225
225
|
// 画布页面,单击跳转链接事件屏蔽
|
226
|
-
if(item.action === EventAction.Link && window.location.pathname.includes('workspace')){
|
226
|
+
if (item.action === EventAction.Link && window.location.pathname.includes('workspace')) {
|
227
227
|
continue
|
228
228
|
}
|
229
|
-
if(item.action === EventAction.Link){
|
229
|
+
if (item.action === EventAction.Link) {
|
230
230
|
this[this.eventFns[item.action]](item.value, item.dcimMenuForType);
|
231
|
-
}else{
|
231
|
+
} else {
|
232
232
|
this[this.eventFns[item.action]] && this[this.eventFns[item.action]](item.value, item.params);
|
233
233
|
}
|
234
|
-
if(item.action === 7){
|
234
|
+
if (item.action === 7) {
|
235
235
|
Store.set(this.generateStoreKey('LT:hidePen'), item.value);
|
236
236
|
}
|
237
237
|
}
|
@@ -270,10 +270,10 @@ var Pen = /** @class */ (function () {
|
|
270
270
|
// window.open(url, params === undefined ? '_blank' : params);
|
271
271
|
var port = window.location.port;
|
272
272
|
var href = window.location.href;
|
273
|
-
if(!url.includes("http") && port.includes("3000") && url.includes("id")){
|
274
|
-
url= '/workspace?id=' + url.split('id=')[1]
|
273
|
+
if (!url.includes("http") && port.includes("3000") && url.includes("id")) {
|
274
|
+
url = '/workspace?id=' + url.split('id=')[1]
|
275
275
|
// console.log('url:3000===',url)
|
276
|
-
}else if(!url.includes("http://") && href.includes("topologyDetail")){
|
276
|
+
} else if (!url.includes("http://") && href.includes("topologyDetail")) {
|
277
277
|
switch (params) {
|
278
278
|
case '1': // 返回上一页
|
279
279
|
let str = href.replace(/\/topologyDetail/g, "")
|
package/core/src/offscreen.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
var __extends = (this && this.__extends) || (function () {
|
2
2
|
var extendStatics = function (d, b) {
|
3
3
|
extendStatics = Object.setPrototypeOf ||
|
4
|
-
|
5
|
-
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
5
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
6
6
|
return extendStatics(d, b);
|
7
7
|
};
|
8
8
|
return function (d, b) {
|
@@ -13,7 +13,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
13
13
|
})();
|
14
14
|
import { Store } from 'le5le-store';
|
15
15
|
import { Canvas } from './canvas';
|
16
|
-
import { Node } from './models'
|
16
|
+
import { Node, Line } from './models'
|
17
17
|
import { commonStore } from './store'
|
18
18
|
var Offscreen = /** @class */ (function (_super) {
|
19
19
|
__extends(Offscreen, _super);
|
@@ -25,38 +25,38 @@ var Offscreen = /** @class */ (function (_super) {
|
|
25
25
|
Store.set(_this.generateStoreKey('LT:offscreen'), _this.canvas);
|
26
26
|
return _this;
|
27
27
|
}
|
28
|
-
Offscreen.prototype.getRoutineLayer = function(auto) {
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
28
|
+
Offscreen.prototype.getRoutineLayer = function (auto) {
|
29
|
+
if (!auto || auto.includes('ActiveLayer')) {
|
30
|
+
this.activeLayer = Store.get(this.generateStoreKey('LT:ActiveLayer'));
|
31
|
+
}
|
32
|
+
if (!auto || auto.includes('HoverLayer')) {
|
33
|
+
this.hoverLayer = Store.get(this.generateStoreKey('LT:HoverLayer'));
|
34
|
+
}
|
35
|
+
if (!auto || auto.includes('AnimateLayer')) {
|
36
|
+
this.animateLayer = Store.get(this.generateStoreKey('LT:AnimateLayer'));
|
37
|
+
}
|
38
38
|
};
|
39
39
|
Offscreen.prototype.render = function () {
|
40
40
|
_super.prototype.render.call(this);
|
41
41
|
var ctx = this.canvas.getContext('2d');
|
42
|
-
if(!commonStore || !commonStore[this.TID]) return;
|
42
|
+
if (!commonStore || !commonStore[this.TID]) return;
|
43
43
|
let store = commonStore[this.TID];
|
44
44
|
ctx.strokeStyle = store.options.color;
|
45
45
|
for (var _i = 0, _a = store.data.pens; _i < _a.length; _i++) {
|
46
46
|
var item = _a[_i];
|
47
|
-
if(!(item instanceof Node)) item = new Node(item);
|
47
|
+
if (!(item instanceof Node) && !(item instanceof Line)) item = new Node(item);
|
48
48
|
if (!item.getTID()) {
|
49
49
|
item.setTID(this.TID);
|
50
50
|
}
|
51
51
|
item.render(ctx);
|
52
52
|
}
|
53
|
-
if(this.activeLayer) {
|
53
|
+
if (this.activeLayer) {
|
54
54
|
this.activeLayer.render(ctx);
|
55
55
|
}
|
56
|
-
if(this.hoverLayer) {
|
57
|
-
|
56
|
+
if (this.hoverLayer) {
|
57
|
+
this.hoverLayer.render(ctx);
|
58
58
|
}
|
59
|
-
if(this.animateLayer) {
|
59
|
+
if (this.animateLayer) {
|
60
60
|
this.animateLayer.render(ctx);
|
61
61
|
}
|
62
62
|
store = null;
|
package/core/src/preview.d.ts
CHANGED
@@ -4,6 +4,7 @@ import { Point } from './models';
|
|
4
4
|
import {Common} from './common';
|
5
5
|
export declare class Preview extends Common{
|
6
6
|
constructor(parent: string | HTMLElement, options?: Options);
|
7
|
+
private eventChangeSubcribe;
|
7
8
|
private scheduledAnimationFrame;
|
8
9
|
private onMouseMove;
|
9
10
|
private onmousedown;
|
package/core/src/preview.js
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
import {Store} from "le5le-store";
|
2
|
-
|
3
2
|
var __extends = (this && this.__extends) || (function () {
|
4
3
|
var extendStatics = function (d, b) {
|
5
4
|
extendStatics = Object.setPrototypeOf ||
|
@@ -22,7 +21,8 @@ import {
|
|
22
21
|
formatPadding,
|
23
22
|
mousMoveFun,
|
24
23
|
mousDownFun,
|
25
|
-
omouseEventPrototDoWindowFn
|
24
|
+
omouseEventPrototDoWindowFn,
|
25
|
+
pageZoom
|
26
26
|
} from './utils';
|
27
27
|
import {
|
28
28
|
resetSelectInteractiveState,
|
@@ -35,6 +35,24 @@ var Preview = (function (_super) {
|
|
35
35
|
var _this = _super.call(this, parent, options) || this;
|
36
36
|
_this.offscreen.getRoutineLayer(['AnimateLayer']);
|
37
37
|
_this.scheduledAnimationFrame = false;
|
38
|
+
_this.innerHeight = window.innerHeight || document.documentElement.clientHeight; // 初始化网页高度
|
39
|
+
_this.devicePixelInnerHeight = _this.innerHeight; // 初始化网页缩放高度
|
40
|
+
_this.devicePixelRatio = window.devicePixelRatio; // 初始化窗口分辨率
|
41
|
+
// 选中值发生变化时触发,目前用于日期切换
|
42
|
+
_this.eventChangeSubcribe = Store.subscribe(this.generateStoreKey('EVENT:change'), function (data) {
|
43
|
+
const {node, date} = data;
|
44
|
+
const pickerBindData = _this.store.pickerDataPool.bindData;
|
45
|
+
if(pickerBindData) {
|
46
|
+
// 切换显示日期文字的元件值
|
47
|
+
for (let value of Object.values(pickerBindData)){
|
48
|
+
if(value.dateId === node.id) {
|
49
|
+
const pen = _this.store.data.pens[value.order];
|
50
|
+
pen.text = date.valueStr;
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
54
|
+
node.formData.realIds ? _this.dispatch('change', node, date) : _this.render(); // eventOut外部事件
|
55
|
+
});
|
38
56
|
_this.onMouseMove = function (e) {
|
39
57
|
_this.store.data.dataResize = 0;
|
40
58
|
// https://caniuse.com/#feat=mdn-api_mouseevent_buttons
|
@@ -88,7 +106,7 @@ var Preview = (function (_super) {
|
|
88
106
|
_this.setNodeText();
|
89
107
|
}
|
90
108
|
resetSelectInteractiveState(_this.moveIn.hoverNode);
|
91
|
-
const {eventType, value
|
109
|
+
const {eventType, value} = mousDownFun(_this.store.options.type, _this.moveIn.eventNode);
|
92
110
|
if (_this.moveIn.type == _this.moveInType.Nodes) {
|
93
111
|
_this.setAttributeForCanvasPoint('pointer');
|
94
112
|
switch (eventType) {
|
@@ -111,7 +129,7 @@ var Preview = (function (_super) {
|
|
111
129
|
_this.switchStaticsCheckType(_this.moveIn.hoverNode, _this.moveIn.eventNode);
|
112
130
|
break;
|
113
131
|
case downDataType.Formselect:
|
114
|
-
setSelectDropdownInteractiveState(_this.moveIn.hoverNode,
|
132
|
+
setSelectDropdownInteractiveState(_this.moveIn.hoverNode, previewType.Dcim);
|
115
133
|
break;
|
116
134
|
}
|
117
135
|
}
|
@@ -181,16 +199,30 @@ var Preview = (function (_super) {
|
|
181
199
|
return false;
|
182
200
|
};
|
183
201
|
window.onresize = function () {
|
184
|
-
|
185
|
-
if(!isFullScreen && _this.isFullScreen){
|
186
|
-
|
202
|
+
let isFullScreen = document.fullscreenElement || document.webkitFullscreenElement || document.mozFullscreenElement;
|
203
|
+
if((!isFullScreen && _this.isFullScreen) || window.keyControlFullScreen){
|
204
|
+
// F11或ESC退出全屏
|
205
|
+
if(!window.keyControlFullScreen) _this.moveIn.hoverNode.text = '全屏';
|
187
206
|
_this.fitViewPreview(_this.isFullScreen);
|
188
207
|
_this.isFullScreen = false;
|
208
|
+
window.keyControlFullScreen = false;
|
189
209
|
}else {
|
190
|
-
//
|
191
|
-
if(
|
192
|
-
|
193
|
-
|
210
|
+
const documentElementHeight = window.innerHeight || document.documentElement.clientHeight; // 每次窗口有变化就重新获取一次网页高度
|
211
|
+
if(window.devicePixelRatio !== _this.devicePixelRatio) {
|
212
|
+
_this.devicePixelInnerHeight = documentElementHeight;
|
213
|
+
_this.devicePixelRatio = window.devicePixelRatio;
|
214
|
+
}
|
215
|
+
if(_this.devicePixelInnerHeight < documentElementHeight && !isFullScreen) {
|
216
|
+
// 按F11 全屏
|
217
|
+
setTimeout(() => {
|
218
|
+
_this.fitViewPreview(false);
|
219
|
+
_this.isFullScreen = true;
|
220
|
+
}, 200);
|
221
|
+
window.keyControlFullScreen = true;
|
222
|
+
}
|
223
|
+
// topology编辑器或全屏下跳出程序
|
224
|
+
if(_this.store.options.type === 'topology' || window.keyControlFullScreen) return;
|
225
|
+
const zoom = pageZoom();
|
194
226
|
_this.isResize = true;
|
195
227
|
clearTimeout(_this.pageResizeTim);
|
196
228
|
_this.pageResizeTim = setTimeout(() => {
|
@@ -303,6 +335,7 @@ var Preview = (function (_super) {
|
|
303
335
|
};
|
304
336
|
Preview.prototype.destroy = function () {
|
305
337
|
this.destroyStatic();
|
338
|
+
if(this.eventChangeSubcribe) this.eventChangeSubcribe.unsubscribe();
|
306
339
|
this.onMouseMove = null;
|
307
340
|
this.onmousedown = null;
|
308
341
|
this.onmouseup = null;
|
package/core/src/store/data.d.ts
CHANGED
@@ -38,7 +38,9 @@ export interface paramsData {
|
|
38
38
|
assetIds?: [],
|
39
39
|
areaIds?: [],
|
40
40
|
varVaule?: [],
|
41
|
+
branchValue?: [],
|
41
42
|
echartData?: [],
|
43
|
+
dataConfig?: {},
|
42
44
|
echartAssemblyData?: [],
|
43
45
|
routingkey?: string,
|
44
46
|
pathRewrite?: string
|
@@ -56,6 +58,7 @@ export interface visualization2DStore {
|
|
56
58
|
data: visualization2DData;
|
57
59
|
}[];
|
58
60
|
elementInteractivePoor: {}; // element 交互过渡数据
|
61
|
+
pickerDataPool: {}; // datePicker 交互数据池
|
59
62
|
echartsDataPool: {}; // echarts Dom节点数据
|
60
63
|
echartsOptionsPool: {}; // echarts options节点数据
|
61
64
|
echartsRealDataPool: {}; // echarts 实时数据
|
@@ -102,7 +105,9 @@ export const createStore = () => {
|
|
102
105
|
assetIds: [],
|
103
106
|
areaIds: [],
|
104
107
|
varVaule: [],
|
108
|
+
branchValue: [],
|
105
109
|
echartData: [],
|
110
|
+
dataConfig: {},
|
106
111
|
echartAssemblyData: [],
|
107
112
|
routingkey: '',
|
108
113
|
pathRewrite: ''
|
@@ -110,6 +115,7 @@ export const createStore = () => {
|
|
110
115
|
pens: {},
|
111
116
|
options: { ...DefalutOptions },
|
112
117
|
elementInteractivePoor: {}, // element 交互过渡数据
|
118
|
+
pickerDataPool: {}, // datePicker 交互数据池
|
113
119
|
echartsDataPool: {}, // echarts Dom节点数据
|
114
120
|
echartsOptionsPool: {}, // echarts options节点数据
|
115
121
|
echartsRealDataPool: {}, // echarts 实时数据
|
@@ -174,6 +180,7 @@ export const clearStore = (store: visualization2DStore, del: string) => {
|
|
174
180
|
assetIds: [],
|
175
181
|
areaIds: [],
|
176
182
|
varVaule: [],
|
183
|
+
branchValue: [],
|
177
184
|
echartData: [],
|
178
185
|
echartAssemblyData: [],
|
179
186
|
routingkey: '',
|
package/core/src/store/data.js
CHANGED
@@ -44,7 +44,9 @@ export var createStore = function () {
|
|
44
44
|
assetIds: [],
|
45
45
|
areaIds: [],
|
46
46
|
varVaule: [],
|
47
|
+
branchValue: [],
|
47
48
|
echartData: [],
|
49
|
+
dataConfig: {},
|
48
50
|
echartAssemblyData: [],
|
49
51
|
routingkey: '',
|
50
52
|
pathRewrite: ''
|
@@ -52,9 +54,10 @@ export var createStore = function () {
|
|
52
54
|
pens: {},
|
53
55
|
options: { ...DefalutOptions },
|
54
56
|
elementInteractivePoor: {}, // element 交互过渡数据
|
57
|
+
pickerDataPool: {}, // datePicker 交互数据池
|
55
58
|
echartsDataPool: {}, // echarts Dom节点数据
|
56
59
|
echartsOptionsPool: {}, // echarts options节点数据
|
57
|
-
echartsRealDataPool: {}, // echarts 实时数据
|
60
|
+
echartsRealDataPool: {}, // echarts 实时数据 datePicker
|
58
61
|
switchTabDataPool: {}, // tabs
|
59
62
|
tableDataPool: {}, // form table
|
60
63
|
selectDataPool: {}, // form select
|
@@ -68,7 +71,8 @@ export var createStore = function () {
|
|
68
71
|
dpiRatio: 1,
|
69
72
|
lastScale: 1,
|
70
73
|
monitorAlarm: false,// 全局报警标记,代表正在访问的这个topology文件中是否有告警发生
|
71
|
-
parentElem: null
|
74
|
+
parentElem: null,
|
75
|
+
timeDataPool: {}, // time
|
72
76
|
};
|
73
77
|
};
|
74
78
|
export var useStore = function (id) {
|
@@ -87,6 +91,7 @@ export function clearElementDataPool(data) {
|
|
87
91
|
if(node.chart) {
|
88
92
|
node.chart.off('mouseover');
|
89
93
|
node.chart.off('mouseout');
|
94
|
+
node.chart.off('globalout');
|
90
95
|
node.chart.dispose();
|
91
96
|
}
|
92
97
|
if(node.div && node.div.parentNode) node.div.parentNode.removeChild(node.div);
|
@@ -149,7 +154,12 @@ export var clearStore = function (store, del) {
|
|
149
154
|
assetIds: [],
|
150
155
|
areaIds: [],
|
151
156
|
varVaule: [],
|
157
|
+
branchValue: [],
|
152
158
|
echartData: [],
|
159
|
+
dataConfig: store.mqttParams.dataConfig.data ? {
|
160
|
+
data: {},
|
161
|
+
picker: store.mqttParams.dataConfig.picker
|
162
|
+
} : {},
|
153
163
|
echartAssemblyData: [],
|
154
164
|
routingkey: '',
|
155
165
|
pathRewrite: ''
|
@@ -160,6 +170,7 @@ export var clearStore = function (store, del) {
|
|
160
170
|
store.lastScale = 1;
|
161
171
|
store.monitorAlarm = false;
|
162
172
|
store.elementInteractivePoor = {};
|
173
|
+
store.pickerDataPool = {};
|
163
174
|
store.echartsOptionsPool = {};
|
164
175
|
store.echartsRealDataPool = {};
|
165
176
|
store.switchTabDataPool = {};
|
@@ -172,8 +183,10 @@ export var clearStore = function (store, del) {
|
|
172
183
|
iframeDataPool: store.iframeDataPool,
|
173
184
|
formoverDataPool: store.formoverDataPool,
|
174
185
|
formoverCanvasDataPool: store.formoverCanvasDataPool,
|
186
|
+
timeDataPool: store.timeDataPool
|
175
187
|
});
|
176
188
|
if(del) {
|
189
|
+
store.mqttParams.dataConfig = {};
|
177
190
|
delete commonStore[store.id];
|
178
191
|
removeAllElement();
|
179
192
|
}
|
@@ -3,4 +3,5 @@ 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 setConnectionTagForConf(node: Node): void;
|
6
|
+
export declare function setConnectionTagForConf(node: Node): void;
|
7
|
+
export declare function setConnectionTabsData(node: Node): void;
|
@@ -2,7 +2,7 @@
|
|
2
2
|
import {commonStore} from '../store';
|
3
3
|
import { setConfItemNode } from '../healps';
|
4
4
|
import { EventAction } from '../models';
|
5
|
-
|
5
|
+
import {confAssociateDateValueShowType, datePickerValueFormatting} from '../utils';
|
6
6
|
/**
|
7
7
|
* 在节点注册前初始化node数据
|
8
8
|
* @param node 节点数据
|
@@ -47,14 +47,46 @@ export function initDefaultValidat(node, retData) {
|
|
47
47
|
if (node.name === 'line') {
|
48
48
|
node.defaultStrokeStyle = node.strokeStyle;
|
49
49
|
}
|
50
|
+
setPickerDateConnectData(node);
|
51
|
+
setVarBranchData(node, retData);
|
52
|
+
}
|
53
|
+
// 初始化配置日期元件关联的数据
|
54
|
+
function setPickerDateConnectData(node) {
|
55
|
+
if(node.formData && node.formData.bindDateShowType === confAssociateDateValueShowType.date) {
|
56
|
+
const pickerData = commonStore[node.TID].pickerDataPool;
|
57
|
+
if(!pickerData.bindData) pickerData.bindData = {};
|
58
|
+
pickerData.bindData[node.id] = {
|
59
|
+
order: node.order,
|
60
|
+
dateId: node.formData.dateId
|
61
|
+
};
|
62
|
+
node.text = datePickerValueFormatting({
|
63
|
+
formatType: node.formData.dateFormat,
|
64
|
+
valueType: node.formData.valueType
|
65
|
+
}).dateStr;
|
66
|
+
}
|
67
|
+
}
|
68
|
+
// 设置变量类型和支路地址的异步数据
|
69
|
+
function setVarBranchData(node, retData) {
|
70
|
+
if(!retData) return;
|
71
|
+
const componentData = retData.componentData;
|
72
|
+
let varData = null;
|
73
|
+
let branchNameData = null;
|
74
|
+
if(componentData) {
|
75
|
+
varData = componentData[node.id] || {};
|
76
|
+
branchNameData = componentData[node.id] || {};
|
77
|
+
}else {
|
78
|
+
varData = retData.varData;
|
79
|
+
branchNameData = retData.branchNameData;
|
80
|
+
}
|
81
|
+
const dataDictionary = {...varData, ...branchNameData};
|
50
82
|
// 变量类型数据展示,不需要实时更新
|
51
|
-
if(Array.isArray(node.data) &&
|
83
|
+
if(Array.isArray(node.data) && Object.keys(dataDictionary).length) {
|
52
84
|
let typeName = '';
|
53
85
|
let imgs = '';
|
54
|
-
const
|
86
|
+
const assetId = retData.asset && retData.asset.assetId;
|
55
87
|
node.data.map((vd) => {
|
56
|
-
|
57
|
-
|
88
|
+
const varNode = dataDictionary[vd.value] || dataDictionary[`${assetId}_${vd.value}`];
|
89
|
+
if((vd.key.includes('varValue') || vd.key.includes('branchVal')) && varNode){
|
58
90
|
const showType = varNode.showType ? parseInt(varNode.showType) : 1;
|
59
91
|
if(showType === 1 && varNode.value) typeName += typeName ? `,${varNode.value}` : varNode.value;
|
60
92
|
if(showType === 2 && varNode.value) console.log('显示图标>>>');
|
@@ -142,15 +174,10 @@ export function setConnectionTagForConf(node) {
|
|
142
174
|
if(t === 'statisticType' || t.includes('switchTabType')) setType = 'tab';
|
143
175
|
if(t.includes('selectOption')) setType = 'selectShow';
|
144
176
|
});
|
145
|
-
|
146
|
-
if(!setType && isTabs) console.log('>>>未能找到绑定的标签数据,请检查绑定的Tabs标签是否包含switchTabType前缀>>>');
|
177
|
+
if(!setType) console.log('>>>未能找到绑定的标签数据,请检查绑定的Tabs标签是否包含switchTabType前缀>>>');
|
147
178
|
if(setType === 'tab'){
|
148
179
|
// tab切换
|
149
|
-
|
150
|
-
let topologyChangeData = commonStore[node.TID].switchTabDataPool;
|
151
|
-
let keyName = node.bindStaticId ? `${tagData}Data` : `${tagData}AreaData`;
|
152
|
-
if (!topologyChangeData[keyName]) topologyChangeData[keyName] = {};
|
153
|
-
topologyChangeData[keyName][node.id] = node;
|
180
|
+
setConnectionTabsData(node);
|
154
181
|
}
|
155
182
|
if(setType === 'selectShow'){
|
156
183
|
// 下拉显示隐藏
|
@@ -170,4 +197,20 @@ export function setConnectionTagForConf(node) {
|
|
170
197
|
commonStore[node.TID].selectTabDataPool[parentId].set(node.id, params);
|
171
198
|
}
|
172
199
|
}
|
200
|
+
}
|
201
|
+
|
202
|
+
/**
|
203
|
+
* 初始化配置tabs数据
|
204
|
+
* @param node
|
205
|
+
*/
|
206
|
+
export function setConnectionTabsData(node) {
|
207
|
+
const switchTabType = node.tags.find((t) => {
|
208
|
+
return t.includes('switchTabType');
|
209
|
+
}); // 获取按钮组类型
|
210
|
+
if(!switchTabType) return;
|
211
|
+
const isTabs = node.events && node.events.find((ev) => ev.action === 8);
|
212
|
+
let topologyChangeData = commonStore[node.TID].switchTabDataPool;
|
213
|
+
let keyName = node.bindStaticId && isTabs ? `${switchTabType}Data` : `${switchTabType}AreaData`;
|
214
|
+
if (!topologyChangeData[keyName]) topologyChangeData[keyName] = {};
|
215
|
+
topologyChangeData[keyName][node.id] = node;
|
173
216
|
}
|
@@ -43,8 +43,32 @@ export interface SelectStaticType {
|
|
43
43
|
dataShow?:number;
|
44
44
|
visible?:number;
|
45
45
|
}
|
46
|
+
export interface DatePickerBindType {
|
47
|
+
echarts?:number;
|
48
|
+
tag?:number;
|
49
|
+
kpi?:number;
|
50
|
+
asset?:number;
|
51
|
+
area?:number;
|
52
|
+
varType?:number;
|
53
|
+
branch?:number;
|
54
|
+
word?:number;
|
55
|
+
}
|
56
|
+
export interface ConfBindValueType {
|
57
|
+
increment?:number; // 增量值
|
58
|
+
current?:number; // 当前值
|
59
|
+
max?:number; // 最大值
|
60
|
+
min?:number; // 最小值
|
61
|
+
average?:number; // 平均值
|
62
|
+
}
|
63
|
+
export interface ConfAssociateDateValueShowType {
|
64
|
+
real?:number; // 实时值
|
65
|
+
date?:number; // 日期值
|
66
|
+
}
|
46
67
|
export const moveDataType: MoveDataType;
|
47
68
|
export const downDataType: DownDataType;
|
48
69
|
export const previewType: PreviewType;
|
49
70
|
export const animateType: AnimateType;
|
50
71
|
export const selectStaticType: SelectStaticType;
|
72
|
+
export const datePickerBindType: DatePickerBindType;
|
73
|
+
export const confBindValueType: ConfBindValueType;
|
74
|
+
export const confAssociateDateValueShowType: ConfAssociateDateValueShowType;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export const echartsStaticType = ['DAY', 'WEEK', 'MONTH', 'YEAR', 'REALTIME'];
|
1
|
+
export const echartsStaticType = ['DAY', 'WEEK', 'MONTH', 'YEAR', 'REALTIME', 'CUSTOMIZE'];
|
2
2
|
export const winEventActionFns = ['Link', 'DoAnimate', 'DoFn', 'DoWindowFn', 'openImg'];
|
3
3
|
export const moveDataType = {
|
4
4
|
None: 0,
|
@@ -40,4 +40,25 @@ export const selectStaticType = {
|
|
40
40
|
static: 1,
|
41
41
|
dataShow: 2,
|
42
42
|
visible: 3
|
43
|
+
};
|
44
|
+
export const datePickerBindType = {
|
45
|
+
echarts: 1, // echart
|
46
|
+
tag: 3, // 测点
|
47
|
+
kpi: 6, // 指标
|
48
|
+
asset: 9, // 资产
|
49
|
+
area: 21, // 区域
|
50
|
+
varType: 12, // 变量类型
|
51
|
+
branch: 15, // 支路地址
|
52
|
+
word: -1 // 文字
|
53
|
+
};
|
54
|
+
export const confBindValueType = {
|
55
|
+
increment: 1, // 增量值
|
56
|
+
current: 2, // 当前值
|
57
|
+
max: 3, // 最大值
|
58
|
+
min: 4, // 最小值
|
59
|
+
average: 5 // 平均值
|
60
|
+
};
|
61
|
+
export const confAssociateDateValueShowType = {
|
62
|
+
real: 1, // 实时值
|
63
|
+
date: 2 // 日期值
|
43
64
|
};
|
@@ -1,4 +1,7 @@
|
|
1
1
|
import {Node} from "../models";
|
2
|
+
export declare function pageZoom(): number;
|
3
|
+
export declare function datePickerValueFormatting(data: {}): {};
|
4
|
+
export declare function getTabConnectSHConf(node: Node): Node;
|
2
5
|
export declare function tabStaticOperation(type: string, node: Node, areaData: any, params: object): void;
|
3
6
|
export declare function tabHideShowOperation(node: any, areaData: any, visible: boolean): void;
|
4
7
|
export declare function getEchartsRealData(node: {}, data: []): void;
|
@@ -8,4 +11,5 @@ export declare function setKpiAddrData(data: any): [];
|
|
8
11
|
export declare function setAssetIdData(data: any): [];
|
9
12
|
export declare function setAreaIdData(data: any): [];
|
10
13
|
export declare function setVarValueData(data: any): [];
|
14
|
+
export declare function setBranchAddressData(data: any): [];
|
11
15
|
export declare function setThreeCategoryIdData(pen: Node, data: any): [];
|