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.
Files changed (96) hide show
  1. package/es/app.js +23 -0
  2. package/es/components/BoxShadowPicker/index.less.d.ts +9 -9
  3. package/es/components/ColorPicker/util.js +4 -4
  4. package/es/components/DialogHistory/index.css +22 -0
  5. package/es/components/DialogHistory/index.js +388 -79
  6. package/es/components/DialogImagePicker/GroupPanel/index.js +1 -12
  7. package/es/components/ECharts/index.js +31 -23
  8. package/es/components/FormBindPoint/FreedomScene.js +181 -11
  9. package/es/components/FormBindPoint/ProductionOrDeviceScene.js +12 -5
  10. package/es/components/FormBindPoint/index.js +6 -0
  11. package/es/components/Icon/index.js +1 -1
  12. package/es/components/IconFont/index.js +6 -0
  13. package/es/components/ImageUploader/index.js +8 -7
  14. package/es/components/ModalChangePointValue.js +272 -0
  15. package/es/components/ModalChoosePoint/index.js +53 -16
  16. package/es/components/PointSelect/DeviceIndicatorTable.js +111 -0
  17. package/es/components/PointSelect/IndicatorSelect.js +182 -0
  18. package/es/constant.js +2 -2
  19. package/es/element/BorderBox/util/typings.d.ts +9 -9
  20. package/es/element/Decoration/util/typings.d.ts +9 -9
  21. package/es/element/EleFan/Component.js +1 -1
  22. package/es/element/EleFanBySvg/index.js +3 -3
  23. package/es/element/EleImage/index.js +1 -1
  24. package/es/element/ElePointImage/Component.js +30 -41
  25. package/es/element/ElePointImage/index.js +1 -1
  26. package/es/element/ElePointValue/Component.js +117 -17
  27. package/es/element/ElePointValue/PropsSet/StatisticsPropsSet/index.js +6 -0
  28. package/es/element/ElePointValue/index.css +11 -0
  29. package/es/element/ElePointValue/index.js +6 -0
  30. package/es/element/EleShine/Component.js +133 -23
  31. package/es/element/EleShine/PropsSet/OtherPropsSet/index.js +27 -34
  32. package/es/element/EleShine/PropsSet/PointAlarmTool.js +99 -0
  33. package/es/element/EleShine/PropsSet/index.js +9 -1
  34. package/es/element/EleShine/index.js +2 -1
  35. package/es/element/EleState/index.js +1 -1
  36. package/es/element/EleSwitch/Component.js +2 -12
  37. package/es/element/PipeNodes/NodeBL/index.js +1 -1
  38. package/es/element/PipeNodes/NodeBR/index.js +1 -1
  39. package/es/element/PipeNodes/NodeBottom/index.js +1 -1
  40. package/es/element/PipeNodes/NodeCenter/index.js +1 -1
  41. package/es/element/PipeNodes/NodeHorizontal/index.js +1 -1
  42. package/es/element/PipeNodes/NodeLeft/index.js +1 -1
  43. package/es/element/PipeNodes/NodeRight/index.js +1 -1
  44. package/es/element/PipeNodes/NodeTL/index.js +1 -1
  45. package/es/element/PipeNodes/NodeTR/index.js +1 -1
  46. package/es/element/PipeNodes/NodeTop/index.js +1 -1
  47. package/es/element/PipeNodes/NodeVertical/index.js +1 -1
  48. package/es/element/PointCard/PointListCard/Component.js +3 -2
  49. package/es/element/PointCard/PointListCard/index.js +1 -0
  50. package/es/element/type.d.ts +4 -6
  51. package/es/element/utils/getValueByExpression.js +3 -0
  52. package/es/element/utils/handleEleEvent.js +11 -1
  53. package/es/element/utils/pointWrite.js +4 -5
  54. package/es/hooks/usePointWatch.js +1 -1
  55. package/es/models/useEditor.js +14 -8
  56. package/es/pages/display/Player/index.js +444 -123
  57. package/es/pages/display/index.js +2 -2
  58. package/es/pages/document.ejs +1 -1
  59. package/es/pages/editor/PanelLeft/BasicShapeList/listData.js +8 -8
  60. package/es/pages/editor/PanelLeft/BorderBoxEleList/index.less.d.ts +7 -7
  61. package/es/pages/editor/PanelLeft/DecorationEleList/index.less.d.ts +7 -7
  62. package/es/pages/editor/PanelLeft/GroupManageDialog/index.js +4 -4
  63. package/es/pages/editor/PanelLeft/ImgGroup/index.js +1 -12
  64. package/es/pages/editor/PanelLeft/MetaEleList/listData.js +14 -14
  65. package/es/pages/editor/PanelLeft/PipeEleList/listData.js +11 -11
  66. package/es/pages/editor/PanelLeft/PointCardEleList/listData.js +6 -6
  67. package/es/pages/editor/PanelLeft/RecommendEleList/listData.js +4 -4
  68. package/es/pages/editor/PanelLeft/index.js +3 -3
  69. package/es/pages/editor/PanelRight/components/FormLayer/index.js +3 -1
  70. package/es/pages/editor/PanelRight/index.less.d.ts +7 -7
  71. package/es/pages/editor/PanelTop/HotKeyDescribe/index.js +1 -1
  72. package/es/pages/editor/PanelTop/Save/index.js +120 -67
  73. package/es/pages/editor/index.js +223 -135
  74. package/es/pages/editor/utils/scadaChangeLog.js +237 -0
  75. package/es/services/common/Uploader.js +1 -1
  76. package/es/services/common/typings.d.ts +15 -15
  77. package/es/services/energy/index.js +56 -0
  78. package/es/services/gateway/Device.js +22 -0
  79. package/es/services/gateway/Point.js +46 -25
  80. package/es/services/gateway/typings.d.ts +3 -0
  81. package/es/services/master/typings.d.ts +362 -362
  82. package/es/services/product/typings.d.ts +1045 -1045
  83. package/es/services/project/typings.d.ts +1609 -1609
  84. package/es/services/request.js +126 -13
  85. package/es/shims.x6.d.ts +15 -15
  86. package/es/typings.d.ts +12 -0
  87. package/es/utils/auth.js +6 -2
  88. package/es/utils/cssStyle.js +4 -4
  89. package/es/utils/dataURItoBlob.js +25 -0
  90. package/es/utils/date.js +7 -0
  91. package/es/utils/decomposeMatrix.js +5 -5
  92. package/es/utils/events.js +3 -3
  93. package/es/utils/index.js +34 -34
  94. package/es/utils/pointValueFormat.js +3 -3
  95. package/package.json +16 -15
  96. package/es/elementCss.css +0 -19
