dcim-topology2d 2.1.0 → 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/conversion.d.ts +1 -1
- package/chart-diagram/src/utils/conversion.js +6 -5
- package/core/src/common.js +11 -10
- package/core/src/core.js +15 -1
- package/core/src/element/common.js +12 -3
- package/core/src/element/datePicker.js +13 -16
- package/core/src/element/select.d.ts +1 -1
- package/core/src/element/select.js +1 -3
- package/core/src/element/tab.js +3 -8
- package/core/src/healps/changeData.js +61 -41
- package/core/src/middles/default.js +47 -43
- package/core/src/middles/nodes/formDatePicker.js +53 -12
- package/core/src/middles/nodes/formselect.js +14 -5
- package/core/src/middles/nodes/index.d.ts +2 -1
- package/core/src/middles/nodes/index.js +1 -0
- package/core/src/middles/nodes/switchs.d.ts +2 -0
- package/core/src/middles/nodes/switchs.js +46 -0
- package/core/src/models/line.js +7 -7
- package/core/src/models/node.js +83 -81
- package/core/src/models/pen.js +11 -11
- package/core/src/offscreen.js +19 -19
- package/core/src/preview.js +16 -7
- package/core/src/store/data.d.ts +2 -0
- package/core/src/store/data.js +6 -0
- package/core/src/utils/assignment.js +33 -2
- package/core/src/utils/construction.d.ts +24 -0
- package/core/src/utils/construction.js +22 -1
- package/core/src/utils/conversion.d.ts +2 -0
- package/core/src/utils/conversion.js +109 -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 +75 -4
- package/package.json +1 -1
- package/store/default.js +22 -0
- package/store/index.js +2 -1
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.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,
|
@@ -41,7 +41,17 @@ var Preview = (function (_super) {
|
|
41
41
|
// 选中值发生变化时触发,目前用于日期切换
|
42
42
|
_this.eventChangeSubcribe = Store.subscribe(this.generateStoreKey('EVENT:change'), function (data) {
|
43
43
|
const {node, date} = data;
|
44
|
-
_this.
|
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外部事件
|
45
55
|
});
|
46
56
|
_this.onMouseMove = function (e) {
|
47
57
|
_this.store.data.dataResize = 0;
|
@@ -96,7 +106,7 @@ var Preview = (function (_super) {
|
|
96
106
|
_this.setNodeText();
|
97
107
|
}
|
98
108
|
resetSelectInteractiveState(_this.moveIn.hoverNode);
|
99
|
-
const {eventType, value
|
109
|
+
const {eventType, value} = mousDownFun(_this.store.options.type, _this.moveIn.eventNode);
|
100
110
|
if (_this.moveIn.type == _this.moveInType.Nodes) {
|
101
111
|
_this.setAttributeForCanvasPoint('pointer');
|
102
112
|
switch (eventType) {
|
@@ -119,7 +129,7 @@ var Preview = (function (_super) {
|
|
119
129
|
_this.switchStaticsCheckType(_this.moveIn.hoverNode, _this.moveIn.eventNode);
|
120
130
|
break;
|
121
131
|
case downDataType.Formselect:
|
122
|
-
setSelectDropdownInteractiveState(_this.moveIn.hoverNode,
|
132
|
+
setSelectDropdownInteractiveState(_this.moveIn.hoverNode, previewType.Dcim);
|
123
133
|
break;
|
124
134
|
}
|
125
135
|
}
|
@@ -212,8 +222,7 @@ var Preview = (function (_super) {
|
|
212
222
|
}
|
213
223
|
// topology编辑器或全屏下跳出程序
|
214
224
|
if(_this.store.options.type === 'topology' || window.keyControlFullScreen) return;
|
215
|
-
const
|
216
|
-
const zoom = window.innerWidth < screenWidth ? document.documentElement.clientWidth / screenWidth : 1;
|
225
|
+
const zoom = pageZoom();
|
217
226
|
_this.isResize = true;
|
218
227
|
clearTimeout(_this.pageResizeTim);
|
219
228
|
_this.pageResizeTim = setTimeout(() => {
|
package/core/src/store/data.d.ts
CHANGED
@@ -40,6 +40,7 @@ export interface paramsData {
|
|
40
40
|
varVaule?: [],
|
41
41
|
branchValue?: [],
|
42
42
|
echartData?: [],
|
43
|
+
dataConfig?: {},
|
43
44
|
echartAssemblyData?: [],
|
44
45
|
routingkey?: string,
|
45
46
|
pathRewrite?: string
|
@@ -106,6 +107,7 @@ export const createStore = () => {
|
|
106
107
|
varVaule: [],
|
107
108
|
branchValue: [],
|
108
109
|
echartData: [],
|
110
|
+
dataConfig: {},
|
109
111
|
echartAssemblyData: [],
|
110
112
|
routingkey: '',
|
111
113
|
pathRewrite: ''
|
package/core/src/store/data.js
CHANGED
@@ -46,6 +46,7 @@ export var createStore = function () {
|
|
46
46
|
varVaule: [],
|
47
47
|
branchValue: [],
|
48
48
|
echartData: [],
|
49
|
+
dataConfig: {},
|
49
50
|
echartAssemblyData: [],
|
50
51
|
routingkey: '',
|
51
52
|
pathRewrite: ''
|
@@ -155,6 +156,10 @@ export var clearStore = function (store, del) {
|
|
155
156
|
varVaule: [],
|
156
157
|
branchValue: [],
|
157
158
|
echartData: [],
|
159
|
+
dataConfig: store.mqttParams.dataConfig.data ? {
|
160
|
+
data: {},
|
161
|
+
picker: store.mqttParams.dataConfig.picker
|
162
|
+
} : {},
|
158
163
|
echartAssemblyData: [],
|
159
164
|
routingkey: '',
|
160
165
|
pathRewrite: ''
|
@@ -181,6 +186,7 @@ export var clearStore = function (store, del) {
|
|
181
186
|
timeDataPool: store.timeDataPool
|
182
187
|
});
|
183
188
|
if(del) {
|
189
|
+
store.mqttParams.dataConfig = {};
|
184
190
|
delete commonStore[store.id];
|
185
191
|
removeAllElement();
|
186
192
|
}
|
@@ -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,7 +47,38 @@ export function initDefaultValidat(node, retData) {
|
|
47
47
|
if (node.name === 'line') {
|
48
48
|
node.defaultStrokeStyle = node.strokeStyle;
|
49
49
|
}
|
50
|
-
|
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};
|
51
82
|
// 变量类型数据展示,不需要实时更新
|
52
83
|
if(Array.isArray(node.data) && Object.keys(dataDictionary).length) {
|
53
84
|
let typeName = '';
|
@@ -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,6 @@
|
|
1
1
|
import {Node} from "../models";
|
2
|
+
export declare function pageZoom(): number;
|
3
|
+
export declare function datePickerValueFormatting(data: {}): {};
|
2
4
|
export declare function getTabConnectSHConf(node: Node): Node;
|
3
5
|
export declare function tabStaticOperation(type: string, node: Node, areaData: any, params: object): void;
|
4
6
|
export declare function tabHideShowOperation(node: any, areaData: any, visible: boolean): void;
|
@@ -1,6 +1,114 @@
|
|
1
1
|
import {commonStore} from '../store';
|
2
2
|
import {setElementSwitchTabState} from '../element';
|
3
3
|
import {echartsStaticType} from '../utils';
|
4
|
+
import {datePickerType, datePickerTypeList} from "../../../store";
|
5
|
+
|
6
|
+
/**
|
7
|
+
* yyyy-MM-dd 格式转换
|
8
|
+
* @param valueType 默认值类型:1-默认当天
|
9
|
+
* @returns {string}
|
10
|
+
*/
|
11
|
+
// function yyyMMddFormatting(valueType) {
|
12
|
+
// if(valueType === 1){
|
13
|
+
// // 默认当天
|
14
|
+
// return new Date().toISOString().split('T')[0];
|
15
|
+
// }
|
16
|
+
// }
|
17
|
+
|
18
|
+
/**
|
19
|
+
* yyyy-MM-dd HH:mm:ss 格式转换
|
20
|
+
* @param valueType 默认值类型:1-默认当天
|
21
|
+
* @returns {string}
|
22
|
+
*/
|
23
|
+
// function yyyMMddHHmmssFormatting(valueType) {
|
24
|
+
// if(valueType === 1){
|
25
|
+
// // 默认当天
|
26
|
+
// return new Date().toISOString().replace('T', ' ').substring(0, 19);
|
27
|
+
// }
|
28
|
+
// }
|
29
|
+
|
30
|
+
/**
|
31
|
+
* yyyy 格式转换
|
32
|
+
* @param valueType 默认值类型:1-默认当天
|
33
|
+
* @returns {number}
|
34
|
+
*/
|
35
|
+
// function yyyFormatting(valueType) {
|
36
|
+
// if(valueType === 1){
|
37
|
+
// // 默认当天
|
38
|
+
// return new new Date().getFullYear();
|
39
|
+
// }
|
40
|
+
// }
|
41
|
+
|
42
|
+
/**
|
43
|
+
* yyyy-MM 格式转换
|
44
|
+
* @param valueType 默认值类型:1-默认当天
|
45
|
+
* @returns {string}
|
46
|
+
*/
|
47
|
+
// function yyyMMFormatting(valueType) {
|
48
|
+
// if(valueType === 1){
|
49
|
+
// // 默认当天
|
50
|
+
// return new Date().toISOString().slice(0, 7);
|
51
|
+
// }
|
52
|
+
// }
|
53
|
+
|
54
|
+
/**
|
55
|
+
* HH:mm:ss 格式转换
|
56
|
+
* @param valueType 默认值类型:1-默认当天
|
57
|
+
* @returns {string}
|
58
|
+
*/
|
59
|
+
// function hhmmssddFormatting(valueType) {
|
60
|
+
// if(valueType === 1){
|
61
|
+
// // 默认当天
|
62
|
+
// Date.prototype.formatTime = function() {
|
63
|
+
// return [this.getHours(), this.getMinutes(), this.getSeconds()]
|
64
|
+
// .map(v => v.toString().padStart(2, '0')).join(':');
|
65
|
+
// };
|
66
|
+
// return new Date().formatTime();
|
67
|
+
// }
|
68
|
+
// }
|
69
|
+
export function pageZoom() {
|
70
|
+
let screenWidth = 0;
|
71
|
+
if(window.screen.width < 1920) {
|
72
|
+
// 1920 * 1080分辨率以下的适配
|
73
|
+
const zoom = window.screen.width / 1920;
|
74
|
+
screenWidth = Math.round(window.screen.width / zoom);
|
75
|
+
}else {
|
76
|
+
screenWidth = window.screen.width;
|
77
|
+
}
|
78
|
+
const order = window.screen.width > 1280 ? 12 : 8; // 差值计算
|
79
|
+
return window.innerWidth < screenWidth ? (window.innerWidth - order) / screenWidth : 1;
|
80
|
+
}
|
81
|
+
|
82
|
+
/**
|
83
|
+
* 日期转换
|
84
|
+
* @param data: {formatType: '日期格式', valueType: '默认值类型'}
|
85
|
+
* @returns {string}
|
86
|
+
*/
|
87
|
+
export function datePickerValueFormatting(data) {
|
88
|
+
if(!Object.keys(datePickerType).length) {
|
89
|
+
// 获取日期类型map数据
|
90
|
+
const params = datePickerTypeList.reduce((obj, item) => {
|
91
|
+
obj[item['id']] = item.format;
|
92
|
+
return obj;
|
93
|
+
}, {});
|
94
|
+
Object.assign(datePickerType, params);
|
95
|
+
}
|
96
|
+
let now = new Date(); // data.valueType === 1 默认
|
97
|
+
const map = {
|
98
|
+
yyyy: now.getFullYear(),
|
99
|
+
MM: String(now.getMonth() + 1).padStart(2, '0'),
|
100
|
+
dd: String(now.getDate()).padStart(2, '0'),
|
101
|
+
HH: String(now.getHours()).padStart(2, '0'),
|
102
|
+
mm: String(now.getMinutes()).padStart(2, '0'),
|
103
|
+
ss: String(now.getSeconds()).padStart(2, '0')
|
104
|
+
};
|
105
|
+
const date = data.dateType ? datePickerType[data.dateType].replace(/yyyy|MM|dd|HH|mm|ss/g, match => map[match]) : '';
|
106
|
+
const dateStr = data.formatType.replace(/yyyy|MM|dd|HH|mm|ss/g, match => map[match]);
|
107
|
+
return {
|
108
|
+
date,
|
109
|
+
dateStr
|
110
|
+
};
|
111
|
+
}
|
4
112
|
// tab切换页签删除数据处理
|
5
113
|
export function getTabConnectSHConf(node) {
|
6
114
|
const switchTabType = node.tags.find((t) => {
|
@@ -82,6 +190,7 @@ export function tabHideShowOperation(node, areaData, isActive) {
|
|
82
190
|
if(!(areaNode && pens[areaNode.order])) return;
|
83
191
|
const tagNode = pens[areaNode.order];
|
84
192
|
tagNode.visible = !isActive;
|
193
|
+
tagNode.visibleSwitch = tagNode.visible;
|
85
194
|
setElementSwitchTabState(tagNode);
|
86
195
|
}
|
87
196
|
}
|
package/core/src/utils/math.d.ts
CHANGED
package/core/src/utils/math.js
CHANGED
@@ -77,7 +77,7 @@ export function mousDownFun(type, eventNode) {
|
|
77
77
|
params.eventType = downDataType.Tabswitch; // Tab切换
|
78
78
|
}else if(action === 11) {
|
79
79
|
params.eventType = downDataType.Formselect; // select下拉切换
|
80
|
-
params.staticType = eventNode.dcimStaticForType; // 1: 数据统计;2:数据展示;3
|
80
|
+
// params.staticType = eventNode.dcimStaticForType; // 1: 数据统计;2:数据展示;3:显示隐藏;4:日期类型
|
81
81
|
}else {
|
82
82
|
// action === 5 远程控制比较特殊,无论是否绑定远程控制事件,只要数据中有远程控制属性且值为0都会认定为远程控制
|
83
83
|
params.eventType = downDataType.Target; // 链接跳转
|
package/core/src/utils/params.js
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
import {commonStore} from '../store';
|
2
|
+
import {datePickerValueFormatting} from "./conversion";
|
3
|
+
import {datePickerBindType, confBindValueType} from "./construction";
|
4
|
+
const confConfigMap = new Map();
|
2
5
|
// 获取绑定数据的参数
|
3
6
|
export function getParams(id, data) {
|
4
|
-
data.
|
7
|
+
for (let i = 0, length = data.length; i < length; i++) {
|
8
|
+
const item = data[i];
|
5
9
|
filterParams(id, item);
|
6
10
|
if (item.children && item.children.length) {
|
7
11
|
getParams(id, item.children);
|
@@ -9,7 +13,8 @@ export function getParams(id, data) {
|
|
9
13
|
if (item.formData && item.formData.detailPageData && item.formData.detailPageData.pens && item.formData.detailPageData.pens.length) {
|
10
14
|
getParams(id, item.formData.detailPageData.pens);
|
11
15
|
}
|
12
|
-
}
|
16
|
+
}
|
17
|
+
confConfigMap.clear();
|
13
18
|
}
|
14
19
|
// 过滤出参数
|
15
20
|
export function filterParams(id, node) {
|
@@ -23,36 +28,48 @@ export function filterParams(id, node) {
|
|
23
28
|
let branchValue = [];
|
24
29
|
let doorIds = [];
|
25
30
|
let isMqttEventType = false;
|
31
|
+
let dcimStaticForType = '';
|
26
32
|
node.events.map((ev) => {
|
27
33
|
if(ev.value && ev.value === 'entranceGuard') doorIds.push(ev.params); // 门禁参数
|
28
34
|
if(ev.type === 3) isMqttEventType = true;
|
35
|
+
if(ev.type === 4) dcimStaticForType = ev.dcimStaticForType;
|
29
36
|
});
|
30
37
|
if(doorIds.length) commonStore[id].mqttParams.doorIds = [...commonStore[id].mqttParams.doorIds, ...doorIds];
|
31
38
|
if(!isMqttEventType) return;
|
32
39
|
if (node.data && Array.isArray(node.data) && node.data.length) {
|
33
|
-
node.data.
|
40
|
+
for (let i = 0, length = node.data.length; i < length; i ++) {
|
41
|
+
const item = node.data[i];
|
42
|
+
let type = 0;
|
34
43
|
if (item.key === 'tagId') {
|
35
44
|
tagIds.push(item.value);
|
45
|
+
type = datePickerBindType.tag;
|
36
46
|
}
|
37
47
|
if (item.key === 'kpiAddr') {
|
38
48
|
kpiAddrs.push(item.value);
|
49
|
+
type = datePickerBindType.kpi;
|
39
50
|
}
|
40
51
|
if (item.key === 'assetId') {
|
41
52
|
assetIds.push(item.value);
|
53
|
+
type = datePickerBindType.asset;
|
42
54
|
}
|
43
55
|
if (item.key === 'areaId') {
|
44
56
|
areaIds.push(item.value);
|
57
|
+
type = datePickerBindType.area;
|
45
58
|
}
|
46
59
|
if (item.key.includes('varValue')) {
|
47
60
|
varVaule.push(item.value);
|
61
|
+
type = datePickerBindType.varType;
|
48
62
|
}
|
49
63
|
if (item.key === 'branchVal') {
|
50
64
|
branchValue.push(item.value);
|
65
|
+
type = datePickerBindType.branch;
|
51
66
|
}
|
52
|
-
|
67
|
+
if(dcimStaticForType && node.formData && type) setConfConfigMap(node.id, id, node.formData, item.value, type);
|
68
|
+
}
|
53
69
|
}
|
54
70
|
if (node.data && Object.prototype.toString.call(node.data) === '[object Object]' && node.data.params && node.data.params.id) {
|
55
71
|
echartData.push(node.data.params.id);
|
72
|
+
if(dcimStaticForType && node.formData) setConfConfigMap(node.id, id, node.formData, node.data.params.id, 1);
|
56
73
|
}
|
57
74
|
commonStore[id].mqttParams.tagIds = [...commonStore[id].mqttParams.tagIds, ...tagIds];
|
58
75
|
commonStore[id].mqttParams.kpiAddrs = [...commonStore[id].mqttParams.kpiAddrs, ...kpiAddrs];
|
@@ -62,4 +79,58 @@ export function filterParams(id, node) {
|
|
62
79
|
commonStore[id].mqttParams.branchValue = [...commonStore[id].mqttParams.branchValue, ...branchValue];
|
63
80
|
commonStore[id].mqttParams.tagEcharts = [...commonStore[id].mqttParams.tagEcharts, ...tagEcharts];
|
64
81
|
commonStore[id].mqttParams.echartData = [...commonStore[id].mqttParams.echartData, ...echartData];
|
82
|
+
}
|
83
|
+
|
84
|
+
/**
|
85
|
+
* 设置绑定日期的配置数据
|
86
|
+
* @param formData 元件关联的日期数据
|
87
|
+
* @param id 当前元件id
|
88
|
+
* @param tid
|
89
|
+
* @param realData 当前元件绑定的数据
|
90
|
+
* @param type 当前元件绑定的数据类型 1:echart 3:测点 6:指标 9:资产 12:变量类型 15:支路地址 21:区域
|
91
|
+
*/
|
92
|
+
function setConfConfigMap(id, tid, formData, realData, type) {
|
93
|
+
if(!formData.dateId) return;
|
94
|
+
const dateId = formData.dateId;
|
95
|
+
let value = null;
|
96
|
+
let valueStr = '';
|
97
|
+
if(confConfigMap.has(dateId)) {
|
98
|
+
|
99
|
+
const {date, dateStr} = confConfigMap.get(dateId);
|
100
|
+
|
101
|
+
value = date;
|
102
|
+
|
103
|
+
valueStr = dateStr;
|
104
|
+
|
105
|
+
}else {
|
106
|
+
|
107
|
+
const {date, dateStr} = datePickerValueFormatting({
|
108
|
+
formatType: formData.dateFormat,
|
109
|
+
valueType: formData.valueType,
|
110
|
+
dateType: formData.dateType
|
111
|
+
});
|
112
|
+
|
113
|
+
value = date;
|
114
|
+
|
115
|
+
valueStr = dateStr;
|
116
|
+
|
117
|
+
confConfigMap.set(dateId, {date, dateStr});
|
118
|
+
|
119
|
+
}
|
120
|
+
const dataConfig = commonStore[tid].mqttParams.dataConfig;
|
121
|
+
if(!dataConfig.data){
|
122
|
+
dataConfig.data = {};
|
123
|
+
dataConfig.picker = new Map();
|
124
|
+
}
|
125
|
+
dataConfig.data[id] = {
|
126
|
+
id: realData,
|
127
|
+
date: value,
|
128
|
+
dataType: type,
|
129
|
+
valueType: confBindValueType.increment
|
130
|
+
};
|
131
|
+
dataConfig.picker.set(id, {
|
132
|
+
dateId,
|
133
|
+
date: value,
|
134
|
+
dateStr: valueStr
|
135
|
+
});
|
65
136
|
}
|