coolcare-lite-scada-component 1.0.21 → 1.0.23
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
20
|
import { GetPointHistoryData } from "../../services/gateway/Point";
|
|
21
|
+
import ModalChoosePoint from "../ModalChoosePoint";
|
|
17
22
|
import Echarts from "../ECharts";
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
|
|
18
25
|
import styles from "./index.css";
|
|
26
|
+
var Link = Typography.Link;
|
|
19
27
|
var RangePicker = DatePicker.RangePicker;
|
|
20
28
|
var defaultInterval = 2;
|
|
21
29
|
|
|
@@ -26,15 +34,21 @@ 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,
|
|
47
|
+
projectId = _ref.projectId;
|
|
35
48
|
var _Form$useForm = Form.useForm(),
|
|
36
49
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
37
50
|
form = _Form$useForm2[0];
|
|
51
|
+
var chart = useRef();
|
|
38
52
|
var _useState = useState(false),
|
|
39
53
|
_useState2 = _slicedToArray(_useState, 2),
|
|
40
54
|
isNoData = _useState2[0],
|
|
@@ -44,16 +58,34 @@ var DialogHistory = function DialogHistory(_ref) {
|
|
|
44
58
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
45
59
|
loading = _useState4[0],
|
|
46
60
|
setLoading = _useState4[1];
|
|
47
|
-
/**
|
|
48
|
-
var _useState5 = useState(
|
|
61
|
+
/** 添加对比点位弹框 */
|
|
62
|
+
var _useState5 = useState(false),
|
|
49
63
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
50
|
-
|
|
51
|
-
|
|
64
|
+
visiblePointSet = _useState6[0],
|
|
65
|
+
setVisiblePointSet = _useState6[1];
|
|
66
|
+
/** 曲线图配置 */
|
|
67
|
+
var _useState7 = useState(undefined),
|
|
68
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
69
|
+
chartOptions = _useState8[0],
|
|
70
|
+
setChartOptions = _useState8[1];
|
|
71
|
+
/** 当前点位列表 */
|
|
72
|
+
var _useState9 = useState([]),
|
|
73
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
74
|
+
pointIdList = _useState10[0],
|
|
75
|
+
setPointIdList = _useState10[1];
|
|
76
|
+
/** 当前点位时间段内是否有报警 */
|
|
77
|
+
var _useState11 = useState(false),
|
|
78
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
79
|
+
haveAlarm = _useState12[0],
|
|
80
|
+
setHaveAlarm = _useState12[1];
|
|
52
81
|
var closeModal = function closeModal() {
|
|
53
82
|
form.resetFields();
|
|
54
83
|
setLoading(false);
|
|
55
84
|
setChartOptions(undefined);
|
|
56
85
|
setIsNoData(false);
|
|
86
|
+
setVisiblePointSet(false);
|
|
87
|
+
setHaveAlarm(false);
|
|
88
|
+
setPointIdList([]);
|
|
57
89
|
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
58
90
|
};
|
|
59
91
|
|
|
@@ -68,21 +100,35 @@ var DialogHistory = function DialogHistory(_ref) {
|
|
|
68
100
|
_context.next = 3;
|
|
69
101
|
break;
|
|
70
102
|
}
|
|
71
|
-
message.
|
|
103
|
+
message.info('请至少查询一个点位');
|
|
72
104
|
return _context.abrupt("return");
|
|
73
105
|
case 3:
|
|
74
|
-
|
|
106
|
+
if (!(ranges.length !== 2)) {
|
|
107
|
+
_context.next = 6;
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
message.info('请选择时间范围');
|
|
111
|
+
return _context.abrupt("return");
|
|
112
|
+
case 6:
|
|
113
|
+
if (!(typeof interval !== 'number' || interval < 0)) {
|
|
114
|
+
_context.next = 9;
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
message.info('请正确输入时间间隔');
|
|
118
|
+
return _context.abrupt("return");
|
|
119
|
+
case 9:
|
|
120
|
+
_context.prev = 9;
|
|
75
121
|
diff = moment(ranges[1]).valueOf() - moment(ranges[0]).valueOf();
|
|
76
122
|
if (!(diff > oneYearTime)) {
|
|
77
|
-
_context.next =
|
|
123
|
+
_context.next = 14;
|
|
78
124
|
break;
|
|
79
125
|
}
|
|
80
126
|
message.error('历史数据最大查询范围是一年');
|
|
81
127
|
return _context.abrupt("return");
|
|
82
|
-
case
|
|
128
|
+
case 14:
|
|
83
129
|
// 获取点位数据
|
|
84
130
|
setLoading(true);
|
|
85
|
-
_context.next =
|
|
131
|
+
_context.next = 17;
|
|
86
132
|
return GetPointHistoryData({
|
|
87
133
|
timeQuantum: {
|
|
88
134
|
startDate: moment(ranges[0]).format('YYYY-MM-DD HH:mm'),
|
|
@@ -91,7 +137,7 @@ var DialogHistory = function DialogHistory(_ref) {
|
|
|
91
137
|
pointIdList: idList,
|
|
92
138
|
interval: interval
|
|
93
139
|
});
|
|
94
|
-
case
|
|
140
|
+
case 17:
|
|
95
141
|
res = _context.sent;
|
|
96
142
|
if (res.success) {
|
|
97
143
|
data = res.data;
|
|
@@ -112,7 +158,11 @@ var DialogHistory = function DialogHistory(_ref) {
|
|
|
112
158
|
setIsNoData(false);
|
|
113
159
|
}
|
|
114
160
|
data.forEach(function (item) {
|
|
115
|
-
var _item$pointDataList, _item$pointDataList2;
|
|
161
|
+
var _item$pointAlarmTimeF, _item$pointDataList, _item$pointDataList2;
|
|
162
|
+
// @ts-ignore
|
|
163
|
+
if ((_item$pointAlarmTimeF = item.pointAlarmTimeFrameList) === null || _item$pointAlarmTimeF === void 0 ? void 0 : _item$pointAlarmTimeF.length) {
|
|
164
|
+
setHaveAlarm(true);
|
|
165
|
+
}
|
|
116
166
|
var pointEnumId = item.pointEnumId,
|
|
117
167
|
pointEnumItemList = item.pointEnumItemList;
|
|
118
168
|
var unit = item.unit;
|
|
@@ -180,18 +230,17 @@ var DialogHistory = function DialogHistory(_ref) {
|
|
|
180
230
|
// 配置曲线数据
|
|
181
231
|
series.push({
|
|
182
232
|
animation: false,
|
|
183
|
-
name: item.pointName,
|
|
184
|
-
type: 'line',
|
|
233
|
+
name: "".concat(item.deviceName, "-").concat(item.pointName),
|
|
234
|
+
type: interval == 0 ? 'scatter' : 'line',
|
|
185
235
|
unit: item.unit,
|
|
186
236
|
yAxisIndex: yAxisData.findIndex(function (yAxis) {
|
|
187
237
|
return yAxis.pointEnumId === item.pointEnumId;
|
|
188
238
|
}),
|
|
189
239
|
smooth: false,
|
|
240
|
+
showAllSymbol: true,
|
|
241
|
+
symbolSize: 1.5,
|
|
190
242
|
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
|
-
};
|
|
243
|
+
return [new Date(dataItem.ts).getTime(), dataItem.val];
|
|
195
244
|
}),
|
|
196
245
|
markPoint: {
|
|
197
246
|
data: [{
|
|
@@ -237,15 +286,16 @@ var DialogHistory = function DialogHistory(_ref) {
|
|
|
237
286
|
var colorSpan = function colorSpan(color) {
|
|
238
287
|
return "<i class=\"echart-circlepoint\" style=\"background: ".concat(color, "\"></i>");
|
|
239
288
|
};
|
|
240
|
-
var text = "".concat(moment(params[0].
|
|
289
|
+
var text = "".concat(moment(params[0].axisValueLabel).format(interval < 1 ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD HH:mm'), "<br/>");
|
|
241
290
|
for (var i = 0; i < params.length; i += 1) {
|
|
242
|
-
text += "".concat(colorSpan(params[i].color), " ").concat(params[i].seriesName, "\uFF1A").concat(params[i].
|
|
291
|
+
text += "".concat(colorSpan(params[i].color), " ").concat(params[i].seriesName, "\uFF1A").concat(params[i].data[1] === null ? '无数据' : params[i].data[1], " <br/>");
|
|
243
292
|
}
|
|
244
293
|
return text;
|
|
245
294
|
}
|
|
246
295
|
},
|
|
247
296
|
yAxis: yAxisData,
|
|
248
297
|
xAxis: {
|
|
298
|
+
type: 'time',
|
|
249
299
|
axisLabel: {
|
|
250
300
|
formatter: function formatter(value) {
|
|
251
301
|
return moment(value).format('YYYY-MM-DD HH:mm');
|
|
@@ -253,8 +303,8 @@ var DialogHistory = function DialogHistory(_ref) {
|
|
|
253
303
|
},
|
|
254
304
|
splitLine: {
|
|
255
305
|
show: false
|
|
256
|
-
}
|
|
257
|
-
data: xAxisData
|
|
306
|
+
}
|
|
307
|
+
// data: xAxisData,
|
|
258
308
|
},
|
|
259
309
|
series: series
|
|
260
310
|
});
|
|
@@ -263,23 +313,23 @@ var DialogHistory = function DialogHistory(_ref) {
|
|
|
263
313
|
setIsNoData(true);
|
|
264
314
|
message.error(res.message);
|
|
265
315
|
}
|
|
266
|
-
_context.next =
|
|
316
|
+
_context.next = 26;
|
|
267
317
|
break;
|
|
268
|
-
case
|
|
269
|
-
_context.prev =
|
|
270
|
-
_context.t0 = _context["catch"](
|
|
318
|
+
case 21:
|
|
319
|
+
_context.prev = 21;
|
|
320
|
+
_context.t0 = _context["catch"](9);
|
|
271
321
|
console.error(_context.t0);
|
|
272
322
|
setIsNoData(true);
|
|
273
323
|
setChartOptions(undefined);
|
|
274
|
-
case
|
|
275
|
-
_context.prev =
|
|
324
|
+
case 26:
|
|
325
|
+
_context.prev = 26;
|
|
276
326
|
setLoading(false);
|
|
277
|
-
return _context.finish(
|
|
278
|
-
case
|
|
327
|
+
return _context.finish(26);
|
|
328
|
+
case 29:
|
|
279
329
|
case "end":
|
|
280
330
|
return _context.stop();
|
|
281
331
|
}
|
|
282
|
-
}, _callee, null, [[
|
|
332
|
+
}, _callee, null, [[9, 21, 26, 29]]);
|
|
283
333
|
}));
|
|
284
334
|
return function (_x, _x2, _x3) {
|
|
285
335
|
return _ref2.apply(this, arguments);
|
|
@@ -289,55 +339,59 @@ var DialogHistory = function DialogHistory(_ref) {
|
|
|
289
339
|
wait: 700
|
|
290
340
|
}),
|
|
291
341
|
fetchPointHistoryDebounce = _useDebounceFn.run;
|
|
292
|
-
var
|
|
293
|
-
var
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
342
|
+
var handleSubmit = /*#__PURE__*/function () {
|
|
343
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
344
|
+
var _yield$form$validateF, dateRange, interval;
|
|
345
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
346
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
347
|
+
case 0:
|
|
348
|
+
_context2.next = 2;
|
|
349
|
+
return form.validateFields();
|
|
350
|
+
case 2:
|
|
351
|
+
_yield$form$validateF = _context2.sent;
|
|
352
|
+
dateRange = _yield$form$validateF.dateRange;
|
|
353
|
+
interval = _yield$form$validateF.interval;
|
|
354
|
+
fetchPointHistoryDebounce(pointIdList, dateRange, interval);
|
|
355
|
+
case 6:
|
|
356
|
+
case "end":
|
|
357
|
+
return _context2.stop();
|
|
358
|
+
}
|
|
359
|
+
}, _callee2);
|
|
360
|
+
}));
|
|
361
|
+
return function handleSubmit() {
|
|
362
|
+
return _ref3.apply(this, arguments);
|
|
363
|
+
};
|
|
364
|
+
}();
|
|
311
365
|
|
|
312
366
|
/** 打开弹框,初始化数据,获取曲线图形 */
|
|
313
367
|
useEffect(function () {
|
|
314
368
|
if (visible && (pointIdListProp === null || pointIdListProp === void 0 ? void 0 : pointIdListProp.length)) {
|
|
315
369
|
var ranges = dateRangeProp || [moment().subtract(1, 'days'), moment()];
|
|
370
|
+
var interval = typeof intervalProp === 'number' && intervalProp ? intervalProp : defaultInterval;
|
|
316
371
|
form.setFieldsValue({
|
|
317
372
|
dateRange: ranges,
|
|
318
|
-
interval:
|
|
373
|
+
interval: interval
|
|
319
374
|
});
|
|
320
|
-
|
|
375
|
+
setPointIdList(pointIdListProp);
|
|
376
|
+
fetchPointHistoryDebounce(pointIdListProp, ranges, interval);
|
|
321
377
|
}
|
|
322
|
-
}, [visible, form, pointIdListProp, dateRangeProp, intervalProp
|
|
378
|
+
}, [visible, form, pointIdListProp, dateRangeProp, intervalProp]);
|
|
323
379
|
return /*#__PURE__*/React.createElement(Modal, {
|
|
324
380
|
title: "\u5386\u53F2\u6570\u636E\u66F2\u7EBF",
|
|
325
|
-
|
|
381
|
+
visible: visible,
|
|
326
382
|
closable: true,
|
|
327
383
|
width: 1300,
|
|
328
|
-
zIndex: 42000,
|
|
329
384
|
footer: null,
|
|
330
385
|
onCancel: closeModal,
|
|
331
386
|
afterClose: closeModal,
|
|
332
|
-
getContainer:
|
|
387
|
+
getContainer: getContainer
|
|
333
388
|
}, /*#__PURE__*/React.createElement(Form, {
|
|
334
|
-
onValuesChange: function onValuesChange(changedValues, values) {
|
|
335
|
-
return handleFormChange(values);
|
|
336
|
-
},
|
|
337
|
-
layout: "inline",
|
|
338
389
|
requiredMark: false,
|
|
339
390
|
form: form,
|
|
340
391
|
name: "form"
|
|
392
|
+
}, /*#__PURE__*/React.createElement(Space, {
|
|
393
|
+
size: 30,
|
|
394
|
+
align: 'center'
|
|
341
395
|
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
342
396
|
name: "dateRange",
|
|
343
397
|
label: "\u65F6\u95F4\u8303\u56F4",
|
|
@@ -353,9 +407,6 @@ var DialogHistory = function DialogHistory(_ref) {
|
|
|
353
407
|
showTime: {
|
|
354
408
|
format: 'HH:mm'
|
|
355
409
|
},
|
|
356
|
-
getPopupContainer: function getPopupContainer(node) {
|
|
357
|
-
return node;
|
|
358
|
-
},
|
|
359
410
|
allowClear: false,
|
|
360
411
|
ranges: {
|
|
361
412
|
近一天: [moment().subtract(1, 'day'), moment()],
|
|
@@ -376,9 +427,24 @@ var DialogHistory = function DialogHistory(_ref) {
|
|
|
376
427
|
}, /*#__PURE__*/React.createElement(InputNumber, {
|
|
377
428
|
disabled: loading,
|
|
378
429
|
placeholder: "\u8BF7\u8F93\u5165\u6B63\u6574\u6570"
|
|
379
|
-
}))
|
|
430
|
+
})), /*#__PURE__*/React.createElement(Form.Item, null, /*#__PURE__*/React.createElement(Button, {
|
|
431
|
+
type: 'primary',
|
|
432
|
+
onClick: handleSubmit
|
|
433
|
+
}, "\u67E5\u8BE2"))), isSinglePoint ? /*#__PURE__*/React.createElement("div", {
|
|
434
|
+
key: 'singlePointSetBox'
|
|
435
|
+
}, /*#__PURE__*/React.createElement(Space, {
|
|
436
|
+
size: 30,
|
|
437
|
+
align: 'center'
|
|
438
|
+
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
439
|
+
label: "\u6DFB\u52A0\u5BF9\u6BD4"
|
|
440
|
+
}, /*#__PURE__*/React.createElement(Link, {
|
|
441
|
+
onClick: function onClick() {
|
|
442
|
+
setVisiblePointSet(true);
|
|
443
|
+
}
|
|
444
|
+
}, "\u6DFB\u52A0\u5C5E\u6027")))) : null), /*#__PURE__*/React.createElement("div", {
|
|
380
445
|
className: styles['chart-wrap']
|
|
381
446
|
}, /*#__PURE__*/React.createElement(Echarts, {
|
|
447
|
+
ref: chart,
|
|
382
448
|
option: chartOptions,
|
|
383
449
|
loading: loading,
|
|
384
450
|
style: {
|
|
@@ -388,6 +454,18 @@ var DialogHistory = function DialogHistory(_ref) {
|
|
|
388
454
|
className: styles['chart-empty'],
|
|
389
455
|
image: Empty.PRESENTED_IMAGE_SIMPLE,
|
|
390
456
|
description: "\u6682\u65E0\u70B9\u4F4D\u5386\u53F2\u6570\u636E"
|
|
391
|
-
}))
|
|
457
|
+
})), /*#__PURE__*/React.createElement(ModalChoosePoint, {
|
|
458
|
+
visible: visiblePointSet,
|
|
459
|
+
onSubmit: function onSubmit(val) {
|
|
460
|
+
setPointIdList(function (pre) {
|
|
461
|
+
return _toConsumableArray(new Set([].concat(_toConsumableArray(pre), _toConsumableArray(val))));
|
|
462
|
+
});
|
|
463
|
+
},
|
|
464
|
+
companyId: companyId,
|
|
465
|
+
projectId: projectId,
|
|
466
|
+
onCancel: function onCancel() {
|
|
467
|
+
setVisiblePointSet(false);
|
|
468
|
+
}
|
|
469
|
+
}));
|
|
392
470
|
};
|
|
393
|
-
export default
|
|
471
|
+
export default DialogPointHistory;
|
|
@@ -0,0 +1,234 @@
|
|
|
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
|
+
projectId = _ref.projectId;
|
|
31
|
+
var _Form$useForm = Form.useForm(),
|
|
32
|
+
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
33
|
+
form = _Form$useForm2[0];
|
|
34
|
+
/** 设备列表 */
|
|
35
|
+
var _useState = useState([]),
|
|
36
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
37
|
+
deviceList = _useState2[0],
|
|
38
|
+
setDeviceList = _useState2[1];
|
|
39
|
+
/** 产品点位列表 */
|
|
40
|
+
var _useState3 = useState([]),
|
|
41
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
42
|
+
pointList = _useState4[0],
|
|
43
|
+
setPointList = _useState4[1];
|
|
44
|
+
var query = useQuery();
|
|
45
|
+
var closeModal = function closeModal() {
|
|
46
|
+
form.resetFields();
|
|
47
|
+
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/** 获取产品最新发布版本点位列表 */
|
|
51
|
+
var fetchPointList = useCallback(/*#__PURE__*/function () {
|
|
52
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(val) {
|
|
53
|
+
var res;
|
|
54
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
55
|
+
while (1) switch (_context.prev = _context.next) {
|
|
56
|
+
case 0:
|
|
57
|
+
_context.prev = 0;
|
|
58
|
+
_context.next = 3;
|
|
59
|
+
return GetDevicePoint({
|
|
60
|
+
deviceIdList: [val]
|
|
61
|
+
});
|
|
62
|
+
case 3:
|
|
63
|
+
res = _context.sent;
|
|
64
|
+
if (res.success) {
|
|
65
|
+
setPointList(res.data || []);
|
|
66
|
+
} else {
|
|
67
|
+
message.error(res.message);
|
|
68
|
+
}
|
|
69
|
+
_context.next = 11;
|
|
70
|
+
break;
|
|
71
|
+
case 7:
|
|
72
|
+
_context.prev = 7;
|
|
73
|
+
_context.t0 = _context["catch"](0);
|
|
74
|
+
console.error(_context.t0);
|
|
75
|
+
message.error('获取属性列表失败');
|
|
76
|
+
case 11:
|
|
77
|
+
case "end":
|
|
78
|
+
return _context.stop();
|
|
79
|
+
}
|
|
80
|
+
}, _callee, null, [[0, 7]]);
|
|
81
|
+
}));
|
|
82
|
+
return function (_x) {
|
|
83
|
+
return _ref2.apply(this, arguments);
|
|
84
|
+
};
|
|
85
|
+
}(), []);
|
|
86
|
+
|
|
87
|
+
/** 获取设备列表 */
|
|
88
|
+
var fetchDeviceList = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
89
|
+
var res, _res$data;
|
|
90
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
91
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
92
|
+
case 0:
|
|
93
|
+
_context2.prev = 0;
|
|
94
|
+
_context2.next = 3;
|
|
95
|
+
return GetColdChainPermissionDevicePage({
|
|
96
|
+
companyId: companyId,
|
|
97
|
+
projectId: projectId,
|
|
98
|
+
isPermission: true
|
|
99
|
+
});
|
|
100
|
+
case 3:
|
|
101
|
+
res = _context2.sent;
|
|
102
|
+
if (res.success) {
|
|
103
|
+
setDeviceList(((_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.list) || []);
|
|
104
|
+
} else {
|
|
105
|
+
message.error(res.message);
|
|
106
|
+
}
|
|
107
|
+
_context2.next = 10;
|
|
108
|
+
break;
|
|
109
|
+
case 7:
|
|
110
|
+
_context2.prev = 7;
|
|
111
|
+
_context2.t0 = _context2["catch"](0);
|
|
112
|
+
message.error('获取设备列表失败');
|
|
113
|
+
case 10:
|
|
114
|
+
case "end":
|
|
115
|
+
return _context2.stop();
|
|
116
|
+
}
|
|
117
|
+
}, _callee2, null, [[0, 7]]);
|
|
118
|
+
})), [companyId, projectId]);
|
|
119
|
+
|
|
120
|
+
/** 提交表单且数据验证成功后回调事件 */
|
|
121
|
+
var onFinish = /*#__PURE__*/function () {
|
|
122
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(val) {
|
|
123
|
+
var _val$pointIdList;
|
|
124
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
125
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
126
|
+
case 0:
|
|
127
|
+
if ((_val$pointIdList = val.pointIdList) === null || _val$pointIdList === void 0 ? void 0 : _val$pointIdList.length) {
|
|
128
|
+
onSubmit(val.pointIdList);
|
|
129
|
+
closeModal();
|
|
130
|
+
} else {
|
|
131
|
+
message.error('请至少选择一个属性');
|
|
132
|
+
}
|
|
133
|
+
case 1:
|
|
134
|
+
case "end":
|
|
135
|
+
return _context3.stop();
|
|
136
|
+
}
|
|
137
|
+
}, _callee3);
|
|
138
|
+
}));
|
|
139
|
+
return function onFinish(_x2) {
|
|
140
|
+
return _ref4.apply(this, arguments);
|
|
141
|
+
};
|
|
142
|
+
}();
|
|
143
|
+
useEffect(function () {
|
|
144
|
+
if (visible && !deviceList.length) {
|
|
145
|
+
fetchDeviceList();
|
|
146
|
+
}
|
|
147
|
+
}, [visible, deviceList.length]);
|
|
148
|
+
return /*#__PURE__*/React.createElement(Modal, {
|
|
149
|
+
title: '选择属性',
|
|
150
|
+
closable: false,
|
|
151
|
+
width: 300,
|
|
152
|
+
maskClosable: true,
|
|
153
|
+
footer: null,
|
|
154
|
+
onCancel: closeModal,
|
|
155
|
+
visible: visible,
|
|
156
|
+
wrapClassName: 'form-modal'
|
|
157
|
+
}, /*#__PURE__*/React.createElement(Form, {
|
|
158
|
+
layout: "vertical",
|
|
159
|
+
form: form,
|
|
160
|
+
name: "filterForm",
|
|
161
|
+
onFinish: onFinish,
|
|
162
|
+
initialValues: {
|
|
163
|
+
type: 1
|
|
164
|
+
}
|
|
165
|
+
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
166
|
+
name: "deviceId",
|
|
167
|
+
label: "\u8BBE\u5907",
|
|
168
|
+
rules: [{
|
|
169
|
+
required: true,
|
|
170
|
+
message: '请选择'
|
|
171
|
+
}]
|
|
172
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
173
|
+
placeholder: "\u8BF7\u9009\u62E9",
|
|
174
|
+
onChange: function onChange(value) {
|
|
175
|
+
fetchPointList(value);
|
|
176
|
+
form.setFieldsValue({
|
|
177
|
+
pointIdList: []
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}, deviceList.map(function (item) {
|
|
181
|
+
return /*#__PURE__*/React.createElement(Option, {
|
|
182
|
+
value: item.deviceId,
|
|
183
|
+
label: item.deviceName,
|
|
184
|
+
key: item.deviceId
|
|
185
|
+
}, item.deviceName);
|
|
186
|
+
}))), /*#__PURE__*/React.createElement(Form.Item, {
|
|
187
|
+
noStyle: true,
|
|
188
|
+
dependencies: ['deviceId']
|
|
189
|
+
}, function (_ref5) {
|
|
190
|
+
var getFieldValue = _ref5.getFieldValue;
|
|
191
|
+
return /*#__PURE__*/React.createElement(Form.Item, {
|
|
192
|
+
name: "pointIdList",
|
|
193
|
+
label: "\u5C5E\u6027",
|
|
194
|
+
rules: [{
|
|
195
|
+
required: true,
|
|
196
|
+
message: '请选择'
|
|
197
|
+
}]
|
|
198
|
+
}, /*#__PURE__*/React.createElement(Select, {
|
|
199
|
+
allowClear: true,
|
|
200
|
+
mode: 'multiple',
|
|
201
|
+
showSearch: true,
|
|
202
|
+
optionFilterProp: "label",
|
|
203
|
+
placeholder: "\u8BF7\u9009\u62E9",
|
|
204
|
+
disabled: !getFieldValue('deviceId')
|
|
205
|
+
}, pointList.map(function (item) {
|
|
206
|
+
return /*#__PURE__*/React.createElement(Option, {
|
|
207
|
+
value: item.pointId,
|
|
208
|
+
label: item.pointName,
|
|
209
|
+
key: item.pointId
|
|
210
|
+
}, item.pointName);
|
|
211
|
+
})));
|
|
212
|
+
}), /*#__PURE__*/React.createElement(Form.Item, _extends({}, tailLayout, {
|
|
213
|
+
noStyle: true,
|
|
214
|
+
className: "modelFooterItem"
|
|
215
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
216
|
+
className: "form-modal-footer"
|
|
217
|
+
}, /*#__PURE__*/React.createElement(Space, {
|
|
218
|
+
align: "center",
|
|
219
|
+
size: 15
|
|
220
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
221
|
+
onClick: onCancel,
|
|
222
|
+
htmlType: "button",
|
|
223
|
+
style: {
|
|
224
|
+
float: 'right'
|
|
225
|
+
}
|
|
226
|
+
}, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button, {
|
|
227
|
+
type: "primary",
|
|
228
|
+
htmlType: "submit",
|
|
229
|
+
style: {
|
|
230
|
+
float: 'right'
|
|
231
|
+
}
|
|
232
|
+
}, "\u786E\u5B9A"))))));
|
|
233
|
+
};
|
|
234
|
+
export default ModalChoosePoint;
|
|
@@ -510,7 +510,9 @@ var Player = function Player(_ref) {
|
|
|
510
510
|
onCancel: function onCancel() {
|
|
511
511
|
return setVisibleDialogHistory(false);
|
|
512
512
|
},
|
|
513
|
-
pointIdListProp: activePointIds
|
|
513
|
+
pointIdListProp: activePointIds,
|
|
514
|
+
companyId: query.companyId,
|
|
515
|
+
projectId: query.projectId
|
|
514
516
|
}), /*#__PURE__*/React.createElement(DialogPointWrite, {
|
|
515
517
|
visible: visibleDialogPointWrite,
|
|
516
518
|
points: activePoints,
|
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
|
};
|
|
@@ -84,6 +88,10 @@ type PlayerQuery =
|
|
|
84
88
|
token?: string;
|
|
85
89
|
/** 刷新token */
|
|
86
90
|
xToken?: string;
|
|
91
|
+
/** 公司 id */
|
|
92
|
+
companyId: string;
|
|
93
|
+
/** 项目 id */
|
|
94
|
+
projectId?: string;
|
|
87
95
|
}
|
|
88
96
|
| {
|
|
89
97
|
/** 通过输入的环境名 env, 决定接口调用的地址,默认是 prod */
|