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
@@ -1,4 +1,8 @@
1
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 _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
3
+ 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."); }
4
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
5
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
2
6
  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
7
  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
8
  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; }
@@ -25,10 +29,56 @@ import DialogHistory from "../../../components/DialogHistory";
25
29
  import DialogPointWrite from "../../../components/DialogPointWrite";
26
30
  import ModalFanDevicePoint from "../../../components/ModalFanDevicePoint";
27
31
  import emitter from "../../../utils/events";
28
- import { GetDevicePoint } from "../../../services/gateway/Device";
32
+ import { GetDeviceIndicator, GetDevicePoint } from "../../../services/gateway/Device";
29
33
  import "./index.css";
30
- import { GetTdIndicatorAggregateData } from "../../../services/gateway/Point";
34
+ import { GetTdIndicatorAggregateData, GetTdIndicatorHistoryData } from "../../../services/gateway/Point";
31
35
  import dayjs from 'dayjs';
36
+ import { GetEnergyByMeterList } from "../../../services/energy";
37
+ import ModalChangePointValue from "../../../components/ModalChangePointValue";
38
+ var DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss';
39
+ var HISTORY_DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm';
40
+ var getIndicatorHistoryTotalValue = function getIndicatorHistoryTotalValue(indicatorDataList) {
41
+ var valueList = (indicatorDataList || []).filter(function (item) {
42
+ return Number.isFinite(item === null || item === void 0 ? void 0 : item.val);
43
+ });
44
+ if (!valueList.length) {
45
+ return 0;
46
+ }
47
+ return valueList.reduce(function (sum, item) {
48
+ return sum + Number(item.val);
49
+ }, 0);
50
+ };
51
+ var getStatisticsTimeRange = function getStatisticsTimeRange() {
52
+ var dateType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
53
+ var now = dayjs();
54
+ switch (dateType) {
55
+ case 2:
56
+ return {
57
+ startTime: now.startOf('day').format(DATE_TIME_FORMAT),
58
+ endTime: now.endOf('day').format(DATE_TIME_FORMAT)
59
+ };
60
+ case 3:
61
+ {
62
+ var dayOfWeek = now.day();
63
+ var startOfWeek = now.startOf('day').subtract(dayOfWeek === 0 ? 6 : dayOfWeek - 1, 'day');
64
+ return {
65
+ startTime: startOfWeek.format(DATE_TIME_FORMAT),
66
+ endTime: startOfWeek.add(6, 'day').endOf('day').format(DATE_TIME_FORMAT)
67
+ };
68
+ }
69
+ case 1:
70
+ return {
71
+ startTime: now.startOf('year').format(DATE_TIME_FORMAT),
72
+ endTime: now.endOf('year').format(DATE_TIME_FORMAT)
73
+ };
74
+ case 0:
75
+ default:
76
+ return {
77
+ startTime: now.startOf('month').format(DATE_TIME_FORMAT),
78
+ endTime: now.endOf('month').format(DATE_TIME_FORMAT)
79
+ };
80
+ }
81
+ };
32
82
  var Player = function Player(_ref) {
33
83
  var _jsonConfig$pageConfi;
34
84
  var jsonConfig = _ref.jsonConfig,
@@ -49,18 +99,30 @@ var Player = function Player(_ref) {
49
99
  _useState6 = _slicedToArray(_useState5, 2),
50
100
  visibleDialogPointWrite = _useState6[0],
51
101
  setVisibleDialogPointWrite = _useState6[1];
52
- var _useState7 = useState([]),
102
+ var _useState7 = useState(false),
53
103
  _useState8 = _slicedToArray(_useState7, 2),
54
- activePointIds = _useState8[0],
55
- setActivePointIds = _useState8[1];
104
+ visibleModalChangePointValue = _useState8[0],
105
+ setVisibleModalChangePointValue = _useState8[1];
56
106
  var _useState9 = useState([]),
57
107
  _useState0 = _slicedToArray(_useState9, 2),
58
- activePoints = _useState0[0],
59
- setActivePoints = _useState0[1];
60
- var _useState1 = useState(),
108
+ activePointIds = _useState0[0],
109
+ setActivePointIds = _useState0[1];
110
+ var _useState1 = useState([]),
61
111
  _useState10 = _slicedToArray(_useState1, 2),
62
- activeDeviceId = _useState10[0],
63
- setActiveDeviceId = _useState10[1];
112
+ activeIndicatorNos = _useState10[0],
113
+ setActiveIndicatorNos = _useState10[1];
114
+ var _useState11 = useState({}),
115
+ _useState12 = _slicedToArray(_useState11, 2),
116
+ changePointValueProps = _useState12[0],
117
+ setChangePointValueProps = _useState12[1];
118
+ var _useState13 = useState([]),
119
+ _useState14 = _slicedToArray(_useState13, 2),
120
+ activePoints = _useState14[0],
121
+ setActivePoints = _useState14[1];
122
+ var _useState15 = useState(),
123
+ _useState16 = _slicedToArray(_useState15, 2),
124
+ activeDeviceId = _useState16[0],
125
+ setActiveDeviceId = _useState16[1];
64
126
  var wrapSize = useSize(wrapRef);
65
127
  var mittMeta = useMemo(function () {
66
128
  return getMittMeta(query);
@@ -96,7 +158,7 @@ var Player = function Player(_ref) {
96
158
  var handler = /*#__PURE__*/function () {
97
159
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(points) {
98
160
  var _points$;
99
- var deviceId, _res$data, res, _t;
161
+ var _points$2, indicatorNo, _res$data, res, _points$3, deviceId, _res$data2, _res, _t, _t2;
100
162
  return _regenerator().w(function (_context) {
101
163
  while (1) switch (_context.p = _context.n) {
102
164
  case 0:
@@ -106,22 +168,15 @@ var Player = function Player(_ref) {
106
168
  }
107
169
  return _context.a(2);
108
170
  case 1:
109
- // if (query.scene === 'freedom') {
110
- // setActivePointIds(points.map((v) => v.pointId));
111
- // setVisibleDialogHistory(true);
112
- // return;
113
- // }
114
- deviceId = points === null || points === void 0 ? void 0 : (_points$ = points[0]) === null || _points$ === void 0 ? void 0 : _points$.deviceId;
115
- if (query.scene === 'device') {
116
- deviceId = parseInt(query.deviceId, 10);
171
+ if (!(points === null || points === void 0 ? void 0 : (_points$ = points[0]) === null || _points$ === void 0 ? void 0 : _points$.indicatorNo)) {
172
+ _context.n = 8;
173
+ break;
117
174
  }
175
+ indicatorNo = points === null || points === void 0 ? void 0 : (_points$2 = points[0]) === null || _points$2 === void 0 ? void 0 : _points$2.indicatorNo;
118
176
  _context.p = 2;
119
177
  _context.n = 3;
120
- return GetDevicePoint({
121
- deviceIdList: [deviceId],
122
- pointIdentifierNameList: points.map(function (v) {
123
- return v.identifierName;
124
- })
178
+ return GetDeviceIndicator({
179
+ indicatorNoList: [indicatorNo]
125
180
  });
126
181
  case 3:
127
182
  res = _context.v;
@@ -136,40 +191,83 @@ var Player = function Player(_ref) {
136
191
  _context.n = 5;
137
192
  break;
138
193
  }
139
- message.error('没有找到对应的点');
194
+ message.error('没有找到对应的指标');
140
195
  return _context.a(2);
141
196
  case 5:
197
+ setActivePointIds([]);
198
+ setActiveIndicatorNos([res.data[0].indicatorNo]);
199
+ setVisibleDialogHistory(true);
200
+ _context.n = 7;
201
+ break;
202
+ case 6:
203
+ _context.p = 6;
204
+ _t = _context.v;
205
+ console.error(_t);
206
+ message.error('oops, 出错了');
207
+ case 7:
208
+ _context.n = 15;
209
+ break;
210
+ case 8:
211
+ deviceId = points === null || points === void 0 ? void 0 : (_points$3 = points[0]) === null || _points$3 === void 0 ? void 0 : _points$3.deviceId;
212
+ if (query.scene === 'device') {
213
+ deviceId = parseInt(query.deviceId, 10);
214
+ }
215
+ _context.p = 9;
216
+ _context.n = 10;
217
+ return GetDevicePoint({
218
+ deviceIdList: [deviceId],
219
+ pointIdentifierNameList: points.map(function (v) {
220
+ return v.identifierName;
221
+ })
222
+ });
223
+ case 10:
224
+ _res = _context.v;
225
+ if (_res.success) {
226
+ _context.n = 11;
227
+ break;
228
+ }
229
+ message.error('oops, 出错了');
230
+ return _context.a(2);
231
+ case 11:
232
+ if ((_res$data2 = _res.data) === null || _res$data2 === void 0 ? void 0 : _res$data2.length) {
233
+ _context.n = 12;
234
+ break;
235
+ }
236
+ message.error('没有找到对应的点');
237
+ return _context.a(2);
238
+ case 12:
142
239
  if (!isInIframe()) {
143
- _context.n = 6;
240
+ _context.n = 13;
144
241
  break;
145
242
  }
146
243
  // 如果是在 iframe 上显示(嵌入小麦), 使用小麦平台的历史曲线弹窗
147
244
  window.parent.postMessage({
148
245
  event: 'show-point-history-modal',
149
246
  payload: {
150
- pointIds: res.data.map(function (v) {
247
+ pointIds: _res.data.map(function (v) {
151
248
  return v.pointId;
152
249
  }),
153
250
  locationSearch: window.location.search
154
251
  }
155
252
  }, '*');
156
253
  return _context.a(2);
157
- case 6:
158
- setActivePointIds(res.data.map(function (v) {
254
+ case 13:
255
+ setActiveIndicatorNos([]);
256
+ setActivePointIds(_res.data.map(function (v) {
159
257
  return v.pointId;
160
258
  }));
161
259
  setVisibleDialogHistory(true);
162
- _context.n = 8;
260
+ _context.n = 15;
163
261
  break;
164
- case 7:
165
- _context.p = 7;
166
- _t = _context.v;
167
- console.error(_t);
262
+ case 14:
263
+ _context.p = 14;
264
+ _t2 = _context.v;
265
+ console.error(_t2);
168
266
  message.error('oops, 出错了');
169
- case 8:
267
+ case 15:
170
268
  return _context.a(2);
171
269
  }
172
- }, _callee, null, [[2, 7]]);
270
+ }, _callee, null, [[9, 14], [2, 6]]);
173
271
  }));
174
272
  return function handler(_x) {
175
273
  return _ref2.apply(this, arguments);
@@ -220,46 +318,79 @@ var Player = function Player(_ref) {
220
318
  };
221
319
  }, [query, mittMeta]);
222
320
 
223
- // 监听显示风机设备点位弹窗事件
321
+ // 监听显示点位写入弹窗事件2
224
322
  useEffect(function () {
225
323
  var handler = /*#__PURE__*/function () {
226
- var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(_ref4) {
227
- var deviceId, id;
324
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(points) {
228
325
  return _regenerator().w(function (_context3) {
229
326
  while (1) switch (_context3.n) {
230
327
  case 0:
231
- deviceId = _ref4.deviceId;
232
328
  if (!(query.scene === 'product')) {
233
329
  _context3.n = 1;
234
330
  break;
235
331
  }
236
332
  return _context3.a(2);
237
333
  case 1:
238
- id = query.scene === 'device' ? Number(query.deviceId) : deviceId;
239
- setActiveDeviceId(id);
240
- setVisibleModalFanDevicePoint(true);
334
+ setVisibleModalChangePointValue(true);
335
+ setChangePointValueProps(function () {
336
+ return points[0];
337
+ });
241
338
  case 2:
242
339
  return _context3.a(2);
243
340
  }
244
341
  }, _callee3);
245
342
  }));
246
343
  return function handler(_x3) {
247
- return _ref5.apply(this, arguments);
344
+ return _ref4.apply(this, arguments);
248
345
  };
249
346
  }();
250
- var eventName = "show-fan-device-point-modal-".concat(mittMeta.namespace);
347
+ var eventName = "show-point-write-".concat(mittMeta.namespace);
251
348
  emitter.on(eventName, handler);
252
349
  return function () {
253
350
  emitter.off(eventName, handler);
254
351
  };
255
352
  }, [query, mittMeta]);
256
353
 
257
- // 监听场景组态切换事件
354
+ // 监听显示风机设备点位弹窗事件
258
355
  useEffect(function () {
259
356
  var handler = /*#__PURE__*/function () {
260
- var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(scadaId) {
357
+ var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(_ref5) {
358
+ var deviceId, id;
261
359
  return _regenerator().w(function (_context4) {
262
360
  while (1) switch (_context4.n) {
361
+ case 0:
362
+ deviceId = _ref5.deviceId;
363
+ if (!(query.scene === 'product')) {
364
+ _context4.n = 1;
365
+ break;
366
+ }
367
+ return _context4.a(2);
368
+ case 1:
369
+ id = query.scene === 'device' ? Number(query.deviceId) : deviceId;
370
+ setActiveDeviceId(id);
371
+ setVisibleModalFanDevicePoint(true);
372
+ case 2:
373
+ return _context4.a(2);
374
+ }
375
+ }, _callee4);
376
+ }));
377
+ return function handler(_x4) {
378
+ return _ref6.apply(this, arguments);
379
+ };
380
+ }();
381
+ var eventName = "show-fan-device-point-modal-".concat(mittMeta.namespace);
382
+ emitter.on(eventName, handler);
383
+ return function () {
384
+ emitter.off(eventName, handler);
385
+ };
386
+ }, [query, mittMeta]);
387
+
388
+ // 监听场景组态切换事件
389
+ useEffect(function () {
390
+ var handler = /*#__PURE__*/function () {
391
+ var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(scadaId) {
392
+ return _regenerator().w(function (_context5) {
393
+ while (1) switch (_context5.n) {
263
394
  case 0:
264
395
  onEvent === null || onEvent === void 0 ? void 0 : onEvent({
265
396
  event: 'freedom-scene-switch',
@@ -267,19 +398,13 @@ var Player = function Player(_ref) {
267
398
  scadaId: scadaId
268
399
  }
269
400
  });
270
- console.log('[186]-index.tsx', onEvent, {
271
- event: 'freedom-scene-switch',
272
- payload: {
273
- scadaId: scadaId
274
- }
275
- });
276
401
  case 1:
277
- return _context4.a(2);
402
+ return _context5.a(2);
278
403
  }
279
- }, _callee4);
404
+ }, _callee5);
280
405
  }));
281
- return function handler(_x4) {
282
- return _ref6.apply(this, arguments);
406
+ return function handler(_x5) {
407
+ return _ref7.apply(this, arguments);
283
408
  };
284
409
  }();
285
410
  var mittMeta = getMittMeta(query);
@@ -347,23 +472,23 @@ var Player = function Player(_ref) {
347
472
  // scene === 'device' 加载设备点位数据
348
473
  useEffect(function () {
349
474
  var fetchDevicePoints = /*#__PURE__*/function () {
350
- var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(deviceId) {
475
+ var _ref8 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(deviceId) {
351
476
  var res, pointList;
352
- return _regenerator().w(function (_context5) {
353
- while (1) switch (_context5.n) {
477
+ return _regenerator().w(function (_context6) {
478
+ while (1) switch (_context6.n) {
354
479
  case 0:
355
- _context5.n = 1;
480
+ _context6.n = 1;
356
481
  return GetDevicePoint({
357
482
  deviceIdList: [deviceId]
358
483
  }, []);
359
484
  case 1:
360
- res = _context5.v;
485
+ res = _context6.v;
361
486
  if (res.success) {
362
- _context5.n = 2;
487
+ _context6.n = 2;
363
488
  break;
364
489
  }
365
490
  message.error('设备点位数据获取失败');
366
- return _context5.a(2);
491
+ return _context6.a(2);
367
492
  case 2:
368
493
  pointList = res.data || [];
369
494
  pointList.forEach(function (v) {
@@ -371,12 +496,12 @@ var Player = function Player(_ref) {
371
496
  emitter.emit("point-update-".concat(identifierName, "-").concat(mittMeta.namespace), v);
372
497
  });
373
498
  case 3:
374
- return _context5.a(2);
499
+ return _context6.a(2);
375
500
  }
376
- }, _callee5);
501
+ }, _callee6);
377
502
  }));
378
- return function fetchDevicePoints(_x5) {
379
- return _ref7.apply(this, arguments);
503
+ return function fetchDevicePoints(_x6) {
504
+ return _ref8.apply(this, arguments);
380
505
  };
381
506
  }();
382
507
  var timer;
@@ -391,73 +516,107 @@ var Player = function Player(_ref) {
391
516
  clearInterval(timer);
392
517
  }
393
518
  };
394
- }, [query, jsonConfig, mittMeta]);
519
+ }, [query, jsonConfig, mittMeta, RefreshFrequency]);
395
520
  useEffect(function () {}, [query, jsonConfig, mittMeta]);
396
521
  // scene === 'freedom' 加载设备点位数据
397
522
  useEffect(function () {
398
523
  var fetchDevicePoints = /*#__PURE__*/function () {
399
- var _ref8 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(ids) {
524
+ var _ref9 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(ids) {
400
525
  var res, pointList;
401
- return _regenerator().w(function (_context6) {
402
- while (1) switch (_context6.n) {
526
+ return _regenerator().w(function (_context7) {
527
+ while (1) switch (_context7.n) {
403
528
  case 0:
404
- _context6.n = 1;
529
+ _context7.n = 1;
405
530
  return GetDevicePoint({
406
531
  pointIdList: ids
407
532
  }, []);
408
533
  case 1:
409
- res = _context6.v;
534
+ res = _context7.v;
410
535
  if (res.success) {
411
- _context6.n = 2;
536
+ _context7.n = 2;
412
537
  break;
413
538
  }
414
539
  message.error('设备点位数据获取失败');
415
- return _context6.a(2);
540
+ return _context7.a(2);
416
541
  case 2:
417
542
  pointList = res.data || [];
418
543
  pointList.forEach(function (v) {
419
544
  emitter.emit("point-update-".concat(v.pointId, "-").concat(mittMeta.namespace), v);
420
545
  });
421
546
  case 3:
422
- return _context6.a(2);
547
+ return _context7.a(2);
423
548
  }
424
- }, _callee6);
549
+ }, _callee7);
425
550
  }));
426
- return function fetchDevicePoints(_x6) {
427
- return _ref8.apply(this, arguments);
551
+ return function fetchDevicePoints(_x7) {
552
+ return _ref9.apply(this, arguments);
428
553
  };
429
554
  }();
430
- var fetchDeviceSpecialPoint = /*#__PURE__*/function () {
431
- var _ref9 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(ids, dateType) {
555
+ var fetchDeviceIndicator = /*#__PURE__*/function () {
556
+ var _ref0 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8(ids) {
432
557
  var res, pointList;
433
- return _regenerator().w(function (_context7) {
434
- while (1) switch (_context7.n) {
558
+ return _regenerator().w(function (_context8) {
559
+ while (1) switch (_context8.n) {
435
560
  case 0:
436
- _context7.n = 1;
561
+ _context8.n = 1;
562
+ return GetDeviceIndicator({
563
+ indicatorNoList: ids,
564
+ isGetIndicatorData: true
565
+ }, []);
566
+ case 1:
567
+ res = _context8.v;
568
+ if (res.success) {
569
+ _context8.n = 2;
570
+ break;
571
+ }
572
+ message.error('设备点位数据获取失败');
573
+ return _context8.a(2);
574
+ case 2:
575
+ pointList = res.data || [];
576
+ pointList.forEach(function (v) {
577
+ emitter.emit("point-update-".concat(v.indicatorNo, "-").concat(mittMeta.namespace), v);
578
+ });
579
+ case 3:
580
+ return _context8.a(2);
581
+ }
582
+ }, _callee8);
583
+ }));
584
+ return function fetchDeviceIndicator(_x8) {
585
+ return _ref0.apply(this, arguments);
586
+ };
587
+ }();
588
+ var fetchDeviceSpecialPoint = /*#__PURE__*/function () {
589
+ var _ref1 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(ids, dateType) {
590
+ var _getStatisticsTimeRan, startTime, endTime, res, pointList;
591
+ return _regenerator().w(function (_context9) {
592
+ while (1) switch (_context9.n) {
593
+ case 0:
594
+ _getStatisticsTimeRan = getStatisticsTimeRange(dateType), startTime = _getStatisticsTimeRan.startTime, endTime = _getStatisticsTimeRan.endTime;
595
+ _context9.n = 1;
437
596
  return GetTdIndicatorAggregateData(ids.map(function (v) {
438
597
  var productNo = {
439
- r5onwf: 'energy',
440
- p4snlw: 'steamc',
441
- rommzw: 'waterc'
598
+ emqktt: 'energy',
599
+ mrwtn4: 'steamc',
600
+ kf78l3: 'waterc'
442
601
  };
443
602
  var str = v.split('_');
444
603
  return {
445
604
  indicatorNo: "".concat(str[0], "_").concat(str[1], "_").concat(productNo[str[0]]),
446
605
  aggregateType: 3,
447
606
  timeQuantumList: [{
448
- startDate: dayjs().startOf(dateType == 0 ? "month" : "year").format('YYYY-MM-DD HH:mm:ss'),
449
- endDate: dayjs().endOf(dateType == 0 ? "month" : "year").format('YYYY-MM-DD HH:mm:ss')
607
+ startDate: startTime,
608
+ endDate: endTime
450
609
  }]
451
610
  };
452
611
  }));
453
612
  case 1:
454
- res = _context7.v;
613
+ res = _context9.v;
455
614
  if (res.success) {
456
- _context7.n = 2;
615
+ _context9.n = 2;
457
616
  break;
458
617
  }
459
618
  message.error('设备点位数据获取失败');
460
- return _context7.a(2);
619
+ return _context9.a(2);
461
620
  case 2:
462
621
  pointList = res.data || [];
463
622
  pointList.forEach(function (v) {
@@ -467,28 +626,117 @@ var Player = function Player(_ref) {
467
626
  emitter.emit("point-update-".concat(pointId, "-").concat(mittMeta.namespace), v);
468
627
  });
469
628
  case 3:
470
- return _context7.a(2);
629
+ return _context9.a(2);
471
630
  }
472
- }, _callee7);
631
+ }, _callee9);
473
632
  }));
474
- return function fetchDeviceSpecialPoint(_x7, _x8) {
475
- return _ref9.apply(this, arguments);
633
+ return function fetchDeviceSpecialPoint(_x9, _x0) {
634
+ return _ref1.apply(this, arguments);
476
635
  };
477
636
  }();
478
- var timer;
637
+ var fetchIndicatorSpecialPoint = /*#__PURE__*/function () {
638
+ var _ref10 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(ids, dateType) {
639
+ var _getStatisticsTimeRan2, startTime, endTime, res, pointList;
640
+ return _regenerator().w(function (_context0) {
641
+ while (1) switch (_context0.n) {
642
+ case 0:
643
+ _getStatisticsTimeRan2 = getStatisticsTimeRange(dateType), startTime = _getStatisticsTimeRan2.startTime, endTime = _getStatisticsTimeRan2.endTime;
644
+ _context0.n = 1;
645
+ return GetTdIndicatorHistoryData({
646
+ indicatorNoList: ids,
647
+ timeQuantum: {
648
+ startDate: dayjs(startTime).format(HISTORY_DATE_TIME_FORMAT),
649
+ endDate: dayjs(endTime).format(HISTORY_DATE_TIME_FORMAT)
650
+ },
651
+ interval: 0
652
+ });
653
+ case 1:
654
+ res = _context0.v;
655
+ if (res.success) {
656
+ _context0.n = 2;
657
+ break;
658
+ }
659
+ message.error('璁惧鐐逛綅鏁版嵁鑾峰彇澶辫触');
660
+ return _context0.a(2);
661
+ case 2:
662
+ pointList = res.data || [];
663
+ pointList.forEach(function (v, index) {
664
+ var indicatorNo = v.indicatorNo || ids[index];
665
+ var totalValue = getIndicatorHistoryTotalValue(v.indicatorDataList);
666
+ emitter.emit("point-update-".concat(indicatorNo, "-").concat(mittMeta.namespace), _objectSpread(_objectSpread({}, v), {}, {
667
+ aggregateDataList: [{
668
+ val: totalValue,
669
+ ts: endTime
670
+ }],
671
+ indicatorData: {
672
+ val: totalValue,
673
+ ts: endTime
674
+ },
675
+ updateTime: endTime
676
+ }));
677
+ });
678
+ case 3:
679
+ return _context0.a(2);
680
+ }
681
+ }, _callee0);
682
+ }));
683
+ return function fetchIndicatorSpecialPoint(_x1, _x10) {
684
+ return _ref10.apply(this, arguments);
685
+ };
686
+ }();
687
+ var fetchEnergyByMeterList = /*#__PURE__*/function () {
688
+ var _ref11 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1(type, ids, dateType) {
689
+ var _getStatisticsTimeRan3, startTime, endTime;
690
+ return _regenerator().w(function (_context1) {
691
+ while (1) switch (_context1.n) {
692
+ case 0:
693
+ _getStatisticsTimeRan3 = getStatisticsTimeRange(dateType), startTime = _getStatisticsTimeRan3.startTime, endTime = _getStatisticsTimeRan3.endTime;
694
+ GetEnergyByMeterList({
695
+ dataType: type,
696
+ meterIdList: ids,
697
+ startDateTime: startTime,
698
+ endDateTime: endTime,
699
+ dateType: 2
700
+ }).then(function (res) {
701
+ if (res.success) {
702
+ res.data.forEach(function (item) {
703
+ emitter.emit("point-update-".concat(item.id, "-").concat(mittMeta.namespace), item);
704
+ });
705
+ }
706
+ });
707
+ case 1:
708
+ return _context1.a(2);
709
+ }
710
+ }, _callee1);
711
+ }));
712
+ return function fetchEnergyByMeterList(_x11, _x12, _x13) {
713
+ return _ref11.apply(this, arguments);
714
+ };
715
+ }();
716
+ var pointTimer;
717
+ var indicatorTimer;
479
718
  var specialPointTimer;
719
+ var meterPointTimer;
480
720
  if (query.scene === 'freedom' && jsonConfig) {
481
721
  var _jsonConfig$cells;
482
722
  var pointIds = [];
483
723
  var specialPoint = [];
724
+ var virtual = [];
725
+ var indicator = [];
484
726
  jsonConfig === null || jsonConfig === void 0 ? void 0 : (_jsonConfig$cells = jsonConfig.cells) === null || _jsonConfig$cells === void 0 ? void 0 : _jsonConfig$cells.forEach(function (cell) {
485
- var _cell$data;
486
- if ((cell === null || cell === void 0 ? void 0 : (_cell$data = cell.data) === null || _cell$data === void 0 ? void 0 : _cell$data.valueType) == 1) {
727
+ var _cell$data, _cell$data$pointList, _cell$data2, _cell$data3;
728
+ 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') {
729
+ virtual.push(cell);
730
+ } else if ((cell === null || cell === void 0 ? void 0 : (_cell$data3 = cell.data) === null || _cell$data3 === void 0 ? void 0 : _cell$data3.valueType) === 1) {
487
731
  specialPoint.push(cell);
488
732
  } else {
489
- var _cell$data2, _cell$data2$pointList;
490
- cell === null || cell === void 0 ? void 0 : (_cell$data2 = cell.data) === null || _cell$data2 === void 0 ? void 0 : (_cell$data2$pointList = _cell$data2.pointList) === null || _cell$data2$pointList === void 0 ? void 0 : _cell$data2$pointList.forEach(function (point) {
491
- pointIds.push(point.pointId);
733
+ var _cell$data4, _cell$data4$pointList;
734
+ 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) {
735
+ if (point.valueType == 'indicator') {
736
+ indicator.push(point.indicatorNo);
737
+ } else {
738
+ pointIds.push(point.pointId);
739
+ }
492
740
  });
493
741
  }
494
742
 
@@ -514,35 +762,98 @@ var Player = function Player(_ref) {
514
762
  });
515
763
  if (pointIds.length > 0) {
516
764
  fetchDevicePoints(pointIds);
517
- timer = setInterval(function () {
765
+ pointTimer = setInterval(function () {
518
766
  fetchDevicePoints(pointIds);
519
767
  }, RefreshFrequency);
520
768
  }
521
- if (specialPoint.length) {
522
- var monthPoint = specialPoint.filter(function (item) {
523
- return item.data.valueDate == 0;
524
- }).map(function (item) {
525
- return item.data.pointList[0].pointId;
526
- });
527
- var yaerPoint = specialPoint.filter(function (item) {
528
- return item.data.valueDate == 1;
529
- }).map(function (item) {
530
- return item.data.pointList[0].pointId;
531
- });
532
- monthPoint.length && fetchDeviceSpecialPoint(monthPoint, 0);
533
- yaerPoint.length && fetchDeviceSpecialPoint(yaerPoint, 1);
534
- specialPointTimer = setInterval(function () {
535
- monthPoint.length && fetchDeviceSpecialPoint(monthPoint, 0);
536
- yaerPoint.length && fetchDeviceSpecialPoint(yaerPoint, 1);
769
+ if (indicator.length > 0) {
770
+ fetchDeviceIndicator(indicator);
771
+ indicatorTimer = setInterval(function () {
772
+ fetchDeviceIndicator(indicator);
537
773
  }, RefreshFrequency);
538
774
  }
775
+ if (specialPoint.length) {
776
+ var statisticsDateList = _toConsumableArray(new Set(specialPoint.map(function (item) {
777
+ var _item$data$valueDate;
778
+ return (_item$data$valueDate = item.data.valueDate) !== null && _item$data$valueDate !== void 0 ? _item$data$valueDate : 0;
779
+ })));
780
+ var fetchSpecialPoints = function fetchSpecialPoints() {
781
+ statisticsDateList.forEach(function (dateType) {
782
+ var pointIds = specialPoint.filter(function (item) {
783
+ var _item$data$valueDate2;
784
+ return ((_item$data$valueDate2 = item.data.valueDate) !== null && _item$data$valueDate2 !== void 0 ? _item$data$valueDate2 : 0) === dateType;
785
+ }).filter(function (item) {
786
+ var _item$data$pointList$;
787
+ return ((_item$data$pointList$ = item.data.pointList[0]) === null || _item$data$pointList$ === void 0 ? void 0 : _item$data$pointList$.valueType) !== 'indicator';
788
+ }).map(function (item) {
789
+ var _item$data$pointList$2;
790
+ return (_item$data$pointList$2 = item.data.pointList[0]) === null || _item$data$pointList$2 === void 0 ? void 0 : _item$data$pointList$2.pointId;
791
+ }).filter(Boolean);
792
+ var indicatorNos = specialPoint.filter(function (item) {
793
+ var _item$data$valueDate3;
794
+ return ((_item$data$valueDate3 = item.data.valueDate) !== null && _item$data$valueDate3 !== void 0 ? _item$data$valueDate3 : 0) === dateType;
795
+ }).filter(function (item) {
796
+ var _item$data$pointList$3;
797
+ return ((_item$data$pointList$3 = item.data.pointList[0]) === null || _item$data$pointList$3 === void 0 ? void 0 : _item$data$pointList$3.valueType) === 'indicator';
798
+ }).map(function (item) {
799
+ var _item$data$pointList$4;
800
+ return (_item$data$pointList$4 = item.data.pointList[0]) === null || _item$data$pointList$4 === void 0 ? void 0 : _item$data$pointList$4.indicatorNo;
801
+ }).filter(Boolean);
802
+ if (pointIds.length > 0) {
803
+ fetchDeviceSpecialPoint(pointIds, dateType);
804
+ }
805
+ if (indicatorNos.length > 0) {
806
+ fetchIndicatorSpecialPoint(indicatorNos, dateType);
807
+ }
808
+ });
809
+ };
810
+ fetchSpecialPoints();
811
+ specialPointTimer = setInterval(fetchSpecialPoints, RefreshFrequency);
812
+ }
813
+ if (virtual.length) {
814
+ var dataType = _toConsumableArray(new Set(virtual.map(function (item) {
815
+ var _item$data$pointList$5;
816
+ return (_item$data$pointList$5 = item.data.pointList[0]) === null || _item$data$pointList$5 === void 0 ? void 0 : _item$data$pointList$5.dataType;
817
+ }).filter(Boolean)));
818
+ var valueDate = _toConsumableArray(new Set(virtual.map(function (item) {
819
+ var _item$data$valueDate4;
820
+ return (_item$data$valueDate4 = item.data.valueDate) !== null && _item$data$valueDate4 !== void 0 ? _item$data$valueDate4 : 0;
821
+ })));
822
+ var fetchVirtualPoints = function fetchVirtualPoints() {
823
+ dataType.forEach(function (type) {
824
+ valueDate.forEach(function (date) {
825
+ var ids = virtual.filter(function (item) {
826
+ var _item$data$pointList$6, _item$data$valueDate5;
827
+ return ((_item$data$pointList$6 = item.data.pointList[0]) === null || _item$data$pointList$6 === void 0 ? void 0 : _item$data$pointList$6.dataType) == type && ((_item$data$valueDate5 = item.data.valueDate) !== null && _item$data$valueDate5 !== void 0 ? _item$data$valueDate5 : 0) === date;
828
+ }).map(function (item) {
829
+ var _item$data$pointList$7;
830
+ return (_item$data$pointList$7 = item.data.pointList[0]) === null || _item$data$pointList$7 === void 0 ? void 0 : _item$data$pointList$7.meterId;
831
+ }).filter(Boolean);
832
+ if (ids.length > 0) {
833
+ fetchEnergyByMeterList(type, ids, date);
834
+ }
835
+ });
836
+ });
837
+ };
838
+ fetchVirtualPoints();
839
+ meterPointTimer = setInterval(fetchVirtualPoints, RefreshFrequency);
840
+ }
539
841
  }
540
842
  return function () {
541
- if (timer) {
542
- clearInterval(timer);
843
+ if (pointTimer) {
844
+ clearInterval(pointTimer);
845
+ }
846
+ if (indicatorTimer) {
847
+ clearInterval(indicatorTimer);
848
+ }
849
+ if (specialPointTimer) {
850
+ clearInterval(specialPointTimer);
851
+ }
852
+ if (meterPointTimer) {
853
+ clearInterval(meterPointTimer);
543
854
  }
544
855
  };
545
- }, [query, jsonConfig, mittMeta]);
856
+ }, [query, jsonConfig, mittMeta, RefreshFrequency]);
546
857
  useEffect(function () {
547
858
  var graph = graphRef.current;
548
859
  if (jsonConfig && graph && query) {
@@ -583,6 +894,7 @@ var Player = function Player(_ref) {
583
894
  return setVisibleDialogHistory(false);
584
895
  },
585
896
  pointIdListProp: activePointIds,
897
+ indicatorNoList: activeIndicatorNos,
586
898
  companyId: query.companyId,
587
899
  projectId: query.projectId
588
900
  }), /*#__PURE__*/React.createElement(DialogPointWrite, {
@@ -591,6 +903,15 @@ var Player = function Player(_ref) {
591
903
  onCancel: function onCancel() {
592
904
  return setVisibleDialogPointWrite(false);
593
905
  }
906
+ }), /*#__PURE__*/React.createElement(ModalChangePointValue, {
907
+ visible: visibleModalChangePointValue,
908
+ protocol: changePointValueProps.protocol,
909
+ pointValue: changePointValueProps.pointValue,
910
+ pointIdList: changePointValueProps.pointIdList,
911
+ pointEnumItemList: changePointValueProps.pointEnumItemList,
912
+ onCancel: function onCancel() {
913
+ return setVisibleModalChangePointValue(false);
914
+ }
594
915
  }));
595
916
  };
596
917
  export default Player;