coolcare-lite-scada-component 2.0.17 → 2.0.19
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.
|
@@ -6,12 +6,14 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
6
6
|
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
7
7
|
import React from "react";
|
|
8
8
|
import { memo, useState, useEffect } from 'react';
|
|
9
|
-
import { Tooltip } from 'antd';
|
|
9
|
+
import { Tooltip, Modal } from 'antd';
|
|
10
10
|
import Switch from "../../components/Switch";
|
|
11
11
|
import { usePointWatch } from "../../hooks";
|
|
12
12
|
import { isNumber } from "../../utils";
|
|
13
13
|
import { pointWrite } from "../utils";
|
|
14
14
|
import styles from "./index.css";
|
|
15
|
+
import { ExclamationCircleOutlined } from '@ant-design/icons';
|
|
16
|
+
var confirm = Modal.confirm;
|
|
15
17
|
var EleSwitchComponent = function EleSwitchComponent(_ref) {
|
|
16
18
|
var _payload$pointList, _payload$mittMeta;
|
|
17
19
|
var node = _ref.node;
|
|
@@ -30,18 +32,28 @@ var EleSwitchComponent = function EleSwitchComponent(_ref) {
|
|
|
30
32
|
tooltipTitle = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, "\u70B9\u4F4D\u540D\u79F0\uFF1A", (pointData === null || pointData === void 0 ? void 0 : pointData.pointName) || '-'), /*#__PURE__*/React.createElement("div", null, "\u70B9\u4F4D\u503C\uFF1A", (_pointData$value = pointData === null || pointData === void 0 ? void 0 : pointData.value) !== null && _pointData$value !== void 0 ? _pointData$value : '-', " ", (_pointData$unit = pointData === null || pointData === void 0 ? void 0 : pointData.unit) !== null && _pointData$unit !== void 0 ? _pointData$unit : '-'), /*#__PURE__*/React.createElement("div", null, "\u66F4\u65B0\u65F6\u95F4\uFF1A", (pointData === null || pointData === void 0 ? void 0 : pointData.updateTime) || '-'));
|
|
31
33
|
}
|
|
32
34
|
var handleChange = function handleChange(val) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
confirm({
|
|
36
|
+
title: "操作警告",
|
|
37
|
+
icon: /*#__PURE__*/React.createElement(ExclamationCircleOutlined, null),
|
|
38
|
+
content: "确定执行操作吗?",
|
|
39
|
+
getContainer: function getContainer() {
|
|
40
|
+
return document.getElementById("scada-body");
|
|
41
|
+
},
|
|
42
|
+
onOk: function onOk() {
|
|
43
|
+
if (window.scadaMode === 'edit' || !configPoint || !(payload === null || payload === void 0 ? void 0 : payload.pointWriteable)) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
var checkedValue = payload.checkedValue,
|
|
47
|
+
unCheckedValue = payload.unCheckedValue;
|
|
48
|
+
pointWrite({
|
|
49
|
+
identifierName: configPoint.identifierName,
|
|
50
|
+
pointId: 'pointId' in configPoint ? configPoint.pointId : undefined,
|
|
51
|
+
deviceId: 'deviceId' in configPoint ? configPoint.deviceId : undefined,
|
|
52
|
+
value: val ? checkedValue : unCheckedValue
|
|
53
|
+
});
|
|
54
|
+
setValue(val);
|
|
55
|
+
}
|
|
43
56
|
});
|
|
44
|
-
setValue(val);
|
|
45
57
|
};
|
|
46
58
|
useEffect(function () {
|
|
47
59
|
if (isNumber(pointData === null || pointData === void 0 ? void 0 : pointData.value) && isNumber(payload === null || payload === void 0 ? void 0 : payload.checkedValue) && (pointData === null || pointData === void 0 ? void 0 : pointData.value) === (payload === null || payload === void 0 ? void 0 : payload.checkedValue)) {
|
|
@@ -27,7 +27,7 @@ import emitter from "../../../utils/events";
|
|
|
27
27
|
import { GetDevicePoint } from "../../../services/gateway/Device";
|
|
28
28
|
import "./index.css";
|
|
29
29
|
/** 刷新频率 */
|
|
30
|
-
var RefreshFrequency =
|
|
30
|
+
var RefreshFrequency = 30 * 1000;
|
|
31
31
|
var Player = function Player(_ref) {
|
|
32
32
|
var jsonConfig = _ref.jsonConfig,
|
|
33
33
|
query = _ref.query;
|
|
@@ -228,7 +228,8 @@ var Display = function Display(_ref) {
|
|
|
228
228
|
});
|
|
229
229
|
}, []);
|
|
230
230
|
return /*#__PURE__*/React.createElement("div", {
|
|
231
|
-
className: styles.wrap
|
|
231
|
+
className: styles.wrap,
|
|
232
|
+
id: "scada-body"
|
|
232
233
|
}, !!queryRef.current && /*#__PURE__*/React.createElement(Player, {
|
|
233
234
|
jsonConfig: jsonConfig,
|
|
234
235
|
query: queryRef.current
|