coolcare-lite-scada-component 1.0.15 → 1.0.17

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,26 @@ 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
- if (window.scadaMode === 'edit' || !configPoint || !(payload === null || payload === void 0 ? void 0 : payload.pointWriteable)) {
34
- return;
35
- }
36
- var checkedValue = payload.checkedValue,
37
- unCheckedValue = payload.unCheckedValue;
38
- pointWrite({
39
- identifierName: configPoint.identifierName,
40
- pointId: 'pointId' in configPoint ? configPoint.pointId : undefined,
41
- deviceId: 'deviceId' in configPoint ? configPoint.deviceId : undefined,
42
- value: val ? checkedValue : unCheckedValue
35
+ confirm({
36
+ title: "操作警告",
37
+ icon: /*#__PURE__*/React.createElement(ExclamationCircleOutlined, null),
38
+ content: "确定执行操作吗?",
39
+ getContainer: false,
40
+ onOk: function onOk() {
41
+ if (window.scadaMode === 'edit' || !configPoint || !(payload === null || payload === void 0 ? void 0 : payload.pointWriteable)) {
42
+ return;
43
+ }
44
+ var checkedValue = payload.checkedValue,
45
+ unCheckedValue = payload.unCheckedValue;
46
+ pointWrite({
47
+ identifierName: configPoint.identifierName,
48
+ pointId: 'pointId' in configPoint ? configPoint.pointId : undefined,
49
+ deviceId: 'deviceId' in configPoint ? configPoint.deviceId : undefined,
50
+ value: val ? checkedValue : unCheckedValue
51
+ });
52
+ setValue(val);
53
+ }
43
54
  });
44
- setValue(val);
45
55
  };
46
56
  useEffect(function () {
47
57
  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)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coolcare-lite-scada-component",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "scripts": {
5
5
  "start": "umi dev",
6
6
  "build:prod": "UMI_ENV=prod umi build",