coolcare-lite-scada-component 2.0.34 → 2.0.36
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.
- package/es/components/DialogHistory/index.js +199 -81
- package/es/components/ImageUploader/index.js +1 -1
- package/es/components/ModalChoosePoint/index.js +235 -0
- package/es/element/ElePointImage/Component.js +41 -30
- package/es/element/ElePointValue/Component.js +10 -6
- package/es/element/ElePointValue/PropsSet/StatisticsPropsSet/index.js +77 -0
- package/es/element/ElePointValue/PropsSet/index.js +5 -1
- package/es/pages/display/Player/index.js +102 -16
- package/es/pages/editor/PanelRight/components/FormLayer/index.js +12 -2
- package/es/services/gateway/Point.js +56 -7
- package/es/typings.d.ts +12 -4
- package/package.json +2 -2
|
@@ -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,17 @@ 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";
|
|
21
|
+
import ModalChoosePoint from "../ModalChoosePoint";
|
|
17
22
|
import Echarts from "../ECharts";
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
|
|
18
25
|
import styles from "./index.css";
|
|
26
|
+
var Link = Typography.Link;
|
|
19
27
|
var RangePicker = DatePicker.RangePicker;
|
|
20
28
|
var defaultInterval = 2;
|
|
21
29
|
|
|
@@ -26,15 +34,20 @@ var oneYearTime = 365 * 3600 * 1000 * 24;
|
|
|
26
34
|
// const oneMonthTime = 31 * 3600 * 1000 * 24;
|
|
27
35
|
// const oneWeekTime = 7 * 3600 * 1000 * 24;
|
|
28
36
|
|
|
29
|
-
var
|
|
30
|
-
var
|
|
37
|
+
var DialogPointHistory = function DialogPointHistory(_ref) {
|
|
38
|
+
var _ref$isSinglePoint = _ref.isSinglePoint,
|
|
39
|
+
isSinglePoint = _ref$isSinglePoint === void 0 ? true : _ref$isSinglePoint,
|
|
40
|
+
pointIdListProp = _ref.pointIdListProp,
|
|
31
41
|
dateRangeProp = _ref.dateRangeProp,
|
|
32
42
|
intervalProp = _ref.intervalProp,
|
|
33
43
|
visible = _ref.visible,
|
|
34
|
-
onCancel = _ref.onCancel
|
|
44
|
+
onCancel = _ref.onCancel,
|
|
45
|
+
companyId = _ref.companyId,
|
|
46
|
+
projectId = _ref.projectId;
|
|
35
47
|
var _Form$useForm = Form.useForm(),
|
|
36
48
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
37
49
|
form = _Form$useForm2[0];
|
|
50
|
+
var chart = useRef();
|
|
38
51
|
var _useState = useState(false),
|
|
39
52
|
_useState2 = _slicedToArray(_useState, 2),
|
|
40
53
|
isNoData = _useState2[0],
|
|
@@ -44,45 +57,85 @@ var DialogHistory = function DialogHistory(_ref) {
|
|
|
44
57
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
45
58
|
loading = _useState4[0],
|
|
46
59
|
setLoading = _useState4[1];
|
|
47
|
-
/**
|
|
48
|
-
var _useState5 = useState(
|
|
60
|
+
/** 添加对比点位弹框 */
|
|
61
|
+
var _useState5 = useState(false),
|
|
49
62
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
50
|
-
|
|
51
|
-
|
|
63
|
+
visiblePointSet = _useState6[0],
|
|
64
|
+
setVisiblePointSet = _useState6[1];
|
|
65
|
+
/** 曲线图配置 */
|
|
66
|
+
var _useState7 = useState(undefined),
|
|
67
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
68
|
+
chartOptions = _useState8[0],
|
|
69
|
+
setChartOptions = _useState8[1];
|
|
70
|
+
/** 当前点位列表 */
|
|
71
|
+
var _useState9 = useState([]),
|
|
72
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
73
|
+
pointIdList = _useState10[0],
|
|
74
|
+
setPointIdList = _useState10[1];
|
|
75
|
+
/** 当前点位时间段内是否有报警 */
|
|
76
|
+
var _useState11 = useState(false),
|
|
77
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
78
|
+
haveAlarm = _useState12[0],
|
|
79
|
+
setHaveAlarm = _useState12[1];
|
|
80
|
+
var _useState13 = useState(undefined),
|
|
81
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
82
|
+
deviceId = _useState14[0],
|
|
83
|
+
setDeviceId = _useState14[1];
|
|
84
|
+
var _useState15 = useState([]),
|
|
85
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
86
|
+
tagList = _useState16[0],
|
|
87
|
+
setTagList = _useState16[1];
|
|
52
88
|
var closeModal = function closeModal() {
|
|
53
89
|
form.resetFields();
|
|
54
90
|
setLoading(false);
|
|
55
91
|
setChartOptions(undefined);
|
|
56
92
|
setIsNoData(false);
|
|
93
|
+
setVisiblePointSet(false);
|
|
94
|
+
setHaveAlarm(false);
|
|
95
|
+
setPointIdList([]);
|
|
57
96
|
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
58
97
|
};
|
|
59
98
|
|
|
60
99
|
/** 获取点位历史数据 */
|
|
61
100
|
var fetchPointHistory = useCallback(/*#__PURE__*/function () {
|
|
62
101
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(idList, ranges, interval) {
|
|
63
|
-
var diff, res, data, series, yAxisData
|
|
102
|
+
var diff, res, data, series, yAxisData;
|
|
64
103
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
65
104
|
while (1) switch (_context.prev = _context.next) {
|
|
66
105
|
case 0:
|
|
67
106
|
if (idList === null || idList === void 0 ? void 0 : idList.length) {
|
|
68
|
-
_context.next =
|
|
107
|
+
_context.next = 2;
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
return _context.abrupt("return");
|
|
111
|
+
case 2:
|
|
112
|
+
if (!(ranges.length !== 2)) {
|
|
113
|
+
_context.next = 5;
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
message.info('请选择时间范围');
|
|
117
|
+
return _context.abrupt("return");
|
|
118
|
+
case 5:
|
|
119
|
+
if (!(typeof interval !== 'number' || interval < 0)) {
|
|
120
|
+
_context.next = 8;
|
|
69
121
|
break;
|
|
70
122
|
}
|
|
71
|
-
message.
|
|
123
|
+
message.info('请正确输入时间间隔');
|
|
72
124
|
return _context.abrupt("return");
|
|
73
|
-
case
|
|
74
|
-
_context.prev =
|
|
125
|
+
case 8:
|
|
126
|
+
_context.prev = 8;
|
|
75
127
|
diff = moment(ranges[1]).valueOf() - moment(ranges[0]).valueOf();
|
|
76
128
|
if (!(diff > oneYearTime)) {
|
|
77
|
-
_context.next =
|
|
129
|
+
_context.next = 13;
|
|
78
130
|
break;
|
|
79
131
|
}
|
|
80
132
|
message.error('历史数据最大查询范围是一年');
|
|
81
133
|
return _context.abrupt("return");
|
|
82
|
-
case
|
|
134
|
+
case 13:
|
|
83
135
|
// 获取点位数据
|
|
84
136
|
setLoading(true);
|
|
85
|
-
|
|
137
|
+
setTagList([]);
|
|
138
|
+
_context.next = 17;
|
|
86
139
|
return GetPointHistoryData({
|
|
87
140
|
timeQuantum: {
|
|
88
141
|
startDate: moment(ranges[0]).format('YYYY-MM-DD HH:mm'),
|
|
@@ -91,7 +144,7 @@ var DialogHistory = function DialogHistory(_ref) {
|
|
|
91
144
|
pointIdList: idList,
|
|
92
145
|
interval: interval
|
|
93
146
|
});
|
|
94
|
-
case
|
|
147
|
+
case 17:
|
|
95
148
|
res = _context.sent;
|
|
96
149
|
if (res.success) {
|
|
97
150
|
data = res.data;
|
|
@@ -102,7 +155,7 @@ var DialogHistory = function DialogHistory(_ref) {
|
|
|
102
155
|
// 图形处理
|
|
103
156
|
series = [];
|
|
104
157
|
yAxisData = [];
|
|
105
|
-
|
|
158
|
+
setDeviceId(data[0].deviceId);
|
|
106
159
|
if (data.every(function (v) {
|
|
107
160
|
var _v$pointDataList;
|
|
108
161
|
return ((_v$pointDataList = v.pointDataList) === null || _v$pointDataList === void 0 ? void 0 : _v$pointDataList.length) === 0 || !v.pointDataList;
|
|
@@ -112,7 +165,17 @@ var DialogHistory = function DialogHistory(_ref) {
|
|
|
112
165
|
setIsNoData(false);
|
|
113
166
|
}
|
|
114
167
|
data.forEach(function (item) {
|
|
115
|
-
var _item$
|
|
168
|
+
var _item$pointAlarmTimeF, _item$pointDataList;
|
|
169
|
+
setTagList(function (old) {
|
|
170
|
+
return [].concat(_toConsumableArray(old), [{
|
|
171
|
+
name: "".concat(item.deviceName, "-").concat(item.pointName),
|
|
172
|
+
key: item.pointId
|
|
173
|
+
}]);
|
|
174
|
+
});
|
|
175
|
+
// @ts-ignore
|
|
176
|
+
if ((_item$pointAlarmTimeF = item.pointAlarmTimeFrameList) === null || _item$pointAlarmTimeF === void 0 ? void 0 : _item$pointAlarmTimeF.length) {
|
|
177
|
+
setHaveAlarm(true);
|
|
178
|
+
}
|
|
116
179
|
var pointEnumId = item.pointEnumId,
|
|
117
180
|
pointEnumItemList = item.pointEnumItemList;
|
|
118
181
|
var unit = item.unit;
|
|
@@ -171,28 +234,30 @@ var DialogHistory = function DialogHistory(_ref) {
|
|
|
171
234
|
}
|
|
172
235
|
yAxisData.push(yAxis);
|
|
173
236
|
}
|
|
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
237
|
// 配置曲线数据
|
|
181
238
|
series.push({
|
|
182
239
|
animation: false,
|
|
183
|
-
name: item.pointName,
|
|
184
|
-
type: 'line',
|
|
240
|
+
name: "".concat(item.deviceName, "-").concat(item.pointName),
|
|
241
|
+
type: interval == 0 ? 'scatter' : 'line',
|
|
185
242
|
unit: item.unit,
|
|
186
243
|
yAxisIndex: yAxisData.findIndex(function (yAxis) {
|
|
187
244
|
return yAxis.pointEnumId === item.pointEnumId;
|
|
188
245
|
}),
|
|
189
246
|
smooth: false,
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
247
|
+
showAllSymbol: true,
|
|
248
|
+
symbolSize: 1.5,
|
|
249
|
+
data: (_item$pointDataList = item.pointDataList) === null || _item$pointDataList === void 0 ? void 0 : _item$pointDataList.map(function (dataItem) {
|
|
250
|
+
return [new Date(dataItem.ts).getTime(), dataItem.val];
|
|
251
|
+
}),
|
|
252
|
+
markPoint: {
|
|
253
|
+
data: [{
|
|
254
|
+
type: 'max',
|
|
255
|
+
name: '最大值'
|
|
256
|
+
}, {
|
|
257
|
+
type: 'min',
|
|
258
|
+
name: '最小值'
|
|
259
|
+
}]
|
|
260
|
+
}
|
|
196
261
|
});
|
|
197
262
|
});
|
|
198
263
|
|
|
@@ -228,15 +293,16 @@ var DialogHistory = function DialogHistory(_ref) {
|
|
|
228
293
|
var colorSpan = function colorSpan(color) {
|
|
229
294
|
return "<i class=\"echart-circlepoint\" style=\"background: ".concat(color, "\"></i>");
|
|
230
295
|
};
|
|
231
|
-
var text = "".concat(moment(params[0].
|
|
296
|
+
var text = "".concat(moment(params[0].axisValueLabel).format(interval < 1 ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD HH:mm'), "<br/>");
|
|
232
297
|
for (var i = 0; i < params.length; i += 1) {
|
|
233
|
-
text += "".concat(colorSpan(params[i].color), " ").concat(params[i].seriesName, "\uFF1A").concat(params[i].
|
|
298
|
+
text += "".concat(colorSpan(params[i].color), " ").concat(params[i].seriesName, "\uFF1A").concat(params[i].data[1] === null ? '无数据' : params[i].data[1], " <br/>");
|
|
234
299
|
}
|
|
235
300
|
return text;
|
|
236
301
|
}
|
|
237
302
|
},
|
|
238
303
|
yAxis: yAxisData,
|
|
239
304
|
xAxis: {
|
|
305
|
+
type: 'time',
|
|
240
306
|
axisLabel: {
|
|
241
307
|
formatter: function formatter(value) {
|
|
242
308
|
return moment(value).format('YYYY-MM-DD HH:mm');
|
|
@@ -244,8 +310,7 @@ var DialogHistory = function DialogHistory(_ref) {
|
|
|
244
310
|
},
|
|
245
311
|
splitLine: {
|
|
246
312
|
show: false
|
|
247
|
-
}
|
|
248
|
-
data: xAxisData
|
|
313
|
+
}
|
|
249
314
|
},
|
|
250
315
|
series: series
|
|
251
316
|
});
|
|
@@ -254,23 +319,23 @@ var DialogHistory = function DialogHistory(_ref) {
|
|
|
254
319
|
setIsNoData(true);
|
|
255
320
|
message.error(res.message);
|
|
256
321
|
}
|
|
257
|
-
_context.next =
|
|
322
|
+
_context.next = 26;
|
|
258
323
|
break;
|
|
259
|
-
case
|
|
260
|
-
_context.prev =
|
|
261
|
-
_context.t0 = _context["catch"](
|
|
324
|
+
case 21:
|
|
325
|
+
_context.prev = 21;
|
|
326
|
+
_context.t0 = _context["catch"](8);
|
|
262
327
|
console.error(_context.t0);
|
|
263
328
|
setIsNoData(true);
|
|
264
329
|
setChartOptions(undefined);
|
|
265
|
-
case
|
|
266
|
-
_context.prev =
|
|
330
|
+
case 26:
|
|
331
|
+
_context.prev = 26;
|
|
267
332
|
setLoading(false);
|
|
268
|
-
return _context.finish(
|
|
269
|
-
case
|
|
333
|
+
return _context.finish(26);
|
|
334
|
+
case 29:
|
|
270
335
|
case "end":
|
|
271
336
|
return _context.stop();
|
|
272
337
|
}
|
|
273
|
-
}, _callee, null, [[
|
|
338
|
+
}, _callee, null, [[8, 21, 26, 29]]);
|
|
274
339
|
}));
|
|
275
340
|
return function (_x, _x2, _x3) {
|
|
276
341
|
return _ref2.apply(this, arguments);
|
|
@@ -280,37 +345,49 @@ var DialogHistory = function DialogHistory(_ref) {
|
|
|
280
345
|
wait: 700
|
|
281
346
|
}),
|
|
282
347
|
fetchPointHistoryDebounce = _useDebounceFn.run;
|
|
283
|
-
var
|
|
284
|
-
var
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
348
|
+
var handleSubmit = /*#__PURE__*/function () {
|
|
349
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
350
|
+
var _yield$form$validateF, dateRange, interval;
|
|
351
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
352
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
353
|
+
case 0:
|
|
354
|
+
_context2.next = 2;
|
|
355
|
+
return form.validateFields();
|
|
356
|
+
case 2:
|
|
357
|
+
_yield$form$validateF = _context2.sent;
|
|
358
|
+
dateRange = _yield$form$validateF.dateRange;
|
|
359
|
+
interval = _yield$form$validateF.interval;
|
|
360
|
+
fetchPointHistoryDebounce(pointIdList, dateRange, interval);
|
|
361
|
+
case 6:
|
|
362
|
+
case "end":
|
|
363
|
+
return _context2.stop();
|
|
364
|
+
}
|
|
365
|
+
}, _callee2);
|
|
366
|
+
}));
|
|
367
|
+
return function handleSubmit() {
|
|
368
|
+
return _ref3.apply(this, arguments);
|
|
369
|
+
};
|
|
370
|
+
}();
|
|
371
|
+
useEffect(function () {
|
|
372
|
+
var _form$getFieldsValue = form.getFieldsValue(),
|
|
373
|
+
dateRange = _form$getFieldsValue.dateRange,
|
|
374
|
+
interval = _form$getFieldsValue.interval;
|
|
375
|
+
fetchPointHistoryDebounce(pointIdList, dateRange, interval);
|
|
376
|
+
}, [pointIdList]);
|
|
302
377
|
|
|
303
378
|
/** 打开弹框,初始化数据,获取曲线图形 */
|
|
304
379
|
useEffect(function () {
|
|
305
380
|
if (visible && (pointIdListProp === null || pointIdListProp === void 0 ? void 0 : pointIdListProp.length)) {
|
|
306
381
|
var ranges = dateRangeProp || [moment().subtract(1, 'days'), moment()];
|
|
382
|
+
var interval = typeof intervalProp === 'number' && intervalProp ? intervalProp : defaultInterval;
|
|
307
383
|
form.setFieldsValue({
|
|
308
384
|
dateRange: ranges,
|
|
309
|
-
interval:
|
|
385
|
+
interval: interval
|
|
310
386
|
});
|
|
311
|
-
|
|
387
|
+
setPointIdList(pointIdListProp);
|
|
388
|
+
fetchPointHistoryDebounce(pointIdListProp, ranges, interval);
|
|
312
389
|
}
|
|
313
|
-
}, [visible, form, pointIdListProp, dateRangeProp, intervalProp
|
|
390
|
+
}, [visible, form, pointIdListProp, dateRangeProp, intervalProp]);
|
|
314
391
|
return /*#__PURE__*/React.createElement(Modal, {
|
|
315
392
|
title: "\u5386\u53F2\u6570\u636E\u66F2\u7EBF",
|
|
316
393
|
open: visible,
|
|
@@ -322,20 +399,20 @@ var DialogHistory = function DialogHistory(_ref) {
|
|
|
322
399
|
afterClose: closeModal,
|
|
323
400
|
getContainer: false
|
|
324
401
|
}, /*#__PURE__*/React.createElement(Form, {
|
|
325
|
-
onValuesChange: function onValuesChange(changedValues, values) {
|
|
326
|
-
return handleFormChange(values);
|
|
327
|
-
},
|
|
328
|
-
layout: "inline",
|
|
329
402
|
requiredMark: false,
|
|
330
403
|
form: form,
|
|
331
404
|
name: "form"
|
|
405
|
+
}, /*#__PURE__*/React.createElement(Space, {
|
|
406
|
+
size: 30,
|
|
407
|
+
align: 'center'
|
|
332
408
|
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
333
409
|
name: "dateRange",
|
|
334
410
|
label: "\u65F6\u95F4\u8303\u56F4",
|
|
335
411
|
rules: [{
|
|
336
412
|
required: true,
|
|
337
413
|
message: '请选择时间范围'
|
|
338
|
-
}]
|
|
414
|
+
}],
|
|
415
|
+
className: "temperatureDateRange"
|
|
339
416
|
}, /*#__PURE__*/React.createElement(RangePicker, {
|
|
340
417
|
disabled: loading,
|
|
341
418
|
style: {
|
|
@@ -344,16 +421,16 @@ var DialogHistory = function DialogHistory(_ref) {
|
|
|
344
421
|
showTime: {
|
|
345
422
|
format: 'HH:mm'
|
|
346
423
|
},
|
|
347
|
-
getPopupContainer: function getPopupContainer(node) {
|
|
348
|
-
return node;
|
|
349
|
-
},
|
|
350
424
|
allowClear: false,
|
|
351
425
|
ranges: {
|
|
352
426
|
近一天: [moment().subtract(1, 'day'), moment()],
|
|
353
427
|
近一周: [moment().subtract(7, 'day'), moment()],
|
|
354
428
|
近一个月: [moment().subtract(30, 'day'), moment()]
|
|
355
429
|
},
|
|
356
|
-
format: "YYYY-MM-DD HH:mm"
|
|
430
|
+
format: "YYYY-MM-DD HH:mm",
|
|
431
|
+
getPopupContainer: function getPopupContainer() {
|
|
432
|
+
return document.querySelector(".temperatureDateRange") || document.body;
|
|
433
|
+
}
|
|
357
434
|
})), /*#__PURE__*/React.createElement(Form.Item, {
|
|
358
435
|
name: "interval",
|
|
359
436
|
label: "\u95F4\u9694\uFF08\u5206\u949F\uFF09",
|
|
@@ -367,9 +444,37 @@ var DialogHistory = function DialogHistory(_ref) {
|
|
|
367
444
|
}, /*#__PURE__*/React.createElement(InputNumber, {
|
|
368
445
|
disabled: loading,
|
|
369
446
|
placeholder: "\u8BF7\u8F93\u5165\u6B63\u6574\u6570"
|
|
370
|
-
}))
|
|
447
|
+
})), /*#__PURE__*/React.createElement(Form.Item, null, /*#__PURE__*/React.createElement(Button, {
|
|
448
|
+
type: 'primary',
|
|
449
|
+
onClick: handleSubmit
|
|
450
|
+
}, "\u67E5\u8BE2"))), isSinglePoint ? /*#__PURE__*/React.createElement("div", {
|
|
451
|
+
key: 'singlePointSetBox'
|
|
452
|
+
}, /*#__PURE__*/React.createElement(Space, {
|
|
453
|
+
size: 30,
|
|
454
|
+
align: 'center'
|
|
455
|
+
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
456
|
+
label: "\u6DFB\u52A0\u5BF9\u6BD4"
|
|
457
|
+
}, /*#__PURE__*/React.createElement(Link, {
|
|
458
|
+
onClick: function onClick() {
|
|
459
|
+
setVisiblePointSet(true);
|
|
460
|
+
}
|
|
461
|
+
}, "\u6DFB\u52A0\u5C5E\u6027")))) : null), tagList.map(function (item) {
|
|
462
|
+
return /*#__PURE__*/React.createElement(Tag, {
|
|
463
|
+
key: item.key,
|
|
464
|
+
closable: true,
|
|
465
|
+
color: "blue",
|
|
466
|
+
onClose: function onClose() {
|
|
467
|
+
setPointIdList(function (pre) {
|
|
468
|
+
return pre.filter(function (v) {
|
|
469
|
+
return v !== item.key;
|
|
470
|
+
});
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
}, item.name);
|
|
474
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
371
475
|
className: styles['chart-wrap']
|
|
372
476
|
}, /*#__PURE__*/React.createElement(Echarts, {
|
|
477
|
+
ref: chart,
|
|
373
478
|
option: chartOptions,
|
|
374
479
|
loading: loading,
|
|
375
480
|
style: {
|
|
@@ -379,6 +484,19 @@ var DialogHistory = function DialogHistory(_ref) {
|
|
|
379
484
|
className: styles['chart-empty'],
|
|
380
485
|
image: Empty.PRESENTED_IMAGE_SIMPLE,
|
|
381
486
|
description: "\u6682\u65E0\u70B9\u4F4D\u5386\u53F2\u6570\u636E"
|
|
382
|
-
}))
|
|
487
|
+
})), /*#__PURE__*/React.createElement(ModalChoosePoint, {
|
|
488
|
+
visible: visiblePointSet,
|
|
489
|
+
onSubmit: function onSubmit(val) {
|
|
490
|
+
setPointIdList(function (pre) {
|
|
491
|
+
return _toConsumableArray(new Set([].concat(_toConsumableArray(pre), _toConsumableArray(val))));
|
|
492
|
+
});
|
|
493
|
+
},
|
|
494
|
+
currentDeviceId: deviceId,
|
|
495
|
+
companyId: companyId,
|
|
496
|
+
projectId: projectId,
|
|
497
|
+
onCancel: function onCancel() {
|
|
498
|
+
setVisiblePointSet(false);
|
|
499
|
+
}
|
|
500
|
+
}));
|
|
383
501
|
};
|
|
384
|
-
export default
|
|
502
|
+
export default DialogPointHistory;
|
|
@@ -72,7 +72,7 @@ var ImageUploader = function ImageUploader(_ref) {
|
|
|
72
72
|
if (!isJpgOrPngOrSvgOrGif) {
|
|
73
73
|
message.error('只能上传 JPG/PNG/Svg/Gif 文件!');
|
|
74
74
|
}
|
|
75
|
-
var size =
|
|
75
|
+
var size = 50;
|
|
76
76
|
var isLtSize = file.size / 1024 / 1024 < size;
|
|
77
77
|
if (!isLtSize) {
|
|
78
78
|
notification.open({
|