coolcare-lite-scada-component 1.0.63 → 1.0.64

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.
@@ -0,0 +1,186 @@
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 _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return r; }; var t, r = {}, e = Object.prototype, n = e.hasOwnProperty, o = "function" == typeof Symbol ? Symbol : {}, i = o.iterator || "@@iterator", a = o.asyncIterator || "@@asyncIterator", u = o.toStringTag || "@@toStringTag"; function c(t, r, e, n) { return Object.defineProperty(t, r, { value: e, enumerable: !n, configurable: !n, writable: !n }); } try { c({}, ""); } catch (t) { c = function c(t, r, e) { return t[r] = e; }; } function h(r, e, n, o) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype); return c(a, "_invoke", function (r, e, n) { var o = 1; return function (i, a) { if (3 === o) throw Error("Generator is already running"); if (4 === o) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var u = n.delegate; if (u) { var c = d(u, n); if (c) { if (c === f) continue; return c; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (1 === o) throw o = 4, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = 3; var h = s(r, e, n); if ("normal" === h.type) { if (o = n.done ? 4 : 2, h.arg === f) continue; return { value: h.arg, done: n.done }; } "throw" === h.type && (o = 4, n.method = "throw", n.arg = h.arg); } }; }(r, n, new Context(o || [])), !0), a; } function s(t, r, e) { try { return { type: "normal", arg: t.call(r, e) }; } catch (t) { return { type: "throw", arg: t }; } } r.wrap = h; var f = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var l = {}; c(l, i, function () { return this; }); var p = Object.getPrototypeOf, y = p && p(p(x([]))); y && y !== e && n.call(y, i) && (l = y); var v = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(l); function g(t) { ["next", "throw", "return"].forEach(function (r) { c(t, r, function (t) { return this._invoke(r, t); }); }); } function AsyncIterator(t, r) { function e(o, i, a, u) { var c = s(t[o], t, i); if ("throw" !== c.type) { var h = c.arg, f = h.value; return f && "object" == _typeof(f) && n.call(f, "__await") ? r.resolve(f.__await).then(function (t) { e("next", t, a, u); }, function (t) { e("throw", t, a, u); }) : r.resolve(f).then(function (t) { h.value = t, a(h); }, function (t) { return e("throw", t, a, u); }); } u(c.arg); } var o; c(this, "_invoke", function (t, n) { function i() { return new r(function (r, o) { e(t, n, r, o); }); } return o = o ? o.then(i, i) : i(); }, !0); } function d(r, e) { var n = e.method, o = r.i[n]; if (o === t) return e.delegate = null, "throw" === n && r.i.return && (e.method = "return", e.arg = t, d(r, e), "throw" === e.method) || "return" !== n && (e.method = "throw", e.arg = new TypeError("The iterator does not provide a '" + n + "' method")), f; var i = s(o, r.i, e.arg); if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, f; var a = i.arg; return a ? a.done ? (e[r.r] = a.value, e.next = r.n, "return" !== e.method && (e.method = "next", e.arg = t), e.delegate = null, f) : a : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, f); } function w(t) { this.tryEntries.push(t); } function m(r) { var e = r[4] || {}; e.type = "normal", e.arg = t, r[4] = e; } function Context(t) { this.tryEntries = [[-1]], t.forEach(w, this), this.reset(!0); } function x(r) { if (null != r) { var e = r[i]; if (e) return e.call(r); if ("function" == typeof r.next) return r; if (!isNaN(r.length)) { var o = -1, a = function e() { for (; ++o < r.length;) if (n.call(r, o)) return e.value = r[o], e.done = !1, e; return e.value = t, e.done = !0, e; }; return a.next = a; } } throw new TypeError(_typeof(r) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, c(v, "constructor", GeneratorFunctionPrototype), c(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = c(GeneratorFunctionPrototype, u, "GeneratorFunction"), r.isGeneratorFunction = function (t) { var r = "function" == typeof t && t.constructor; return !!r && (r === GeneratorFunction || "GeneratorFunction" === (r.displayName || r.name)); }, r.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, c(t, u, "GeneratorFunction")), t.prototype = Object.create(v), t; }, r.awrap = function (t) { return { __await: t }; }, g(AsyncIterator.prototype), c(AsyncIterator.prototype, a, function () { return this; }), r.AsyncIterator = AsyncIterator, r.async = function (t, e, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(h(t, e, n, o), i); return r.isGeneratorFunction(e) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, g(v), c(v, u, "Generator"), c(v, i, function () { return this; }), c(v, "toString", function () { return "[object Generator]"; }), r.keys = function (t) { var r = Object(t), e = []; for (var n in r) e.unshift(n); return function t() { for (; e.length;) if ((n = e.pop()) in r) return t.value = n, t.done = !1, t; return t.done = !0, t; }; }, r.values = x, Context.prototype = { constructor: Context, reset: function reset(r) { if (this.prev = this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(m), !r) for (var e in this) "t" === e.charAt(0) && n.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0][4]; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(r) { if (this.done) throw r; var e = this; function n(t) { a.type = "throw", a.arg = r, e.next = t; } for (var o = e.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i[4], u = this.prev, c = i[1], h = i[2]; if (-1 === i[0]) return n("end"), !1; if (!c && !h) throw Error("try statement without catch or finally"); if (null != i[0] && i[0] <= u) { if (u < c) return this.method = "next", this.arg = t, n(c), !0; if (u < h) return n(h), !1; } } }, abrupt: function abrupt(t, r) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var n = this.tryEntries[e]; if (n[0] > -1 && n[0] <= this.prev && this.prev < n[2]) { var o = n; break; } } o && ("break" === t || "continue" === t) && o[0] <= r && r <= o[2] && (o = null); var i = o ? o[4] : {}; return i.type = t, i.arg = r, o ? (this.method = "next", this.next = o[2], f) : this.complete(i); }, complete: function complete(t, r) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && r && (this.next = r), f; }, finish: function finish(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[2] === t) return this.complete(e[4], e[3]), m(e), f; } }, catch: function _catch(t) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var e = this.tryEntries[r]; if (e[0] === t) { var n = e[4]; if ("throw" === n.type) { var o = n.arg; m(e); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(r, e, n) { return this.delegate = { i: x(r), r: e, n: n }, "next" === this.method && (this.arg = t), f; } }, r; }
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
+ 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
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
6
+ 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."); }
7
+ 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; } }
8
+ 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; }
9
+ 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; } }
10
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
11
+ import React from "react";
12
+ import { Input, Popover } from 'antd';
13
+ import { useState, useEffect } from 'react';
14
+ import { DownOutlined } from '@ant-design/icons';
15
+ import { useMount, useRequest } from 'ahooks';
16
+ import { GetDeviceIndicator } from "../../services/gateway/Device";
17
+ import styles from "./index.css";
18
+ import DeviceIndicatorTable from "./DeviceIndicatorTable";
19
+ var IndicatorSelect = function IndicatorSelect(_ref) {
20
+ var style = _ref.style,
21
+ _ref$size = _ref.size,
22
+ size = _ref$size === void 0 ? 'small' : _ref$size,
23
+ onChange = _ref.onChange,
24
+ value = _ref.value,
25
+ deviceId = _ref.deviceId;
26
+ var _useState = useState(),
27
+ _useState2 = _slicedToArray(_useState, 2),
28
+ pointInfo = _useState2[0],
29
+ setPointInfo = _useState2[1];
30
+ var _useState3 = useState(false),
31
+ _useState4 = _slicedToArray(_useState3, 2),
32
+ visible = _useState4[0],
33
+ setVisible = _useState4[1];
34
+ var _useState5 = useState(false),
35
+ _useState6 = _slicedToArray(_useState5, 2),
36
+ loading = _useState6[0],
37
+ setLoading = _useState6[1];
38
+ var handleDevicePointChange = function handleDevicePointChange(val) {
39
+ var info = {
40
+ indicatorIdentifier: val.indicatorIdentifier,
41
+ indicatorName: val.indicatorName,
42
+ indicatorNo: val.indicatorNo
43
+ };
44
+ setPointInfo(info);
45
+ onChange === null || onChange === void 0 ? void 0 : onChange(info);
46
+ setVisible(false);
47
+ };
48
+ var _useRequest = useRequest(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
49
+ var _yield$GetDeviceIndic, success, data;
50
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
51
+ while (1) switch (_context.prev = _context.next) {
52
+ case 0:
53
+ if (deviceId) {
54
+ _context.next = 2;
55
+ break;
56
+ }
57
+ return _context.abrupt("return", []);
58
+ case 2:
59
+ setLoading(true);
60
+ _context.next = 5;
61
+ return GetDeviceIndicator({
62
+ deviceIdList: [deviceId]
63
+ });
64
+ case 5:
65
+ _yield$GetDeviceIndic = _context.sent;
66
+ success = _yield$GetDeviceIndic.success;
67
+ data = _yield$GetDeviceIndic.data;
68
+ if (success) {
69
+ _context.next = 10;
70
+ break;
71
+ }
72
+ return _context.abrupt("return", []);
73
+ case 10:
74
+ return _context.abrupt("return", data || []);
75
+ case 11:
76
+ case "end":
77
+ return _context.stop();
78
+ }
79
+ }, _callee);
80
+ })), {
81
+ cacheKey: "device-indicator-".concat(deviceId),
82
+ refreshDeps: [deviceId],
83
+ onError: function onError(err) {
84
+ console.error(err);
85
+ },
86
+ onFinally: function onFinally() {
87
+ setLoading(false);
88
+ }
89
+ }),
90
+ deviceIndicatorList = _useRequest.data;
91
+ useEffect(function () {
92
+ if (!value && deviceId) {
93
+ setPointInfo(undefined);
94
+ }
95
+ }, [deviceId, value]);
96
+ useMount(function () {
97
+ var getPointNameWhenInit = /*#__PURE__*/function () {
98
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) {
99
+ var _yield$GetDeviceIndic2, success, data, point;
100
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
101
+ while (1) switch (_context2.prev = _context2.next) {
102
+ case 0:
103
+ _context2.prev = 0;
104
+ setLoading(true);
105
+ _context2.next = 4;
106
+ return GetDeviceIndicator(params);
107
+ case 4:
108
+ _yield$GetDeviceIndic2 = _context2.sent;
109
+ success = _yield$GetDeviceIndic2.success;
110
+ data = _yield$GetDeviceIndic2.data;
111
+ if (success) {
112
+ _context2.next = 9;
113
+ break;
114
+ }
115
+ return _context2.abrupt("return");
116
+ case 9:
117
+ point = (data || []).find(function (item) {
118
+ return item.indicatorNo === value;
119
+ });
120
+ setPointInfo({
121
+ indicatorIdentifier: point.indicatorIdentifier,
122
+ indicatorName: point.indicatorName,
123
+ indicatorNo: point.indicatorNo
124
+ });
125
+ _context2.next = 16;
126
+ break;
127
+ case 13:
128
+ _context2.prev = 13;
129
+ _context2.t0 = _context2["catch"](0);
130
+ console.error(_context2.t0);
131
+ case 16:
132
+ _context2.prev = 16;
133
+ setLoading(false);
134
+ return _context2.finish(16);
135
+ case 19:
136
+ case "end":
137
+ return _context2.stop();
138
+ }
139
+ }, _callee2, null, [[0, 13, 16, 19]]);
140
+ }));
141
+ return function getPointNameWhenInit(_x) {
142
+ return _ref3.apply(this, arguments);
143
+ };
144
+ }();
145
+ if (deviceId && value) {
146
+ getPointNameWhenInit({
147
+ deviceIdList: [deviceId]
148
+ });
149
+ }
150
+ });
151
+ return /*#__PURE__*/React.createElement(Popover, {
152
+ content: /*#__PURE__*/React.createElement(DeviceIndicatorTable, {
153
+ onChange: handleDevicePointChange,
154
+ data: deviceIndicatorList || [],
155
+ loading: loading,
156
+ indicatorId: pointInfo === null || pointInfo === void 0 ? void 0 : pointInfo.indicatorId,
157
+ onClose: function onClose() {
158
+ return setVisible(false);
159
+ }
160
+ }),
161
+ placement: "leftTop",
162
+ trigger: "click",
163
+ open: visible,
164
+ overlayInnerStyle: {
165
+ width: deviceId ? 620 : 360
166
+ },
167
+ onOpenChange: setVisible
168
+ }, /*#__PURE__*/React.createElement(Input, {
169
+ value: pointInfo === null || pointInfo === void 0 ? void 0 : pointInfo.indicatorName,
170
+ size: size,
171
+ style: style,
172
+ className: styles['cursor-pointer'],
173
+ onClick: function onClick() {
174
+ return setVisible(true);
175
+ },
176
+ readOnly: true,
177
+ placeholder: "",
178
+ suffix: /*#__PURE__*/React.createElement(DownOutlined, {
179
+ style: {
180
+ color: 'rgba(0,0,0,.25)',
181
+ fontSize: 12
182
+ }
183
+ })
184
+ }));
185
+ };
186
+ export default IndicatorSelect;
@@ -17,7 +17,7 @@ var directionClassNameMap = {
17
17
  bottom: 'flex-col-reverse'
18
18
  };
