coolcare-lite-scada-component 1.0.20 → 1.0.22
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.
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
5
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
2
6
|
function _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
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); }); }; }
|
|
@@ -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 } from 'antd';
|
|
14
18
|
import moment from 'moment';
|
|
15
19
|
import { useDebounceFn } from 'ahooks';
|
|
16
|
-
import { GetPointHistoryData } from "../../services/gateway/Point";
|
|
20
|
+
import { DownHistoryDataToExcelOrPdf, GetPointHistoryData } from "../../services/gateway/Point";
|
|
21
|
+
import ModalChoosePoint from "../ModalChoosePoint";
|
|
17
22
|
import Echarts from "../ECharts";
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
import { saveAs } from 'file-saver';
|
|
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
|
+
getContainer = _ref.getContainer,
|
|
46
|
+
companyId = _ref.companyId;
|
|
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,142 @@ 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(undefined),
|
|
60
|
+
var _useState5 = useState(false),
|
|
49
61
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
50
|
-
|
|
51
|
-
|
|
62
|
+
excelDownloading = _useState6[0],
|
|
63
|
+
setExcelDownloading = _useState6[1];
|
|
64
|
+
/** 添加对比点位弹框 */
|
|
65
|
+
var _useState7 = useState(false),
|
|
66
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
67
|
+
visiblePointSet = _useState8[0],
|
|
68
|
+
setVisiblePointSet = _useState8[1];
|
|
69
|
+
/** 曲线图配置 */
|
|
70
|
+
var _useState9 = useState(undefined),
|
|
71
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
72
|
+
chartOptions = _useState10[0],
|
|
73
|
+
setChartOptions = _useState10[1];
|
|
74
|
+
/** 当前点位列表 */
|
|
75
|
+
var _useState11 = useState([]),
|
|
76
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
77
|
+
pointIdList = _useState12[0],
|
|
78
|
+
setPointIdList = _useState12[1];
|
|
79
|
+
/** 当前点位时间段内是否有报警 */
|
|
80
|
+
var _useState13 = useState(false),
|
|
81
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
82
|
+
haveAlarm = _useState14[0],
|
|
83
|
+
setHaveAlarm = _useState14[1];
|
|
84
|
+
/** 是否已查看原始数据 */
|
|
85
|
+
var _useState15 = useState(false),
|
|
86
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
87
|
+
isCheckAlarm = _useState16[0],
|
|
88
|
+
setIsCheckAlarm = _useState16[1];
|
|
52
89
|
var closeModal = function closeModal() {
|
|
53
90
|
form.resetFields();
|
|
54
91
|
setLoading(false);
|
|
55
92
|
setChartOptions(undefined);
|
|
56
93
|
setIsNoData(false);
|
|
94
|
+
setVisiblePointSet(false);
|
|
95
|
+
setHaveAlarm(false);
|
|
96
|
+
setIsCheckAlarm(false);
|
|
97
|
+
setPointIdList([]);
|
|
57
98
|
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
58
99
|
};
|
|
59
100
|
|
|
101
|
+
/** 下载excel、pdf */
|
|
102
|
+
var downloadExcel = /*#__PURE__*/function () {
|
|
103
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
104
|
+
var _form$getFieldsValue, dateRange, interval, res, blobUrl;
|
|
105
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
106
|
+
while (1) switch (_context.prev = _context.next) {
|
|
107
|
+
case 0:
|
|
108
|
+
_context.prev = 0;
|
|
109
|
+
setExcelDownloading(true);
|
|
110
|
+
_form$getFieldsValue = form.getFieldsValue(), dateRange = _form$getFieldsValue.dateRange, interval = _form$getFieldsValue.interval;
|
|
111
|
+
_context.next = 5;
|
|
112
|
+
return DownHistoryDataToExcelOrPdf({
|
|
113
|
+
pointIdList: pointIdList,
|
|
114
|
+
timeInterval: interval,
|
|
115
|
+
fileType: 1,
|
|
116
|
+
isAlarmLacy: false,
|
|
117
|
+
timeQuantumList: [{
|
|
118
|
+
// @ts-ignore
|
|
119
|
+
startDate: moment(dateRange[0]).format('YYYY-MM-DD HH:mm:ss'),
|
|
120
|
+
// @ts-ignore
|
|
121
|
+
endDate: moment(dateRange[1]).format('YYYY-MM-DD HH:mm:ss')
|
|
122
|
+
}],
|
|
123
|
+
isMerge: false,
|
|
124
|
+
isBack: false,
|
|
125
|
+
isZip: true,
|
|
126
|
+
zipFileList: []
|
|
127
|
+
}, {
|
|
128
|
+
responseType: 'blob',
|
|
129
|
+
headers: {
|
|
130
|
+
'Content-Type': 'application/json'
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
case 5:
|
|
134
|
+
res = _context.sent;
|
|
135
|
+
blobUrl = window.URL.createObjectURL(res);
|
|
136
|
+
saveAs(blobUrl, "history_".concat(moment(dateRange[0]).format('YYYY-MM-DD HH:mm:ss'), "_").concat(moment(dateRange[1]).format('YYYY-MM-DD HH:mm:ss'), ".zip"));
|
|
137
|
+
setExcelDownloading(false);
|
|
138
|
+
_context.next = 15;
|
|
139
|
+
break;
|
|
140
|
+
case 11:
|
|
141
|
+
_context.prev = 11;
|
|
142
|
+
_context.t0 = _context["catch"](0);
|
|
143
|
+
message.error('下载excel失败');
|
|
144
|
+
setExcelDownloading(false);
|
|
145
|
+
case 15:
|
|
146
|
+
case "end":
|
|
147
|
+
return _context.stop();
|
|
148
|
+
}
|
|
149
|
+
}, _callee, null, [[0, 11]]);
|
|
150
|
+
}));
|
|
151
|
+
return function downloadExcel() {
|
|
152
|
+
return _ref2.apply(this, arguments);
|
|
153
|
+
};
|
|
154
|
+
}();
|
|
155
|
+
|
|
60
156
|
/** 获取点位历史数据 */
|
|
61
157
|
var fetchPointHistory = useCallback(/*#__PURE__*/function () {
|
|
62
|
-
var
|
|
158
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(idList, ranges, interval) {
|
|
63
159
|
var diff, res, data, series, yAxisData, xAxisData;
|
|
64
|
-
return _regeneratorRuntime().wrap(function
|
|
65
|
-
while (1) switch (
|
|
160
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
161
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
66
162
|
case 0:
|
|
67
163
|
if (idList === null || idList === void 0 ? void 0 : idList.length) {
|
|
68
|
-
|
|
164
|
+
_context2.next = 3;
|
|
69
165
|
break;
|
|
70
166
|
}
|
|
71
|
-
message.
|
|
72
|
-
return
|
|
167
|
+
message.info('请至少查询一个点位');
|
|
168
|
+
return _context2.abrupt("return");
|
|
73
169
|
case 3:
|
|
74
|
-
|
|
170
|
+
if (!(ranges.length !== 2)) {
|
|
171
|
+
_context2.next = 6;
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
message.info('请选择时间范围');
|
|
175
|
+
return _context2.abrupt("return");
|
|
176
|
+
case 6:
|
|
177
|
+
if (!(typeof interval !== 'number' || interval < 0)) {
|
|
178
|
+
_context2.next = 9;
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
message.info('请正确输入时间间隔');
|
|
182
|
+
return _context2.abrupt("return");
|
|
183
|
+
case 9:
|
|
184
|
+
_context2.prev = 9;
|
|
75
185
|
diff = moment(ranges[1]).valueOf() - moment(ranges[0]).valueOf();
|
|
76
186
|
if (!(diff > oneYearTime)) {
|
|
77
|
-
|
|
187
|
+
_context2.next = 14;
|
|
78
188
|
break;
|
|
79
189
|
}
|
|
80
190
|
message.error('历史数据最大查询范围是一年');
|
|
81
|
-
return
|
|
82
|
-
case
|
|
191
|
+
return _context2.abrupt("return");
|
|
192
|
+
case 14:
|
|
83
193
|
// 获取点位数据
|
|
84
194
|
setLoading(true);
|
|
85
|
-
|
|
195
|
+
_context2.next = 17;
|
|
86
196
|
return GetPointHistoryData({
|
|
87
197
|
timeQuantum: {
|
|
88
198
|
startDate: moment(ranges[0]).format('YYYY-MM-DD HH:mm'),
|
|
@@ -91,8 +201,8 @@ var DialogHistory = function DialogHistory(_ref) {
|
|
|
91
201
|
pointIdList: idList,
|
|
92
202
|
interval: interval
|
|
93
203
|
});
|
|
94
|
-
case
|
|
95
|
-
res =
|
|
204
|
+
case 17:
|
|
205
|
+
res = _context2.sent;
|
|
96
206
|
if (res.success) {
|
|
97
207
|
data = res.data;
|
|
98
208
|
if (!data || !data.length) {
|
|
@@ -112,7 +222,11 @@ var DialogHistory = function DialogHistory(_ref) {
|
|
|
112
222
|
setIsNoData(false);
|
|
113
223
|
}
|
|
114
224
|
data.forEach(function (item) {
|
|
115
|
-
var _item$pointDataList, _item$pointDataList2;
|
|
225
|
+
var _item$pointAlarmTimeF, _item$pointDataList, _item$pointDataList2;
|
|
226
|
+
// @ts-ignore
|
|
227
|
+
if ((_item$pointAlarmTimeF = item.pointAlarmTimeFrameList) === null || _item$pointAlarmTimeF === void 0 ? void 0 : _item$pointAlarmTimeF.length) {
|
|
228
|
+
setHaveAlarm(true);
|
|
229
|
+
}
|
|
116
230
|
var pointEnumId = item.pointEnumId,
|
|
117
231
|
pointEnumItemList = item.pointEnumItemList;
|
|
118
232
|
var unit = item.unit;
|
|
@@ -180,18 +294,17 @@ var DialogHistory = function DialogHistory(_ref) {
|
|
|
180
294
|
// 配置曲线数据
|
|
181
295
|
series.push({
|
|
182
296
|
animation: false,
|
|
183
|
-
name: item.pointName,
|
|
184
|
-
type: 'line',
|
|
297
|
+
name: "".concat(item.deviceName, "-").concat(item.pointName),
|
|
298
|
+
type: interval == 0 ? 'scatter' : 'line',
|
|
185
299
|
unit: item.unit,
|
|
186
300
|
yAxisIndex: yAxisData.findIndex(function (yAxis) {
|
|
187
301
|
return yAxis.pointEnumId === item.pointEnumId;
|
|
188
302
|
}),
|
|
189
303
|
smooth: false,
|
|
304
|
+
showAllSymbol: true,
|
|
305
|
+
symbolSize: 1.5,
|
|
190
306
|
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
|
-
};
|
|
307
|
+
return [new Date(dataItem.ts).getTime(), dataItem.val];
|
|
195
308
|
}),
|
|
196
309
|
markPoint: {
|
|
197
310
|
data: [{
|
|
@@ -237,15 +350,16 @@ var DialogHistory = function DialogHistory(_ref) {
|
|
|
237
350
|
var colorSpan = function colorSpan(color) {
|
|
238
351
|
return "<i class=\"echart-circlepoint\" style=\"background: ".concat(color, "\"></i>");
|
|
239
352
|
};
|
|
240
|
-
var text = "".concat(moment(params[0].
|
|
353
|
+
var text = "".concat(moment(params[0].axisValueLabel).format(interval < 1 ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD HH:mm'), "<br/>");
|
|
241
354
|
for (var i = 0; i < params.length; i += 1) {
|
|
242
|
-
text += "".concat(colorSpan(params[i].color), " ").concat(params[i].seriesName, "\uFF1A").concat(params[i].
|
|
355
|
+
text += "".concat(colorSpan(params[i].color), " ").concat(params[i].seriesName, "\uFF1A").concat(params[i].data[1] === null ? '无数据' : params[i].data[1], " <br/>");
|
|
243
356
|
}
|
|
244
357
|
return text;
|
|
245
358
|
}
|
|
246
359
|
},
|
|
247
360
|
yAxis: yAxisData,
|
|
248
361
|
xAxis: {
|
|
362
|
+
type: 'time',
|
|
249
363
|
axisLabel: {
|
|
250
364
|
formatter: function formatter(value) {
|
|
251
365
|
return moment(value).format('YYYY-MM-DD HH:mm');
|
|
@@ -253,8 +367,8 @@ var DialogHistory = function DialogHistory(_ref) {
|
|
|
253
367
|
},
|
|
254
368
|
splitLine: {
|
|
255
369
|
show: false
|
|
256
|
-
}
|
|
257
|
-
data: xAxisData
|
|
370
|
+
}
|
|
371
|
+
// data: xAxisData,
|
|
258
372
|
},
|
|
259
373
|
series: series
|
|
260
374
|
});
|
|
@@ -263,81 +377,97 @@ var DialogHistory = function DialogHistory(_ref) {
|
|
|
263
377
|
setIsNoData(true);
|
|
264
378
|
message.error(res.message);
|
|
265
379
|
}
|
|
266
|
-
|
|
380
|
+
_context2.next = 26;
|
|
267
381
|
break;
|
|
268
|
-
case
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
console.error(
|
|
382
|
+
case 21:
|
|
383
|
+
_context2.prev = 21;
|
|
384
|
+
_context2.t0 = _context2["catch"](9);
|
|
385
|
+
console.error(_context2.t0);
|
|
272
386
|
setIsNoData(true);
|
|
273
387
|
setChartOptions(undefined);
|
|
274
|
-
case
|
|
275
|
-
|
|
388
|
+
case 26:
|
|
389
|
+
_context2.prev = 26;
|
|
276
390
|
setLoading(false);
|
|
277
|
-
return
|
|
278
|
-
case
|
|
391
|
+
return _context2.finish(26);
|
|
392
|
+
case 29:
|
|
279
393
|
case "end":
|
|
280
|
-
return
|
|
394
|
+
return _context2.stop();
|
|
281
395
|
}
|
|
282
|
-
},
|
|
396
|
+
}, _callee2, null, [[9, 21, 26, 29]]);
|
|
283
397
|
}));
|
|
284
398
|
return function (_x, _x2, _x3) {
|
|
285
|
-
return
|
|
399
|
+
return _ref3.apply(this, arguments);
|
|
286
400
|
};
|
|
287
401
|
}(), []);
|
|
288
402
|
var _useDebounceFn = useDebounceFn(fetchPointHistory, {
|
|
289
403
|
wait: 700
|
|
290
404
|
}),
|
|
291
405
|
fetchPointHistoryDebounce = _useDebounceFn.run;
|
|
292
|
-
var
|
|
293
|
-
var
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
406
|
+
var handleSubmit = /*#__PURE__*/function () {
|
|
407
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
408
|
+
var _yield$form$validateF, dateRange, interval;
|
|
409
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
410
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
411
|
+
case 0:
|
|
412
|
+
_context3.next = 2;
|
|
413
|
+
return form.validateFields();
|
|
414
|
+
case 2:
|
|
415
|
+
_yield$form$validateF = _context3.sent;
|
|
416
|
+
dateRange = _yield$form$validateF.dateRange;
|
|
417
|
+
interval = _yield$form$validateF.interval;
|
|
418
|
+
fetchPointHistoryDebounce(pointIdList, dateRange, interval);
|
|
419
|
+
case 6:
|
|
420
|
+
case "end":
|
|
421
|
+
return _context3.stop();
|
|
422
|
+
}
|
|
423
|
+
}, _callee3);
|
|
424
|
+
}));
|
|
425
|
+
return function handleSubmit() {
|
|
426
|
+
return _ref4.apply(this, arguments);
|
|
427
|
+
};
|
|
428
|
+
}();
|
|
300
429
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
430
|
+
/** 查看原始数据 */
|
|
431
|
+
var checkOriginalData = function checkOriginalData() {
|
|
432
|
+
form.setFieldsValue({
|
|
433
|
+
interval: 0
|
|
434
|
+
});
|
|
435
|
+
setIsCheckAlarm(true);
|
|
436
|
+
var _form$getFieldsValue2 = form.getFieldsValue(),
|
|
437
|
+
dateRange = _form$getFieldsValue2.dateRange,
|
|
438
|
+
interval = _form$getFieldsValue2.interval;
|
|
439
|
+
fetchPointHistoryDebounce(pointIdList, dateRange, interval);
|
|
440
|
+
};
|
|
311
441
|
|
|
312
442
|
/** 打开弹框,初始化数据,获取曲线图形 */
|
|
313
443
|
useEffect(function () {
|
|
314
444
|
if (visible && (pointIdListProp === null || pointIdListProp === void 0 ? void 0 : pointIdListProp.length)) {
|
|
315
445
|
var ranges = dateRangeProp || [moment().subtract(1, 'days'), moment()];
|
|
446
|
+
var interval = typeof intervalProp === 'number' && intervalProp ? intervalProp : defaultInterval;
|
|
316
447
|
form.setFieldsValue({
|
|
317
448
|
dateRange: ranges,
|
|
318
|
-
interval:
|
|
449
|
+
interval: interval
|
|
319
450
|
});
|
|
320
|
-
|
|
451
|
+
setPointIdList(pointIdListProp);
|
|
452
|
+
fetchPointHistoryDebounce(pointIdListProp, ranges, interval);
|
|
321
453
|
}
|
|
322
|
-
}, [visible, form, pointIdListProp, dateRangeProp, intervalProp
|
|
454
|
+
}, [visible, form, pointIdListProp, dateRangeProp, intervalProp]);
|
|
323
455
|
return /*#__PURE__*/React.createElement(Modal, {
|
|
324
456
|
title: "\u5386\u53F2\u6570\u636E\u66F2\u7EBF",
|
|
325
|
-
|
|
457
|
+
visible: visible,
|
|
326
458
|
closable: true,
|
|
327
459
|
width: 1300,
|
|
328
|
-
zIndex: 42000,
|
|
329
460
|
footer: null,
|
|
330
461
|
onCancel: closeModal,
|
|
331
462
|
afterClose: closeModal,
|
|
332
|
-
getContainer:
|
|
463
|
+
getContainer: getContainer
|
|
333
464
|
}, /*#__PURE__*/React.createElement(Form, {
|
|
334
|
-
onValuesChange: function onValuesChange(changedValues, values) {
|
|
335
|
-
return handleFormChange(values);
|
|
336
|
-
},
|
|
337
|
-
layout: "inline",
|
|
338
465
|
requiredMark: false,
|
|
339
466
|
form: form,
|
|
340
467
|
name: "form"
|
|
468
|
+
}, /*#__PURE__*/React.createElement(Space, {
|
|
469
|
+
size: 30,
|
|
470
|
+
align: 'center'
|
|
341
471
|
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
342
472
|
name: "dateRange",
|
|
343
473
|
label: "\u65F6\u95F4\u8303\u56F4",
|
|
@@ -353,9 +483,6 @@ var DialogHistory = function DialogHistory(_ref) {
|
|
|
353
483
|
showTime: {
|
|
354
484
|
format: 'HH:mm'
|
|
355
485
|
},
|
|
356
|
-
getPopupContainer: function getPopupContainer(node) {
|
|
357
|
-
return node;
|
|
358
|
-
},
|
|
359
486
|
allowClear: false,
|
|
360
487
|
ranges: {
|
|
361
488
|
近一天: [moment().subtract(1, 'day'), moment()],
|
|
@@ -376,9 +503,24 @@ var DialogHistory = function DialogHistory(_ref) {
|
|
|
376
503
|
}, /*#__PURE__*/React.createElement(InputNumber, {
|
|
377
504
|
disabled: loading,
|
|
378
505
|
placeholder: "\u8BF7\u8F93\u5165\u6B63\u6574\u6570"
|
|
379
|
-
}))
|
|
506
|
+
})), /*#__PURE__*/React.createElement(Form.Item, null, /*#__PURE__*/React.createElement(Button, {
|
|
507
|
+
type: 'primary',
|
|
508
|
+
onClick: handleSubmit
|
|
509
|
+
}, "\u67E5\u8BE2"))), isSinglePoint ? /*#__PURE__*/React.createElement("div", {
|
|
510
|
+
key: 'singlePointSetBox'
|
|
511
|
+
}, /*#__PURE__*/React.createElement(Space, {
|
|
512
|
+
size: 30,
|
|
513
|
+
align: 'center'
|
|
514
|
+
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
515
|
+
label: "\u6DFB\u52A0\u5BF9\u6BD4"
|
|
516
|
+
}, /*#__PURE__*/React.createElement(Link, {
|
|
517
|
+
onClick: function onClick() {
|
|
518
|
+
setVisiblePointSet(true);
|
|
519
|
+
}
|
|
520
|
+
}, "\u6DFB\u52A0\u5C5E\u6027")))) : null), /*#__PURE__*/React.createElement("div", {
|
|
380
521
|
className: styles['chart-wrap']
|
|
381
522
|
}, /*#__PURE__*/React.createElement(Echarts, {
|
|
523
|
+
ref: chart,
|
|
382
524
|
option: chartOptions,
|
|
383
525
|
loading: loading,
|
|
384
526
|
style: {
|
|
@@ -388,6 +530,17 @@ var DialogHistory = function DialogHistory(_ref) {
|
|
|
388
530
|
className: styles['chart-empty'],
|
|
389
531
|
image: Empty.PRESENTED_IMAGE_SIMPLE,
|
|
390
532
|
description: "\u6682\u65E0\u70B9\u4F4D\u5386\u53F2\u6570\u636E"
|
|
391
|
-
}))
|
|
533
|
+
})), /*#__PURE__*/React.createElement(ModalChoosePoint, {
|
|
534
|
+
visible: visiblePointSet,
|
|
535
|
+
onSubmit: function onSubmit(val) {
|
|
536
|
+
setPointIdList(function (pre) {
|
|
537
|
+
return _toConsumableArray(new Set([].concat(_toConsumableArray(pre), _toConsumableArray(val))));
|
|
538
|
+
});
|
|
539
|
+
},
|
|
540
|
+
companyId: companyId,
|
|
541
|
+
onCancel: function onCancel() {
|
|
542
|
+
setVisiblePointSet(false);
|
|
543
|
+
}
|
|
544
|
+
}));
|
|
392
545
|
};
|
|
393
|
-
export default
|
|
546
|
+
export default DialogPointHistory;
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
+
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; }
|
|
4
|
+
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); }
|
|
5
|
+
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); }); }; }
|
|
6
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
7
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
8
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
9
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
10
|
+
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; } }
|
|
11
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
12
|
+
import React from "react";
|
|
13
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
14
|
+
import { Modal, Button, Form, Space, message, Select } from 'antd';
|
|
15
|
+
import { GetDevicePoint } from "../../services/gateway/Device";
|
|
16
|
+
import { GetColdChainPermissionDevicePage } from "../../services/project/ProjectUserPermission";
|
|
17
|
+
import { useQuery } from "../../hooks";
|
|
18
|
+
var Option = Select.Option;
|
|
19
|
+
var tailLayout = {
|
|
20
|
+
wrapperCol: {
|
|
21
|
+
offset: 2,
|
|
22
|
+
span: 22
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
var ModalChoosePoint = function ModalChoosePoint(_ref) {
|
|
26
|
+
var visible = _ref.visible,
|
|
27
|
+
onSubmit = _ref.onSubmit,
|
|
28
|
+
onCancel = _ref.onCancel,
|
|
29
|
+
companyId = _ref.companyId;
|
|
30
|
+
var _Form$useForm = Form.useForm(),
|
|
31
|
+
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
32
|
+
form = _Form$useForm2[0];
|
|
33
|
+
/** 设备列表 */
|
|
34
|
+
var _useState = useState([]),
|
|
35
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
36
|
+
deviceList = _useState2[0],
|
|
37
|
+
setDeviceList = _useState2[1];
|
|
38
|
+
/** 产品点位列表 */
|
|
39
|
+
var _useState3 = useState([]),
|
|
40
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
41
|
+
pointList = _useState4[0],
|
|
42
|
+
setPointList = _useState4[1];
|
|
43
|
+
var query = useQuery();
|
|
44
|
+
var closeModal = function closeModal() {
|
|
45
|
+
form.resetFields();
|
|
46
|
+
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/** 获取产品最新发布版本点位列表 */
|
|
50
|
+
var fetchPointList = useCallback(/*#__PURE__*/function () {
|
|
51
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(val) {
|
|
52
|
+
var res;
|
|
53
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
54
|
+
while (1) switch (_context.prev = _context.next) {
|
|
55
|
+
case 0:
|
|
56
|
+
_context.prev = 0;
|
|
57
|
+
_context.next = 3;
|
|
58
|
+
return GetDevicePoint({
|
|
59
|
+
deviceIdList: [val]
|
|
60
|
+
});
|
|
61
|
+
case 3:
|
|
62
|
+
res = _context.sent;
|
|
63
|
+
if (res.success) {
|
|
64
|
+
setPointList(res.data || []);
|
|
65
|
+
} else {
|
|
66
|
+
message.error(res.message);
|
|
67
|
+
}
|
|
68
|
+
_context.next = 11;
|
|
69
|
+
break;
|
|
70
|
+
case 7:
|
|
71
|
+
_context.prev = 7;
|
|
72
|
+
_context.t0 = _context["catch"](0);
|
|
73
|
+
console.error(_context.t0);
|
|
74
|
+
message.error('获取属性列表失败');
|
|
75
|
+
case 11:
|
|
76
|
+
case "end":
|
|
77
|
+
return _context.stop();
|
|
78
|
+
}
|
|
79
|
+
}, _callee, null, [[0, 7]]);
|
|
80
|
+
}));
|
|
81
|
+
return function (_x) {
|
|
82
|
+
return _ref2.apply(this, arguments);
|
|
83
|
+
};
|
|
84
|
+
}(), []);
|
|
85
|
+
|
|
86
|
+
/** 获取设备列表 */
|
|
87
|
+
var fetchDeviceList = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
88
|
+
var res, _res$data;
|
|
89
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
90
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
91
|
+
case 0:
|
|
92
|
+
_context2.prev = 0;
|
|
93
|
+
_context2.next = 3;
|
|
94
|
+
return GetColdChainPermissionDevicePage({
|
|
95
|
+
companyId: Number(query.companyId),
|
|
96
|
+
projectId: Number(query.projectId),
|
|
97
|
+
isPermission: true
|
|
98
|
+
});
|
|
99
|
+
case 3:
|
|
100
|
+
res = _context2.sent;
|
|
101
|
+
if (res.success) {
|
|
102
|
+
setDeviceList(((_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.list) || []);
|
|
103
|
+
} else {
|
|
104
|
+
message.error(res.message);
|
|
105
|
+
}
|
|
106
|
+
_context2.next = 10;
|
|
107
|
+
break;
|
|
108
|
+
case 7:
|
|
109
|
+
_context2.prev = 7;
|
|
110
|
+
_context2.t0 = _context2["catch"](0);
|
|
111
|
+
message.error('获取设备列表失败');
|
|
112
|
+
case 10:
|
|
113
|
+
case "end":
|
|
114
|
+
return _context2.stop();
|
|
115
|
+
}
|
|
116
|
+
}, _callee2, null, [[0, 7]]);
|
|
117
|
+
})), [query]);
|
|
118
|
+
|
|
119
|
+
/** 提交表单且数据验证成功后回调事件 */
|
|
120
|
+
var onFinish = /*#__PURE__*/function () {
|
|
121
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(val) {
|
|
122
|
+
var _val$pointIdList;
|
|
123
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
124
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
125
|
+
case 0:
|
|
126
|
+
if ((_val$pointIdList = val.pointIdList) === null || _val$pointIdList === void 0 ? void 0 : _val$pointIdList.length) {
|
|
127
|
+
onSubmit(val.pointIdList);
|
|
128
|
+
closeModal();
|
|
129
|
+
} else {
|
|
130
|
+
message.error('请至少选择一个属性');
|
|
131
|
+
}
|
|
132
|
+
case 1:
|
|
133
|
+
case "end":
|
|
134
|
+
return _context3.stop();
|
|
135
|
+
}
|
|
136
|
+
}, _callee3);
|
|
137
|
+
}));
|
|
138
|
+
return function onFinish(_x2) {
|
|
139
|
+
return _ref4.apply(this, arguments);
|
|
140
|
+
};
|
|
141
|
+
}();
|
|
142
|
+
useEffect(function () {
|
|
143
|
+
if (visible && !deviceList.length) {
|
|
144
|
+
fetchDeviceList();
|
|
145
|
+
}
|
|
146
|
+
}, [visible, deviceList.length]);
|
|
147
|
+
return /*#__PURE__*/React.createElement(Modal, {
|
|
148
|
+
title: '选择属性',
|
|
149
|
+
closable: false,
|
|
150
|
+
width: 300,
|
|
151
|
+
maskClosable: true,
|
|
152
|
+
footer: null,
|
|
153
|
+
onCancel: closeModal,
|
|
154
|
+
visible: visible,
|
|
155
|
+
wrapClassName: 'form-modal'
|
|
156
|
+
}, /*#__PURE__*/React.createElement(Form, {
|
|
157
|
+
layout: "vertical",
|
|
158
|
+
form: form,
|
|
159
|
+
name: "filterForm",
|
|
160
|
+
onFinish: onFinish,
|
|
161
|
+
initialValues: {
|
|
162
|
+
type: 1
|
|
163
|
+
}
|
|
164
|
+
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
165
|
+
name: "deviceId",
|
|
166
|
+
label: "\u8BBE\u5907",
|
|
167
|
+
rules: [{
|
|
168
|
+
required: true,
|
|
169
|
+
message: '请选择'
|
|
170
|
+
}]
|
|
171
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
172
|
+
placeholder: "\u8BF7\u9009\u62E9",
|
|
173
|
+
onChange: function onChange(value) {
|
|
174
|
+
fetchPointList(value);
|
|
175
|
+
form.setFieldsValue({
|
|
176
|
+
pointIdList: []
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}, deviceList.map(function (item) {
|
|
180
|
+
return /*#__PURE__*/React.createElement(Option, {
|
|
181
|
+
value: item.deviceId,
|
|
182
|
+
label: item.deviceName,
|
|
183
|
+
key: item.deviceId
|
|
184
|
+
}, item.deviceName);
|
|
185
|
+
}))), /*#__PURE__*/React.createElement(Form.Item, {
|
|
186
|
+
noStyle: true,
|
|
187
|
+
dependencies: ['deviceId']
|
|
188
|
+
}, function (_ref5) {
|
|
189
|
+
var getFieldValue = _ref5.getFieldValue;
|
|
190
|
+
return /*#__PURE__*/React.createElement(Form.Item, {
|
|
191
|
+
name: "pointIdList",
|
|
192
|
+
label: "\u5C5E\u6027",
|
|
193
|
+
rules: [{
|
|
194
|
+
required: true,
|
|
195
|
+
message: '请选择'
|
|
196
|
+
}]
|
|
197
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
198
|
+
allowClear: true,
|
|
199
|
+
mode: 'multiple',
|
|
200
|
+
showSearch: true,
|
|
201
|
+
optionFilterProp: "label",
|
|
202
|
+
placeholder: "\u8BF7\u9009\u62E9",
|
|
203
|
+
disabled: !getFieldValue('deviceId')
|
|
204
|
+
}, pointList.map(function (item) {
|
|
205
|
+
return /*#__PURE__*/React.createElement(Option, {
|
|
206
|
+
value: item.pointId,
|
|
207
|
+
label: item.pointName,
|
|
208
|
+
key: item.pointId
|
|
209
|
+
}, item.pointName);
|
|
210
|
+
})));
|
|
211
|
+
}), /*#__PURE__*/React.createElement(Form.Item, _extends({}, tailLayout, {
|
|
212
|
+
noStyle: true,
|
|
213
|
+
className: "modelFooterItem"
|
|
214
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
215
|
+
className: "form-modal-footer"
|
|
216
|
+
}, /*#__PURE__*/React.createElement(Space, {
|
|
217
|
+
align: "center",
|
|
218
|
+
size: 15
|
|
219
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
220
|
+
onClick: onCancel,
|
|
221
|
+
htmlType: "button",
|
|
222
|
+
style: {
|
|
223
|
+
float: 'right'
|
|
224
|
+
}
|
|
225
|
+
}, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button, {
|
|
226
|
+
type: "primary",
|
|
227
|
+
htmlType: "submit",
|
|
228
|
+
style: {
|
|
229
|
+
float: 'right'
|
|
230
|
+
}
|
|
231
|
+
}, "\u786E\u5B9A"))))));
|
|
232
|
+
};
|
|
233
|
+
export default ModalChoosePoint;
|
package/es/services/request.js
CHANGED
|
@@ -92,7 +92,7 @@ export function setRequrl(val) {
|
|
|
92
92
|
reqUrl = val;
|
|
93
93
|
}
|
|
94
94
|
var requestPrefixMap = {
|
|
95
|
-
dev: '',
|
|
95
|
+
dev: 'https://dev.sinocold.com:30443',
|
|
96
96
|
prod: 'https://iot.sinocold.net',
|
|
97
97
|
staging: 'https://dev.sinocold.com:30443',
|
|
98
98
|
generalfushi: 'https://iot.generalfushi.com'
|
package/es/typings.d.ts
CHANGED
|
@@ -29,30 +29,34 @@ type EditorQuery =
|
|
|
29
29
|
scadaType: '0' | '1';
|
|
30
30
|
/** 来源 */
|
|
31
31
|
from?: string;
|
|
32
|
+
/** 公司 id */
|
|
33
|
+
companyId: string;
|
|
32
34
|
/** 项目 id */
|
|
33
35
|
projectId?: string;
|
|
34
36
|
}
|
|
35
37
|
| {
|
|
36
38
|
scene: 'device';
|
|
39
|
+
/** 公司 id */
|
|
40
|
+
companyId: string;
|
|
41
|
+
/** 项目 id */
|
|
42
|
+
projectId?: string;
|
|
37
43
|
/** scene = 'device' 时传设备 id */
|
|
38
44
|
deviceId: string;
|
|
39
45
|
/** 组态类型:web | app */
|
|
40
46
|
scadaType: '0' | '1';
|
|
41
47
|
/** 来源 */
|
|
42
48
|
from?: string;
|
|
43
|
-
/** 项目 id */
|
|
44
|
-
projectId?: string;
|
|
45
49
|
}
|
|
46
50
|
| {
|
|
47
51
|
scene: 'freedom';
|
|
48
52
|
/** 组态 id */
|
|
49
53
|
scadaId: string;
|
|
50
|
-
/** 公司 id */
|
|
51
|
-
companyId: string;
|
|
52
54
|
/** 组态标题 */
|
|
53
55
|
title: string;
|
|
54
56
|
/** 来源 */
|
|
55
57
|
from?: string;
|
|
58
|
+
/** 公司 id */
|
|
59
|
+
companyId: string;
|
|
56
60
|
/** 项目 id */
|
|
57
61
|
projectId?: string;
|
|
58
62
|
};
|