@@ -4,48 +4,158 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
5
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6
6
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
8
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
10
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
11
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
12
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
13
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
14
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
15
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
16
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
7
17
  import React from "react";
8
- import { memo } from 'react';
18
+ import { memo, useEffect, useMemo, useState } from 'react';
9
19
  import { Tooltip } from 'antd';
10
20
  import { getValueByExpression } from "../utils";
11
21
  import { reactShapeNodeAreEqual } from "../utils";
12
- import { usePointWatch, useEleEventHandle } from "../../hooks";
22
+ import { useEleEventHandle } from "../../hooks";
13
23
  import ExpressionFormat from "../../components/ExpressionFormat";
24
+ import emitter from "../../utils/events";
14
25
  import styles from "./index.css";
26
+ var ALARM_EXPRESSION_VALUE = '告警';
27
+ var triggerLogicTextMap = {
28
+ single: '单一报警触发',
29
+ all: '全部报警触发'
30
+ };
31
+ function getBindPointEventKey(point) {
32
+ if (!point) {
33
+ return '';
34
+ }
35
+ if ('pointId' in point && point.pointId) {
36
+ return point.pointId;
37
+ }
38
+ if ('identifierName' in point && point.identifierName) {
39
+ return point.identifierName;
40
+ }
41
+ if ('meterId' in point && point.meterId) {
42
+ return point.meterId;
43
+ }
44
+ if ('indicatorNo' in point && point.indicatorNo) {
45
+ return point.indicatorNo;
46
+ }
47
+ return '';
48
+ }
49
+ function getPointExpressions(point, payload) {
50
+ var _point$expressions;
51
+ return (point === null || point === void 0 ? void 0 : (_point$expressions = point.expressions) === null || _point$expressions === void 0 ? void 0 : _point$expressions.length) ? point.expressions : (payload === null || payload === void 0 ? void 0 : payload.shineExpressions) || [];
52
+ }
15
53
  var EleShineComponent = function EleShineComponent(_ref) {
16
- var _payload$pointList, _payload$mittMeta$nam, _payload$mittMeta, _payload$mittMeta2;
54
+ var _payload$mittMeta2, _payload$mittMeta$nam2, _payload$mittMeta3;
17
55
  var node = _ref.node;
18
56
  var payload = node === null || node === void 0 ? void 0 : node.getData();
19
- var configPoint = payload === null || payload === void 0 ? void 0 : (_payload$pointList = payload.pointList) === null || _payload$pointList === void 0 ? void 0 : _payload$pointList[0];
57
+ var bindPointList = (payload === null || payload === void 0 ? void 0 : payload.pointList) || [];
58
+ var triggerLogic = (payload === null || payload === void 0 ? void 0 : payload.triggerLogic) === 'all' ? 'all' : 'single';
59
+ var _useState = useState(function () {
60
+ return _toConsumableArray(bindPointList);
61
+ }),
62
+ _useState2 = _slicedToArray(_useState, 2),
63
+ pointList = _useState2[0],
64
+ setPointList = _useState2[1];
65
+ var bindPointConfigSignature = useMemo(function () {
66
+ return bindPointList.map(function (point, index) {
67
+ return JSON.stringify({
68
+ index: index,
69
+ eventKey: getBindPointEventKey(point),
70
+ deviceId: 'deviceId' in point ? point.deviceId : undefined,
71
+ expressions: getPointExpressions(point, payload)
72
+ });
73
+ }).join('|');
74
+ }, [bindPointList, payload === null || payload === void 0 ? void 0 : payload.shineExpressions]);
75
+ var bindPointEventSignature = useMemo(function () {
76
+ return bindPointList.map(function (point, index) {
77
+ return "".concat(index, ":").concat(getBindPointEventKey(point));
78
+ }).join('|');
79
+ }, [bindPointList]);
80
+ useEffect(function () {
81
+ setPointList(_toConsumableArray(bindPointList));
82
+ }, [bindPointConfigSignature]);
83
+ useEffect(function () {
84
+ var _payload$mittMeta$nam, _payload$mittMeta;
85
+ if (window.scadaMode === 'edit' || !bindPointList.length) {
86
+ return function () {};
87
+ }
88
+ var namespace = (_payload$mittMeta$nam = payload === null || payload === void 0 ? void 0 : (_payload$mittMeta = payload.mittMeta) === null || _payload$mittMeta === void 0 ? void 0 : _payload$mittMeta.namespace) !== null && _payload$mittMeta$nam !== void 0 ? _payload$mittMeta$nam : 0;
89
+ var eventHandlerList = [];
90
+ bindPointList.forEach(function (point, index) {
91
+ var eventKey = getBindPointEventKey(point);
92
+ if (!eventKey) {
93
+ return;
94
+ }
95
+ var eventName = "point-update-".concat(eventKey, "-").concat(namespace);
96
+ var eventHandler = function eventHandler(pointData) {
97
+ setPointList(function (prev) {
98
+ return prev.map(function (item, itemIndex) {
99
+ if (itemIndex !== index) {
100
+ return item;
101
+ }
102
+ return _objectSpread(_objectSpread({}, item), pointData);
103
+ });
104
+ });
105
+ };
106
+ emitter.on(eventName, eventHandler);
107
+ eventHandlerList.push({
108
+ eventName: eventName,
109
+ eventHandler: eventHandler
110
+ });
111
+ });
112
+ return function () {
113
+ eventHandlerList.forEach(function (item) {
114
+ emitter.off(item.eventName, item.eventHandler);
115
+ });
116
+ };
117
+ }, [bindPointEventSignature, payload === null || payload === void 0 ? void 0 : (_payload$mittMeta2 = payload.mittMeta) === null || _payload$mittMeta2 === void 0 ? void 0 : _payload$mittMeta2.namespace]);
20
118
  var eventHandles = useEleEventHandle({
21
119
  events: payload === null || payload === void 0 ? void 0 : payload.events,
22
120
  payload: {
23
- points: [{
24
- identifierName: configPoint === null || configPoint === void 0 ? void 0 : configPoint.identifierName,
25
- deviceId: configPoint && 'deviceId' in configPoint ? configPoint.deviceId : undefined
26
- }],
27
- namespace: (_payload$mittMeta$nam = payload === null || payload === void 0 ? void 0 : (_payload$mittMeta = payload.mittMeta) === null || _payload$mittMeta === void 0 ? void 0 : _payload$mittMeta.namespace) !== null && _payload$mittMeta$nam !== void 0 ? _payload$mittMeta$nam : 0
121
+ points: bindPointList.map(function (point) {
122
+ return {
123
+ identifierName: point.identifierName,
124
+ deviceId: 'deviceId' in point ? point.deviceId : undefined,
125
+ pointId: 'pointId' in point ? point.pointId : undefined,
126
+ indicatorNo: 'indicatorNo' in point ? point.indicatorNo : undefined
127
+ };
128
+ }),
129
+ namespace: (_payload$mittMeta$nam2 = payload === null || payload === void 0 ? void 0 : (_payload$mittMeta3 = payload.mittMeta) === null || _payload$mittMeta3 === void 0 ? void 0 : _payload$mittMeta3.namespace) !== null && _payload$mittMeta$nam2 !== void 0 ? _payload$mittMeta$nam2 : 0
28
130
  }
29
131
  });
30
- var pointData = usePointWatch(configPoint, payload === null || payload === void 0 ? void 0 : (_payload$mittMeta2 = payload.mittMeta) === null || _payload$mittMeta2 === void 0 ? void 0 : _payload$mittMeta2.namespace);
31
132
  var tooltipTitle = null;
32
- if (!configPoint) {
133
+ if (!bindPointList.length) {
33
134
  tooltipTitle = '未绑定点位';
34
135
  } else {
35
- var _pointData$value, _pointData$unit;
36
- 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) || '-'), /*#__PURE__*/React.createElement(ExpressionFormat, {
37
- bodyStyle: {
38
- color: '#ff4d4f'
39
- },
40
- expressions: (payload === null || payload === void 0 ? void 0 : payload.shineExpressions) || [],
41
- valueType: "text"
136
+ tooltipTitle = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, "\u89E6\u53D1\u903B\u8F91\uFF1A", triggerLogicTextMap[triggerLogic]), pointList.map(function (point, index) {
137
+ var _point$value, _point$unit;
138
+ return /*#__PURE__*/React.createElement("div", {
139
+ key: "".concat(getBindPointEventKey(point), "-").concat(index)
140
+ }, /*#__PURE__*/React.createElement("div", null, "\u70B9\u4F4D", pointList.length === 1 ? '' : index + 1, "\uFF1A", (point === null || point === void 0 ? void 0 : point.pointName) || (point === null || point === void 0 ? void 0 : point.identifierName) || (point === null || point === void 0 ? void 0 : point.indicatorNo) || (point === null || point === void 0 ? void 0 : point.meterId) || '-'), /*#__PURE__*/React.createElement("div", null, "\u70B9\u4F4D\u503C\uFF1A", (_point$value = point === null || point === void 0 ? void 0 : point.value) !== null && _point$value !== void 0 ? _point$value : '-', " ", (_point$unit = point === null || point === void 0 ? void 0 : point.unit) !== null && _point$unit !== void 0 ? _point$unit : '-'), /*#__PURE__*/React.createElement("div", null, "\u66F4\u65B0\u65F6\u95F4\uFF1A", (point === null || point === void 0 ? void 0 : point.updateTime) || '-'), /*#__PURE__*/React.createElement(ExpressionFormat, {
141
+ bodyStyle: {
142
+ color: '#ff4d4f'
143
+ },
144
+ expressions: getPointExpressions(point, payload),
145
+ valueType: "text"
146
+ }));
42
147
  }));
43
148
  }
