coolcare-lite-scada-component 4.1.0 → 4.1.2
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/es/app.js +23 -0
- package/es/components/BoxShadowPicker/index.less.d.ts +9 -9
- package/es/components/ColorPicker/util.js +4 -4
- package/es/components/DialogHistory/index.css +22 -0
- package/es/components/DialogHistory/index.js +388 -79
- package/es/components/DialogImagePicker/GroupPanel/index.js +1 -12
- package/es/components/ECharts/index.js +31 -23
- package/es/components/FormBindPoint/FreedomScene.js +181 -11
- package/es/components/FormBindPoint/ProductionOrDeviceScene.js +12 -5
- package/es/components/FormBindPoint/index.js +6 -0
- package/es/components/Icon/index.js +1 -1
- package/es/components/IconFont/index.js +6 -0
- package/es/components/ImageUploader/index.js +8 -7
- package/es/components/ModalChangePointValue.js +272 -0
- package/es/components/ModalChoosePoint/index.js +53 -16
- package/es/components/PointSelect/DeviceIndicatorTable.js +111 -0
- package/es/components/PointSelect/IndicatorSelect.js +182 -0
- package/es/constant.js +2 -2
- package/es/element/BorderBox/util/typings.d.ts +9 -9
- package/es/element/Decoration/util/typings.d.ts +9 -9
- package/es/element/EleFan/Component.js +1 -1
- package/es/element/EleFanBySvg/index.js +3 -3
- package/es/element/EleImage/index.js +1 -1
- package/es/element/ElePointImage/Component.js +30 -41
- package/es/element/ElePointImage/index.js +1 -1
- package/es/element/ElePointValue/Component.js +117 -17
- package/es/element/ElePointValue/PropsSet/StatisticsPropsSet/index.js +6 -0
- package/es/element/ElePointValue/index.css +11 -0
- package/es/element/ElePointValue/index.js +6 -0
- package/es/element/EleShine/Component.js +133 -23
- package/es/element/EleShine/PropsSet/OtherPropsSet/index.js +27 -34
- package/es/element/EleShine/PropsSet/PointAlarmTool.js +99 -0
- package/es/element/EleShine/PropsSet/index.js +9 -1
- package/es/element/EleShine/index.js +2 -1
- package/es/element/EleState/index.js +1 -1
- package/es/element/EleSwitch/Component.js +2 -12
- package/es/element/PipeNodes/NodeBL/index.js +1 -1
- package/es/element/PipeNodes/NodeBR/index.js +1 -1
- package/es/element/PipeNodes/NodeBottom/index.js +1 -1
- package/es/element/PipeNodes/NodeCenter/index.js +1 -1
- package/es/element/PipeNodes/NodeHorizontal/index.js +1 -1
- package/es/element/PipeNodes/NodeLeft/index.js +1 -1
- package/es/element/PipeNodes/NodeRight/index.js +1 -1
- package/es/element/PipeNodes/NodeTL/index.js +1 -1
- package/es/element/PipeNodes/NodeTR/index.js +1 -1
- package/es/element/PipeNodes/NodeTop/index.js +1 -1
- package/es/element/PipeNodes/NodeVertical/index.js +1 -1
- package/es/element/PointCard/PointListCard/Component.js +3 -2
- package/es/element/PointCard/PointListCard/index.js +1 -0
- package/es/element/type.d.ts +4 -6
- package/es/element/utils/getValueByExpression.js +3 -0
- package/es/element/utils/handleEleEvent.js +11 -1
- package/es/element/utils/pointWrite.js +4 -5
- package/es/hooks/usePointWatch.js +1 -1
- package/es/models/useEditor.js +14 -8
- package/es/pages/display/Player/index.js +444 -123
- package/es/pages/display/index.js +2 -2
- package/es/pages/document.ejs +1 -1
- package/es/pages/editor/PanelLeft/BasicShapeList/listData.js +8 -8
- package/es/pages/editor/PanelLeft/BorderBoxEleList/index.less.d.ts +7 -7
- package/es/pages/editor/PanelLeft/DecorationEleList/index.less.d.ts +7 -7
- package/es/pages/editor/PanelLeft/GroupManageDialog/index.js +4 -4
- package/es/pages/editor/PanelLeft/ImgGroup/index.js +1 -12
- package/es/pages/editor/PanelLeft/MetaEleList/listData.js +14 -14
- package/es/pages/editor/PanelLeft/PipeEleList/listData.js +11 -11
- package/es/pages/editor/PanelLeft/PointCardEleList/listData.js +6 -6
- package/es/pages/editor/PanelLeft/RecommendEleList/listData.js +4 -4
- package/es/pages/editor/PanelLeft/index.js +3 -3
- package/es/pages/editor/PanelRight/components/FormLayer/index.js +3 -1
- package/es/pages/editor/PanelRight/index.less.d.ts +7 -7
- package/es/pages/editor/PanelTop/HotKeyDescribe/index.js +1 -1
- package/es/pages/editor/PanelTop/Save/index.js +120 -67
- package/es/pages/editor/index.js +223 -135
- package/es/pages/editor/utils/scadaChangeLog.js +237 -0
- package/es/services/common/Uploader.js +1 -1
- package/es/services/common/typings.d.ts +15 -15
- package/es/services/energy/index.js +56 -0
- package/es/services/gateway/Device.js +22 -0
- package/es/services/gateway/Point.js +46 -25
- package/es/services/gateway/typings.d.ts +3 -0
- package/es/services/master/typings.d.ts +362 -362
- package/es/services/product/typings.d.ts +1045 -1045
- package/es/services/project/typings.d.ts +1609 -1609
- package/es/services/request.js +126 -13
- package/es/shims.x6.d.ts +15 -15
- package/es/typings.d.ts +12 -0
- package/es/utils/auth.js +6 -2
- package/es/utils/cssStyle.js +4 -4
- package/es/utils/dataURItoBlob.js +25 -0
- package/es/utils/date.js +7 -0
- package/es/utils/decomposeMatrix.js +5 -5
- package/es/utils/events.js +3 -3
- package/es/utils/index.js +34 -34
- package/es/utils/pointValueFormat.js +3 -3
- package/package.json +16 -15
- package/es/elementCss.css +0 -19
package/es/pages/editor/index.js
CHANGED
|
@@ -3,7 +3,7 @@ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try {
|
|
|
3
3
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
4
4
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
5
5
|
import React from "react";
|
|
6
|
-
import { useEffect, useRef } from 'react';
|
|
6
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
7
7
|
import { useModel, Helmet } from 'umi';
|
|
8
8
|
import { message } from 'antd';
|
|
9
9
|
import { GetDeviceConfiguration } from "../../services/gateway/Device";
|
|
@@ -11,17 +11,18 @@ import { GetCompanyConfigurationPage } from "../../services/gateway/CompanyConfi
|
|
|
11
11
|
import { useQuery } from "../../hooks";
|
|
12
12
|
import GraphCore from "../../graph/graphCore";
|
|
13
13
|
import { defaultDeviceMobileSize, defaultDevicePCSize } from "../../constant";
|
|
14
|
+
import { buildScadaConfigSnapshot, captureScadaScreenshot, setScadaConfigSnapshotToStorage } from "./utils/scadaChangeLog";
|
|
14
15
|
import Palette from "./Palette";
|
|
15
16
|
import PanelTop from "./PanelTop";
|
|
16
17
|
import PanelLeft from "./PanelLeft";
|
|
17
18
|
import PanelRight from "./PanelRight";
|
|
18
19
|
import styles from "./index.css";
|
|
19
20
|
|
|
20
|
-
//
|
|
21
|
+
// 濞夈劌鍞藉銉ュ徔 Tools [https://x6.antv.vision/zh/docs/tutorial/intermediate/tools]
|
|
21
22
|
import "../../graph/tools/registerX6Tool";
|
|
22
|
-
//
|
|
23
|
+
// 濞夈劌鍞介懛顏勭暰娑?node
|
|
23
24
|
import "../../element/register";
|
|
24
|
-
//
|
|
25
|
+
// 濞夈劌鍞介懛顏勭暰娑?edge
|
|
25
26
|
import "../../edge/register";
|
|
26
27
|
export default (function () {
|
|
27
28
|
var paletteWrapRef = useRef(null);
|
|
@@ -31,13 +32,41 @@ export default (function () {
|
|
|
31
32
|
graphCoreRef: model.graphCoreRef,
|
|
32
33
|
setScene: model.setScene,
|
|
33
34
|
setPageConfig: model.setPageConfig,
|
|
34
|
-
fetchUserDeviceList: model.fetchUserDeviceList
|
|
35
|
+
fetchUserDeviceList: model.fetchUserDeviceList,
|
|
36
|
+
setInitialScadaConfigSnapshot: model.setInitialScadaConfigSnapshot
|
|
35
37
|
};
|
|
36
38
|
}),
|
|
37
39
|
graphCoreRef = _useModel.graphCoreRef,
|
|
38
40
|
setScene = _useModel.setScene,
|
|
39
41
|
setPageConfig = _useModel.setPageConfig,
|
|
40
|
-
fetchUserDeviceList = _useModel.fetchUserDeviceList
|
|
42
|
+
fetchUserDeviceList = _useModel.fetchUserDeviceList,
|
|
43
|
+
setInitialScadaConfigSnapshot = _useModel.setInitialScadaConfigSnapshot;
|
|
44
|
+
var cacheScadaConfig = useCallback(/*#__PURE__*/function () {
|
|
45
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(pageConfigValue) {
|
|
46
|
+
var _graphCoreRef$current;
|
|
47
|
+
var graph, snapshot, _t, _t2, _t3;
|
|
48
|
+
return _regenerator().w(function (_context) {
|
|
49
|
+
while (1) switch (_context.n) {
|
|
50
|
+
case 0:
|
|
51
|
+
graph = (_graphCoreRef$current = graphCoreRef.current) === null || _graphCoreRef$current === void 0 ? void 0 : _graphCoreRef$current.graph;
|
|
52
|
+
_t = buildScadaConfigSnapshot;
|
|
53
|
+
_t2 = pageConfigValue || {};
|
|
54
|
+
_t3 = graph;
|
|
55
|
+
_context.n = 1;
|
|
56
|
+
return captureScadaScreenshot(graph);
|
|
57
|
+
case 1:
|
|
58
|
+
snapshot = _t(_t2, _t3, _context.v);
|
|
59
|
+
setInitialScadaConfigSnapshot(JSON.stringify(snapshot));
|
|
60
|
+
setScadaConfigSnapshotToStorage(query, snapshot);
|
|
61
|
+
case 2:
|
|
62
|
+
return _context.a(2);
|
|
63
|
+
}
|
|
64
|
+
}, _callee);
|
|
65
|
+
}));
|
|
66
|
+
return function (_x) {
|
|
67
|
+
return _ref.apply(this, arguments);
|
|
68
|
+
};
|
|
69
|
+
}(), [graphCoreRef, query, setInitialScadaConfigSnapshot]);
|
|
41
70
|
useEffect(function () {
|
|
42
71
|
setScene(query.scene);
|
|
43
72
|
}, [query, setScene]);
|
|
@@ -45,43 +74,67 @@ export default (function () {
|
|
|
45
74
|
window.scadaMode = 'edit';
|
|
46
75
|
}, []);
|
|
47
76
|
useEffect(function () {
|
|
48
|
-
var handler = function
|
|
49
|
-
var
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
var handler = /*#__PURE__*/function () {
|
|
78
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(e) {
|
|
79
|
+
var _graphCoreRef$current2;
|
|
80
|
+
var graph, data, configJSON, _graphCoreRef$current3, width, height, initialPageConfig;
|
|
81
|
+
return _regenerator().w(function (_context2) {
|
|
82
|
+
while (1) switch (_context2.n) {
|
|
83
|
+
case 0:
|
|
84
|
+
graph = (_graphCoreRef$current2 = graphCoreRef.current) === null || _graphCoreRef$current2 === void 0 ? void 0 : _graphCoreRef$current2.graph;
|
|
85
|
+
data = e.data;
|
|
86
|
+
if (!(data.event === 'response-product-scada-config' && query.scene === 'product')) {
|
|
87
|
+
_context2.n = 3;
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
if (!data.payload) {
|
|
91
|
+
_context2.n = 2;
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
configJSON = JSON.parse(data.payload || '{}');
|
|
95
|
+
graph === null || graph === void 0 ? void 0 : graph.fromJSON(configJSON);
|
|
96
|
+
// 缂傗晜鏂侀悽璇茬閸愬懎顔愰敍灞煎▏閻㈣绔烽崘鍛啇閸忓懏寮х憴鍡楀經
|
|
97
|
+
graph === null || graph === void 0 ? void 0 : graph.zoomToFit({
|
|
98
|
+
padding: 20,
|
|
99
|
+
// 鏉堢绐?
|
|
100
|
+
preserveAspectRatio: true // 閺勵垰鎯佹穱婵囧瘮闂€鍨啍濮f柣鈧?
|
|
101
|
+
});
|
|
102
|
+
setPageConfig(configJSON.pageConfig);
|
|
103
|
+
_context2.n = 1;
|
|
104
|
+
return cacheScadaConfig(configJSON.pageConfig);
|
|
105
|
+
case 1:
|
|
106
|
+
_context2.n = 3;
|
|
107
|
+
break;
|
|
108
|
+
case 2:
|
|
109
|
+
// query.scadaType 0閿涙eb 缁?1閿涙氨些閸斻劎顏?
|
|
110
|
+
width = query.scadaType === '0' ? defaultDevicePCSize.width : defaultDeviceMobileSize.width;
|
|
111
|
+
height = query.scadaType === '0' ? defaultDevicePCSize.height : defaultDeviceMobileSize.height;
|
|
112
|
+
initialPageConfig = {
|
|
113
|
+
dimensions: {
|
|
114
|
+
width: width,
|
|
115
|
+
height: height
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
setPageConfig(initialPageConfig);
|
|
119
|
+
(_graphCoreRef$current3 = graphCoreRef.current) === null || _graphCoreRef$current3 === void 0 ? void 0 : _graphCoreRef$current3.initScadaContainer(width, height);
|
|
120
|
+
_context2.n = 3;
|
|
121
|
+
return cacheScadaConfig(initialPageConfig);
|
|
122
|
+
case 3:
|
|
123
|
+
return _context2.a(2);
|
|
124
|
+
}
|
|
125
|
+
}, _callee2);
|
|
126
|
+
}));
|
|
127
|
+
return function handler(_x2) {
|
|
128
|
+
return _ref2.apply(this, arguments);
|
|
129
|
+
};
|
|
130
|
+
}();
|
|
78
131
|
window.addEventListener('message', handler);
|
|
79
132
|
return function () {
|
|
80
133
|
window.removeEventListener('message', handler);
|
|
81
134
|
};
|
|
82
|
-
}, [query, graphCoreRef, setPageConfig]);
|
|
135
|
+
}, [query, graphCoreRef, setPageConfig, cacheScadaConfig]);
|
|
83
136
|
|
|
84
|
-
//
|
|
137
|
+
// 閸掓繂顫愰崠?graph 楠炴儼骞忛崣鏍矋閹線鍘ょ純?
|
|
85
138
|
useEffect(function () {
|
|
86
139
|
var canvasDom = document.getElementById('palette-wrap');
|
|
87
140
|
if (!canvasDom) {
|
|
@@ -101,166 +154,201 @@ export default (function () {
|
|
|
101
154
|
productVersionId: Number(query.productVersionId)
|
|
102
155
|
}
|
|
103
156
|
};
|
|
104
|
-
//
|
|
157
|
+
// 閸?parent 缁愭褰涢崣鎴︹偓浣圭Х閹垽绱濈拠閿嬬湴缂佸嫭鈧線鍘ょ純?
|
|
105
158
|
(_window$opener = window.opener) === null || _window$opener === void 0 ? void 0 : _window$opener.postMessage(msg, '*');
|
|
106
159
|
}
|
|
107
160
|
if (query.scene === 'device') {
|
|
108
161
|
var fetchDeviceScadaConfig = /*#__PURE__*/function () {
|
|
109
|
-
var
|
|
110
|
-
var hideMsg, _yield$GetDeviceConfi, success, data, activeScada, configJSON, width, height,
|
|
111
|
-
return _regenerator().w(function (
|
|
112
|
-
while (1) switch (
|
|
162
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
|
|
163
|
+
var hideMsg, _yield$GetDeviceConfi, success, data, activeScada, configJSON, width, height, initialPageConfig, _t4;
|
|
164
|
+
return _regenerator().w(function (_context3) {
|
|
165
|
+
while (1) switch (_context3.p = _context3.n) {
|
|
113
166
|
case 0:
|
|
114
|
-
hideMsg = message.loading('
|
|
115
|
-
|
|
116
|
-
|
|
167
|
+
hideMsg = message.loading('Loading scada config');
|
|
168
|
+
_context3.p = 1;
|
|
169
|
+
_context3.n = 2;
|
|
117
170
|
return GetDeviceConfiguration({
|
|
118
171
|
deviceConfigurationType: Number(query.scadaType),
|
|
119
172
|
deviceId: Number(query.deviceId)
|
|
120
173
|
});
|
|
121
174
|
case 2:
|
|
122
|
-
_yield$GetDeviceConfi =
|
|
175
|
+
_yield$GetDeviceConfi = _context3.v;
|
|
123
176
|
success = _yield$GetDeviceConfi.success;
|
|
124
177
|
data = _yield$GetDeviceConfi.data;
|
|
125
178
|
if (success) {
|
|
126
|
-
|
|
179
|
+
_context3.n = 3;
|
|
127
180
|
break;
|
|
128
181
|
}
|
|
129
|
-
message.error('
|
|
130
|
-
return
|
|
182
|
+
message.error('Load configuration failed');
|
|
183
|
+
return _context3.a(2);
|
|
131
184
|
case 3:
|
|
132
185
|
activeScada = data === null || data === void 0 ? void 0 : data.find(function (v) {
|
|
133
186
|
return v.deviceConfigurationType === Number(query.scadaType);
|
|
134
187
|
});
|
|
135
|
-
if (activeScada === null || activeScada === void 0 ? void 0 : activeScada.config) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
if (configJSON.pageConfig) {
|
|
139
|
-
setPageConfig(configJSON.pageConfig);
|
|
140
|
-
}
|
|
141
|
-
// 缩放画布内容,使画布内容充满视口
|
|
142
|
-
graphCore.graph.zoomToFit({
|
|
143
|
-
padding: 20,
|
|
144
|
-
// 边距
|
|
145
|
-
preserveAspectRatio: true // 是否保持长宽比。
|
|
146
|
-
});
|
|
147
|
-
} else {
|
|
148
|
-
// query.scadaType 0:web 端 1:移动端
|
|
149
|
-
width = query.scadaType === '0' ? defaultDevicePCSize.width : defaultDeviceMobileSize.width;
|
|
150
|
-
height = query.scadaType === '0' ? defaultDevicePCSize.height : defaultDeviceMobileSize.height;
|
|
151
|
-
setPageConfig({
|
|
152
|
-
dimensions: {
|
|
153
|
-
width: width,
|
|
154
|
-
height: height
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
graphCore.initScadaContainer(width, height);
|
|
188
|
+
if (!(activeScada === null || activeScada === void 0 ? void 0 : activeScada.config)) {
|
|
189
|
+
_context3.n = 5;
|
|
190
|
+
break;
|
|
158
191
|
}
|
|
159
|
-
|
|
160
|
-
|
|
192
|
+
configJSON = JSON.parse(activeScada.config || '{}');
|
|
193
|
+
graphCore.graph.fromJSON(configJSON);
|
|
194
|
+
if (configJSON.pageConfig) {
|
|
195
|
+
setPageConfig(configJSON.pageConfig);
|
|
196
|
+
}
|
|
197
|
+
// 缂傗晜鏂侀悽璇茬閸愬懎顔愰敍灞煎▏閻㈣绔烽崘鍛啇閸忓懏寮х憴鍡楀經
|
|
198
|
+
graphCore.graph.zoomToFit({
|
|
199
|
+
padding: 20,
|
|
200
|
+
// 鏉堢绐?
|
|
201
|
+
preserveAspectRatio: true // 閺勵垰鎯佹穱婵囧瘮闂€鍨啍濮f柣鈧?
|
|
202
|
+
});
|
|
203
|
+
_context3.n = 4;
|
|
204
|
+
return cacheScadaConfig(configJSON.pageConfig || {});
|
|
161
205
|
case 4:
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
console.error(_t);
|
|
165
|
-
message.error('组态配置获取失败');
|
|
206
|
+
_context3.n = 6;
|
|
207
|
+
break;
|
|
166
208
|
case 5:
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
209
|
+
// query.scadaType 0閿涙eb 缁?1閿涙氨些閸斻劎顏?
|
|
210
|
+
width = query.scadaType === '0' ? defaultDevicePCSize.width : defaultDeviceMobileSize.width;
|
|
211
|
+
height = query.scadaType === '0' ? defaultDevicePCSize.height : defaultDeviceMobileSize.height;
|
|
212
|
+
initialPageConfig = {
|
|
213
|
+
dimensions: {
|
|
214
|
+
width: width,
|
|
215
|
+
height: height
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
setPageConfig(initialPageConfig);
|
|
219
|
+
graphCore.initScadaContainer(width, height);
|
|
220
|
+
_context3.n = 6;
|
|
221
|
+
return cacheScadaConfig(initialPageConfig);
|
|
170
222
|
case 6:
|
|
171
|
-
|
|
223
|
+
_context3.n = 8;
|
|
224
|
+
break;
|
|
225
|
+
case 7:
|
|
226
|
+
_context3.p = 7;
|
|
227
|
+
_t4 = _context3.v;
|
|
228
|
+
console.error(_t4);
|
|
229
|
+
message.error('Load configuration failed');
|
|
230
|
+
case 8:
|
|
231
|
+
_context3.p = 8;
|
|
232
|
+
hideMsg();
|
|
233
|
+
return _context3.f(8);
|
|
234
|
+
case 9:
|
|
235
|
+
return _context3.a(2);
|
|
172
236
|
}
|
|
173
|
-
},
|
|
237
|
+
}, _callee3, null, [[1, 7, 8, 9]]);
|
|
174
238
|
}));
|
|
175
239
|
return function fetchDeviceScadaConfig() {
|
|
176
|
-
return
|
|
240
|
+
return _ref3.apply(this, arguments);
|
|
177
241
|
};
|
|
178
242
|
}();
|
|
179
243
|
fetchDeviceScadaConfig();
|
|
180
244
|
}
|
|
181
245
|
if (query.scene === 'freedom') {
|
|
182
246
|
var fetchScadaConfig = /*#__PURE__*/function () {
|
|
183
|
-
var
|
|
184
|
-
var hideMsg, _data$list, _yield$GetCompanyConf, success, data, scadaConfig, configJSON, width, height,
|
|
185
|
-
return _regenerator().w(function (
|
|
186
|
-
while (1) switch (
|
|
247
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
|
|
248
|
+
var hideMsg, _data$list, _yield$GetCompanyConf, success, data, scadaConfig, _configJSON$cells, configJSON, width, height, initialPageConfig, _t5;
|
|
249
|
+
return _regenerator().w(function (_context4) {
|
|
250
|
+
while (1) switch (_context4.p = _context4.n) {
|
|
187
251
|
case 0:
|
|
188
|
-
hideMsg = message.loading('
|
|
189
|
-
|
|
190
|
-
|
|
252
|
+
hideMsg = message.loading('Loading scada config');
|
|
253
|
+
_context4.p = 1;
|
|
254
|
+
_context4.n = 2;
|
|
191
255
|
return GetCompanyConfigurationPage({
|
|
192
256
|
companyConfigurationId: Number(query.scadaId),
|
|
193
257
|
isGetConfig: true,
|
|
194
258
|
companyId: Number(query.companyId)
|
|
195
259
|
});
|
|
196
260
|
case 2:
|
|
197
|
-
_yield$GetCompanyConf =
|
|
261
|
+
_yield$GetCompanyConf = _context4.v;
|
|
198
262
|
success = _yield$GetCompanyConf.success;
|
|
199
263
|
data = _yield$GetCompanyConf.data;
|
|
200
264
|
if (!(!success || !(data === null || data === void 0 ? void 0 : (_data$list = data.list) === null || _data$list === void 0 ? void 0 : _data$list.length))) {
|
|
201
|
-
|
|
265
|
+
_context4.n = 3;
|
|
202
266
|
break;
|
|
203
267
|
}
|
|
204
|
-
message.error('
|
|
205
|
-
return
|
|
268
|
+
message.error('Load configuration failed');
|
|
269
|
+
return _context4.a(2);
|
|
206
270
|
case 3:
|
|
207
271
|
scadaConfig = data.list[0].config;
|
|
208
|
-
if (scadaConfig) {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
setPageConfig({
|
|
224
|
-
title: query.title,
|
|
225
|
-
dimensions: {
|
|
226
|
-
width: width,
|
|
227
|
-
height: height
|
|
272
|
+
if (!scadaConfig) {
|
|
273
|
+
_context4.n = 5;
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
configJSON = JSON.parse(scadaConfig || '{}'); // 娣囶喖顦查崥搴n伂娣囨繂鐡ㄩ弫鐗堝祦閺冭绱濋崶鐖卻on閺佺増宓佺粔宥呯摠閸?%"閼板苯顕遍懛瀵告畱"%"閺佺増宓佹稉銏犮亼闂傤噣顣?
|
|
277
|
+
if (configJSON === null || configJSON === void 0 ? void 0 : (_configJSON$cells = configJSON.cells) === null || _configJSON$cells === void 0 ? void 0 : _configJSON$cells.length) {
|
|
278
|
+
configJSON === null || configJSON === void 0 ? void 0 : configJSON.cells.forEach(function (item) {
|
|
279
|
+
var _item$attrs, _item$attrs$body, _item$attrs2, _item$attrs2$body, _item$attrs2$body$ref, _item$attrs3, _item$attrs3$body, _item$attrs5, _item$attrs5$body, _item$attrs6, _item$attrs6$body, _item$attrs6$body$ref, _item$attrs7, _item$attrs7$body;
|
|
280
|
+
if ((item === null || item === void 0 ? void 0 : (_item$attrs = item.attrs) === null || _item$attrs === void 0 ? void 0 : (_item$attrs$body = _item$attrs.body) === null || _item$attrs$body === void 0 ? void 0 : _item$attrs$body.refWidth) && (item === null || item === void 0 ? void 0 : (_item$attrs2 = item.attrs) === null || _item$attrs2 === void 0 ? void 0 : (_item$attrs2$body = _item$attrs2.body) === null || _item$attrs2$body === void 0 ? void 0 : (_item$attrs2$body$ref = _item$attrs2$body.refWidth) === null || _item$attrs2$body$ref === void 0 ? void 0 : _item$attrs2$body$ref.indexOf('%')) === -1 && !isNaN(Number(item === null || item === void 0 ? void 0 : (_item$attrs3 = item.attrs) === null || _item$attrs3 === void 0 ? void 0 : (_item$attrs3$body = _item$attrs3.body) === null || _item$attrs3$body === void 0 ? void 0 : _item$attrs3$body.refWidth))) {
|
|
281
|
+
var _item$attrs4, _item$attrs4$body;
|
|
282
|
+
item.attrs.body.refWidth = "".concat(item === null || item === void 0 ? void 0 : (_item$attrs4 = item.attrs) === null || _item$attrs4 === void 0 ? void 0 : (_item$attrs4$body = _item$attrs4.body) === null || _item$attrs4$body === void 0 ? void 0 : _item$attrs4$body.refWidth, "%");
|
|
283
|
+
}
|
|
284
|
+
if ((item === null || item === void 0 ? void 0 : (_item$attrs5 = item.attrs) === null || _item$attrs5 === void 0 ? void 0 : (_item$attrs5$body = _item$attrs5.body) === null || _item$attrs5$body === void 0 ? void 0 : _item$attrs5$body.refHeight) && (item === null || item === void 0 ? void 0 : (_item$attrs6 = item.attrs) === null || _item$attrs6 === void 0 ? void 0 : (_item$attrs6$body = _item$attrs6.body) === null || _item$attrs6$body === void 0 ? void 0 : (_item$attrs6$body$ref = _item$attrs6$body.refHeight) === null || _item$attrs6$body$ref === void 0 ? void 0 : _item$attrs6$body$ref.indexOf('%')) === -1 && !isNaN(Number(item === null || item === void 0 ? void 0 : (_item$attrs7 = item.attrs) === null || _item$attrs7 === void 0 ? void 0 : (_item$attrs7$body = _item$attrs7.body) === null || _item$attrs7$body === void 0 ? void 0 : _item$attrs7$body.refHeight))) {
|
|
285
|
+
var _item$attrs8, _item$attrs8$body;
|
|
286
|
+
item.attrs.body.refHeight = "".concat(item === null || item === void 0 ? void 0 : (_item$attrs8 = item.attrs) === null || _item$attrs8 === void 0 ? void 0 : (_item$attrs8$body = _item$attrs8.body) === null || _item$attrs8$body === void 0 ? void 0 : _item$attrs8$body.refHeight, "%");
|
|
228
287
|
}
|
|
229
288
|
});
|
|
230
|
-
graphCore.initScadaContainer(width, height);
|
|
231
289
|
}
|
|
232
|
-
|
|
233
|
-
|
|
290
|
+
graphCore.graph.fromJSON(configJSON);
|
|
291
|
+
if (configJSON.pageConfig) {
|
|
292
|
+
setPageConfig(configJSON.pageConfig);
|
|
293
|
+
}
|
|
294
|
+
// 缂傗晜鏂侀悽璇茬閸愬懎顔愰敍灞煎▏閻㈣绔烽崘鍛啇閸忓懏寮х憴鍡楀經
|
|
295
|
+
graphCore.graph.zoomToFit({
|
|
296
|
+
padding: 20,
|
|
297
|
+
// 鏉堢绐?
|
|
298
|
+
preserveAspectRatio: true // 閺勵垰鎯佹穱婵囧瘮闂€鍨啍濮f柣鈧?
|
|
299
|
+
});
|
|
300
|
+
_context4.n = 4;
|
|
301
|
+
return cacheScadaConfig(configJSON.pageConfig || {});
|
|
234
302
|
case 4:
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
console.error(_t2);
|
|
238
|
-
message.error('组态配置获取失败');
|
|
303
|
+
_context4.n = 6;
|
|
304
|
+
break;
|
|
239
305
|
case 5:
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
306
|
+
width = 1366;
|
|
307
|
+
height = 768;
|
|
308
|
+
initialPageConfig = {
|
|
309
|
+
title: query.title,
|
|
310
|
+
dimensions: {
|
|
311
|
+
width: width,
|
|
312
|
+
height: height
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
setPageConfig(initialPageConfig);
|
|
316
|
+
graphCore.initScadaContainer(width, height);
|
|
317
|
+
_context4.n = 6;
|
|
318
|
+
return cacheScadaConfig(initialPageConfig);
|
|
243
319
|
case 6:
|
|
244
|
-
|
|
320
|
+
_context4.n = 8;
|
|
321
|
+
break;
|
|
322
|
+
case 7:
|
|
323
|
+
_context4.p = 7;
|
|
324
|
+
_t5 = _context4.v;
|
|
325
|
+
console.error(_t5);
|
|
326
|
+
message.error('Load configuration failed');
|
|
327
|
+
case 8:
|
|
328
|
+
_context4.p = 8;
|
|
329
|
+
hideMsg();
|
|
330
|
+
return _context4.f(8);
|
|
331
|
+
case 9:
|
|
332
|
+
return _context4.a(2);
|
|
245
333
|
}
|
|
246
|
-
},
|
|
334
|
+
}, _callee4, null, [[1, 7, 8, 9]]);
|
|
247
335
|
}));
|
|
248
336
|
return function fetchScadaConfig() {
|
|
249
|
-
return
|
|
337
|
+
return _ref4.apply(this, arguments);
|
|
250
338
|
};
|
|
251
339
|
}();
|
|
252
340
|
fetchScadaConfig();
|
|
253
341
|
}
|
|
254
|
-
}, [graphCoreRef, query, setPageConfig]);
|
|
342
|
+
}, [cacheScadaConfig, graphCoreRef, query, setPageConfig]);
|
|
255
343
|
useEffect(function () {
|
|
256
344
|
if (process.env.NODE_ENV === 'production') {
|
|
257
345
|
window.onbeforeunload = function (e) {
|
|
258
346
|
e = e || window.event;
|
|
259
347
|
if (e) {
|
|
260
|
-
//
|
|
261
|
-
e.returnValue = '
|
|
348
|
+
// Keep the same behavior as before.
|
|
349
|
+
e.returnValue = 'Are you sure you want to leave?';
|
|
262
350
|
}
|
|
263
|
-
return '
|
|
351
|
+
return 'Are you sure you want to leave?';
|
|
264
352
|
};
|
|
265
353
|
}
|
|
266
354
|
return function () {
|
|
@@ -268,7 +356,7 @@ export default (function () {
|
|
|
268
356
|
};
|
|
269
357
|
}, []);
|
|
270
358
|
|
|
271
|
-
// scene
|
|
359
|
+
// scene 娑?freedom 閺冭绱濋懢宄板絿閻劍鍩涚拋鎯ь槵閸掓銆?
|
|
272
360
|
useEffect(function () {
|
|
273
361
|
if (query.scene !== 'freedom') {
|
|
274
362
|
return;
|
|
@@ -278,7 +366,7 @@ export default (function () {
|
|
|
278
366
|
projectId: query.projectId ? Number(query.projectId) : undefined
|
|
279
367
|
} : undefined);
|
|
280
368
|
}, [query, fetchUserDeviceList]);
|
|
281
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Helmet, null, /*#__PURE__*/React.createElement("title", null, "\
|
|
369
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Helmet, null, /*#__PURE__*/React.createElement("title", null, "\u7F02\u4F78\u5AED\u9227?CoolCare")), /*#__PURE__*/React.createElement("div", {
|
|
282
370
|
className: "".concat(styles.editor)
|
|
283
371
|
}, /*#__PURE__*/React.createElement("header", {
|
|
284
372
|
className: styles['header-tools']
|