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.
- package/es/app.js +23 -0
- package/es/components/BoxShadowPicker/index.less.d.ts +9 -9
- package/es/components/ColorPicker/util.js +4 -4
- package/es/components/DialogHistory/index.css +22 -0
- package/es/components/DialogHistory/index.js +388 -79
- package/es/components/DialogImagePicker/GroupPanel/index.js +1 -12
- package/es/components/ECharts/index.js +31 -23
- package/es/components/FormBindPoint/FreedomScene.js +181 -11
- package/es/components/FormBindPoint/ProductionOrDeviceScene.js +12 -5
- package/es/components/FormBindPoint/index.js +6 -0
- package/es/components/Icon/index.js +1 -1
- package/es/components/IconFont/index.js +6 -0
- package/es/components/ImageUploader/index.js +8 -7
- package/es/components/ModalChangePointValue.js +272 -0
- package/es/components/ModalChoosePoint/index.js +53 -16
- package/es/components/PointSelect/DeviceIndicatorTable.js +111 -0
- package/es/components/PointSelect/IndicatorSelect.js +182 -0
- package/es/constant.js +2 -2
- package/es/element/BorderBox/util/typings.d.ts +9 -9
- package/es/element/Decoration/util/typings.d.ts +9 -9
- package/es/element/EleFan/Component.js +1 -1
- package/es/element/EleFanBySvg/index.js +3 -3
- package/es/element/EleImage/index.js +1 -1
- package/es/element/ElePointImage/Component.js +30 -41
- package/es/element/ElePointImage/index.js +1 -1
- package/es/element/ElePointValue/Component.js +117 -17
- package/es/element/ElePointValue/PropsSet/StatisticsPropsSet/index.js +6 -0
- package/es/element/ElePointValue/index.css +11 -0
- package/es/element/ElePointValue/index.js +6 -0
- package/es/element/EleShine/Component.js +133 -23
- package/es/element/EleShine/PropsSet/OtherPropsSet/index.js +27 -34
- package/es/element/EleShine/PropsSet/PointAlarmTool.js +99 -0
- package/es/element/EleShine/PropsSet/index.js +9 -1
- package/es/element/EleShine/index.js +2 -1
- package/es/element/EleState/index.js +1 -1
- package/es/element/EleSwitch/Component.js +2 -12
- package/es/element/PipeNodes/NodeBL/index.js +1 -1
- package/es/element/PipeNodes/NodeBR/index.js +1 -1
- package/es/element/PipeNodes/NodeBottom/index.js +1 -1
- package/es/element/PipeNodes/NodeCenter/index.js +1 -1
- package/es/element/PipeNodes/NodeHorizontal/index.js +1 -1
- package/es/element/PipeNodes/NodeLeft/index.js +1 -1
- package/es/element/PipeNodes/NodeRight/index.js +1 -1
- package/es/element/PipeNodes/NodeTL/index.js +1 -1
- package/es/element/PipeNodes/NodeTR/index.js +1 -1
- package/es/element/PipeNodes/NodeTop/index.js +1 -1
- package/es/element/PipeNodes/NodeVertical/index.js +1 -1
- package/es/element/PointCard/PointListCard/Component.js +3 -2
- package/es/element/PointCard/PointListCard/index.js +1 -0
- package/es/element/type.d.ts +4 -6
- package/es/element/utils/getValueByExpression.js +3 -0
- package/es/element/utils/handleEleEvent.js +11 -1
- package/es/element/utils/pointWrite.js +4 -5
- package/es/hooks/usePointWatch.js +1 -1
- package/es/models/useEditor.js +14 -8
- package/es/pages/display/Player/index.js +444 -123
- package/es/pages/display/index.js +2 -2
- package/es/pages/document.ejs +1 -1
- package/es/pages/editor/PanelLeft/BasicShapeList/listData.js +8 -8
- package/es/pages/editor/PanelLeft/BorderBoxEleList/index.less.d.ts +7 -7
- package/es/pages/editor/PanelLeft/DecorationEleList/index.less.d.ts +7 -7
- package/es/pages/editor/PanelLeft/GroupManageDialog/index.js +4 -4
- package/es/pages/editor/PanelLeft/ImgGroup/index.js +1 -12
- package/es/pages/editor/PanelLeft/MetaEleList/listData.js +14 -14
- package/es/pages/editor/PanelLeft/PipeEleList/listData.js +11 -11
- package/es/pages/editor/PanelLeft/PointCardEleList/listData.js +6 -6
- package/es/pages/editor/PanelLeft/RecommendEleList/listData.js +4 -4
- package/es/pages/editor/PanelLeft/index.js +3 -3
- package/es/pages/editor/PanelRight/components/FormLayer/index.js +3 -1
- package/es/pages/editor/PanelRight/index.less.d.ts +7 -7
- package/es/pages/editor/PanelTop/HotKeyDescribe/index.js +1 -1
- package/es/pages/editor/PanelTop/Save/index.js +120 -67
- package/es/pages/editor/index.js +223 -135
- package/es/pages/editor/utils/scadaChangeLog.js +237 -0
- package/es/services/common/Uploader.js +1 -1
- package/es/services/common/typings.d.ts +15 -15
- package/es/services/energy/index.js +56 -0
- package/es/services/gateway/Device.js +22 -0
- package/es/services/gateway/Point.js +46 -25
- package/es/services/gateway/typings.d.ts +3 -0
- package/es/services/master/typings.d.ts +362 -362
- package/es/services/product/typings.d.ts +1045 -1045
- package/es/services/project/typings.d.ts +1609 -1609
- package/es/services/request.js +126 -13
- package/es/shims.x6.d.ts +15 -15
- package/es/typings.d.ts +12 -0
- package/es/utils/auth.js +6 -2
- package/es/utils/cssStyle.js +4 -4
- package/es/utils/dataURItoBlob.js +25 -0
- package/es/utils/date.js +7 -0
- package/es/utils/decomposeMatrix.js +5 -5
- package/es/utils/events.js +3 -3
- package/es/utils/index.js +34 -34
- package/es/utils/pointValueFormat.js +3 -3
- package/package.json +16 -15
- package/es/elementCss.css +0 -19
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
2
|
-
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
3
1
|
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
4
2
|
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
3
|
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
6
4
|
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
5
|
+
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
6
|
+
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
7
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); }
|
|
8
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); }); }; }
|
|
9
9
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
@@ -17,12 +17,14 @@ import { useCallback, useEffect, useState, useRef } from 'react';
|
|
|
17
17
|
import { Modal, Form, message, InputNumber, DatePicker, Empty, Typography, Button, Space, Tag } from 'antd';
|
|
18
18
|
import moment from 'moment';
|
|
19
19
|
import { useDebounceFn } from 'ahooks';
|
|
20
|
-
import { GetPointHistoryData } from "../../services/gateway/Point";
|
|
21
|
-
import ModalChoosePoint from "../ModalChoosePoint";
|
|
20
|
+
import { DownHistoryDataToExcelOrPdf, GetPointHistoryData, GetTdIndicatorHistoryData } from "../../services/gateway/Point";
|
|
22
21
|
import Echarts from "../ECharts";
|
|
22
|
+
import base64ToBlob from "../../utils/dataURItoBlob";
|
|
23
23
|
// @ts-ignore
|
|
24
24
|
|
|
25
25
|
import styles from "./index.css";
|
|
26
|
+
import ModalChoosePoint from "../ModalChoosePoint";
|
|
27
|
+
import { dateDiff } from "../../utils/date";
|
|
26
28
|
var Link = Typography.Link;
|
|
27
29
|
var RangePicker = DatePicker.RangePicker;
|
|
28
30
|
var defaultInterval = 2;
|
|
@@ -38,6 +40,7 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
|
|
|
38
40
|
var _ref$isSinglePoint = _ref.isSinglePoint,
|
|
39
41
|
isSinglePoint = _ref$isSinglePoint === void 0 ? true : _ref$isSinglePoint,
|
|
40
42
|
pointIdListProp = _ref.pointIdListProp,
|
|
43
|
+
indicatorNoList = _ref.indicatorNoList,
|
|
41
44
|
dateRangeProp = _ref.dateRangeProp,
|
|
42
45
|
intervalProp = _ref.intervalProp,
|
|
43
46
|
visible = _ref.visible,
|
|
@@ -72,80 +75,229 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
|
|
|
72
75
|
_useState0 = _slicedToArray(_useState9, 2),
|
|
73
76
|
pointIdList = _useState0[0],
|
|
74
77
|
setPointIdList = _useState0[1];
|
|
75
|
-
|
|
76
|
-
var _useState1 = useState(false),
|
|
78
|
+
var _useState1 = useState(undefined),
|
|
77
79
|
_useState10 = _slicedToArray(_useState1, 2),
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
var _useState11 = useState(
|
|
80
|
+
deviceId = _useState10[0],
|
|
81
|
+
setDeviceId = _useState10[1];
|
|
82
|
+
var _useState11 = useState([]),
|
|
81
83
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
var _useState13 = useState(
|
|
84
|
+
tagList = _useState12[0],
|
|
85
|
+
setTagList = _useState12[1];
|
|
86
|
+
var _useState13 = useState(false),
|
|
85
87
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
86
|
-
|
|
87
|
-
|
|
88
|
+
dataZoom = _useState14[0],
|
|
89
|
+
setDataZoom = _useState14[1];
|
|
90
|
+
var _useState15 = useState([]),
|
|
91
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
92
|
+
dataZoomData = _useState16[0],
|
|
93
|
+
setDataZoomData = _useState16[1];
|
|
94
|
+
var _useState17 = useState('point'),
|
|
95
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
96
|
+
valueType = _useState18[0],
|
|
97
|
+
setValueType = _useState18[1];
|
|
98
|
+
var _useState19 = useState(false),
|
|
99
|
+
_useState20 = _slicedToArray(_useState19, 2),
|
|
100
|
+
excelDownloading = _useState20[0],
|
|
101
|
+
setExcelDownloading = _useState20[1];
|
|
102
|
+
|
|
103
|
+
/** 下载excel、pdf */
|
|
104
|
+
var downloadExcel = /*#__PURE__*/function () {
|
|
105
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
106
|
+
var _form$getFieldsValue, dateRange, interval, res, fileName, blobUrl, link, _e$response, _e$message, _t;
|
|
107
|
+
return _regenerator().w(function (_context) {
|
|
108
|
+
while (1) switch (_context.p = _context.n) {
|
|
109
|
+
case 0:
|
|
110
|
+
_context.p = 0;
|
|
111
|
+
setExcelDownloading(true);
|
|
112
|
+
_form$getFieldsValue = form.getFieldsValue(), dateRange = _form$getFieldsValue.dateRange, interval = _form$getFieldsValue.interval;
|
|
113
|
+
_context.n = 1;
|
|
114
|
+
return DownHistoryDataToExcelOrPdf({
|
|
115
|
+
pointIdList: pointIdList,
|
|
116
|
+
timeInterval: interval,
|
|
117
|
+
fileType: 1,
|
|
118
|
+
isAlarmLacy: false,
|
|
119
|
+
timeQuantumList: [{
|
|
120
|
+
// @ts-ignore
|
|
121
|
+
startDate: moment(dateRange[0]).format('YYYY-MM-DD HH:mm:ss'),
|
|
122
|
+
// @ts-ignore
|
|
123
|
+
endDate: moment(dateRange[1]).format('YYYY-MM-DD HH:mm:ss')
|
|
124
|
+
}],
|
|
125
|
+
isMerge: false,
|
|
126
|
+
isBack: false,
|
|
127
|
+
isZip: true,
|
|
128
|
+
zipFileList: []
|
|
129
|
+
}, {
|
|
130
|
+
responseType: 'blob',
|
|
131
|
+
shouldHandleBlob: false,
|
|
132
|
+
headers: {
|
|
133
|
+
'Content-Type': 'application/json'
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
case 1:
|
|
137
|
+
res = _context.v;
|
|
138
|
+
if (!(!res || res.size === 0)) {
|
|
139
|
+
_context.n = 2;
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
message.error('服务器返回空文件,请稍后重试');
|
|
143
|
+
setExcelDownloading(false);
|
|
144
|
+
return _context.a(2);
|
|
145
|
+
case 2:
|
|
146
|
+
// 安全的下载方式,避免权限问题
|
|
147
|
+
fileName = "history_".concat(moment(dateRange[0]).format('YYYY-MM-DD HH:mm:ss'), "_").concat(moment(dateRange[1]).format('YYYY-MM-DD HH:mm:ss'), ".zip");
|
|
148
|
+
if (window.navigator && window.navigator.msSaveOrOpenBlob) {
|
|
149
|
+
// IE浏览器
|
|
150
|
+
window.navigator.msSaveOrOpenBlob(res, fileName);
|
|
151
|
+
} else {
|
|
152
|
+
blobUrl = window.URL.createObjectURL(res);
|
|
153
|
+
link = document.createElement('a');
|
|
154
|
+
link.style.display = 'none';
|
|
155
|
+
link.href = blobUrl;
|
|
156
|
+
link.download = fileName;
|
|
157
|
+
link.target = '_blank';
|
|
158
|
+
|
|
159
|
+
// 确保在用户交互上下文中执行
|
|
160
|
+
document.body.appendChild(link);
|
|
161
|
+
|
|
162
|
+
// 使用 setTimeout 确保在下一个事件循环中执行
|
|
163
|
+
setTimeout(function () {
|
|
164
|
+
try {
|
|
165
|
+
link.click();
|
|
166
|
+
} catch (clickError) {
|
|
167
|
+
// 如果点击失败,尝试打开新窗口
|
|
168
|
+
window.open(blobUrl, '_blank');
|
|
169
|
+
}
|
|
170
|
+
document.body.removeChild(link);
|
|
171
|
+
window.URL.revokeObjectURL(blobUrl);
|
|
172
|
+
}, 100);
|
|
173
|
+
}
|
|
174
|
+
setExcelDownloading(false);
|
|
175
|
+
_context.n = 4;
|
|
176
|
+
break;
|
|
177
|
+
case 3:
|
|
178
|
+
_context.p = 3;
|
|
179
|
+
_t = _context.v;
|
|
180
|
+
console.log(_t);
|
|
181
|
+
// 检查是否是网络错误或API错误
|
|
182
|
+
if (_t === null || _t === void 0 ? void 0 : (_e$response = _t.response) === null || _e$response === void 0 ? void 0 : _e$response.status) {
|
|
183
|
+
message.error("\u4E0B\u8F7D\u5931\u8D25: HTTP ".concat(_t.response.status));
|
|
184
|
+
} else if (_t === null || _t === void 0 ? void 0 : (_e$message = _t.message) === null || _e$message === void 0 ? void 0 : _e$message.includes('response')) {
|
|
185
|
+
message.error('服务器响应异常,请检查网络连接');
|
|
186
|
+
} else {
|
|
187
|
+
message.error('下载excel失败');
|
|
188
|
+
}
|
|
189
|
+
setExcelDownloading(false);
|
|
190
|
+
case 4:
|
|
191
|
+
return _context.a(2);
|
|
192
|
+
}
|
|
193
|
+
}, _callee, null, [[0, 3]]);
|
|
194
|
+
}));
|
|
195
|
+
return function downloadExcel() {
|
|
196
|
+
return _ref2.apply(this, arguments);
|
|
197
|
+
};
|
|
198
|
+
}();
|
|
199
|
+
|
|
200
|
+
/** 下载图表 */
|
|
201
|
+
var downloadImg = function downloadImg() {
|
|
202
|
+
try {
|
|
203
|
+
var _chart$current, _chart$current$getEch;
|
|
204
|
+
// @ts-ignore
|
|
205
|
+
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);
|
|
206
|
+
var blob = base64ToBlob(_myChart.getDataURL({
|
|
207
|
+
backgroundColor: '#fff'
|
|
208
|
+
}));
|
|
209
|
+
if (window.navigator && window.navigator.msSaveOrOpenBlob) {
|
|
210
|
+
// IE浏览器
|
|
211
|
+
window.navigator.msSaveOrOpenBlob(blob, 'chart.jpg');
|
|
212
|
+
} else {
|
|
213
|
+
var blobUrl = window.URL.createObjectURL(blob);
|
|
214
|
+
var link = document.createElement('a');
|
|
215
|
+
link.style.display = 'none';
|
|
216
|
+
link.href = blobUrl;
|
|
217
|
+
link.download = 'chart.jpg';
|
|
218
|
+
link.target = '_blank';
|
|
219
|
+
document.body.appendChild(link);
|
|
220
|
+
setTimeout(function () {
|
|
221
|
+
try {
|
|
222
|
+
link.click();
|
|
223
|
+
} catch (clickError) {
|
|
224
|
+
window.open(blobUrl, '_blank');
|
|
225
|
+
}
|
|
226
|
+
document.body.removeChild(link);
|
|
227
|
+
window.URL.revokeObjectURL(blobUrl);
|
|
228
|
+
}, 100);
|
|
229
|
+
}
|
|
230
|
+
} catch (e) {
|
|
231
|
+
console.error('下载图表失败:', e);
|
|
232
|
+
message.error('下载图表失败');
|
|
233
|
+
}
|
|
234
|
+
};
|
|
88
235
|
var closeModal = function closeModal() {
|
|
89
236
|
form.resetFields();
|
|
90
237
|
setLoading(false);
|
|
91
238
|
setChartOptions(undefined);
|
|
92
239
|
setIsNoData(false);
|
|
93
240
|
setVisiblePointSet(false);
|
|
94
|
-
setHaveAlarm(false);
|
|
95
241
|
setPointIdList([]);
|
|
96
242
|
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
97
243
|
};
|
|
98
244
|
|
|
99
245
|
/** 获取点位历史数据 */
|
|
100
246
|
var fetchPointHistory = useCallback(/*#__PURE__*/function () {
|
|
101
|
-
var
|
|
102
|
-
var diff, res, data, series, yAxisData,
|
|
103
|
-
return _regenerator().w(function (
|
|
104
|
-
while (1) switch (
|
|
247
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(idList, indicatorNo, ranges, interval) {
|
|
248
|
+
var diff, fun, res, data, _chart$current2, _chart$current2$getEc, _chart$current2$getEc2, series, yAxisData, _t2;
|
|
249
|
+
return _regenerator().w(function (_context2) {
|
|
250
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
105
251
|
case 0:
|
|
106
|
-
if (idList === null || idList === void 0 ? void 0 : idList.length) {
|
|
107
|
-
|
|
252
|
+
if (!(!(idList === null || idList === void 0 ? void 0 : idList.length) && !(indicatorNo === null || indicatorNo === void 0 ? void 0 : indicatorNo.length))) {
|
|
253
|
+
_context2.n = 1;
|
|
108
254
|
break;
|
|
109
255
|
}
|
|
110
|
-
return
|
|
256
|
+
return _context2.a(2);
|
|
111
257
|
case 1:
|
|
112
258
|
if (!(ranges.length !== 2)) {
|
|
113
|
-
|
|
259
|
+
_context2.n = 2;
|
|
114
260
|
break;
|
|
115
261
|
}
|
|
116
262
|
message.info('请选择时间范围');
|
|
117
|
-
return
|
|
263
|
+
return _context2.a(2);
|
|
118
264
|
case 2:
|
|
265
|
+
if (!idList.length) {
|
|
266
|
+
_context2.n = 3;
|
|
267
|
+
break;
|
|
268
|
+
}
|
|
119
269
|
if (!(typeof interval !== 'number' || interval < 0)) {
|
|
120
|
-
|
|
270
|
+
_context2.n = 3;
|
|
121
271
|
break;
|
|
122
272
|
}
|
|
123
273
|
message.info('请正确输入时间间隔');
|
|
124
|
-
return
|
|
274
|
+
return _context2.a(2);
|
|
125
275
|
case 3:
|
|
126
|
-
|
|
276
|
+
_context2.p = 3;
|
|
127
277
|
diff = moment(ranges[1]).valueOf() - moment(ranges[0]).valueOf();
|
|
128
278
|
if (!(diff > oneYearTime)) {
|
|
129
|
-
|
|
279
|
+
_context2.n = 4;
|
|
130
280
|
break;
|
|
131
281
|
}
|
|
132
282
|
message.error('历史数据最大查询范围是一年');
|
|
133
|
-
return
|
|
283
|
+
return _context2.a(2);
|
|
134
284
|
case 4:
|
|
135
285
|
// 获取点位数据
|
|
136
286
|
setLoading(true);
|
|
137
287
|
setTagList([]);
|
|
138
|
-
|
|
139
|
-
|
|
288
|
+
fun = indicatorNo.length ? GetTdIndicatorHistoryData : GetPointHistoryData;
|
|
289
|
+
_context2.n = 5;
|
|
290
|
+
return fun({
|
|
140
291
|
timeQuantum: {
|
|
141
292
|
startDate: moment(ranges[0]).format('YYYY-MM-DD HH:mm'),
|
|
142
293
|
endDate: moment(ranges[1]).format('YYYY-MM-DD HH:mm')
|
|
143
294
|
},
|
|
295
|
+
indicatorNoList: indicatorNo,
|
|
144
296
|
pointIdList: idList,
|
|
145
297
|
interval: interval
|
|
146
298
|
});
|
|
147
299
|
case 5:
|
|
148
|
-
res =
|
|
300
|
+
res = _context2.v;
|
|
149
301
|
if (res.success) {
|
|
150
302
|
data = res.data;
|
|
151
303
|
if (!data || !data.length) {
|
|
@@ -157,25 +309,21 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
|
|
|
157
309
|
yAxisData = [];
|
|
158
310
|
setDeviceId(data[0].deviceId);
|
|
159
311
|
if (data.every(function (v) {
|
|
160
|
-
var
|
|
161
|
-
return ((
|
|
312
|
+
var _ref4;
|
|
313
|
+
return ((_ref4 = v.pointDataList || v.indicatorDataList) === null || _ref4 === void 0 ? void 0 : _ref4.length) === 0 || !v.pointDataList && !v.indicatorDataList;
|
|
162
314
|
})) {
|
|
163
315
|
setIsNoData(true);
|
|
164
316
|
} else {
|
|
165
317
|
setIsNoData(false);
|
|
166
318
|
}
|
|
167
319
|
data.forEach(function (item) {
|
|
168
|
-
var
|
|
320
|
+
var _ref5;
|
|
169
321
|
setTagList(function (old) {
|
|
170
322
|
return [].concat(_toConsumableArray(old), [{
|
|
171
|
-
name: "".concat(item.deviceName, "-").concat(item.pointName),
|
|
323
|
+
name: "".concat(item.deviceName, "-").concat(item.pointName || item.indicatorName),
|
|
172
324
|
key: item.pointId
|
|
173
325
|
}]);
|
|
174
326
|
});
|
|
175
|
-
// @ts-ignore
|
|
176
|
-
if ((_item$pointAlarmTimeF = item.pointAlarmTimeFrameList) === null || _item$pointAlarmTimeF === void 0 ? void 0 : _item$pointAlarmTimeF.length) {
|
|
177
|
-
setHaveAlarm(true);
|
|
178
|
-
}
|
|
179
327
|
var pointEnumId = item.pointEnumId,
|
|
180
328
|
pointEnumItemList = item.pointEnumItemList;
|
|
181
329
|
var unit = item.unit;
|
|
@@ -237,7 +385,7 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
|
|
|
237
385
|
// 配置曲线数据
|
|
238
386
|
series.push({
|
|
239
387
|
animation: false,
|
|
240
|
-
name: "".concat(item.deviceName, "-").concat(item.pointName),
|
|
388
|
+
name: "".concat(item.deviceName, "-").concat(item.pointName || item.indicatorName),
|
|
241
389
|
type: interval == 0 ? 'scatter' : 'line',
|
|
242
390
|
unit: item.unit,
|
|
243
391
|
yAxisIndex: yAxisData.findIndex(function (yAxis) {
|
|
@@ -245,8 +393,9 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
|
|
|
245
393
|
}),
|
|
246
394
|
smooth: false,
|
|
247
395
|
showAllSymbol: true,
|
|
396
|
+
identifierName: item.identifierName,
|
|
248
397
|
symbolSize: 1.5,
|
|
249
|
-
data: (
|
|
398
|
+
data: (_ref5 = item.pointDataList || item.indicatorDataList) === null || _ref5 === void 0 ? void 0 : _ref5.map(function (dataItem) {
|
|
250
399
|
return [new Date(dataItem.ts).getTime(), dataItem.val];
|
|
251
400
|
}),
|
|
252
401
|
markPoint: {
|
|
@@ -260,7 +409,7 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
|
|
|
260
409
|
}
|
|
261
410
|
});
|
|
262
411
|
});
|
|
263
|
-
|
|
412
|
+
(_chart$current2 = chart.current) === null || _chart$current2 === void 0 ? void 0 : (_chart$current2$getEc = _chart$current2.getEchartsInstance) === null || _chart$current2$getEc === void 0 ? void 0 : (_chart$current2$getEc2 = _chart$current2$getEc.call(_chart$current2)) === null || _chart$current2$getEc2 === void 0 ? void 0 : _chart$current2$getEc2.resize();
|
|
264
413
|
// 应用图形配置
|
|
265
414
|
setChartOptions({
|
|
266
415
|
color: ['#2297E8', '#48CE38', '#F8D156', '#FD9827', '#9764DC', '#1FCA6A'],
|
|
@@ -281,6 +430,23 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
|
|
|
281
430
|
type: 'inside',
|
|
282
431
|
xAxisIndex: 0,
|
|
283
432
|
filterMode: 'empty'
|
|
433
|
+
}, {
|
|
434
|
+
id: 'history-y-axis-zoom',
|
|
435
|
+
type: 'slider',
|
|
436
|
+
orient: 'vertical',
|
|
437
|
+
yAxisIndex: yAxisData.map(function (_, index) {
|
|
438
|
+
return index;
|
|
439
|
+
}),
|
|
440
|
+
filterMode: 'none',
|
|
441
|
+
right: 8,
|
|
442
|
+
top: 50,
|
|
443
|
+
bottom: 80,
|
|
444
|
+
width: 18,
|
|
445
|
+
start: 0,
|
|
446
|
+
end: 100,
|
|
447
|
+
showDataShadow: false,
|
|
448
|
+
showDetail: false,
|
|
449
|
+
brushSelect: false
|
|
284
450
|
}],
|
|
285
451
|
legend: {
|
|
286
452
|
show: true,
|
|
@@ -319,25 +485,25 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
|
|
|
319
485
|
setIsNoData(true);
|
|
320
486
|
message.error(res.message);
|
|
321
487
|
}
|
|
322
|
-
|
|
488
|
+
_context2.n = 7;
|
|
323
489
|
break;
|
|
324
490
|
case 6:
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
console.error(
|
|
491
|
+
_context2.p = 6;
|
|
492
|
+
_t2 = _context2.v;
|
|
493
|
+
console.error(_t2);
|
|
328
494
|
setIsNoData(true);
|
|
329
495
|
setChartOptions(undefined);
|
|
330
496
|
case 7:
|
|
331
|
-
|
|
497
|
+
_context2.p = 7;
|
|
332
498
|
setLoading(false);
|
|
333
|
-
return
|
|
499
|
+
return _context2.f(7);
|
|
334
500
|
case 8:
|
|
335
|
-
return
|
|
501
|
+
return _context2.a(2);
|
|
336
502
|
}
|
|
337
|
-
},
|
|
503
|
+
}, _callee2, null, [[3, 6, 7, 8]]);
|
|
338
504
|
}));
|
|
339
|
-
return function (_x, _x2, _x3) {
|
|
340
|
-
return
|
|
505
|
+
return function (_x, _x2, _x3, _x4) {
|
|
506
|
+
return _ref3.apply(this, arguments);
|
|
341
507
|
};
|
|
342
508
|
}(), []);
|
|
343
509
|
var _useDebounceFn = useDebounceFn(fetchPointHistory, {
|
|
@@ -345,57 +511,70 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
|
|
|
345
511
|
}),
|
|
346
512
|
fetchPointHistoryDebounce = _useDebounceFn.run;
|
|
347
513
|
var handleSubmit = /*#__PURE__*/function () {
|
|
348
|
-
var
|
|
514
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
|
|
349
515
|
var _yield$form$validateF, dateRange, interval;
|
|
350
|
-
return _regenerator().w(function (
|
|
351
|
-
while (1) switch (
|
|
516
|
+
return _regenerator().w(function (_context3) {
|
|
517
|
+
while (1) switch (_context3.n) {
|
|
352
518
|
case 0:
|
|
353
|
-
|
|
519
|
+
_context3.n = 1;
|
|
354
520
|
return form.validateFields();
|
|
355
521
|
case 1:
|
|
356
|
-
_yield$form$validateF =
|
|
522
|
+
_yield$form$validateF = _context3.v;
|
|
357
523
|
dateRange = _yield$form$validateF.dateRange;
|
|
358
524
|
interval = _yield$form$validateF.interval;
|
|
359
|
-
|
|
525
|
+
setValueType(indicatorNoList.length ? 'indicator' : 'point');
|
|
526
|
+
fetchPointHistoryDebounce(indicatorNoList.length ? [] : pointIdList, indicatorNoList.length ? pointIdList : [], dateRange, interval);
|
|
360
527
|
case 2:
|
|
361
|
-
return
|
|
528
|
+
return _context3.a(2);
|
|
362
529
|
}
|
|
363
|
-
},
|
|
530
|
+
}, _callee3);
|
|
364
531
|
}));
|
|
365
532
|
return function handleSubmit() {
|
|
366
|
-
return
|
|
533
|
+
return _ref6.apply(this, arguments);
|
|
367
534
|
};
|
|
368
535
|
}();
|
|
369
536
|
useEffect(function () {
|
|
370
|
-
var _form$
|
|
371
|
-
dateRange = _form$
|
|
372
|
-
interval = _form$
|
|
373
|
-
|
|
537
|
+
var _form$getFieldsValue2 = form.getFieldsValue(),
|
|
538
|
+
dateRange = _form$getFieldsValue2.dateRange,
|
|
539
|
+
interval = _form$getFieldsValue2.interval;
|
|
540
|
+
setValueType(indicatorNoList.length ? 'indicator' : 'point');
|
|
541
|
+
fetchPointHistoryDebounce(indicatorNoList.length ? [] : pointIdList, indicatorNoList.length ? pointIdList : [], dateRange, interval);
|
|
374
542
|
}, [pointIdList]);
|
|
375
543
|
|
|
376
544
|
/** 打开弹框,初始化数据,获取曲线图形 */
|
|
377
545
|
useEffect(function () {
|
|
378
|
-
if (visible
|
|
379
|
-
var ranges = dateRangeProp || [moment().subtract(1, 'days'), moment()];
|
|
546
|
+
if (visible) {
|
|
547
|
+
var ranges = dateRangeProp || [moment(moment().subtract(1, 'days').format('YYYY-MM-DD 00:00')), moment(moment().format('YYYY-MM-DD 23:59'))];
|
|
380
548
|
var interval = typeof intervalProp === 'number' && intervalProp ? intervalProp : defaultInterval;
|
|
381
549
|
form.setFieldsValue({
|
|
382
550
|
dateRange: ranges,
|
|
383
551
|
interval: interval
|
|
384
552
|
});
|
|
385
|
-
|
|
386
|
-
|
|
553
|
+
if (pointIdListProp === null || pointIdListProp === void 0 ? void 0 : pointIdListProp.length) {
|
|
554
|
+
setPointIdList(pointIdListProp);
|
|
555
|
+
setValueType('point');
|
|
556
|
+
fetchPointHistoryDebounce(pointIdListProp, [], ranges, interval);
|
|
557
|
+
} else if (indicatorNoList === null || indicatorNoList === void 0 ? void 0 : indicatorNoList.length) {
|
|
558
|
+
setPointIdList(indicatorNoList);
|
|
559
|
+
setValueType('indicator');
|
|
560
|
+
fetchPointHistoryDebounce([], indicatorNoList, ranges, interval);
|
|
561
|
+
}
|
|
387
562
|
}
|
|
388
|
-
}, [visible, form, pointIdListProp, dateRangeProp, intervalProp]);
|
|
389
|
-
return /*#__PURE__*/React.createElement(Modal, {
|
|
563
|
+
}, [visible, form, pointIdListProp, dateRangeProp, intervalProp, indicatorNoList]);
|
|
564
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Modal, {
|
|
390
565
|
title: "\u5386\u53F2\u6570\u636E\u66F2\u7EBF",
|
|
391
566
|
open: visible,
|
|
392
567
|
closable: true,
|
|
393
|
-
width:
|
|
394
|
-
zIndex:
|
|
568
|
+
width: 1600,
|
|
569
|
+
zIndex: 9997,
|
|
395
570
|
footer: null,
|
|
396
571
|
onCancel: closeModal,
|
|
397
572
|
afterClose: closeModal,
|
|
398
573
|
getContainer: false
|
|
574
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
575
|
+
className: "row"
|
|
576
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
577
|
+
className: "flex1"
|
|
399
578
|
}, /*#__PURE__*/React.createElement(Form, {
|
|
400
579
|
requiredMark: false,
|
|
401
580
|
form: form,
|
|
@@ -427,9 +606,9 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
|
|
|
427
606
|
},
|
|
428
607
|
format: "YYYY-MM-DD HH:mm",
|
|
429
608
|
getPopupContainer: function getPopupContainer() {
|
|
430
|
-
return document.querySelector(
|
|
609
|
+
return document.querySelector('.temperatureDateRange') || document.body;
|
|
431
610
|
}
|
|
432
|
-
})), /*#__PURE__*/React.createElement(Form.Item, {
|
|
611
|
+
})), indicatorNoList.length ? null : /*#__PURE__*/React.createElement(Form.Item, {
|
|
433
612
|
name: "interval",
|
|
434
613
|
label: "\u95F4\u9694\uFF08\u5206\u949F\uFF09",
|
|
435
614
|
rules: [{
|
|
@@ -456,7 +635,16 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
|
|
|
456
635
|
onClick: function onClick() {
|
|
457
636
|
setVisiblePointSet(true);
|
|
458
637
|
}
|
|
459
|
-
}, "\u6DFB\u52A0\u5C5E\u6027"))
|
|
638
|
+
}, "\u6DFB\u52A0\u5C5E\u6027")), /*#__PURE__*/React.createElement(Form.Item, {
|
|
639
|
+
label: "\u6570\u636E\u64CD\u4F5C"
|
|
640
|
+
}, /*#__PURE__*/React.createElement(Space, {
|
|
641
|
+
size: 15
|
|
642
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
643
|
+
onClick: downloadExcel,
|
|
644
|
+
loading: excelDownloading
|
|
645
|
+
}, "\u4E0B\u8F7Dexcel"), /*#__PURE__*/React.createElement(Button, {
|
|
646
|
+
onClick: downloadImg
|
|
647
|
+
}, "\u4E0B\u8F7D\u56FE\u8868"))))) : null), tagList.map(function (item) {
|
|
460
648
|
return /*#__PURE__*/React.createElement(Tag, {
|
|
461
649
|
key: item.key,
|
|
462
650
|
closable: true,
|
|
@@ -477,12 +665,131 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
|
|
|
477
665
|
loading: loading,
|
|
478
666
|
style: {
|
|
479
667
|
height: '500px'
|
|
668
|
+
},
|
|
669
|
+
onEvents: {
|
|
670
|
+
datazoom: function datazoom() {
|
|
671
|
+
var _chart$current3, _chart$current3$getEc, _option$dataZoom, _xZoom$start, _xZoom$end;
|
|
672
|
+
// 获取当前 echarts 实例
|
|
673
|
+
var myChart = chart === null || chart === void 0 ? void 0 : (_chart$current3 = chart.current) === null || _chart$current3 === void 0 ? void 0 : (_chart$current3$getEc = _chart$current3.getEchartsInstance) === null || _chart$current3$getEc === void 0 ? void 0 : _chart$current3$getEc.call(_chart$current3);
|
|
674
|
+
if (!myChart) return;
|
|
675
|
+
|
|
676
|
+
// 获取当前配置
|
|
677
|
+
var option = myChart.getOption();
|
|
678
|
+
// 获取缩放范围
|
|
679
|
+
// Y zoom also emits this event; statistics use the first X zoom control.
|
|
680
|
+
var xZoom = (_option$dataZoom = option.dataZoom) === null || _option$dataZoom === void 0 ? void 0 : _option$dataZoom[0];
|
|
681
|
+
var startValue = (_xZoom$start = xZoom === null || xZoom === void 0 ? void 0 : xZoom.start) !== null && _xZoom$start !== void 0 ? _xZoom$start : 0;
|
|
682
|
+
var endValue = (_xZoom$end = xZoom === null || xZoom === void 0 ? void 0 : xZoom.end) !== null && _xZoom$end !== void 0 ? _xZoom$end : 100;
|
|
683
|
+
if (startValue === 0 && endValue === 100) {
|
|
684
|
+
setDataZoom(false);
|
|
685
|
+
return;
|
|
686
|
+
}
|
|
687
|
+
// 获取所有系列的数据
|
|
688
|
+
var visibleData = option.series.filter(function (item) {
|
|
689
|
+
return ['totalenergy', 'tlwatercs', 'tlhgscs'].includes(item.identifierName);
|
|
690
|
+
}).map(function (series) {
|
|
691
|
+
// 获取当前显示范围的数据
|
|
692
|
+
var data = series.data.filter(function (_, index) {
|
|
693
|
+
var percent = index / series.data.length * 100;
|
|
694
|
+
return percent >= startValue && percent <= endValue;
|
|
695
|
+
});
|
|
696
|
+
return {
|
|
697
|
+
name: series.name,
|
|
698
|
+
data: data
|
|
699
|
+
};
|
|
700
|
+
});
|
|
701
|
+
if (visibleData.length) {
|
|
702
|
+
setDataZoomData(visibleData);
|
|
703
|
+
setDataZoom(true);
|
|
704
|
+
} else {
|
|
705
|
+
setDataZoom(false);
|
|
706
|
+
}
|
|
707
|
+
console.log('当前显示的数据集合:', visibleData);
|
|
708
|
+
}
|
|
480
709
|
}
|
|
481
710
|
}), isNoData && /*#__PURE__*/React.createElement(Empty, {
|
|
482
711
|
className: styles['chart-empty'],
|
|
483
712
|
image: Empty.PRESENTED_IMAGE_SIMPLE,
|
|
484
713
|
description: "\u6682\u65E0\u70B9\u4F4D\u5386\u53F2\u6570\u636E"
|
|
485
|
-
})),
|
|
714
|
+
}))), pointIdList.some(function (item) {
|
|
715
|
+
return ['totalenergy', 'tlwatercs', 'tlhgscs'].some(function (_item) {
|
|
716
|
+
return item.includes(_item);
|
|
717
|
+
});
|
|
718
|
+
}) ? /*#__PURE__*/React.createElement("div", {
|
|
719
|
+
className: styles.totalBox
|
|
720
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
721
|
+
className: styles.totalItem
|
|
722
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
723
|
+
className: styles.totalItemTitle
|
|
724
|
+
}, /*#__PURE__*/React.createElement("span", null, "\u65F6\u95F4\u8DE8\u5EA6\uFF1A")), /*#__PURE__*/React.createElement("div", {
|
|
725
|
+
className: styles.totalItemContent
|
|
726
|
+
}, /*#__PURE__*/React.createElement("span", null, dataZoom && dataZoomData.length ? function (_longestSeries$data) {
|
|
727
|
+
var longestSeries = dataZoomData.reduce(function (prev, curr) {
|
|
728
|
+
var _prev$data, _curr$data;
|
|
729
|
+
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;
|
|
730
|
+
});
|
|
731
|
+
if (!(longestSeries === null || longestSeries === void 0 ? void 0 : (_longestSeries$data = longestSeries.data) === null || _longestSeries$data === void 0 ? void 0 : _longestSeries$data.length)) return '-';
|
|
732
|
+
var firstPoint = longestSeries.data[0];
|
|
733
|
+
var lastPoint = longestSeries.data[longestSeries.data.length - 1];
|
|
734
|
+
return firstPoint && lastPoint ? dateDiff(firstPoint[0], lastPoint[0]) : '-';
|
|
735
|
+
}() : function () {
|
|
736
|
+
var dateRange = form.getFieldValue('dateRange');
|
|
737
|
+
return (dateRange === null || dateRange === void 0 ? void 0 : dateRange[0]) && (dateRange === null || dateRange === void 0 ? void 0 : dateRange[1]) ? dateDiff(dateRange[0], dateRange[1]) : '-';
|
|
738
|
+
}()))), /*#__PURE__*/React.createElement("div", {
|
|
739
|
+
className: styles.totalItem
|
|
740
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
741
|
+
className: styles.totalItemTitle
|
|
742
|
+
}, /*#__PURE__*/React.createElement("span", null, "\u8017", ['电', '水', '气'][['totalenergy', 'tlwatercs', 'tlhgscs'].findIndex(function (item) {
|
|
743
|
+
return pointIdList[0].includes(item);
|
|
744
|
+
})], "\u91CF\uFF1A")), /*#__PURE__*/React.createElement("div", {
|
|
745
|
+
className: styles.totalItemContent
|
|
746
|
+
}, (dataZoom ? dataZoomData : ((chartOptions === null || chartOptions === void 0 ? void 0 : chartOptions.series) || []).filter(function (item) {
|
|
747
|
+
return ['totalenergy', 'tlwatercs', 'tlhgscs'].includes(item.identifierName);
|
|
748
|
+
})).map(function (item) {
|
|
749
|
+
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) {
|
|
750
|
+
return _item[1];
|
|
751
|
+
}))) - Math.min.apply(Math, _toConsumableArray(item.data.map(function (_item) {
|
|
752
|
+
return _item[1];
|
|
753
|
+
})))).toFixed(2))));
|
|
754
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
755
|
+
className: styles.totalItem
|
|
756
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
757
|
+
className: styles.totalItemTitle
|
|
758
|
+
}, /*#__PURE__*/React.createElement("span", null, "\u671F\u672B\u503C\uFF1A")), /*#__PURE__*/React.createElement("div", {
|
|
759
|
+
className: styles.totalItemContent
|
|
760
|
+
}, ((dataZoom ? dataZoomData : chartOptions === null || chartOptions === void 0 ? void 0 : chartOptions.series.filter(function (item) {
|
|
761
|
+
return ['totalenergy', 'tlwatercs', 'tlhgscs'].includes(item.identifierName);
|
|
762
|
+
})) || []).map(function (item) {
|
|
763
|
+
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) {
|
|
764
|
+
return _item[1];
|
|
765
|
+
})))));
|
|
766
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
767
|
+
className: styles.totalItem
|
|
768
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
769
|
+
className: styles.totalItemTitle
|
|
770
|
+
}, /*#__PURE__*/React.createElement("span", null, "\u671F\u521D\u503C\uFF1A")), /*#__PURE__*/React.createElement("div", {
|
|
771
|
+
className: styles.totalItemContent
|
|
772
|
+
}, ((dataZoom ? dataZoomData : chartOptions === null || chartOptions === void 0 ? void 0 : chartOptions.series.filter(function (item) {
|
|
773
|
+
return ['totalenergy', 'tlwatercs', 'tlhgscs'].includes(item.identifierName);
|
|
774
|
+
})) || []).map(function (item) {
|
|
775
|
+
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) {
|
|
776
|
+
return _item[1];
|
|
777
|
+
})))));
|
|
778
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
779
|
+
className: styles.totalItem
|
|
780
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
781
|
+
className: styles.totalItemTitle
|
|
782
|
+
}, /*#__PURE__*/React.createElement("span", null, "\u8BA1\u91CF\u5355\u4F4D\uFF1A")), /*#__PURE__*/React.createElement("div", {
|
|
783
|
+
className: styles.totalItemContent
|
|
784
|
+
}, ((chartOptions === null || chartOptions === void 0 ? void 0 : chartOptions.series.filter(function (item) {
|
|
785
|
+
return ['totalenergy', 'tlwatercs', 'tlhgscs'].includes(item.identifierName);
|
|
786
|
+
})[0]) || {
|
|
787
|
+
unit: ''
|
|
788
|
+
}).unit))) : null)), /*#__PURE__*/React.createElement("div", {
|
|
789
|
+
onClick: function onClick(e) {
|
|
790
|
+
return e.stopPropagation();
|
|
791
|
+
}
|
|
792
|
+
}, /*#__PURE__*/React.createElement(ModalChoosePoint, {
|
|
486
793
|
visible: visiblePointSet,
|
|
487
794
|
onSubmit: function onSubmit(val) {
|
|
488
795
|
setPointIdList(function (pre) {
|
|
@@ -490,11 +797,13 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
|
|
|
490
797
|
});
|
|
491
798
|
},
|
|
492
799
|
currentDeviceId: deviceId,
|
|
800
|
+
key: valueType,
|
|
801
|
+
valueType: valueType,
|
|
493
802
|
companyId: companyId,
|
|
494
803
|
projectId: projectId,
|
|
495
804
|
onCancel: function onCancel() {
|
|
496
805
|
setVisiblePointSet(false);
|
|
497
806
|
}
|
|
498
|
-
}));
|
|
807
|
+
})));
|
|
499
808
|
};
|
|
500
809
|
export default DialogPointHistory;
|