19
19
  var ElePointValueComponent = function ElePointValueComponent(_ref) {
20
- var _payload$pointList, _payload$label, _payload$unit, _payload$unit2, _payload$value, _payload$value2, _payload$mittMeta$nam, _payload$mittMeta, _payload$mittMeta2, _payload$label2, _payload$unit3, _pointData9;
20
+ var _payload$pointList, _payload$label, _payload$unit, _payload$unit2, _payload$value, _payload$value2, _payload$mittMeta$nam, _payload$mittMeta, _payload$mittMeta2, _payload$label2, _payload$unit3, _pointData10;
21
21
  var node = _ref.node;
22
22
  var payload = node === null || node === void 0 ? void 0 : node.getData();
23
23
  var configPoint = payload === null || payload === void 0 ? void 0 : (_payload$pointList = payload.pointList) === null || _payload$pointList === void 0 ? void 0 : _payload$pointList[0];
@@ -33,7 +33,8 @@ var ElePointValueComponent = function ElePointValueComponent(_ref) {
33
33
  deviceId: configPoint && 'deviceId' in configPoint ? configPoint.deviceId : undefined,
34
34
  deviceType: configPoint && 'deviceType' in configPoint ? configPoint.deviceType : 'device',
35
35
  dataType: configPoint && 'dataType' in configPoint ? configPoint.dataType : undefined,
36
- meterId: configPoint && 'meterId' in configPoint ? configPoint.meterId : undefined
36
+ meterId: configPoint && 'meterId' in configPoint ? configPoint.meterId : undefined,
37
+ indicatorNo: configPoint && 'indicatorNo' in configPoint ? configPoint.indicatorNo : undefined
37
38
  }],