44
-
45
- /** 是否告警 */
46
- var shineExpressionsValue = getValueByExpression(pointData === null || pointData === void 0 ? void 0 : pointData.value, payload === null || payload === void 0 ? void 0 : payload.shineExpressions);
149
+ var isAlarmList = pointList.map(function (point) {
150
+ return getValueByExpression(point === null || point === void 0 ? void 0 : point.value, getPointExpressions(point, payload)) === ALARM_EXPRESSION_VALUE;
151
+ });
152
+ var shouldShine = false;
47
153
  if (window.scadaMode === 'edit') {
48
- shineExpressionsValue = '告警';
154
+ shouldShine = true;
155
+ } else if (triggerLogic === 'all') {
156
+ shouldShine = isAlarmList.length > 0 && isAlarmList.every(Boolean);
157
+ } else {
158
+ shouldShine = isAlarmList.some(Boolean);
49
159
  }
50
160
  return /*#__PURE__*/React.createElement(Tooltip, {
51
161
  title: tooltipTitle
@@ -63,7 +173,7 @@ var EleShineComponent = function EleShineComponent(_ref) {
63
173
  return eventHandles.current.onMouseLeave(e);
64
174
  },
65
175
  style: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, payload === null || payload === void 0 ? void 0 : payload.fontStyles), payload === null || payload === void 0 ? void 0 : payload.borderStyles), payload === null || payload === void 0 ? void 0 : payload.fillStyles), payload === null || payload === void 0 ? void 0 : payload.margin_padding),
