coolcare-lite-scada-component 3.0.1 → 3.0.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 (45) hide show
  1. package/es/components/DialogHistory/index.css +22 -0
  2. package/es/components/DialogHistory/index.js +317 -83
  3. package/es/components/DialogImagePicker/GroupPanel/index.js +1 -1
  4. package/es/components/ECharts/index.js +31 -23
  5. package/es/components/Icon/index.js +1 -1
  6. package/es/components/ImageUploader/index.js +1 -1
  7. package/es/components/ModalChoosePoint/index.js +235 -0
  8. package/es/element/EleFan/Component.js +1 -1
  9. package/es/element/EleFanBySvg/index.js +3 -3
  10. package/es/element/EleImage/index.js +1 -1
  11. package/es/element/ElePointImage/index.js +1 -1
  12. package/es/element/ElePointValue/Component.js +10 -6
  13. package/es/element/ElePointValue/PropsSet/StatisticsPropsSet/index.js +77 -0
  14. package/es/element/ElePointValue/PropsSet/index.js +5 -1
  15. package/es/element/EleState/index.js +1 -1
  16. package/es/element/EleSwitch/Component.js +3 -4
  17. package/es/element/EleSwitch/index.css +3 -0
  18. package/es/element/PipeNodes/NodeBL/index.js +1 -1
  19. package/es/element/PipeNodes/NodeBR/index.js +1 -1
  20. package/es/element/PipeNodes/NodeBottom/index.js +1 -1
  21. package/es/element/PipeNodes/NodeCenter/index.js +1 -1
  22. package/es/element/PipeNodes/NodeHorizontal/index.js +1 -1
  23. package/es/element/PipeNodes/NodeLeft/index.js +1 -1
  24. package/es/element/PipeNodes/NodeRight/index.js +1 -1
  25. package/es/element/PipeNodes/NodeTL/index.js +1 -1
  26. package/es/element/PipeNodes/NodeTR/index.js +1 -1
  27. package/es/element/PipeNodes/NodeTop/index.js +1 -1
  28. package/es/element/PipeNodes/NodeVertical/index.js +1 -1
  29. package/es/element/type.d.ts +1 -0
  30. package/es/element/utils/pointWrite.js +6 -7
  31. package/es/pages/display/Player/index.js +104 -16
  32. package/es/pages/display/index.js +2 -2
  33. package/es/pages/editor/PanelLeft/BasicShapeList/listData.js +8 -8
  34. package/es/pages/editor/PanelLeft/ImgGroup/index.js +1 -1
  35. package/es/pages/editor/PanelLeft/MetaEleList/listData.js +14 -14
  36. package/es/pages/editor/PanelLeft/PipeEleList/listData.js +11 -11
  37. package/es/pages/editor/PanelLeft/PointCardEleList/listData.js +6 -6
  38. package/es/pages/editor/PanelLeft/RecommendEleList/listData.js +4 -4
  39. package/es/pages/editor/PanelRight/components/FormLayer/index.js +12 -2
  40. package/es/pages/editor/index.js +15 -2
  41. package/es/services/gateway/Point.js +56 -7
  42. package/es/services/request.js +1 -1
  43. package/es/typings.d.ts +18 -4
  44. package/es/utils/date.js +7 -0
  45. package/package.json +3 -3
@@ -8,3 +8,25 @@
8
8
  left: 50%;
9
9
  transform: translate(-50%, -50%);
10
10
  }