38
39
  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
39
40
  }
@@ -43,22 +44,25 @@ var ElePointValueComponent = function ElePointValueComponent(_ref) {
43
44
  if ('value' in (pointData || {})) {
44
45
  var _pointData;
45
46
  value = (_pointData = pointData) === null || _pointData === void 0 ? void 0 : _pointData.value;
47
+ } else if ('indicatorData' in (pointData || {})) {
48
+ var _pointData2, _pointData2$indicator;
49
+ value = (_pointData2 = pointData) === null || _pointData2 === void 0 ? void 0 : (_pointData2$indicator = _pointData2.indicatorData) === null || _pointData2$indicator === void 0 ? void 0 : _pointData2$indicator.val;
46
50
  } else if ('aggregateDataList' in (pointData || {})) {
47
- var _pointData2, _pointData2$aggregate, _pointData2$aggregate2;
48
- value = (_pointData2 = pointData) === null || _pointData2 === void 0 ? void 0 : (_pointData2$aggregate = _pointData2.aggregateDataList) === null || _pointData2$aggregate === void 0 ? void 0 : (_pointData2$aggregate2 = _pointData2$aggregate[0]) === null || _pointData2$aggregate2 === void 0 ? void 0 : _pointData2$aggregate2.val;
51
+ var _pointData3, _pointData3$aggregate, _pointData3$aggregate2;
52
+ value = (_pointData3 = pointData) === null || _pointData3 === void 0 ? void 0 : (_pointData3$aggregate = _pointData3.aggregateDataList) === null || _pointData3$aggregate === void 0 ? void 0 : (_pointData3$aggregate2 = _pointData3$aggregate[0]) === null || _pointData3$aggregate2 === void 0 ? void 0 : _pointData3$aggregate2.val;
49
53
  if (typeof value === 'number') {
50
54
  value = Number(value.toFixed(1));
51
55
  }
52
56
  } else if ('metricsList' in (pointData || {})) {
53
- var _pointData3, _pointData3$metricsLi, _pointData4;
54
- value = Number((_pointData3 = pointData) === null || _pointData3 === void 0 ? void 0 : (_pointData3$metricsLi = _pointData3.metricsList) === null || _pointData3$metricsLi === void 0 ? void 0 : _pointData3$metricsLi.reduce(function (a, b) {
57
+ var _pointData4, _pointData4$metricsLi, _pointData5;
58
+ value = Number((_pointData4 = pointData) === null || _pointData4 === void 0 ? void 0 : (_pointData4$metricsLi = _pointData4.metricsList) === null || _pointData4$metricsLi === void 0 ? void 0 : _pointData4$metricsLi.reduce(function (a, b) {
55
59
  // 将每个数字转换为字符串,然后乘以100,转为整数计算
56
60
  var aNum = Math.round(Number(a) * 100);
57
61
  var bNum = Math.round(Number(b.val) * 100);
58
62
  return (aNum + bNum) / 100;
59
63
  }, 0).toFixed(2));
60
64
  pointData = _objectSpread(_objectSpread({}, pointData), {}, {
61
- pointName: (_pointData4 = pointData) === null || _pointData4 === void 0 ? void 0 : _pointData4.name,
65
+ pointName: (_pointData5 = pointData) === null || _pointData5 === void 0 ? void 0 : _pointData5.name,
62
66
  unit: ['kWh', 't', 'm³', 't', 't'][pointData.type - 1]
63
67
  });
64
68
  }
@@ -66,18 +70,18 @@ var ElePointValueComponent = function ElePointValueComponent(_ref) {
66
70
  if (!configPoint) {
67
71
  tooltipTitle = '未绑定点位';
68
72
  } else {
69
- var _pointData5, _pointData$unit, _pointData6, _pointData7;
70
- tooltipTitle = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, "\u70B9\u4F4D\u540D\u79F0\uFF1A", ((_pointData5 = pointData) === null || _pointData5 === void 0 ? void 0 : _pointData5.pointName) || '-'), /*#__PURE__*/React.createElement("div", null, "\u70B9\u4F4D\u503C\uFF1A", value, " ", (_pointData$unit = (_pointData6 = pointData) === null || _pointData6 === void 0 ? void 0 : _pointData6.unit) !== null && _pointData$unit !== void 0 ? _pointData$unit : '-'), /*#__PURE__*/React.createElement("div", null, "\u66F4\u65B0\u65F6\u95F4\uFF1A", ((_pointData7 = pointData) === null || _pointData7 === void 0 ? void 0 : _pointData7.updateTime) || '-'));
73
+ var _pointData6, _pointData7, _pointData$unit, _pointData8, _pointData9, _pointData0, _pointData0$indicator;
74
+ tooltipTitle = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, "\u70B9\u4F4D\u540D\u79F0\uFF1A", ((_pointData6 = pointData) === null || _pointData6 === void 0 ? void 0 : _pointData6.pointName) || ((_pointData7 = pointData) === null || _pointData7 === void 0 ? void 0 : _pointData7.indicatorName) || '-'), /*#__PURE__*/React.createElement("div", null, "\u70B9\u4F4D\u503C\uFF1A", value, " ", (_pointData$unit = (_pointData8 = pointData) === null || _pointData8 === void 0 ? void 0 : _pointData8.unit) !== null && _pointData$unit !== void 0 ? _pointData$unit : '-'), /*#__PURE__*/React.createElement("div", null, "\u66F4\u65B0\u65F6\u95F4\uFF1A", ((_pointData9 = pointData) === null || _pointData9 === void 0 ? void 0 : _pointData9.updateTime) || ((_pointData0 = pointData) === null || _pointData0 === void 0 ? void 0 : (_pointData0$indicator = _pointData0.indicatorData) === null || _pointData0$indicator === void 0 ? void 0 : _pointData0$indicator.ts) || '-'));
71
75
  }
72
76
  var pointValue = '';
73
77
  if (window.scadaMode === 'edit') {
74
78
  pointValue = '点位值';
75
79
  } else {
76
- var _pointData8;
80
+ var _pointData1;
77
81
  if (configPoint === null || configPoint === void 0 ? void 0 : configPoint.expressions) {
78
82
  pointValue = getValueByExpression(value, configPoint === null || configPoint === void 0 ? void 0 : configPoint.expressions);
79
83
  }
80
- pointValue = ((_pointData8 = pointData) === null || _pointData8 === void 0 ? void 0 : _pointData8.pointEnumItemKey) || value;
84
+ pointValue = ((_pointData1 = pointData) === null || _pointData1 === void 0 ? void 0 : _pointData1.pointEnumItemKey) || value;
81
85
  }
82
86
  var numberColor = getValueByExpression(value, payload === null || payload === void 0 ? void 0 : payload.colorExpressions);
83
87
  return /*#__PURE__*/React.createElement("div", {
@@ -113,6 +117,6 @@ var ElePointValueComponent = function ElePointValueComponent(_ref) {
113
117
  }, pointValue === null ? '-' : pointValue), (payload === null || payload === void 0 ? void 0 : (_payload$unit3 = payload.unit) === null || _payload$unit3 === void 0 ? void 0 : _payload$unit3.isShow) ? /*#__PURE__*/React.createElement("span", {
114
118
  style: unitStyle,
115
119
  className: styles.unit
116
- }, (payload === null || payload === void 0 ? void 0 : payload.unit.text) || ((_pointData9 = pointData) === null || _pointData9 === void 0 ? void 0 : _pointData9.unit)) : null)));
120
+ }, (payload === null || payload === void 0 ? void 0 : payload.unit.text) || ((_pointData10 = pointData) === null || _pointData10 === void 0 ? void 0 : _pointData10.unit)) : null)));
117
121
  };