66
- className: "".concat(styles.wrap, " ").concat(shineExpressionsValue === '告警' ? styles.shine : '')
176
+ className: "".concat(styles.wrap, " ").concat(shouldShine ? styles.shine : '')
67
177
  }));
68
178
  };
69
179
  export default /*#__PURE__*/memo(EleShineComponent, reactShapeNodeAreEqual);
@@ -5,19 +5,16 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
5
5
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
6
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
7
7
  import React from "react";
8
- import { Form } from 'antd';
9
- import { useState } from 'react';
8
+ import { Form, Select } from 'antd';
9
+ import { useEffect, useState } from 'react';
10
10
  import { useModel } from 'umi';
11
- import DialogExpression from "../../../../components/DialogExpression";
12
- import ExpressionFormat from "../../../../components/ExpressionFormat";
13
- import NeedBindPointHint from "../../../../components/NeedBindPointHint";
14
- import TranslateButton from "../../../../components/TranslateButton";
11
+ import { useForceUpdate } from "../../../../hooks";
15
12
  var ColorDataSet = function ColorDataSet() {
16
- var _payload$pointList;
17
- var _useState = useState(false),
13
+ var _useState = useState('single'),
18
14
  _useState2 = _slicedToArray(_useState, 2),
19
- visibleDialogExpression = _useState2[0],
20
- setVisibleDialogExpression = _useState2[1];
15
+ triggerLogic = _useState2[0],
16
+ setTriggerLogic = _useState2[1];
17
+ var forceUpdate = useForceUpdate();
21
18
  var _useModel = useModel('useEditor', function (model) {
22
19
  return {
23
20
  activeNode: model.activeNode
@@ -25,39 +22,35 @@ var ColorDataSet = function ColorDataSet() {
25
22
  }),
26
23
  activeNode = _useModel.activeNode;
27
24
  var payload = activeNode === null || activeNode === void 0 ? void 0 : activeNode.getData();
28
- var bindPoint = (_payload$pointList = payload.pointList) === null || _payload$pointList === void 0 ? void 0 : _payload$pointList[0];
29
- var handleExpressionChange = function handleExpressionChange(expressions) {
25
+ useEffect(function () {
26
+ setTriggerLogic((payload === null || payload === void 0 ? void 0 : payload.triggerLogic) === 'all' ? 'all' : 'single');
27
+ }, [activeNode, payload === null || payload === void 0 ? void 0 : payload.triggerLogic]);
28
+ var handleTriggerLogicChange = function handleTriggerLogicChange(nextTriggerLogic) {
29
+ setTriggerLogic(nextTriggerLogic);
30
30
  activeNode === null || activeNode === void 0 ? void 0 : activeNode.setData({
31
- shineExpressions: expressions
31
+ triggerLogic: nextTriggerLogic
32
32
  }, {
33
33
  deep: false
34
34
  });
35
+ forceUpdate();
35
36
  };
36
- if (!bindPoint) {
37
- return /*#__PURE__*/React.createElement(NeedBindPointHint, null);
38
- }
39
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Form, {
37
+ return /*#__PURE__*/React.createElement(Form, {
40
38
  size: "small",
41
39
  labelCol: {
42
40
  span: 7
43
41
  }
44
42
  }, /*#__PURE__*/React.createElement(Form.Item, {
45
- label: "\u662F\u5426\u544A\u8B66"
46
- }, /*#__PURE__*/React.createElement(TranslateButton, {
47
- onClick: function onClick() {
48
- return setVisibleDialogExpression(true);
49
- }
50
- }), /*#__PURE__*/React.createElement(ExpressionFormat, {
51
- expressions: payload.shineExpressions || [],
52
- valueType: "text"
53
- }))), /*#__PURE__*/React.createElement(DialogExpression, {
54
- valueType: "text",
55
- visible: visibleDialogExpression,
56
- expressions: (payload === null || payload === void 0 ? void 0 : payload.shineExpressions) || [],
57
- onCancel: function onCancel() {
58
- setVisibleDialogExpression(false);
59
- },
60
- onChange: handleExpressionChange
61
- }));
43
+ label: "\u89E6\u53D1\u903B\u8F91"
44
+ }, /*#__PURE__*/React.createElement(Select, {
45
+ value: triggerLogic,
46
+ onChange: handleTriggerLogicChange,
47
+ options: [{
48
+ label: '单一报警触发',
49
+ value: 'single'
50
+ }, {
51
+ label: '全部报警触发',
52
+ value: 'all'
53
+ }]
54
+ })));
62
55
  };