11
+ .totalBox {
12
+ display: flex;
13
+ flex-direction: column;
14
+ width: 300px;
15
+ padding-left: 16px;
16
+ border-left: 1px solid #e8e8e8;
17
+ }
18
+ .totalBox .totalItem {
19
+ display: flex;
20
+ }
21
+ .totalBox .totalItem:not(:last-child) {
22
+ margin-bottom: 8px;
23
+ padding-bottom: 8px;
24
+ border-bottom: 1px solid #e8e8e8;
25
+ }
26
+ .totalBox .totalItem .totalItemTitle {
27
+ width: 80px;
28
+ font-weight: 600;
29
+ }
30
+ .totalBox .totalItem .totalItemContent {
31
+ flex: 1;
32
+ }
@@ -1,5 +1,9 @@
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
2
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { 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 && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
3
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
4
+ 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."); }
5
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
6
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
3
7
  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
8
  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
9
  function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
@@ -9,13 +13,18 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
9
13
  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
14
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
11
15
  import React from "react";
12
- import { useCallback, useEffect, useState } from 'react';
13
- import { Modal, Form, message, InputNumber, DatePicker, Empty } from 'antd';
16
+ import { useCallback, useEffect, useState, useRef } from 'react';
17
+ import { Modal, Form, message, InputNumber, DatePicker, Empty, Typography, Button, Space, Tag } from 'antd';
14
18
  import moment from 'moment';
15
19
  import { useDebounceFn } from 'ahooks';
16
20
  import { GetPointHistoryData } from "../../services/gateway/Point";
17
21
  import Echarts from "../ECharts";
22
+ // @ts-ignore
23
+
18
24
  import styles from "./index.css";
25
+ import ModalChoosePoint from "../ModalChoosePoint";
26
+ import { dateDiff } from "../../utils/date";
27
+ var Link = Typography.Link;
19
28
  var RangePicker = DatePicker.RangePicker;
20
29
  var defaultInterval = 2;
21
30
 
@@ -26,15 +35,20 @@ var oneYearTime = 365 * 3600 * 1000 * 24;
26
35
  // const oneMonthTime = 31 * 3600 * 1000 * 24;
27
36
  // const oneWeekTime = 7 * 3600 * 1000 * 24;
28
37
 
29
- var DialogHistory = function DialogHistory(_ref) {
30
- var pointIdListProp = _ref.pointIdListProp,
38
+ var DialogPointHistory = function DialogPointHistory(_ref) {
39
+ var _ref$isSinglePoint = _ref.isSinglePoint,
40
+ isSinglePoint = _ref$isSinglePoint === void 0 ? true : _ref$isSinglePoint,
41
+ pointIdListProp = _ref.pointIdListProp,
31
42
  dateRangeProp = _ref.dateRangeProp,
32
43
  intervalProp = _ref.intervalProp,
33
44
  visible = _ref.visible,
34
- onCancel = _ref.onCancel;
45
+ onCancel = _ref.onCancel,
46
+ companyId = _ref.companyId,
47
+ projectId = _ref.projectId;
35
48
  var _Form$useForm = Form.useForm(),
36
49
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
37
50
  form = _Form$useForm2[0];
51
+ var chart = useRef();
38
52
  var _useState = useState(false),
39
53
  _useState2 = _slicedToArray(_useState, 2),
40
54
  isNoData = _useState2[0],
@@ -44,45 +58,87 @@ var DialogHistory = function DialogHistory(_ref) {
44
58
  _useState4 = _slicedToArray(_useState3, 2),
45
59
  loading = _useState4[0],
46
60
  setLoading = _useState4[1];
47
- /** 曲线图配置 */
48
- var _useState5 = useState(undefined),
61
+ /** 添加对比点位弹框 */
62
+ var _useState5 = useState(false),
49
63
  _useState6 = _slicedToArray(_useState5, 2),
50
- chartOptions = _useState6[0],
51
- setChartOptions = _useState6[1];
64
+ visiblePointSet = _useState6[0],
65
+ setVisiblePointSet = _useState6[1];
66
+ /** 曲线图配置 */
67
+ var _useState7 = useState(undefined),
68
+ _useState8 = _slicedToArray(_useState7, 2),
69
+ chartOptions = _useState8[0],
70
+ setChartOptions = _useState8[1];
71
+ /** 当前点位列表 */
72
+ var _useState9 = useState([]),
73
+ _useState10 = _slicedToArray(_useState9, 2),
74
+ pointIdList = _useState10[0],
75
+ setPointIdList = _useState10[1];
76
+ var _useState11 = useState(undefined),
77
+ _useState12 = _slicedToArray(_useState11, 2),
78
+ deviceId = _useState12[0],
79
+ setDeviceId = _useState12[1];
80
+ var _useState13 = useState([]),
81
+ _useState14 = _slicedToArray(_useState13, 2),
82
+ tagList = _useState14[0],
83
+ setTagList = _useState14[1];
84
+ var _useState15 = useState(false),
85
+ _useState16 = _slicedToArray(_useState15, 2),
86
+ dataZoom = _useState16[0],
87
+ setDataZoom = _useState16[1];
88
+ var _useState17 = useState([]),
89
+ _useState18 = _slicedToArray(_useState17, 2),
90
+ dataZoomData = _useState18[0],
91
+ setDataZoomData = _useState18[1];
52
92
  var closeModal = function closeModal() {
53
93
  form.resetFields();
54
94
  setLoading(false);
55
95
  setChartOptions(undefined);
56
96
  setIsNoData(false);
97
+ setVisiblePointSet(false);
98
+ setPointIdList([]);
57
99
  onCancel === null || onCancel === void 0 ? void 0 : onCancel();
58
100
  };
59
101
 
60
102
  /** 获取点位历史数据 */
61
103
  var fetchPointHistory = useCallback(/*#__PURE__*/function () {
62
104
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(idList, ranges, interval) {
63
- var diff, res, data, series, yAxisData, xAxisData;
105
+ var diff, res, data, series, yAxisData;
64
106
  return _regeneratorRuntime().wrap(function _callee$(_context) {
65
107
  while (1) switch (_context.prev = _context.next) {
66
108
  case 0:
67
109
  if (idList === null || idList === void 0 ? void 0 : idList.length) {
68
- _context.next = 3;
110
+ _context.next = 2;
111
+ break;
112
+ }
113
+ return _context.abrupt("return");
114
+ case 2:
115
+ if (!(ranges.length !== 2)) {
116
+ _context.next = 5;
69
117
  break;
70
118
  }
71
- message.error('请至少查询一个点位');
119
+ message.info('请选择时间范围');
72
120
  return _context.abrupt("return");
73
- case 3:
74
- _context.prev = 3;
121
+ case 5:
122
+ if (!(typeof interval !== 'number' || interval < 0)) {
123
+ _context.next = 8;
124
+ break;
125
+ }
126
+ message.info('请正确输入时间间隔');
127
+ return _context.abrupt("return");
128
+ case 8:
129
+ _context.prev = 8;
75
130
  diff = moment(ranges[1]).valueOf() - moment(ranges[0]).valueOf();
76
131
  if (!(diff > oneYearTime)) {
77
- _context.next = 8;
132
+ _context.next = 13;
78
133
  break;
79
134
  }
80
135
  message.error('历史数据最大查询范围是一年');
81
136
  return _context.abrupt("return");
82
- case 8:
137
+ case 13:
83
138
  // 获取点位数据
84
139
  setLoading(true);
85
- _context.next = 11;
140
+ setTagList([]);
141
+ _context.next = 17;
86
142
  return GetPointHistoryData({
87
143
  timeQuantum: {
88
144
  startDate: moment(ranges[0]).format('YYYY-MM-DD HH:mm'),
@@ -91,7 +147,7 @@ var DialogHistory = function DialogHistory(_ref) {
91
147
  pointIdList: idList,
92
148
  interval: interval
93
149
  });
94
- case 11:
150
+ case 17:
95
151
  res = _context.sent;
96
152
  if (res.success) {
97
153
  data = res.data;
@@ -102,7 +158,7 @@ var DialogHistory = function DialogHistory(_ref) {
102
158
  // 图形处理
103
159
  series = [];
104
160
  yAxisData = [];
105
- xAxisData = [];
161
+ setDeviceId(data[0].deviceId);
106
162
  if (data.every(function (v) {
107
163
  var _v$pointDataList;
108
164
  return ((_v$pointDataList = v.pointDataList) === null || _v$pointDataList === void 0 ? void 0 : _v$pointDataList.length) === 0 || !v.pointDataList;
@@ -112,7 +168,13 @@ var DialogHistory = function DialogHistory(_ref) {
112
168
  setIsNoData(false);
113
169
  }
114
170
  data.forEach(function (item) {
115
- var _item$pointDataList, _item$pointDataList2;
171
+ var _item$pointDataList;
172
+ setTagList(function (old) {
173
+ return [].concat(_toConsumableArray(old), [{
174
+ name: "".concat(item.deviceName, "-").concat(item.pointName),
175
+ key: item.pointId
176
+ }]);
177
+ });
116
178
  var pointEnumId = item.pointEnumId,
117
179
  pointEnumItemList = item.pointEnumItemList;
118
180
  var unit = item.unit;
@@ -171,31 +233,33 @@ var DialogHistory = function DialogHistory(_ref) {
171
233
  }
172
234
  yAxisData.push(yAxis);
173
235
  }
174
- // 配置x坐标轴数据
175
- if ((_item$pointDataList = item.pointDataList) === null || _item$pointDataList === void 0 ? void 0 : _item$pointDataList.length) {
176
- xAxisData = item.pointDataList.map(function (pointDataItem) {
177
- return pointDataItem.ts;
178
- });
179
- }
180
236
  // 配置曲线数据
181
237
  series.push({
182
238
  animation: false,
183
- name: item.pointName,
184
- type: 'line',
239
+ name: "".concat(item.deviceName, "-").concat(item.pointName),
240
+ type: interval == 0 ? 'scatter' : 'line',
185
241
  unit: item.unit,
186
242
  yAxisIndex: yAxisData.findIndex(function (yAxis) {
187
243
  return yAxis.pointEnumId === item.pointEnumId;
188
244
  }),
189
245
  smooth: false,
190
- data: (_item$pointDataList2 = item.pointDataList) === null || _item$pointDataList2 === void 0 ? void 0 : _item$pointDataList2.map(function (dataItem) {
191
- return {
192
- name: dataItem.ts,
193
- value: dataItem.val
194
- };
195
- })
246
+ showAllSymbol: true,
247
+ symbolSize: 1.5,
248
+ data: (_item$pointDataList = item.pointDataList) === null || _item$pointDataList === void 0 ? void 0 : _item$pointDataList.map(function (dataItem) {
249
+ return [new Date(dataItem.ts).getTime(), dataItem.val];
250
+ }),
251
+ markPoint: {
252
+ data: [{
253
+ type: 'max',
254
+ name: '最大值'
255
+ }, {
256
+ type: 'min',
257
+ name: '最小值'
258
+ }]
259
+ }
196
260
  });
197
261
  });
198
-
262
+ chart.current.getEchartsInstance().resize();
199
263
  // 应用图形配置
200
264
  setChartOptions({
201
265
  color: ['#2297E8', '#48CE38', '#F8D156', '#FD9827', '#9764DC', '#1FCA6A'],
@@ -228,15 +292,16 @@ var DialogHistory = function DialogHistory(_ref) {
228
292
  var colorSpan = function colorSpan(color) {
229
293
  return "<i class=\"echart-circlepoint\" style=\"background: ".concat(color, "\"></i>");
230
294
  };
231
- var text = "".concat(moment(params[0].name).format(interval < 1 ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD HH:mm'), "<br/>");
295
+ var text = "".concat(moment(params[0].axisValueLabel).format(interval < 1 ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD HH:mm'), "<br/>");
232
296
  for (var i = 0; i < params.length; i += 1) {
233
- text += "".concat(colorSpan(params[i].color), " ").concat(params[i].seriesName, "\uFF1A").concat(params[i].value === null ? '无数据' : params[i].value, " <br/>");
297
+ text += "".concat(colorSpan(params[i].color), " ").concat(params[i].seriesName, "\uFF1A").concat(params[i].data[1] === null ? '无数据' : params[i].data[1], " <br/>");
234
298
  }
235
299
  return text;
236
300
  }
237
301
  },
238
302
  yAxis: yAxisData,
239
303
  xAxis: {
304
+ type: 'time',
240
305
  axisLabel: {
241
306
  formatter: function formatter(value) {
242
307
  return moment(value).format('YYYY-MM-DD HH:mm');
@@ -244,8 +309,7 @@ var DialogHistory = function DialogHistory(_ref) {
244
309
  },
245
310
  splitLine: {
246
311
  show: false
247
- },
248
- data: xAxisData
312
+ }
249
313
  },
250
314
  series: series
251
315
  });
@@ -254,23 +318,23 @@ var DialogHistory = function DialogHistory(_ref) {
254
318
  setIsNoData(true);
255
319
  message.error(res.message);
256
320
  }
257
- _context.next = 20;
321
+ _context.next = 26;
258
322
  break;
259
- case 15:
260
- _context.prev = 15;
261
- _context.t0 = _context["catch"](3);
323
+ case 21:
324
+ _context.prev = 21;
325
+ _context.t0 = _context["catch"](8);
262
326
  console.error(_context.t0);
263
327
  setIsNoData(true);
264
328
  setChartOptions(undefined);
265
- case 20:
266
- _context.prev = 20;
329
+ case 26:
330
+ _context.prev = 26;
267
331
  setLoading(false);
268
- return _context.finish(20);
269
- case 23:
332
+ return _context.finish(26);
333
+ case 29:
270
334
  case "end":
271
335
  return _context.stop();
272
336
  }
273
- }, _callee, null, [[3, 15, 20, 23]]);
337
+ }, _callee, null, [[8, 21, 26, 29]]);
274
338
  }));
275
339
  return function (_x, _x2, _x3) {
276
340
  return _ref2.apply(this, arguments);
@@ -280,62 +344,78 @@ var DialogHistory = function DialogHistory(_ref) {
280
344
  wait: 700
281
345
  }),
282
346
  fetchPointHistoryDebounce = _useDebounceFn.run;
283
- var handleFormChange = function handleFormChange(values) {
284
- var dateRange = values.dateRange,
285
- interval = values.interval;
286
- if (typeof interval !== 'number') {
287
- return;
288
- }
289
- fetchPointHistoryDebounce(pointIdListProp, dateRange, interval);
290
- };
291
-
292
- // const handleSubmit = async () => {
293
- // try {
294
- // const { dateRange, interval } = await form.validateFields()
295
- // if (typeof interval) {
296
- // fetchPointHistory(pointIdListProp, dateRange, interval)
297
- // }
298
- // } catch (err) {
299
- // console.error(err)
300
- // }
301
- // }
347
+ var handleSubmit = /*#__PURE__*/function () {
348
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
349
+ var _yield$form$validateF, dateRange, interval;
350
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
351
+ while (1) switch (_context2.prev = _context2.next) {
352
+ case 0:
353
+ _context2.next = 2;
354
+ return form.validateFields();
355
+ case 2:
356
+ _yield$form$validateF = _context2.sent;
357
+ dateRange = _yield$form$validateF.dateRange;
358
+ interval = _yield$form$validateF.interval;
359
+ fetchPointHistoryDebounce(pointIdList, dateRange, interval);
360
+ case 6:
361
+ case "end":
362
+ return _context2.stop();
363
+ }
364
+ }, _callee2);
365
+ }));
366
+ return function handleSubmit() {
367
+ return _ref3.apply(this, arguments);
368
+ };
369
+ }();
370
+ useEffect(function () {
371
+ var _form$getFieldsValue = form.getFieldsValue(),
372
+ dateRange = _form$getFieldsValue.dateRange,
373
+ interval = _form$getFieldsValue.interval;
374
+ fetchPointHistoryDebounce(pointIdList, dateRange, interval);
375
+ }, [pointIdList]);
302
376
 
303
377
  /** 打开弹框,初始化数据,获取曲线图形 */
304
378
  useEffect(function () {
305
379
  if (visible && (pointIdListProp === null || pointIdListProp === void 0 ? void 0 : pointIdListProp.length)) {
306
380
  var ranges = dateRangeProp || [moment().subtract(1, 'days'), moment()];
381
+ var interval = typeof intervalProp === 'number' && intervalProp ? intervalProp : defaultInterval;
307
382
  form.setFieldsValue({
308
383
  dateRange: ranges,
309
- interval: typeof intervalProp === 'number' ? intervalProp : defaultInterval
384
+ interval: interval
310
385
  });
311
- fetchPointHistory(pointIdListProp, ranges, defaultInterval);
386
+ setPointIdList(pointIdListProp);
387
+ fetchPointHistoryDebounce(pointIdListProp, ranges, interval);
312
388
  }
313
- }, [visible, form, pointIdListProp, dateRangeProp, intervalProp, fetchPointHistory]);
389
+ }, [visible, form, pointIdListProp, dateRangeProp, intervalProp]);
314
390
  return /*#__PURE__*/React.createElement(Modal, {
315
391
  title: "\u5386\u53F2\u6570\u636E\u66F2\u7EBF",
316
392
  open: visible,
317
393
  closable: true,
318
- width: 1300,
394
+ width: 1600,
319
395
  zIndex: 42000,
320
396
  footer: null,
321
397
  onCancel: closeModal,
322
398
  afterClose: closeModal,
323
399
  getContainer: false
400
+ }, /*#__PURE__*/React.createElement("div", {
401
+ className: "row"
402
+ }, /*#__PURE__*/React.createElement("div", {
403
+ className: "flex1"
324
404
  }, /*#__PURE__*/React.createElement(Form, {
325
- onValuesChange: function onValuesChange(changedValues, values) {
326
- return handleFormChange(values);
327
- },
328
- layout: "inline",
329
405
  requiredMark: false,
330
406
  form: form,
331
407
  name: "form"
408
+ }, /*#__PURE__*/React.createElement(Space, {
409
+ size: 30,
410
+ align: 'center'
332
411
  }, /*#__PURE__*/React.createElement(Form.Item, {
333
412
  name: "dateRange",
334
413
  label: "\u65F6\u95F4\u8303\u56F4",
335
414
  rules: [{
336
415
  required: true,
337
416
  message: '请选择时间范围'
338
- }]
417
+ }],
418
+ className: "temperatureDateRange"
339
419
  }, /*#__PURE__*/React.createElement(RangePicker, {
340
420
  disabled: loading,
341
421
  style: {
@@ -344,16 +424,16 @@ var DialogHistory = function DialogHistory(_ref) {
344
424
  showTime: {
345
425
  format: 'HH:mm'
346
426
  },
347
- getPopupContainer: function getPopupContainer(node) {
348
- return node;
349
- },
350
427
  allowClear: false,
351
428
  ranges: {
352
429
  近一天: [moment().subtract(1, 'day'), moment()],
353
430
  近一周: [moment().subtract(7, 'day'), moment()],
354
431
  近一个月: [moment().subtract(30, 'day'), moment()]
355
432
  },
356
- format: "YYYY-MM-DD HH:mm"
433
+ format: "YYYY-MM-DD HH:mm",
434
+ getPopupContainer: function getPopupContainer() {
435
+ return document.querySelector(".temperatureDateRange") || document.body;
436
+ }
357
437
  })), /*#__PURE__*/React.createElement(Form.Item, {
358
438
  name: "interval",
359
439
  label: "\u95F4\u9694\uFF08\u5206\u949F\uFF09",
@@ -367,18 +447,172 @@ var DialogHistory = function DialogHistory(_ref) {
367
447
  }, /*#__PURE__*/React.createElement(InputNumber, {
368
448
  disabled: loading,
369
449
  placeholder: "\u8BF7\u8F93\u5165\u6B63\u6574\u6570"
370
- }))), /*#__PURE__*/React.createElement("div", {
450
+ })), /*#__PURE__*/React.createElement(Form.Item, null, /*#__PURE__*/React.createElement(Button, {
451
+ type: 'primary',
452
+ onClick: handleSubmit
453
+ }, "\u67E5\u8BE2"))), isSinglePoint ? /*#__PURE__*/React.createElement("div", {
454
+ key: 'singlePointSetBox'
455
+ }, /*#__PURE__*/React.createElement(Space, {
456
+ size: 30,
457
+ align: 'center'
458
+ }, /*#__PURE__*/React.createElement(Form.Item, {
459
+ label: "\u6DFB\u52A0\u5BF9\u6BD4"
460
+ }, /*#__PURE__*/React.createElement(Link, {
461
+ onClick: function onClick() {
462
+ setVisiblePointSet(true);
463
+ }
464
+ }, "\u6DFB\u52A0\u5C5E\u6027")))) : null), tagList.map(function (item) {
465
+ return /*#__PURE__*/React.createElement(Tag, {
466
+ key: item.key,
467
+ closable: true,
468
+ color: "blue",
469
+ onClose: function onClose() {
470
+ setPointIdList(function (pre) {
471
+ return pre.filter(function (v) {
472
+ return v !== item.key;
473
+ });
474
+ });
475
+ }
476
+ }, item.name);
477
+ }), /*#__PURE__*/React.createElement("div", {
371
478
  className: styles['chart-wrap']
372
479
  }, /*#__PURE__*/React.createElement(Echarts, {
480
+ ref: chart,
373
481
  option: chartOptions,
374
482
  loading: loading,
375
483
  style: {
376
484
  height: '500px'
485
+ },
486
+ onEvents: {
487
+ datazoom: function datazoom(params) {
488
+ var _chart$current, _chart$current$getEch;
489
+ // 获取当前 echarts 实例
490
+ var myChart = chart === null || chart === void 0 ? void 0 : (_chart$current = chart.current) === null || _chart$current === void 0 ? void 0 : (_chart$current$getEch = _chart$current.getEchartsInstance) === null || _chart$current$getEch === void 0 ? void 0 : _chart$current$getEch.call(_chart$current);
491
+ if (!myChart) return;
492
+
493
+ // 获取当前配置
494
+ var option = myChart.getOption();
495
+ // 获取缩放范围
496
+ var startValue = params.start;
497
+ var endValue = params.end;
498
+ if (startValue === 0 && endValue === 100) {
499
+ setDataZoom(false);
500
+ return;
501
+ }
502
+ // 获取所有系列的数据
503
+ var visibleData = option.series.filter(function (item) {
504
+ return ['totalenergy', 'tlwatercs', 'tlhgscs'].includes(item.identifierName);
505
+ }).map(function (series) {
506
+ // 获取当前显示范围的数据
507
+ var data = series.data.filter(function (_, index) {
508
+ var percent = index / series.data.length * 100;
509
+ return percent >= startValue && percent <= endValue;
510
+ });
511
+ return {
512
+ name: series.name,
513
+ data: data
514
+ };
515
+ });
516
+ if (visibleData.length) {
517
+ setDataZoomData(visibleData);
518
+ setDataZoom(true);
519
+ } else {
520
+ setDataZoom(false);
521
+ }
522
+ console.log('当前显示的数据集合:', visibleData);
523
+ }
377
524
  }
378
525
  }), isNoData && /*#__PURE__*/React.createElement(Empty, {
379
526
  className: styles['chart-empty'],
380
527
  image: Empty.PRESENTED_IMAGE_SIMPLE,
381
528
  description: "\u6682\u65E0\u70B9\u4F4D\u5386\u53F2\u6570\u636E"
382
- })));
529
+ }))), pointIdList.some(function (item) {
530
+ return ['totalenergy', 'tlwatercs', 'tlhgscs'].some(function (_item) {
531
+ return item.includes(_item);
532
+ });
533
+ }) ? /*#__PURE__*/React.createElement("div", {
534
+ className: styles.totalBox
535
+ }, /*#__PURE__*/React.createElement("div", {
536
+ className: styles.totalItem
537
+ }, /*#__PURE__*/React.createElement("div", {
538
+ className: styles.totalItemTitle
539
+ }, /*#__PURE__*/React.createElement("span", null, "\u65F6\u95F4\u8DE8\u5EA6\uFF1A")), /*#__PURE__*/React.createElement("div", {
540
+ className: styles.totalItemContent
541
+ }, /*#__PURE__*/React.createElement("span", null, dataZoom && dataZoomData.length ? function (_longestSeries$data) {
542
+ var longestSeries = dataZoomData.reduce(function (prev, curr) {
543
+ var _prev$data, _curr$data;
544
+ return ((prev === null || prev === void 0 ? void 0 : (_prev$data = prev.data) === null || _prev$data === void 0 ? void 0 : _prev$data.length) || 0) > ((curr === null || curr === void 0 ? void 0 : (_curr$data = curr.data) === null || _curr$data === void 0 ? void 0 : _curr$data.length) || 0) ? prev : curr;
545
+ });
546
+ if (!(longestSeries === null || longestSeries === void 0 ? void 0 : (_longestSeries$data = longestSeries.data) === null || _longestSeries$data === void 0 ? void 0 : _longestSeries$data.length)) return '-';
547
+ var firstPoint = longestSeries.data[0];
548
+ var lastPoint = longestSeries.data[longestSeries.data.length - 1];
549
+ return firstPoint && lastPoint ? dateDiff(firstPoint[0], lastPoint[0]) : '-';
550
+ }() : function () {
551
+ var dateRange = form.getFieldValue('dateRange');
552
+ return (dateRange === null || dateRange === void 0 ? void 0 : dateRange[0]) && (dateRange === null || dateRange === void 0 ? void 0 : dateRange[1]) ? dateDiff(dateRange[0], dateRange[1]) : '-';
553
+ }()))), /*#__PURE__*/React.createElement("div", {
554
+ className: styles.totalItem
555
+ }, /*#__PURE__*/React.createElement("div", {
556
+ className: styles.totalItemTitle
557
+ }, /*#__PURE__*/React.createElement("span", null, "\u8017", ['电', '水', '气'][['totalenergy', 'tlwatercs', 'tlhgscs'].findIndex(function (item) {
558
+ return pointIdList[0].includes(item);
559
+ })], "\u91CF\uFF1A")), /*#__PURE__*/React.createElement("div", {
560
+ className: styles.totalItemContent
561
+ }, (dataZoom ? dataZoomData : ((chartOptions === null || chartOptions === void 0 ? void 0 : chartOptions.series) || []).filter(function (item) {
562
+ return ['totalenergy', 'tlwatercs', 'tlhgscs'].includes(item.identifierName);
563
+ })).map(function (item) {
564
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, item.name, ": "), /*#__PURE__*/React.createElement("span", null, parseFloat((Math.max.apply(Math, _toConsumableArray(item.data.map(function (_item) {
565
+ return _item[1];
566
+ }))) - Math.min.apply(Math, _toConsumableArray(item.data.map(function (_item) {
567
+ return _item[1];
568
+ })))).toFixed(2))));
569
+ }))), /*#__PURE__*/React.createElement("div", {
570
+ className: styles.totalItem
571
+ }, /*#__PURE__*/React.createElement("div", {
572
+ className: styles.totalItemTitle
573
+ }, /*#__PURE__*/React.createElement("span", null, "\u671F\u672B\u503C\uFF1A")), /*#__PURE__*/React.createElement("div", {
574
+ className: styles.totalItemContent
575
+ }, ((dataZoom ? dataZoomData : chartOptions === null || chartOptions === void 0 ? void 0 : chartOptions.series.filter(function (item) {
576
+ return ['totalenergy', 'tlwatercs', 'tlhgscs'].includes(item.identifierName);
577
+ })) || []).map(function (item) {
578
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, item.name, ": "), /*#__PURE__*/React.createElement("span", null, Math.max.apply(Math, _toConsumableArray(item.data.map(function (_item) {
579
+ return _item[1];
580
+ })))));
581
+ }))), /*#__PURE__*/React.createElement("div", {
582
+ className: styles.totalItem
583
+ }, /*#__PURE__*/React.createElement("div", {
584
+ className: styles.totalItemTitle
585
+ }, /*#__PURE__*/React.createElement("span", null, "\u671F\u521D\u503C\uFF1A")), /*#__PURE__*/React.createElement("div", {
586
+ className: styles.totalItemContent
587
+ }, ((dataZoom ? dataZoomData : chartOptions === null || chartOptions === void 0 ? void 0 : chartOptions.series.filter(function (item) {
588
+ return ['totalenergy', 'tlwatercs', 'tlhgscs'].includes(item.identifierName);
589
+ })) || []).map(function (item) {
590
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, item.name, ": "), /*#__PURE__*/React.createElement("span", null, Math.min.apply(Math, _toConsumableArray(item.data.map(function (_item) {
591
+ return _item[1];
592
+ })))));
593
+ }))), /*#__PURE__*/React.createElement("div", {
594
+ className: styles.totalItem
595
+ }, /*#__PURE__*/React.createElement("div", {
596
+ className: styles.totalItemTitle
597
+ }, /*#__PURE__*/React.createElement("span", null, "\u8BA1\u91CF\u5355\u4F4D\uFF1A")), /*#__PURE__*/React.createElement("div", {
598
+ className: styles.totalItemContent
599
+ }, ((chartOptions === null || chartOptions === void 0 ? void 0 : chartOptions.series.filter(function (item) {
600
+ return ['totalenergy', 'tlwatercs', 'tlhgscs'].includes(item.identifierName);
601
+ })[0]) || {
602
+ unit: ''
603
+ }).unit))) : null), /*#__PURE__*/React.createElement(ModalChoosePoint, {
604
+ visible: visiblePointSet,
605
+ onSubmit: function onSubmit(val) {
606
+ setPointIdList(function (pre) {
607
+ return _toConsumableArray(new Set([].concat(_toConsumableArray(pre), _toConsumableArray(val))));
608
+ });
609
+ },
610
+ currentDeviceId: deviceId,
611
+ companyId: companyId,
612
+ projectId: projectId,
613
+ onCancel: function onCancel() {
614
+ setVisiblePointSet(false);
615
+ }
616
+ }));
383
617
  };
384
- export default DialogHistory;
618
+ export default DialogPointHistory;
@@ -46,7 +46,7 @@ var GroupItemPanel = function GroupItemPanel(_ref) {
46
46
  setImgList(((_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.list.map(function (item) {
47
47
  var _item$img;
48
48
  return _objectSpread(_objectSpread({}, item), {}, {
49
- img: (_item$img = item.img) === null || _item$img === void 0 ? void 0 : _item$img.replace('https://coolcare-scada.oss-cn-shanghai.aliyuncs.com', 'http://192.168.6.21:9000/iot')
49
+ img: (_item$img = item.img) === null || _item$img === void 0 ? void 0 : _item$img.replace('https://coolcare-scada.oss-cn-shanghai.aliyuncs.com', '/imgfile/iot')
50
50
  });
51
51
  })) || []);
52
52
  } else {