118
122
  export default /*#__PURE__*/memo(ElePointValueComponent, reactShapeNodeAreEqual);
@@ -31,7 +31,7 @@ export default function handleEleEvent() {
31
31
  return;
32
32
  }
33
33
  emitter.emit("show-point-history-".concat(payload.namespace), payload.points.filter(function (v) {
34
- return isString(v.identifierName);
34
+ return isString(v.identifierName || v.indicatorNo);
35
35
  }));
36
36
  return;
37
37
  // 打开链接
@@ -18,7 +18,7 @@ function usePointWatch(point, namespace) {
18
18
  var eventHandler = function eventHandler(val) {
19
19
  setPointData(val);
20
20
  };
21
- var eventName = "point-update-".concat('pointId' in point ? point.pointId : point.identifierName ? point.identifierName : point.meterId, "-").concat(namespace !== null && namespace !== void 0 ? namespace : 0);
21
+ var eventName = "point-update-".concat('pointId' in point ? point.pointId ? point.pointId : point.identifierName ? point.identifierName : point.meterId ? point.meterId : point.indicatorNo : point.indicatorNo, "-").concat(namespace !== null && namespace !== void 0 ? namespace : 0);
22
22
  emitter.on(eventName, eventHandler);
23
23
  return function () {
24
24
  // TODO x6 react 组件的 unmount 没有被触发
@@ -28,7 +28,7 @@ import DialogHistory from "../../../components/DialogHistory";
28
28
  import DialogPointWrite from "../../../components/DialogPointWrite";
29
29
  import ModalFanDevicePoint from "../../../components/ModalFanDevicePoint";
30
30
  import emitter from "../../../utils/events";
31
- import { GetDevicePoint } from "../../../services/gateway/Device";
31
+ import { GetDeviceIndicator, GetDevicePoint } from "../../../services/gateway/Device";
32
32
  import "./index.css";
33
33
  import { GetTdIndicatorAggregateData } from "../../../services/gateway/Point";
34
34
  import dayjs from 'dayjs';
@@ -59,12 +59,16 @@ var Player = function Player(_ref) {
59
59
  setActivePointIds = _useState8[1];
60
60
  var _useState9 = useState([]),
61
61
  _useState0 = _slicedToArray(_useState9, 2),
62
- activePoints = _useState0[0],
63
- setActivePoints = _useState0[1];
64
- var _useState1 = useState(),
62
+ activeIndicatorNos = _useState0[0],
63
+ setActiveIndicatorNos = _useState0[1];
64
+ var _useState1 = useState([]),
65
65
  _useState10 = _slicedToArray(_useState1, 2),
66
- activeDeviceId = _useState10[0],
67
- setActiveDeviceId = _useState10[1];
66
+ activePoints = _useState10[0],
67
+ setActivePoints = _useState10[1];
68
+ var _useState11 = useState(),
69
+ _useState12 = _slicedToArray(_useState11, 2),
70
+ activeDeviceId = _useState12[0],
71
+ setActiveDeviceId = _useState12[1];
68
72
  var wrapSize = useSize(wrapRef);
69
73
  var mittMeta = useMemo(function () {
70
74
  return getMittMeta(query);
@@ -100,7 +104,7 @@ var Player = function Player(_ref) {
100
104
  var handler = /*#__PURE__*/function () {
101
105
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(points) {
102
106
  var _points$;
103
- var deviceId, _res$data, res;
107
+ var _points$2, indicatorNo, _res$data, res, _points$3, deviceId, _res$data2, _res;
104
108
  return _regeneratorRuntime().wrap(function _callee$(_context) {
105
109
  while (1) switch (_context.prev = _context.next) {
106
110
  case 0:
@@ -110,22 +114,15 @@ var Player = function Player(_ref) {
110
114
  }
111
115
  return _context.abrupt("return");
112
116
  case 2:
113
- // if (query.scene === 'freedom') {
114
- // setActivePointIds(points.map((v) => v.pointId));
115
- // setVisibleDialogHistory(true);
116
- // return;
117
- // }
118
- deviceId = points === null || points === void 0 ? void 0 : (_points$ = points[0]) === null || _points$ === void 0 ? void 0 : _points$.deviceId;
119
- if (query.scene === 'device') {
120
- deviceId = parseInt(query.deviceId, 10);
117
+ if (!(points === null || points === void 0 ? void 0 : (_points$ = points[0]) === null || _points$ === void 0 ? void 0 : _points$.indicatorNo)) {
118
+ _context.next = 25;
119
+ break;
121
120
  }
121
+ indicatorNo = points === null || points === void 0 ? void 0 : (_points$2 = points[0]) === null || _points$2 === void 0 ? void 0 : _points$2.indicatorNo;
122
122
  _context.prev = 4;
123
123
  _context.next = 7;
124
- return GetDevicePoint({
125
- deviceIdList: [deviceId],
126
- pointIdentifierNameList: points.map(function (v) {
127
- return v.identifierName;
128
- })
124
+ return GetDeviceIndicator({
125
+ indicatorNoList: [indicatorNo]
129
126
  });
130
127
  case 7:
131
128
  res = _context.sent;
@@ -140,41 +137,84 @@ var Player = function Player(_ref) {
140
137
  _context.next = 14;
141
138
  break;
142
139
  }
143
- message.error('没有找到对应的点');
140
+ message.error('没有找到对应的指标');
144
141
  return _context.abrupt("return");
145
142
  case 14:
143
+ setActivePointIds([]);
144
+ setActiveIndicatorNos([res.data[0].indicatorNo]);
145
+ setVisibleDialogHistory(true);
146
+ _context.next = 23;
147
+ break;
148
+ case 19:
149
+ _context.prev = 19;
150
+ _context.t0 = _context["catch"](4);
151
+ console.error(_context.t0);
152
+ message.error('oops, 出错了');
153
+ case 23:
154
+ _context.next = 49;
155
+ break;
156
+ case 25:
157
+ deviceId = points === null || points === void 0 ? void 0 : (_points$3 = points[0]) === null || _points$3 === void 0 ? void 0 : _points$3.deviceId;
158
+ if (query.scene === 'device') {
159
+ deviceId = parseInt(query.deviceId, 10);
160
+ }
161
+ _context.prev = 27;
162
+ _context.next = 30;
163
+ return GetDevicePoint({
164
+ deviceIdList: [deviceId],
165
+ pointIdentifierNameList: points.map(function (v) {
166
+ return v.identifierName;
167
+ })
168
+ });
169
+ case 30:
170
+ _res = _context.sent;
171
+ if (_res.success) {
172
+ _context.next = 34;
173
+ break;
174
+ }
175
+ message.error('oops, 出错了');
176
+ return _context.abrupt("return");
177
+ case 34:
178
+ if ((_res$data2 = _res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.length) {
179
+ _context.next = 37;
180
+ break;
181
+ }
182
+ message.error('没有找到对应的点');
183
+ return _context.abrupt("return");
184
+ case 37:
146
185
  if (!isInIframe()) {
147
- _context.next = 17;
186
+ _context.next = 40;
148
187
  break;
149
188
  }
150
189
  // 如果是在 iframe 上显示(嵌入小麦), 使用小麦平台的历史曲线弹窗
151
190
  window.parent.postMessage({
152
191
  event: 'show-point-history-modal',
153
192
  payload: {
154
- pointIds: res.data.map(function (v) {
193
+ pointIds: _res.data.map(function (v) {
155
194
  return v.pointId;
156
195
  }),
157
196
  locationSearch: window.location.search
158
197
  }
159
198
  }, '*');
160
199
  return _context.abrupt("return");
161
- case 17:
162
- setActivePointIds(res.data.map(function (v) {
200
+ case 40:
201
+ setActiveIndicatorNos([]);
202
+ setActivePointIds(_res.data.map(function (v) {
163
203
  return v.pointId;
164
204
  }));
165
205
  setVisibleDialogHistory(true);
166
- _context.next = 25;
206
+ _context.next = 49;
167
207
  break;
168
- case 21:
169
- _context.prev = 21;
170
- _context.t0 = _context["catch"](4);
171
- console.error(_context.t0);
208
+ case 45:
209
+ _context.prev = 45;
210
+ _context.t1 = _context["catch"](27);
211
+ console.error(_context.t1);
172
212
  message.error('oops, 出错了');
173
- case 25:
213
+ case 49:
174
214
  case "end":
175
215
  return _context.stop();
176
216
  }
177
- }, _callee, null, [[4, 21]]);
217
+ }, _callee, null, [[4, 19], [27, 45]]);
178
218
  }));
179
219
  return function handler(_x) {
180
220
  return _ref2.apply(this, arguments);
@@ -437,13 +477,47 @@ var Player = function Player(_ref) {
437
477
  return _ref8.apply(this, arguments);
438
478
  };
439
479
  }();
440
- var fetchDeviceSpecialPoint = /*#__PURE__*/function () {
441
- var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(ids, dateType) {
480
+ var fetchDeviceIndicator = /*#__PURE__*/function () {
481
+ var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(ids) {
442
482
  var res, pointList;
443
483
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
444
484
  while (1) switch (_context7.prev = _context7.next) {
445
485
  case 0:
446
486
  _context7.next = 2;
487
+ return GetDeviceIndicator({
488
+ indicatorNoList: ids,
489
+ isGetIndicatorData: true
490
+ }, []);
491
+ case 2:
492
+ res = _context7.sent;
493
+ if (res.success) {
494
+ _context7.next = 6;
495
+ break;
496
+ }
497
+ message.error('设备点位数据获取失败');
498
+ return _context7.abrupt("return");
499
+ case 6:
500
+ pointList = res.data || [];
501
+ pointList.forEach(function (v) {
502
+ emitter.emit("point-update-".concat(v.indicatorNo, "-").concat(mittMeta.namespace), v);
503
+ });
504
+ case 8:
505
+ case "end":
506
+ return _context7.stop();
507
+ }
508
+ }, _callee7);
509
+ }));
510
+ return function fetchDeviceIndicator(_x7) {
511
+ return _ref9.apply(this, arguments);
512
+ };
513
+ }();
514
+ var fetchDeviceSpecialPoint = /*#__PURE__*/function () {
515
+ var _ref0 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(ids, dateType) {
516
+ var res, pointList;
517
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
518
+ while (1) switch (_context8.prev = _context8.next) {
519
+ case 0:
520
+ _context8.next = 2;
447
521
  return GetTdIndicatorAggregateData(ids.map(function (v) {
448
522
  var productNo = {
449
523
  emqktt: 'energy',
@@ -461,13 +535,13 @@ var Player = function Player(_ref) {
461
535
  };
462
536
  }));
463
537
  case 2:
464
- res = _context7.sent;
538
+ res = _context8.sent;
465
539
  if (res.success) {
466
- _context7.next = 6;
540
+ _context8.next = 6;
467
541
  break;
468
542
  }
469
543
  message.error('设备点位数据获取失败');
470
- return _context7.abrupt("return");
544
+ return _context8.abrupt("return");
471
545
  case 6:
472
546
  pointList = res.data || [];
473
547
  pointList.forEach(function (v) {
@@ -478,18 +552,18 @@ var Player = function Player(_ref) {
478
552
  });
479
553
  case 8:
480
554
  case "end":
481
- return _context7.stop();
555
+ return _context8.stop();
482
556
  }
483
- }, _callee7);
557
+ }, _callee8);
484
558
  }));
485
- return function fetchDeviceSpecialPoint(_x7, _x8) {
486
- return _ref9.apply(this, arguments);
559
+ return function fetchDeviceSpecialPoint(_x8, _x9) {
560
+ return _ref0.apply(this, arguments);
487
561
  };
488
562
  }();
489
563
  var fetchEnergyByMeterList = /*#__PURE__*/function () {
490
- var _ref0 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(type, ids, dateType) {
491
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
492
- while (1) switch (_context8.prev = _context8.next) {
564
+ var _ref1 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(type, ids, dateType) {
565
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
566
+ while (1) switch (_context9.prev = _context9.next) {
493
567
  case 0:
494
568
  GetEnergyByMeterList({
495
569
  dataType: type,
@@ -506,12 +580,12 @@ var Player = function Player(_ref) {
506
580
  });
507
581
  case 1:
508
582
  case "end":
509
- return _context8.stop();
583
+ return _context9.stop();
510
584
  }
511
- }, _callee8);
585
+ }, _callee9);
512
586
  }));
513
- return function fetchEnergyByMeterList(_x9, _x0, _x1) {
514
- return _ref0.apply(this, arguments);
587
+ return function fetchEnergyByMeterList(_x0, _x1, _x10) {
588
+ return _ref1.apply(this, arguments);
515
589
  };
516
590
  }();
517
591
  var timer;
@@ -522,6 +596,7 @@ var Player = function Player(_ref) {
522
596
  var pointIds = [];
523
597
  var specialPoint = [];
524
598
  var virtual = [];
599
+ var indicator = [];
525
600
  jsonConfig === null || jsonConfig === void 0 ? void 0 : (_jsonConfig$cells = jsonConfig.cells) === null || _jsonConfig$cells === void 0 ? void 0 : _jsonConfig$cells.forEach(function (cell) {
526
601
  var _cell$data, _cell$data$pointList, _cell$data2, _cell$data3;
527
602
  if ((cell === null || cell === void 0 ? void 0 : (_cell$data = cell.data) === null || _cell$data === void 0 ? void 0 : (_cell$data$pointList = _cell$data.pointList) === null || _cell$data$pointList === void 0 ? void 0 : _cell$data$pointList.length) > 0 && (cell === null || cell === void 0 ? void 0 : (_cell$data2 = cell.data) === null || _cell$data2 === void 0 ? void 0 : _cell$data2.pointList[0].deviceType) === 'virtual') {
@@ -531,7 +606,11 @@ var Player = function Player(_ref) {
531
606
  } else {
532
607
  var _cell$data4, _cell$data4$pointList;
533
608
  cell === null || cell === void 0 ? void 0 : (_cell$data4 = cell.data) === null || _cell$data4 === void 0 ? void 0 : (_cell$data4$pointList = _cell$data4.pointList) === null || _cell$data4$pointList === void 0 ? void 0 : _cell$data4$pointList.forEach(function (point) {
534
- pointIds.push(point.pointId);
609
+ if (point.valueType == 'indicator') {
610
+ indicator.push(point.indicatorNo);
611
+ } else {
612
+ pointIds.push(point.pointId);
613
+ }
535
614
  });
536
615
  }
537
616
 
@@ -561,6 +640,12 @@ var Player = function Player(_ref) {
561
640
  fetchDevicePoints(pointIds);
562
641
  }, RefreshFrequency);
563
642
  }
643
+ if (indicator.length > 0) {
644
+ fetchDeviceIndicator(indicator);
645
+ timer = setInterval(function () {
646
+ fetchDeviceIndicator(indicator);
647
+ }, RefreshFrequency);
648
+ }
564
649
  if (specialPoint.length) {
565
650
  var monthPoint = specialPoint.filter(function (item) {
566
651
  return item.data.valueDate == 0;
@@ -653,6 +738,7 @@ var Player = function Player(_ref) {
653
738
  return setVisibleDialogHistory(false);
654
739
  },
655
740
  pointIdListProp: activePointIds,
741
+ indicatorNoList: activeIndicatorNos,
656
742
  companyId: query.companyId,
657
743
  projectId: query.projectId
658
744
  }), /*#__PURE__*/React.createElement(DialogPointWrite, {
@@ -415,6 +415,8 @@ function _GetDeviceCumulativeUpLineLineChart() {
415
415
  export function GetDeviceDayLiveLineChart(_x32, _x33) {
416
416
  return _GetDeviceDayLiveLineChart.apply(this, arguments);
417
417
  }
418
+
419
+ /** 获取设备指标 POST /api/GatewayMicro/DeviceIndicator/GetDeviceIndicator */
418
420
  function _GetDeviceDayLiveLineChart() {
419
421
  _GetDeviceDayLiveLineChart = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(body, options) {
420
422
  return _regeneratorRuntime().wrap(function _callee15$(_context15) {
@@ -434,4 +436,27 @@ function _GetDeviceDayLiveLineChart() {
434
436
  }, _callee15);
435
437
  }));
436
438
  return _GetDeviceDayLiveLineChart.apply(this, arguments);
439
+ }
440
+ export function GetDeviceIndicator(_x34, _x35) {
441
+ return _GetDeviceIndicator.apply(this, arguments);
442
+ }
443
+ function _GetDeviceIndicator() {
444
+ _GetDeviceIndicator = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16(body, options) {
445
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
446
+ while (1) switch (_context16.prev = _context16.next) {
447
+ case 0:
448
+ return _context16.abrupt("return", request('/api/GatewayMicro/DeviceIndicator/GetDeviceIndicator', _objectSpread({
449
+ method: 'POST',
450
+ headers: {
451
+ 'Content-Type': 'application/json-patch+json'
452
+ },
453
+ data: body
454
+ }, options || {})));
455
+ case 1:
456
+ case "end":
457
+ return _context16.stop();
458
+ }
459
+ }, _callee16);
460
+ }));
461
+ return _GetDeviceIndicator.apply(this, arguments);
437
462
  }