63
56
  export default ColorDataSet;
@@ -0,0 +1,99 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
8
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
10
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
11
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
12
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
13
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
14
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
15
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
16
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
17
+ import React from "react";
18
+ import { useState } from 'react';
19
+ import { Form, Space, Typography } from 'antd';
20
+ import { useModel } from 'umi';
21
+ import DialogExpression from "../../../components/DialogExpression";
22
+ import ExpressionFormat from "../../../components/ExpressionFormat";
23
+ import TranslateButton from "../../../components/TranslateButton";
24
+ import { useForceUpdate } from "../../../hooks";
25
+ var Text = Typography.Text;
26
+ var PointAlarmTool = function PointAlarmTool(_ref) {
27
+ var _payload$pointList;
28
+ var index = _ref.index;
29
+ var _useState = useState(false),
30
+ _useState2 = _slicedToArray(_useState, 2),
31
+ visibleDialogExpression = _useState2[0],
32
+ setVisibleDialogExpression = _useState2[1];
33
+ var forceUpdate = useForceUpdate();
34
+ var _useModel = useModel('useEditor', function (model) {
35
+ return {
36
+ activeNode: model.activeNode
37
+ };
38
+ }),
39
+ activeNode = _useModel.activeNode;
40
+ var payload = activeNode === null || activeNode === void 0 ? void 0 : activeNode.getData();
41
+ var bindPoint = payload === null || payload === void 0 ? void 0 : (_payload$pointList = payload.pointList) === null || _payload$pointList === void 0 ? void 0 : _payload$pointList[index];
42
+ var expressions = (bindPoint === null || bindPoint === void 0 ? void 0 : bindPoint.expressions) || (payload === null || payload === void 0 ? void 0 : payload.shineExpressions) || [];
43
+ var handleExpressionChange = function handleExpressionChange(nextExpressions) {
44
+ if (!activeNode || !bindPoint) {
45
+ return;
46
+ }
47
+ var pointList = _toConsumableArray((payload === null || payload === void 0 ? void 0 : payload.pointList) || []);
48
+ pointList[index] = _objectSpread(_objectSpread({}, bindPoint), {}, {
49
+ expressions: nextExpressions
50
+ });
51
+ activeNode.setData({
52
+ pointList: pointList
53
+ }, {
54
+ deep: false
55
+ });
56
+ forceUpdate();
57
+ };
58
+ if (!bindPoint) {
59
+ return null;
60
+ }
61
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Form.Item, {
62
+ label: "\u662F\u5426\u62A5\u8B66",
63
+ className: "!ml-3 !mb-2"
64
+ }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Space, {
65
+ size: 4
66
+ }, /*#__PURE__*/React.createElement(TranslateButton, {
67
+ onClick: function onClick() {
68
+ return setVisibleDialogExpression(true);
69
+ }
70
+ }), /*#__PURE__*/React.createElement(Text, {
71
+ type: "secondary",
72
+ style: {
73
+ fontSize: 12
74
+ }
75
+ }, "\u7F16\u8F91\u8868\u8FBE\u5F0F")), /*#__PURE__*/React.createElement("div", {
76
+ style: {
77
+ marginTop: 4,
78
+ lineHeight: 1.5
79
+ }
80
+ }, /*#__PURE__*/React.createElement(ExpressionFormat, {
81
+ expressions: expressions,
82
+ valueType: "text",
83
+ itemStyle: {
84
+ width: '100%',
85
+ whiteSpace: 'normal',
86
+ wordBreak: 'break-all',
87
+ alignItems: 'flex-start'
88
+ }
89
+ })))), /*#__PURE__*/React.createElement(DialogExpression, {
90
+ valueType: "text",
91
+ visible: visibleDialogExpression,
92
+ expressions: expressions,
93
+ onCancel: function onCancel() {
94
+ setVisibleDialogExpression(false);
95
+ },
96
+ onChange: handleExpressionChange
97
+ }));
98
+ };
99
+ export default PointAlarmTool;
@@ -3,6 +3,7 @@ import { Collapse } from 'antd';
3
3
  import { CaretRightOutlined } from '@ant-design/icons';
4
4
  import FormBindPoint from "../../../components/FormBindPoint";
5
5
  import OtherPropsSet from "./OtherPropsSet";
6
+ import PointAlarmTool from "./PointAlarmTool";
6
7
  import { useForceUpdate } from "../../../hooks";
7
8
  var Panel = Collapse.Panel;
8
9
  var PropsSet = function PropsSet() {
@@ -20,7 +21,14 @@ var PropsSet = function PropsSet() {
20
21
  header: "\u7ED1\u5B9A\u70B9\u4F4D",
21
22
  key: "1"
22
23
  }, /*#__PURE__*/React.createElement(FormBindPoint, {
23
- onChange: forceUpdate
24
+ onChange: forceUpdate,
25
+ pointListLimit: 1000,
26
+ pointItemToolPlacement: "afterBindField",
27
+ pointItemTool: function pointItemTool(index) {
28
+ return /*#__PURE__*/React.createElement(PointAlarmTool, {
29
+ index: index
30
+ });
31
+ }
24
32
  })), /*#__PURE__*/React.createElement(Panel, {
25
33
  header: "\u5176\u4ED6",
26
34
  key: "2"
@@ -38,8 +38,9 @@ export var defaultConfig = {
38
38
  width: 12,
39
39
  height: 12,
40
40
  data: {
41
- pointListLimit: 1,
41
+ pointListLimit: 1000,
42
42
  keepRatio: true,
43
+ triggerLogic: 'single',
43
44
  borderStyles: {
44
45
  borderRadius: '50%'
45
46
  },
@@ -89,7 +89,7 @@ export var defaultConfig = {
89
89
  refWidth: '60%',
90
90
  refHeight: '60%',
91
91
  fill: 'red',
92
- xlinkHref: 'http://192.168.2.12:9000/xiaomai/img-bed/202111021014940.svg'
92
+ xlinkHref: 'https://utopia1994.oss-cn-shanghai.aliyuncs.com/img-bed/202111021014940.svg'
93
93
  },
94
94
  label: {
95
95
  text: '温度',
@@ -40,9 +40,7 @@ var EleSwitchComponent = function EleSwitchComponent(_ref) {
40
40
  getContainer: function getContainer() {
41
41
  return document.getElementById("scada-body");
42
42
  },
43
- onOk: function onOk(close) {
44
- var _window$event;
45
- (_window$event = window.event) === null || _window$event === void 0 ? void 0 : _window$event.stopPropagation();
43
+ onOk: function onOk() {
46
44
  if (window.scadaMode === 'edit' || !configPoint || !(payload === null || payload === void 0 ? void 0 : payload.pointWriteable)) {
47
45
  return;
48
46
  }
@@ -55,12 +53,6 @@ var EleSwitchComponent = function EleSwitchComponent(_ref) {
55
53
  value: val ? checkedValue : unCheckedValue
56
54
  });
57
55
  setValue(val);
58
- close();
59
- },
60
- onCancel: function onCancel(close) {
61
- var _window$event2;
62
- (_window$event2 = window.event) === null || _window$event2 === void 0 ? void 0 : _window$event2.stopPropagation();
63
- close();
64
56
  }
65
57
  });
66
58
  };
@@ -73,9 +65,7 @@ var EleSwitchComponent = function EleSwitchComponent(_ref) {
73
65
  }, [pointData === null || pointData === void 0 ? void 0 : pointData.value, payload === null || payload === void 0 ? void 0 : payload.checkedValue]);
74
66
  return /*#__PURE__*/React.createElement("div", {
75
67
  className: "".concat(styles.wrap, " ").concat(premission.includes("49") ? "" : styles.hide),
76
- onClick: function onClick(e) {
77
- return e.stopPropagation();
78
- }
68
+ id: "switch-".concat(pointData === null || pointData === void 0 ? void 0 : pointData.deviceId)
79
69
  }, /*#__PURE__*/React.createElement(Tooltip, {
80
70
  title: tooltipTitle
81
71
  }, /*#__PURE__*/React.createElement(Switch, {
@@ -42,7 +42,7 @@ export var defaultConfig = {
42
42
  }],
43
43
  attrs: {
44
44
  body: {
45
- xlinkHref: 'http://192.168.2.12:9000/xiaomai/生产/组态图片/图片元素/be42df157707426fb53360693eae8094.svg',
45
+ xlinkHref: 'https://front-end-assets.oss-cn-shanghai.aliyuncs.com/生产/组态图片/图片元素/be42df157707426fb53360693eae8094.svg',
46
46
  refWidth: '100%',
47
47
  refHeight: '100%'
48
48
  }
@@ -43,7 +43,7 @@ export var defaultConfig = {
43
43
  }],
44
44
  attrs: {
45
45
  body: {
46
- xlinkHref: 'http://192.168.2.12:9000/xiaomai/生产/组态图片/图片元素/7cdce2491ce3468aae034f531bf149d5.svg',
46
+ xlinkHref: 'https://front-end-assets.oss-cn-shanghai.aliyuncs.com/生产/组态图片/图片元素/7cdce2491ce3468aae034f531bf149d5.svg',
47
47
  refWidth: '100%',
48
48
  refHeight: '100%'
49
49
  }
@@ -43,7 +43,7 @@ export var defaultConfig = {
43
43
  }],
44
44
  attrs: {
45
45
  body: {
46
- xlinkHref: 'http://192.168.2.12:9000/xiaomai/%E7%94%9F%E4%BA%A7/%E7%BB%84%E6%80%81%E5%9B%BE%E7%89%87/%E5%9B%BE%E7%89%87%E5%85%83%E7%B4%A0/2358402046b8439b9bee49814e5d94e3.svg',
46
+ xlinkHref: 'https://front-end-assets.oss-cn-shanghai.aliyuncs.com/生产/组态图片/图片元素/2358402046b8439b9bee49814e5d94e3.svg',
47
47
  refWidth: '100%',
48
48
  refHeight: '100%'
49
49
  }
@@ -43,7 +43,7 @@ export var defaultConfig = {
43
43
  }],
44
44
  attrs: {
45
45
  body: {
46
- xlinkHref: 'http://192.168.2.12:9000/xiaomai/%E7%94%9F%E4%BA%A7/%E7%BB%84%E6%80%81%E5%9B%BE%E7%89%87/%E5%9B%BE%E7%89%87%E5%85%83%E7%B4%A0/58225b888f6a48b9af4b21444700c6ba.svg',
46
+ xlinkHref: 'https://front-end-assets.oss-cn-shanghai.aliyuncs.com/生产/组态图片/图片元素/58225b888f6a48b9af4b21444700c6ba.svg',
47
47
  refWidth: '100%',
48
48
  refHeight: '100%'
49
49
  }
@@ -42,7 +42,7 @@ export var defaultConfig = {
42
42
  }],
43
43
  attrs: {
44
44
  body: {
45
- xlinkHref: 'http://192.168.2.12:9000/xiaomai/%E7%94%9F%E4%BA%A7/%E7%BB%84%E6%80%81%E5%9B%BE%E7%89%87/%E5%9B%BE%E7%89%87%E5%85%83%E7%B4%A0/dd03192a3abc487aa7b91ad75d1be533.svg',
45
+ xlinkHref: 'https://front-end-assets.oss-cn-shanghai.aliyuncs.com/生产/组态图片/图片元素/dd03192a3abc487aa7b91ad75d1be533.svg',
46
46
  refWidth: '100%',
47
47
  refHeight: '100%'
48
48
  }
@@ -42,7 +42,7 @@ export var defaultConfig = {
42
42
  }],
43
43
  attrs: {
44
44
  body: {
45
- xlinkHref: 'http://192.168.2.12:9000/xiaomai/生产/组态图片/图片元素/834835fb0d60434d934eee07d18cfafc.svg',
45
+ xlinkHref: 'https://front-end-assets.oss-cn-shanghai.aliyuncs.com/生产/组态图片/图片元素/834835fb0d60434d934eee07d18cfafc.svg',
46
46
  refWidth: '100%',
47
47
  refHeight: '100%'
48
48
  }
@@ -42,7 +42,7 @@ export var defaultConfig = {
42
42
  }],
43
43
  attrs: {
44
44
  body: {
45
- xlinkHref: 'http://192.168.2.12:9000/xiaomai/%E7%94%9F%E4%BA%A7/%E7%BB%84%E6%80%81%E5%9B%BE%E7%89%87/%E5%9B%BE%E7%89%87%E5%85%83%E7%B4%A0/40a74ebbf068410593fbc92442088fc7.svg',
45
+ xlinkHref: 'https://front-end-assets.oss-cn-shanghai.aliyuncs.com/生产/组态图片/图片元素/40a74ebbf068410593fbc92442088fc7.svg',
46
46
  refWidth: '100%',
47
47
  refHeight: '100%'
48
48
  }
@@ -42,7 +42,7 @@ export var defaultConfig = {
42
42
  }],
43
43
  attrs: {
44
44
  body: {
45
- xlinkHref: 'http://192.168.2.12:9000/xiaomai/生产/组态图片/图片元素/ad1218665b854070b21f5572e452c6ef.svg',
45
+ xlinkHref: 'https://front-end-assets.oss-cn-shanghai.aliyuncs.com/生产/组态图片/图片元素/ad1218665b854070b21f5572e452c6ef.svg',
46
46
  refWidth: '100%',
47
47
  refHeight: '100%'
48
48
  }
@@ -42,7 +42,7 @@ export var defaultConfig = {
42
42
  }],
43
43
  attrs: {
44
44
  body: {
45
- xlinkHref: 'http://192.168.2.12:9000/xiaomai/生产/组态图片/图片元素/fe66d6f5586742e3a9aad2782fb45d86.svg',
45
+ xlinkHref: 'https://front-end-assets.oss-cn-shanghai.aliyuncs.com/生产/组态图片/图片元素/fe66d6f5586742e3a9aad2782fb45d86.svg',
46
46
  refWidth: '100%',
47
47
  refHeight: '100%'
48
48
  }
@@ -42,7 +42,7 @@ export var defaultConfig = {
42
42
  }],
43
43
  attrs: {
44
44
  body: {
45
- xlinkHref: 'http://192.168.2.12:9000/xiaomai/%E7%94%9F%E4%BA%A7/%E7%BB%84%E6%80%81%E5%9B%BE%E7%89%87/%E5%9B%BE%E7%89%87%E5%85%83%E7%B4%A0/63831cb71bd24c47bb11b6e02d9e4c77.svg',
45
+ xlinkHref: 'https://front-end-assets.oss-cn-shanghai.aliyuncs.com/生产/组态图片/图片元素/63831cb71bd24c47bb11b6e02d9e4c77.svg',
46
46
  refWidth: '100%',
47
47
  refHeight: '100%'
48
48
  }
@@ -42,7 +42,7 @@ export var defaultConfig = {
42
42
  }],
43
43
  attrs: {
44
44
  body: {
45
- xlinkHref: 'http://192.168.2.12:9000/xiaomai/%E7%94%9F%E4%BA%A7/%E7%BB%84%E6%80%81%E5%9B%BE%E7%89%87/%E5%9B%BE%E7%89%87%E5%85%83%E7%B4%A0/8e5f1deaf3a8466fa168588eaac664bc.svg',
45
+ xlinkHref: 'https://front-end-assets.oss-cn-shanghai.aliyuncs.com/生产/组态图片/图片元素/8e5f1deaf3a8466fa168588eaac664bc.svg',
46
46
  refWidth: '100%',
47
47
  refHeight: '100%'
48
48
  }
@@ -108,6 +108,7 @@ var ElePointListCardComponent = function ElePointListCardComponent(_ref4) {
108
108
  return;
109
109
  }
110
110
  var list = payload.pointList;
111
+ console.log(payload, "payload");
111
112
  setPointList(list);
112
113
  var _unitShow = payload.unitShow;
113
114
  setUnitShow(_unitShow == false ? false : true);
@@ -123,7 +124,7 @@ var ElePointListCardComponent = function ElePointListCardComponent(_ref4) {
123
124
  var eventHandler = function eventHandler(pointData) {
124
125
  setPointList(function (prev) {
125
126
  return prev.map(function (v) {
126
- if (v.identifierName === point.identifierName) {
127
+ if (v.pointId === point.pointId) {
127
128
  return _objectSpread(_objectSpread({}, v), pointData);
128
129
  }
129
130
  return v;
@@ -176,7 +177,7 @@ var ElePointListCardComponent = function ElePointListCardComponent(_ref4) {
176
177
  return /*#__PURE__*/React.createElement(PointItem, {
177
178
  key: point.identifierName,
178
179
  point: point,
179
- unitShow: unitShow,
180
+ unitShow: payload === null || payload === void 0 ? void 0 : payload.unitShow,
180
181
  style: {
181
182
  width: "".concat(100 / cols, "%")
182
183
  },
@@ -69,6 +69,7 @@ export var defaultConfig = {
69
69
  fontSize: 14
70
70
  }
71
71
  },
72
+ unitShow: true,
72
73
  events: [
73
74
  // {
74
75
  // type: 'click',