coolcare-lite-scada-component 2.0.35 → 2.0.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,9 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
2
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
3
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
4
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
6
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
3
7
  function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
4
8
  function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
5
9
  function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
@@ -9,13 +13,17 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
9
13
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
10
14
  function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
11
15
  import React from "react";
12
- import { useCallback, useEffect, useState } from 'react';
13
- import { Modal, Form, message, InputNumber, DatePicker, Empty } from 'antd';
16
+ import { useCallback, useEffect, useState, useRef } from 'react';
17
+ import { Modal, Form, message, InputNumber, DatePicker, Empty, Typography, Button, Space, Tag } from 'antd';
14
18
  import moment from 'moment';
15
19
  import { useDebounceFn } from 'ahooks';
16
20
  import { GetPointHistoryData } from "../../services/gateway/Point";
21
+ import ModalChoosePoint from "../ModalChoosePoint";
17
22
  import Echarts from "../ECharts";
23
+ // @ts-ignore
24
+
18
25
  import styles from "./index.css";
26
+ var Link = Typography.Link;
19
27
  var RangePicker = DatePicker.RangePicker;
20
28
  var defaultInterval = 2;
21
29
 
@@ -26,15 +34,20 @@ var oneYearTime = 365 * 3600 * 1000 * 24;
26
34
  // const oneMonthTime = 31 * 3600 * 1000 * 24;
27
35
  // const oneWeekTime = 7 * 3600 * 1000 * 24;
28
36
 
29
- var DialogHistory = function DialogHistory(_ref) {
30
- var pointIdListProp = _ref.pointIdListProp,
37
+ var DialogPointHistory = function DialogPointHistory(_ref) {
38
+ var _ref$isSinglePoint = _ref.isSinglePoint,
39
+ isSinglePoint = _ref$isSinglePoint === void 0 ? true : _ref$isSinglePoint,
40
+ pointIdListProp = _ref.pointIdListProp,
31
41
  dateRangeProp = _ref.dateRangeProp,
32
42
  intervalProp = _ref.intervalProp,
33
43
  visible = _ref.visible,
34
- onCancel = _ref.onCancel;
44
+ onCancel = _ref.onCancel,
45
+ companyId = _ref.companyId,
46
+ projectId = _ref.projectId;
35
47
  var _Form$useForm = Form.useForm(),
36
48
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
37
49
  form = _Form$useForm2[0];
50
+ var chart = useRef();
38
51
  var _useState = useState(false),
39
52
  _useState2 = _slicedToArray(_useState, 2),
40
53
  isNoData = _useState2[0],
@@ -44,45 +57,85 @@ var DialogHistory = function DialogHistory(_ref) {
44
57
  _useState4 = _slicedToArray(_useState3, 2),
45
58
  loading = _useState4[0],
46
59
  setLoading = _useState4[1];
47
- /** 曲线图配置 */
48
- var _useState5 = useState(undefined),
60
+ /** 添加对比点位弹框 */
61
+ var _useState5 = useState(false),
49
62
  _useState6 = _slicedToArray(_useState5, 2),
50
- chartOptions = _useState6[0],
51
- setChartOptions = _useState6[1];
63
+ visiblePointSet = _useState6[0],
64
+ setVisiblePointSet = _useState6[1];
65
+ /** 曲线图配置 */
66
+ var _useState7 = useState(undefined),
67
+ _useState8 = _slicedToArray(_useState7, 2),
68
+ chartOptions = _useState8[0],
69
+ setChartOptions = _useState8[1];
70
+ /** 当前点位列表 */
71
+ var _useState9 = useState([]),
72
+ _useState10 = _slicedToArray(_useState9, 2),
73
+ pointIdList = _useState10[0],
74
+ setPointIdList = _useState10[1];
75
+ /** 当前点位时间段内是否有报警 */
76
+ var _useState11 = useState(false),
77
+ _useState12 = _slicedToArray(_useState11, 2),
78
+ haveAlarm = _useState12[0],
79
+ setHaveAlarm = _useState12[1];
80
+ var _useState13 = useState(undefined),
81
+ _useState14 = _slicedToArray(_useState13, 2),
82
+ deviceId = _useState14[0],
83
+ setDeviceId = _useState14[1];
84
+ var _useState15 = useState([]),
85
+ _useState16 = _slicedToArray(_useState15, 2),
86
+ tagList = _useState16[0],
87
+ setTagList = _useState16[1];
52
88
  var closeModal = function closeModal() {
53
89
  form.resetFields();
54
90
  setLoading(false);
55
91
  setChartOptions(undefined);
56
92
  setIsNoData(false);
93
+ setVisiblePointSet(false);
94
+ setHaveAlarm(false);
95
+ setPointIdList([]);
57
96
  onCancel === null || onCancel === void 0 ? void 0 : onCancel();
58
97
  };
59
98
 
60
99
  /** 获取点位历史数据 */
61
100
  var fetchPointHistory = useCallback(/*#__PURE__*/function () {
62
101
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(idList, ranges, interval) {
63
- var diff, res, data, series, yAxisData, xAxisData;
102
+ var diff, res, data, series, yAxisData;
64
103
  return _regeneratorRuntime().wrap(function _callee$(_context) {
65
104
  while (1) switch (_context.prev = _context.next) {
66
105
  case 0:
67
106
  if (idList === null || idList === void 0 ? void 0 : idList.length) {
68
- _context.next = 3;
107
+ _context.next = 2;
108
+ break;
109
+ }
110
+ return _context.abrupt("return");
111
+ case 2:
112
+ if (!(ranges.length !== 2)) {
113
+ _context.next = 5;
114
+ break;
115
+ }
116
+ message.info('请选择时间范围');
117
+ return _context.abrupt("return");
118
+ case 5:
119
+ if (!(typeof interval !== 'number' || interval < 0)) {
120
+ _context.next = 8;
69
121
  break;
70
122
  }
71
- message.error('请至少查询一个点位');
123
+ message.info('请正确输入时间间隔');
72
124
  return _context.abrupt("return");
73
- case 3:
74
- _context.prev = 3;
125
+ case 8:
126
+ _context.prev = 8;
75
127
  diff = moment(ranges[1]).valueOf() - moment(ranges[0]).valueOf();
76
128
  if (!(diff > oneYearTime)) {
77
- _context.next = 8;
129
+ _context.next = 13;
78
130
  break;
79
131
  }
80
132
  message.error('历史数据最大查询范围是一年');
81
133
  return _context.abrupt("return");
82
- case 8:
134
+ case 13:
83
135
  // 获取点位数据
84
136
  setLoading(true);
85
- _context.next = 11;
137
+ setTagList([]);
138
+ _context.next = 17;
86
139
  return GetPointHistoryData({
87
140
  timeQuantum: {
88
141
  startDate: moment(ranges[0]).format('YYYY-MM-DD HH:mm'),
@@ -91,7 +144,7 @@ var DialogHistory = function DialogHistory(_ref) {
91
144
  pointIdList: idList,
92
145
  interval: interval
93
146
  });
94
- case 11:
147
+ case 17:
95
148
  res = _context.sent;
96
149
  if (res.success) {
97
150
  data = res.data;
@@ -102,7 +155,7 @@ var DialogHistory = function DialogHistory(_ref) {
102
155
  // 图形处理
103
156
  series = [];
104
157
  yAxisData = [];
105
- xAxisData = [];
158
+ setDeviceId(data[0].deviceId);
106
159
  if (data.every(function (v) {
107
160
  var _v$pointDataList;
108
161
  return ((_v$pointDataList = v.pointDataList) === null || _v$pointDataList === void 0 ? void 0 : _v$pointDataList.length) === 0 || !v.pointDataList;
@@ -112,7 +165,17 @@ var DialogHistory = function DialogHistory(_ref) {
112
165
  setIsNoData(false);
113
166
  }
114
167
  data.forEach(function (item) {
115
- var _item$pointDataList, _item$pointDataList2;
168
+ var _item$pointAlarmTimeF, _item$pointDataList;
169
+ setTagList(function (old) {
170
+ return [].concat(_toConsumableArray(old), [{
171
+ name: "".concat(item.deviceName, "-").concat(item.pointName),
172
+ key: item.pointId
173
+ }]);
174
+ });
175
+ // @ts-ignore
176
+ if ((_item$pointAlarmTimeF = item.pointAlarmTimeFrameList) === null || _item$pointAlarmTimeF === void 0 ? void 0 : _item$pointAlarmTimeF.length) {
177
+ setHaveAlarm(true);
178
+ }
116
179
  var pointEnumId = item.pointEnumId,
117
180
  pointEnumItemList = item.pointEnumItemList;
118
181
  var unit = item.unit;
@@ -171,28 +234,30 @@ var DialogHistory = function DialogHistory(_ref) {
171
234
  }
172
235
  yAxisData.push(yAxis);
173
236
  }
174
- // 配置x坐标轴数据
175
- if ((_item$pointDataList = item.pointDataList) === null || _item$pointDataList === void 0 ? void 0 : _item$pointDataList.length) {
176
- xAxisData = item.pointDataList.map(function (pointDataItem) {
177
- return pointDataItem.ts;
178
- });
179
- }
180
237
  // 配置曲线数据
181
238
  series.push({
182
239
  animation: false,
183
- name: item.pointName,
184
- type: 'line',
240
+ name: "".concat(item.deviceName, "-").concat(item.pointName),
241
+ type: interval == 0 ? 'scatter' : 'line',
185
242
  unit: item.unit,
186
243
  yAxisIndex: yAxisData.findIndex(function (yAxis) {
187
244
  return yAxis.pointEnumId === item.pointEnumId;
188
245
  }),
189
246
  smooth: false,
190
- data: (_item$pointDataList2 = item.pointDataList) === null || _item$pointDataList2 === void 0 ? void 0 : _item$pointDataList2.map(function (dataItem) {
191
- return {
192
- name: dataItem.ts,
193
- value: dataItem.val
194
- };
195
- })
247
+ showAllSymbol: true,
248
+ symbolSize: 1.5,
249
+ data: (_item$pointDataList = item.pointDataList) === null || _item$pointDataList === void 0 ? void 0 : _item$pointDataList.map(function (dataItem) {
250
+ return [new Date(dataItem.ts).getTime(), dataItem.val];
251
+ }),
252
+ markPoint: {
253
+ data: [{
254
+ type: 'max',
255
+ name: '最大值'
256
+ }, {
257
+ type: 'min',
258
+ name: '最小值'
259
+ }]
260
+ }
196
261
  });
197
262
  });
198
263
 
@@ -228,15 +293,16 @@ var DialogHistory = function DialogHistory(_ref) {
228
293
  var colorSpan = function colorSpan(color) {
229
294
  return "<i class=\"echart-circlepoint\" style=\"background: ".concat(color, "\"></i>");
230
295
  };
231
- var text = "".concat(moment(params[0].name).format(interval < 1 ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD HH:mm'), "<br/>");
296
+ var text = "".concat(moment(params[0].axisValueLabel).format(interval < 1 ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD HH:mm'), "<br/>");
232
297
  for (var i = 0; i < params.length; i += 1) {
233
- text += "".concat(colorSpan(params[i].color), " ").concat(params[i].seriesName, "\uFF1A").concat(params[i].value === null ? '无数据' : params[i].value, " <br/>");
298
+ text += "".concat(colorSpan(params[i].color), " ").concat(params[i].seriesName, "\uFF1A").concat(params[i].data[1] === null ? '无数据' : params[i].data[1], " <br/>");
234
299
  }
235
300
  return text;
236
301
  }
237
302
  },
238
303
  yAxis: yAxisData,
239
304
  xAxis: {
305
+ type: 'time',
240
306
  axisLabel: {
241
307
  formatter: function formatter(value) {
242
308
  return moment(value).format('YYYY-MM-DD HH:mm');
@@ -244,8 +310,7 @@ var DialogHistory = function DialogHistory(_ref) {
244
310
  },
245
311
  splitLine: {
246
312
  show: false
247
- },
248
- data: xAxisData
313
+ }
249
314
  },
250
315
  series: series
251
316
  });
@@ -254,23 +319,23 @@ var DialogHistory = function DialogHistory(_ref) {
254
319
  setIsNoData(true);
255
320
  message.error(res.message);
256
321
  }
257
- _context.next = 20;
322
+ _context.next = 26;
258
323
  break;
259
- case 15:
260
- _context.prev = 15;
261
- _context.t0 = _context["catch"](3);
324
+ case 21:
325
+ _context.prev = 21;
326
+ _context.t0 = _context["catch"](8);
262
327
  console.error(_context.t0);
263
328
  setIsNoData(true);
264
329
  setChartOptions(undefined);
265
- case 20:
266
- _context.prev = 20;
330
+ case 26:
331
+ _context.prev = 26;
267
332
  setLoading(false);
268
- return _context.finish(20);
269
- case 23:
333
+ return _context.finish(26);
334
+ case 29:
270
335
  case "end":
271
336
  return _context.stop();
272
337
  }
273
- }, _callee, null, [[3, 15, 20, 23]]);
338
+ }, _callee, null, [[8, 21, 26, 29]]);
274
339
  }));
275
340
  return function (_x, _x2, _x3) {
276
341
  return _ref2.apply(this, arguments);
@@ -280,37 +345,49 @@ var DialogHistory = function DialogHistory(_ref) {
280
345
  wait: 700
281
346
  }),
282
347
  fetchPointHistoryDebounce = _useDebounceFn.run;
283
- var handleFormChange = function handleFormChange(values) {
284
- var dateRange = values.dateRange,
285
- interval = values.interval;
286
- if (typeof interval !== 'number') {
287
- return;
288
- }
289
- fetchPointHistoryDebounce(pointIdListProp, dateRange, interval);
290
- };
291
-
292
- // const handleSubmit = async () => {
293
- // try {
294
- // const { dateRange, interval } = await form.validateFields()
295
- // if (typeof interval) {
296
- // fetchPointHistory(pointIdListProp, dateRange, interval)
297
- // }
298
- // } catch (err) {
299
- // console.error(err)
300
- // }
301
- // }
348
+ var handleSubmit = /*#__PURE__*/function () {
349
+ var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
350
+ var _yield$form$validateF, dateRange, interval;
351
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
352
+ while (1) switch (_context2.prev = _context2.next) {
353
+ case 0:
354
+ _context2.next = 2;
355
+ return form.validateFields();
356
+ case 2:
357
+ _yield$form$validateF = _context2.sent;
358
+ dateRange = _yield$form$validateF.dateRange;
359
+ interval = _yield$form$validateF.interval;
360
+ fetchPointHistoryDebounce(pointIdList, dateRange, interval);
361
+ case 6:
362
+ case "end":
363
+ return _context2.stop();
364
+ }
365
+ }, _callee2);
366
+ }));
367
+ return function handleSubmit() {
368
+ return _ref3.apply(this, arguments);
369
+ };
370
+ }();
371
+ useEffect(function () {
372
+ var _form$getFieldsValue = form.getFieldsValue(),
373
+ dateRange = _form$getFieldsValue.dateRange,
374
+ interval = _form$getFieldsValue.interval;
375
+ fetchPointHistoryDebounce(pointIdList, dateRange, interval);
376
+ }, [pointIdList]);
302
377
 
303
378
  /** 打开弹框,初始化数据,获取曲线图形 */
304
379
  useEffect(function () {
305
380
  if (visible && (pointIdListProp === null || pointIdListProp === void 0 ? void 0 : pointIdListProp.length)) {
306
381
  var ranges = dateRangeProp || [moment().subtract(1, 'days'), moment()];
382
+ var interval = typeof intervalProp === 'number' && intervalProp ? intervalProp : defaultInterval;
307
383
  form.setFieldsValue({
308
384
  dateRange: ranges,
309
- interval: typeof intervalProp === 'number' ? intervalProp : defaultInterval
385
+ interval: interval
310
386
  });
311
- fetchPointHistory(pointIdListProp, ranges, defaultInterval);
387
+ setPointIdList(pointIdListProp);
388
+ fetchPointHistoryDebounce(pointIdListProp, ranges, interval);
312
389
  }
313
- }, [visible, form, pointIdListProp, dateRangeProp, intervalProp, fetchPointHistory]);
390
+ }, [visible, form, pointIdListProp, dateRangeProp, intervalProp]);
314
391
  return /*#__PURE__*/React.createElement(Modal, {
315
392
  title: "\u5386\u53F2\u6570\u636E\u66F2\u7EBF",
316
393
  open: visible,
@@ -322,20 +399,20 @@ var DialogHistory = function DialogHistory(_ref) {
322
399
  afterClose: closeModal,
323
400
  getContainer: false
324
401
  }, /*#__PURE__*/React.createElement(Form, {
325
- onValuesChange: function onValuesChange(changedValues, values) {
326
- return handleFormChange(values);
327
- },
328
- layout: "inline",
329
402
  requiredMark: false,
330
403
  form: form,
331
404
  name: "form"
405
+ }, /*#__PURE__*/React.createElement(Space, {
406
+ size: 30,
407
+ align: 'center'
332
408
  }, /*#__PURE__*/React.createElement(Form.Item, {
333
409
  name: "dateRange",
334
410
  label: "\u65F6\u95F4\u8303\u56F4",
335
411
  rules: [{
336
412
  required: true,
337
413
  message: '请选择时间范围'
338
- }]
414
+ }],
415
+ className: "temperatureDateRange"
339
416
  }, /*#__PURE__*/React.createElement(RangePicker, {
340
417
  disabled: loading,
341
418
  style: {
@@ -344,16 +421,16 @@ var DialogHistory = function DialogHistory(_ref) {
344
421
  showTime: {
345
422
  format: 'HH:mm'
346
423
  },
347
- getPopupContainer: function getPopupContainer(node) {
348
- return node;
349
- },
350
424
  allowClear: false,
351
425
  ranges: {
352
426
  近一天: [moment().subtract(1, 'day'), moment()],
353
427
  近一周: [moment().subtract(7, 'day'), moment()],
354
428
  近一个月: [moment().subtract(30, 'day'), moment()]
355
429
  },
356
- format: "YYYY-MM-DD HH:mm"
430
+ format: "YYYY-MM-DD HH:mm",
431
+ getPopupContainer: function getPopupContainer() {
432
+ return document.querySelector(".temperatureDateRange") || document.body;
433
+ }
357
434
  })), /*#__PURE__*/React.createElement(Form.Item, {
358
435
  name: "interval",
359
436
  label: "\u95F4\u9694\uFF08\u5206\u949F\uFF09",
@@ -367,9 +444,37 @@ var DialogHistory = function DialogHistory(_ref) {
367
444
  }, /*#__PURE__*/React.createElement(InputNumber, {
368
445
  disabled: loading,
369
446
  placeholder: "\u8BF7\u8F93\u5165\u6B63\u6574\u6570"
370
- }))), /*#__PURE__*/React.createElement("div", {
447
+ })), /*#__PURE__*/React.createElement(Form.Item, null, /*#__PURE__*/React.createElement(Button, {
448
+ type: 'primary',
449
+ onClick: handleSubmit
450
+ }, "\u67E5\u8BE2"))), isSinglePoint ? /*#__PURE__*/React.createElement("div", {
451
+ key: 'singlePointSetBox'
452
+ }, /*#__PURE__*/React.createElement(Space, {
453
+ size: 30,
454
+ align: 'center'
455
+ }, /*#__PURE__*/React.createElement(Form.Item, {
456
+ label: "\u6DFB\u52A0\u5BF9\u6BD4"
457
+ }, /*#__PURE__*/React.createElement(Link, {
458
+ onClick: function onClick() {
459
+ setVisiblePointSet(true);
460
+ }
461
+ }, "\u6DFB\u52A0\u5C5E\u6027")))) : null), tagList.map(function (item) {
462
+ return /*#__PURE__*/React.createElement(Tag, {
463
+ key: item.key,
464
+ closable: true,
465
+ color: "blue",
466
+ onClose: function onClose() {
467
+ setPointIdList(function (pre) {
468
+ return pre.filter(function (v) {
469
+ return v !== item.key;
470
+ });
471
+ });
472
+ }
473
+ }, item.name);
474
+ }), /*#__PURE__*/React.createElement("div", {
371
475
  className: styles['chart-wrap']
372
476
  }, /*#__PURE__*/React.createElement(Echarts, {
477
+ ref: chart,
373
478
  option: chartOptions,
374
479
  loading: loading,
375
480
  style: {
@@ -379,6 +484,19 @@ var DialogHistory = function DialogHistory(_ref) {
379
484
  className: styles['chart-empty'],
380
485
  image: Empty.PRESENTED_IMAGE_SIMPLE,
381
486
  description: "\u6682\u65E0\u70B9\u4F4D\u5386\u53F2\u6570\u636E"
382
- })));
487
+ })), /*#__PURE__*/React.createElement(ModalChoosePoint, {
488
+ visible: visiblePointSet,
489
+ onSubmit: function onSubmit(val) {
490
+ setPointIdList(function (pre) {
491
+ return _toConsumableArray(new Set([].concat(_toConsumableArray(pre), _toConsumableArray(val))));
492
+ });
493
+ },
494
+ currentDeviceId: deviceId,
495
+ companyId: companyId,
496
+ projectId: projectId,
497
+ onCancel: function onCancel() {
498
+ setVisiblePointSet(false);
499
+ }
500
+ }));
383
501
  };
384
- export default DialogHistory;
502
+ export default DialogPointHistory;
@@ -72,7 +72,7 @@ var ImageUploader = function ImageUploader(_ref) {
72
72
  if (!isJpgOrPngOrSvgOrGif) {
73
73
  message.error('只能上传 JPG/PNG/Svg/Gif 文件!');
74
74
  }
75
- var size = 30;
75
+ var size = 50;
76
76
  var isLtSize = file.size / 1024 / 1024 < size;
77
77
  if (!isLtSize) {
78
78
  notification.open({
@@ -0,0 +1,235 @@
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 { GetDevicePage, GetDevicePoint } from "../../services/gateway/Device";
16
+ var Option = Select.Option;
17
+ var tailLayout = {
18
+ wrapperCol: {
19
+ offset: 2,
20
+ span: 22
21
+ }
22
+ };
23
+ var ModalChoosePoint = function ModalChoosePoint(_ref) {
24
+ var visible = _ref.visible,
25
+ onSubmit = _ref.onSubmit,
26
+ onCancel = _ref.onCancel,
27
+ companyId = _ref.companyId,
28
+ currentDeviceId = _ref.currentDeviceId;
29
+ var _Form$useForm = Form.useForm(),
30
+ _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
31
+ form = _Form$useForm2[0];
32
+ /** 设备列表 */
33
+ var _useState = useState([]),
34
+ _useState2 = _slicedToArray(_useState, 2),
35
+ deviceList = _useState2[0],
36
+ setDeviceList = _useState2[1];
37
+ /** 产品点位列表 */
38
+ var _useState3 = useState([]),
39
+ _useState4 = _slicedToArray(_useState3, 2),
40
+ pointList = _useState4[0],
41
+ setPointList = _useState4[1];
42
+ var closeModal = function closeModal() {
43
+ onCancel === null || onCancel === void 0 ? void 0 : onCancel();
44
+ };
45
+
46
+ /** 获取产品最新发布版本点位列表 */
47
+ var fetchPointList = useCallback(/*#__PURE__*/function () {
48
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(val) {
49
+ var res;
50
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
51
+ while (1) switch (_context.prev = _context.next) {
52
+ case 0:
53
+ _context.prev = 0;
54
+ _context.next = 3;
55
+ return GetDevicePoint({
56
+ deviceIdList: [val]
57
+ });
58
+ case 3:
59
+ res = _context.sent;
60
+ if (res.success) {
61
+ setPointList(res.data || []);
62
+ } else {
63
+ message.error(res.message);
64
+ }
65
+ _context.next = 11;
66
+ break;
67
+ case 7:
68
+ _context.prev = 7;
69
+ _context.t0 = _context["catch"](0);
70
+ console.error(_context.t0);
71
+ message.error('获取属性列表失败');
72
+ case 11:
73
+ case "end":
74
+ return _context.stop();
75
+ }
76
+ }, _callee, null, [[0, 7]]);
77
+ }));
78
+ return function (_x) {
79
+ return _ref2.apply(this, arguments);
80
+ };
81
+ }(), []);
82
+
83
+ /** 获取设备列表 */
84
+ var fetchDeviceList = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
85
+ var res, _res$data;
86
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
87
+ while (1) switch (_context2.prev = _context2.next) {
88
+ case 0:
89
+ _context2.prev = 0;
90
+ _context2.next = 3;
91
+ return GetDevicePage({
92
+ companyId: companyId
93
+ });
94
+ case 3:
95
+ res = _context2.sent;
96
+ if (res.success) {
97
+ setDeviceList(((_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.list) || []);
98
+ } else {
99
+ message.error(res.message);
100
+ }
101
+ _context2.next = 10;
102
+ break;
103
+ case 7:
104
+ _context2.prev = 7;
105
+ _context2.t0 = _context2["catch"](0);
106
+ message.error('获取设备列表失败');
107
+ case 10:
108
+ case "end":
109
+ return _context2.stop();
110
+ }
111
+ }, _callee2, null, [[0, 7]]);
112
+ })), [companyId]);
113
+
114
+ /** 提交表单且数据验证成功后回调事件 */
115
+ var onFinish = /*#__PURE__*/function () {
116
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(val) {
117
+ var _val$pointIdList;
118
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
119
+ while (1) switch (_context3.prev = _context3.next) {
120
+ case 0:
121
+ if ((_val$pointIdList = val.pointIdList) === null || _val$pointIdList === void 0 ? void 0 : _val$pointIdList.length) {
122
+ onSubmit(val.pointIdList);
123
+ closeModal();
124
+ } else {
125
+ message.error('请至少选择一个属性');
126
+ }
127
+ case 1:
128
+ case "end":
129
+ return _context3.stop();
130
+ }
131
+ }, _callee3);
132
+ }));
133
+ return function onFinish(_x2) {
134
+ return _ref4.apply(this, arguments);
135
+ };
136
+ }();
137
+ useEffect(function () {
138
+ if (visible && !deviceList.length) {
139
+ fetchDeviceList();
140
+ }
141
+ }, [visible, deviceList.length]);
142
+ useEffect(function () {
143
+ if (currentDeviceId) {
144
+ fetchPointList(currentDeviceId);
145
+ form.setFieldValue('deviceId', currentDeviceId);
146
+ }
147
+ }, [currentDeviceId]);
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
+ defaultValue: currentDeviceId,
175
+ onChange: function onChange(value) {
176
+ fetchPointList(value);
177
+ form.setFieldsValue({
178
+ pointIdList: []
179
+ });
180
+ }
181
+ }, deviceList.map(function (item) {
182
+ return /*#__PURE__*/React.createElement(Option, {
183
+ value: item.deviceId,
184
+ label: item.deviceName,
185
+ key: item.deviceId
186
+ }, item.deviceName);
187
+ }))), /*#__PURE__*/React.createElement(Form.Item, {
188
+ noStyle: true,
189
+ dependencies: ['deviceId']
190
+ }, function (_ref5) {
191
+ var getFieldValue = _ref5.getFieldValue;
192
+ return /*#__PURE__*/React.createElement(Form.Item, {
193
+ name: "pointIdList",
194
+ label: "\u5C5E\u6027",
195
+ rules: [{
196
+ required: true,
197
+ message: '请选择'
198
+ }]
199
+ }, /*#__PURE__*/React.createElement(Select, {
200
+ allowClear: true,
201
+ mode: 'multiple',
202
+ showSearch: true,
203
+ optionFilterProp: "label",
204
+ placeholder: "\u8BF7\u9009\u62E9",
205
+ disabled: !getFieldValue('deviceId')
206
+ }, pointList.map(function (item) {
207
+ return /*#__PURE__*/React.createElement(Option, {
208
+ value: item.pointId,
209
+ label: item.pointName,
210
+ key: item.pointId
211
+ }, item.pointName);
212
+ })));
213
+ }), /*#__PURE__*/React.createElement(Form.Item, _extends({}, tailLayout, {
214
+ noStyle: true,
215
+ className: "modelFooterItem"
216
+ }), /*#__PURE__*/React.createElement("div", {
217
+ className: "form-modal-footer"
218
+ }, /*#__PURE__*/React.createElement(Space, {
219
+ align: "center",
220
+ size: 15
221
+ }, /*#__PURE__*/React.createElement(Button, {
222
+ onClick: onCancel,
223
+ htmlType: "button",
224
+ style: {
225
+ float: 'right'
226
+ }
227
+ }, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button, {
228
+ type: "primary",
229
+ htmlType: "submit",
230
+ style: {
231
+ float: 'right'
232
+ }
233
+ }, "\u786E\u5B9A"))))));
234
+ };
235
+ export default ModalChoosePoint;
@@ -17,7 +17,7 @@ var directionClassNameMap = {
17
17
  bottom: 'flex-col-reverse'
18
18
  };
19
19
  var ElePointValueComponent = function ElePointValueComponent(_ref) {
20
- var _payload$pointList, _payload$label, _payload$unit, _payload$unit2, _payload$value, _payload$value2, _payload$mittMeta$nam, _payload$mittMeta, _payload$mittMeta2, _payload$label2, _pointValue, _payload$unit3;
20
+ var _payload$pointList, _payload$label, _payload$unit, _payload$unit2, _payload$value, _payload$value2, _payload$mittMeta$nam, _payload$mittMeta, _payload$mittMeta2, _pointData$aggregateD, _pointData$aggregateD2, _pointData$aggregateD3, _pointData$aggregateD4, _payload$label2, _pointValue, _payload$unit3;
21
21
  var node = _ref.node;
22
22
  var payload = node === null || node === void 0 ? void 0 : node.getData();
23
23
  var configPoint = payload === null || payload === void 0 ? void 0 : (_payload$pointList = payload.pointList) === null || _payload$pointList === void 0 ? void 0 : _payload$pointList[0];
@@ -36,23 +36,27 @@ var ElePointValueComponent = function ElePointValueComponent(_ref) {
36
36
  }
37
37
  });
38
38
  var pointData = usePointWatch(configPoint, payload === null || payload === void 0 ? void 0 : (_payload$mittMeta2 = payload.mittMeta) === null || _payload$mittMeta2 === void 0 ? void 0 : _payload$mittMeta2.namespace);
39
+ var value = (pointData === null || pointData === void 0 ? void 0 : pointData.value) || (pointData === null || pointData === void 0 ? void 0 : (_pointData$aggregateD = pointData.aggregateDataList) === null || _pointData$aggregateD === void 0 ? void 0 : (_pointData$aggregateD2 = _pointData$aggregateD[0]) === null || _pointData$aggregateD2 === void 0 ? void 0 : _pointData$aggregateD2.val) || '-';
40
+ if (pointData === null || pointData === void 0 ? void 0 : (_pointData$aggregateD3 = pointData.aggregateDataList) === null || _pointData$aggregateD3 === void 0 ? void 0 : (_pointData$aggregateD4 = _pointData$aggregateD3[0]) === null || _pointData$aggregateD4 === void 0 ? void 0 : _pointData$aggregateD4.val) {
41
+ value = Number(value.toFixed(1));
42
+ }
39
43
  var tooltipTitle = null;
40
44
  if (!configPoint) {
41
45
  tooltipTitle = '未绑定点位';
42
46
  } else {
43
- var _pointData$value, _pointData$unit;
44
- tooltipTitle = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, "\u70B9\u4F4D\u540D\u79F0\uFF1A", (pointData === null || pointData === void 0 ? void 0 : pointData.pointName) || '-'), /*#__PURE__*/React.createElement("div", null, "\u70B9\u4F4D\u503C\uFF1A", (_pointData$value = pointData === null || pointData === void 0 ? void 0 : pointData.value) !== null && _pointData$value !== void 0 ? _pointData$value : '-', " ", (_pointData$unit = pointData === null || pointData === void 0 ? void 0 : pointData.unit) !== null && _pointData$unit !== void 0 ? _pointData$unit : '-'), /*#__PURE__*/React.createElement("div", null, "\u66F4\u65B0\u65F6\u95F4\uFF1A", (pointData === null || pointData === void 0 ? void 0 : pointData.updateTime) || '-'));
47
+ var _pointData$unit;
48
+ tooltipTitle = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, "\u70B9\u4F4D\u540D\u79F0\uFF1A", (pointData === null || pointData === void 0 ? void 0 : pointData.pointName) || '-'), /*#__PURE__*/React.createElement("div", null, "\u70B9\u4F4D\u503C\uFF1A", value, " ", (_pointData$unit = pointData === null || pointData === void 0 ? void 0 : pointData.unit) !== null && _pointData$unit !== void 0 ? _pointData$unit : '-'), /*#__PURE__*/React.createElement("div", null, "\u66F4\u65B0\u65F6\u95F4\uFF1A", (pointData === null || pointData === void 0 ? void 0 : pointData.updateTime) || '-'));
45
49
  }
46
50
  var pointValue = '';
47
51
  if (window.scadaMode === 'edit') {
48
52
  pointValue = '点位值';
49
53
  } else {
50
54
  if (configPoint === null || configPoint === void 0 ? void 0 : configPoint.expressions) {
51
- pointValue = getValueByExpression(pointData === null || pointData === void 0 ? void 0 : pointData.value, configPoint === null || configPoint === void 0 ? void 0 : configPoint.expressions);
55
+ pointValue = getValueByExpression(value, configPoint === null || configPoint === void 0 ? void 0 : configPoint.expressions);
52
56
  }
53
- pointValue = (pointData === null || pointData === void 0 ? void 0 : pointData.pointEnumItemKey) || (pointData === null || pointData === void 0 ? void 0 : pointData.value);
57
+ pointValue = (pointData === null || pointData === void 0 ? void 0 : pointData.pointEnumItemKey) || value;
54
58
  }
55
- var numberColor = getValueByExpression(pointData === null || pointData === void 0 ? void 0 : pointData.value, payload === null || payload === void 0 ? void 0 : payload.colorExpressions);
59
+ var numberColor = getValueByExpression(value, payload === null || payload === void 0 ? void 0 : payload.colorExpressions);
56
60
  return /*#__PURE__*/React.createElement("div", {
57
61
  onClick: function onClick(e) {
58
62
  return eventHandles.current.onClick(e);
@@ -0,0 +1,77 @@
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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
8
+ 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."); }
9
+ 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; } }
10
+ 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; }
11
+ 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; } }
12
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
13
+ import React from "react";
14
+ import { Form, Select } from 'antd';
15
+ import { useModel } from 'umi';
16
+ import { useEffect } from 'react';
17
+ var StatisticsPropsSet = function StatisticsPropsSet() {
18
+ var _useModel = useModel('useEditor', function (model) {
19
+ return {
20
+ activeNode: model.activeNode
21
+ };
22
+ }),
23
+ activeNode = _useModel.activeNode;
24
+ var _Form$useForm = Form.useForm(),
25
+ _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
26
+ StatisticsForm = _Form$useForm2[0];
27
+ var valueTypeV = Form.useWatch('valueType', StatisticsForm);
28
+ useEffect(function () {
29
+ if (!activeNode) {
30
+ return;
31
+ }
32
+ var data = activeNode.getData();
33
+ StatisticsForm.setFieldsValue({
34
+ valueType: data.valueType || 0,
35
+ valueDate: data.valueDate || 0
36
+ });
37
+ }, [activeNode, StatisticsForm]);
38
+ var onUnitFormChange = function onUnitFormChange(changedValues, values) {
39
+ activeNode === null || activeNode === void 0 ? void 0 : activeNode.setData(_objectSpread({}, values), {
40
+ deep: false
41
+ });
42
+ };
43
+ return /*#__PURE__*/React.createElement(Form, {
44
+ form: StatisticsForm,
45
+ size: "small",
46
+ labelCol: {
47
+ span: 8
48
+ },
49
+ onValuesChange: onUnitFormChange
50
+ }, /*#__PURE__*/React.createElement(Form.Item, {
51
+ name: "valueType",
52
+ label: "\u7EDF\u8BA1\u65B9\u5F0F"
53
+ }, /*#__PURE__*/React.createElement(Select, {
54
+ defaultValue: 0,
55
+ options: [{
56
+ label: '当前值',
57
+ value: 0
58
+ }, {
59
+ label: '累计值',
60
+ value: 1
61
+ }]
62
+ })), /*#__PURE__*/React.createElement(Form.Item, {
63
+ name: "valueDate",
64
+ label: "\u7EDF\u8BA1\u65F6\u95F4"
65
+ }, /*#__PURE__*/React.createElement(Select, {
66
+ disabled: valueTypeV === 0,
67
+ defaultValue: 0,
68
+ options: [{
69
+ label: '本月',
70
+ value: 0
71
+ }, {
72
+ label: '本年',
73
+ value: 1
74
+ }]
75
+ })));
76
+ };
77
+ export default StatisticsPropsSet;
@@ -7,6 +7,7 @@ import GlobalPropsSet from "./GlobalPropSet";
7
7
  import TitlePropsSet from "./TitlePropsSet";
8
8
  import UnitPropsSet from "./UnitPropsSet";
9
9
  import ValuePropsSet from "./ValuePropsSet";
10
+ import StatisticsPropsSet from "./StatisticsPropsSet";
10
11
  var Panel = Collapse.Panel;
11
12
  var PropsSet = function PropsSet() {
12
13
  var forceUpdate = useForceUpdate();
@@ -36,6 +37,9 @@ var PropsSet = function PropsSet() {
36
37
  }, /*#__PURE__*/React.createElement(TitlePropsSet, null)), /*#__PURE__*/React.createElement(Panel, {
37
38
  header: "\u540E\u7F00",
38
39
  key: "5"
39
- }, /*#__PURE__*/React.createElement(UnitPropsSet, null)));
40
+ }, /*#__PURE__*/React.createElement(UnitPropsSet, null)), /*#__PURE__*/React.createElement(Panel, {
41
+ header: "\u7EDF\u8BA1\u65B9\u5F0F",
42
+ key: "6"
43
+ }, /*#__PURE__*/React.createElement(StatisticsPropsSet, null)));
40
44
  };
41
45
  export default PropsSet;
@@ -26,9 +26,10 @@ import ModalFanDevicePoint from "../../../components/ModalFanDevicePoint";
26
26
  import emitter from "../../../utils/events";
27
27
  import { GetDevicePoint } from "../../../services/gateway/Device";
28
28
  import "./index.css";
29
- /** 刷新频率 */
30
- var RefreshFrequency = 10 * 1000;
29
+ import { GetTdIndicatorAggregateData } from "../../../services/gateway/Point";
30
+ import dayjs from 'dayjs';
31
31
  var Player = function Player(_ref) {
32
+ var _jsonConfig$pageConfi;
32
33
  var jsonConfig = _ref.jsonConfig,
33
34
  query = _ref.query,
34
35
  onEvent = _ref.onEvent;
@@ -63,6 +64,9 @@ var Player = function Player(_ref) {
63
64
  var mittMeta = useMemo(function () {
64
65
  return getMittMeta(query);
65
66
  }, [query]);
67
+
68
+ /** 刷新频率 */
69
+ var RefreshFrequency = ((jsonConfig === null || jsonConfig === void 0 ? void 0 : (_jsonConfig$pageConfi = jsonConfig.pageConfig) === null || _jsonConfig$pageConfi === void 0 ? void 0 : _jsonConfig$pageConfi.refreshFrequency) || 1.5 * 60) * 1000;
66
70
  useEffect(function () {
67
71
  window.scadaMode = 'player';
68
72
  return function () {
@@ -71,11 +75,11 @@ var Player = function Player(_ref) {
71
75
  }, []);
72
76
  useEffect(function () {
73
77
  if (jsonConfig) {
74
- var _jsonConfig$pageConfi, _window$parent;
78
+ var _jsonConfig$pageConfi2, _window$parent;
75
79
  var msg = {
76
80
  event: 'scada-config-loaded',
77
81
  payload: {
78
- dimensions: (jsonConfig === null || jsonConfig === void 0 ? void 0 : (_jsonConfig$pageConfi = jsonConfig.pageConfig) === null || _jsonConfig$pageConfi === void 0 ? void 0 : _jsonConfig$pageConfi.dimensions) || {
82
+ dimensions: (jsonConfig === null || jsonConfig === void 0 ? void 0 : (_jsonConfig$pageConfi2 = jsonConfig.pageConfig) === null || _jsonConfig$pageConfi2 === void 0 ? void 0 : _jsonConfig$pageConfi2.dimensions) || {
79
83
  width: 341,
80
84
  height: 500
81
85
  },
@@ -265,7 +269,13 @@ var Player = function Player(_ref) {
265
269
  scadaId: scadaId
266
270
  }
267
271
  });
268
- case 1:
272
+ console.log('[186]-index.tsx', onEvent, {
273
+ event: 'freedom-scene-switch',
274
+ payload: {
275
+ scadaId: scadaId
276
+ }
277
+ });
278
+ case 2:
269
279
  case "end":
270
280
  return _context4.stop();
271
281
  }
@@ -315,13 +325,13 @@ var Player = function Player(_ref) {
315
325
  });
316
326
  }, [query, mittMeta]);
317
327
  useEffect(function () {
318
- var _jsonConfig$pageConfi2, _graphRef$current3;
328
+ var _jsonConfig$pageConfi3, _graphRef$current3;
319
329
  if (!wrapSize || !jsonConfig || !query) return;
320
- if (query.zoomMode === 'width' && (jsonConfig === null || jsonConfig === void 0 ? void 0 : (_jsonConfig$pageConfi2 = jsonConfig.pageConfig) === null || _jsonConfig$pageConfi2 === void 0 ? void 0 : _jsonConfig$pageConfi2.dimensions)) {
330
+ if (query.zoomMode === 'width' && (jsonConfig === null || jsonConfig === void 0 ? void 0 : (_jsonConfig$pageConfi3 = jsonConfig.pageConfig) === null || _jsonConfig$pageConfi3 === void 0 ? void 0 : _jsonConfig$pageConfi3.dimensions)) {
321
331
  var _graphRef$current;
322
- var _jsonConfig$pageConfi3 = jsonConfig.pageConfig.dimensions,
323
- width = _jsonConfig$pageConfi3.width,
324
- height = _jsonConfig$pageConfi3.height;
332
+ var _jsonConfig$pageConfi4 = jsonConfig.pageConfig.dimensions,
333
+ width = _jsonConfig$pageConfi4.width,
334
+ height = _jsonConfig$pageConfi4.height;
325
335
  var scale = wrapSize.width / width;
326
336
  (_graphRef$current = graphRef.current) === null || _graphRef$current === void 0 ? void 0 : _graphRef$current.resize(width * scale, height * scale);
327
337
  } else {
@@ -386,7 +396,7 @@ var Player = function Player(_ref) {
386
396
  }
387
397
  };
388
398
  }, [query, jsonConfig, mittMeta]);
389
-
399
+ useEffect(function () {}, [query, jsonConfig, mittMeta]);
390
400
  // scene === 'freedom' 加载设备点位数据
391
401
  useEffect(function () {
392
402
  var fetchDevicePoints = /*#__PURE__*/function () {
@@ -422,15 +432,71 @@ var Player = function Player(_ref) {
422
432
  return _ref8.apply(this, arguments);
423
433
  };
424
434
  }();
435
+ var fetchDeviceSpecialPoint = /*#__PURE__*/function () {
436
+ var _ref9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(ids, dateType) {
437
+ var res, pointList;
438
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
439
+ while (1) switch (_context7.prev = _context7.next) {
440
+ case 0:
441
+ _context7.next = 2;
442
+ return GetTdIndicatorAggregateData(ids.map(function (v) {
443
+ var productNo = {
444
+ emqktt: 'energy',
445
+ mrwtn4: 'steamc',
446
+ kf78l3: 'waterc'
447
+ };
448
+ var str = v.split('_');
449
+ return {
450
+ indicatorNo: "".concat(str[0], "_").concat(str[1], "_").concat(productNo[str[0]]),
451
+ aggregateType: 3,
452
+ timeQuantumList: [{
453
+ startDate: dayjs().startOf(dateType == 0 ? "month" : "year").format('YYYY-MM-DD HH:mm:ss'),
454
+ endDate: dayjs().endOf(dateType == 0 ? "month" : "year").format('YYYY-MM-DD HH:mm:ss')
455
+ }]
456
+ };
457
+ }));
458
+ case 2:
459
+ res = _context7.sent;
460
+ if (res.success) {
461
+ _context7.next = 6;
462
+ break;
463
+ }
464
+ message.error('设备点位数据获取失败');
465
+ return _context7.abrupt("return");
466
+ case 6:
467
+ pointList = res.data || [];
468
+ pointList.forEach(function (v) {
469
+ var pointId = ids.find(function (id) {
470
+ return id.includes(v.deviceNo);
471
+ });
472
+ emitter.emit("point-update-".concat(pointId, "-").concat(mittMeta.namespace), v);
473
+ });
474
+ case 8:
475
+ case "end":
476
+ return _context7.stop();
477
+ }
478
+ }, _callee7);
479
+ }));
480
+ return function fetchDeviceSpecialPoint(_x7, _x8) {
481
+ return _ref9.apply(this, arguments);
482
+ };
483
+ }();
425
484
  var timer;
485
+ var specialPointTimer;
426
486
  if (query.scene === 'freedom' && jsonConfig) {
427
487
  var _jsonConfig$cells;
428
488
  var pointIds = [];
489
+ var specialPoint = [];
429
490
  jsonConfig === null || jsonConfig === void 0 ? void 0 : (_jsonConfig$cells = jsonConfig.cells) === null || _jsonConfig$cells === void 0 ? void 0 : _jsonConfig$cells.forEach(function (cell) {
430
- var _cell$data, _cell$data$pointList;
431
- cell === null || cell === void 0 ? void 0 : (_cell$data = cell.data) === null || _cell$data === void 0 ? void 0 : (_cell$data$pointList = _cell$data.pointList) === null || _cell$data$pointList === void 0 ? void 0 : _cell$data$pointList.forEach(function (point) {
432
- pointIds.push(point.pointId);
433
- });
491
+ var _cell$data;
492
+ if ((cell === null || cell === void 0 ? void 0 : (_cell$data = cell.data) === null || _cell$data === void 0 ? void 0 : _cell$data.valueType) == 1) {
493
+ specialPoint.push(cell);
494
+ } else {
495
+ var _cell$data2, _cell$data2$pointList;
496
+ cell === null || cell === void 0 ? void 0 : (_cell$data2 = cell.data) === null || _cell$data2 === void 0 ? void 0 : (_cell$data2$pointList = _cell$data2.pointList) === null || _cell$data2$pointList === void 0 ? void 0 : _cell$data2$pointList.forEach(function (point) {
497
+ pointIds.push(point.pointId);
498
+ });
499
+ }
434
500
 
435
501
  // ele-fan 元素单独处理
436
502
  if (cell.shape === 'ele-fan') {
@@ -458,6 +524,24 @@ var Player = function Player(_ref) {
458
524
  fetchDevicePoints(pointIds);
459
525
  }, RefreshFrequency);
460
526
  }
527
+ if (specialPoint.length) {
528
+ var monthPoint = specialPoint.filter(function (item) {
529
+ return item.data.valueDate == 0;
530
+ }).map(function (item) {
531
+ return item.data.pointList[0].pointId;
532
+ });
533
+ var yaerPoint = specialPoint.filter(function (item) {
534
+ return item.data.valueDate == 1;
535
+ }).map(function (item) {
536
+ return item.data.pointList[0].pointId;
537
+ });
538
+ monthPoint.length && fetchDeviceSpecialPoint(monthPoint, 0);
539
+ yaerPoint.length && fetchDeviceSpecialPoint(yaerPoint, 1);
540
+ specialPointTimer = setInterval(function () {
541
+ monthPoint.length && fetchDeviceSpecialPoint(monthPoint, 0);
542
+ yaerPoint.length && fetchDeviceSpecialPoint(yaerPoint, 1);
543
+ }, RefreshFrequency);
544
+ }
461
545
  }
462
546
  return function () {
463
547
  if (timer) {
@@ -502,7 +586,9 @@ var Player = function Player(_ref) {
502
586
  onCancel: function onCancel() {
503
587
  return setVisibleDialogHistory(false);
504
588
  },
505
- pointIdListProp: activePointIds
589
+ pointIdListProp: activePointIds,
590
+ companyId: query.companyId,
591
+ projectId: query.projectId
506
592
  }), /*#__PURE__*/React.createElement(DialogPointWrite, {
507
593
  visible: visibleDialogPointWrite,
508
594
  points: activePoints,
@@ -42,7 +42,8 @@ var LayerForm = function LayerForm() {
42
42
  backgroundColor = values.backgroundColor,
43
43
  borderRadius = values.borderRadius,
44
44
  backgroundImage = values.backgroundImage,
45
- dimensionsSelectValue = values.dimensionsSelectValue;
45
+ dimensionsSelectValue = values.dimensionsSelectValue,
46
+ refreshFrequency = values.refreshFrequency;
46
47
  var width = values.width,
47
48
  height = values.height;
48
49
  if (dimensionsSelectValue !== '自定义') {
@@ -64,7 +65,8 @@ var LayerForm = function LayerForm() {
64
65
  title: title,
65
66
  backgroundColor: backgroundColor,
66
67
  backgroundImage: backgroundImage,
67
- borderRadius: borderRadius
68
+ borderRadius: borderRadius,
69
+ refreshFrequency: refreshFrequency
68
70
  }));
69
71
  }, {
70
72
  leading: false,
@@ -138,6 +140,14 @@ var LayerForm = function LayerForm() {
138
140
  autoComplete: "off",
139
141
  onValuesChange: onFormChange
140
142
  }, /*#__PURE__*/React.createElement(Form.Item, {
143
+ name: "refreshFrequency",
144
+ label: "\u5237\u65B0\u9891\u7387"
145
+ }, /*#__PURE__*/React.createElement(InputNumber, {
146
+ min: 5,
147
+ max: 999,
148
+ defaultValue: 90,
149
+ addonBefore: "秒"
150
+ })), /*#__PURE__*/React.createElement(Form.Item, {
141
151
  name: "dimensionsSelectValue",
142
152
  label: "\u5206\u8FA8\u7387"
143
153
  }, /*#__PURE__*/React.createElement(Select, {
@@ -90,8 +90,7 @@ function _GetPointPage() {
90
90
  export function GetPointHistoryData(_x7, _x8) {
91
91
  return _GetPointHistoryData.apply(this, arguments);
92
92
  }
93
-
94
- /** 历史数据导出xlsx货pdf(支持进度条) POST /api/GatewayMicro/Point/DownHistoryDataToExcelOrPdf */
93
+ /** 获取点位历史数据 POST /api/GatewayMicro/Point/GetPointHistoryData */
95
94
  function _GetPointHistoryData() {
96
95
  _GetPointHistoryData = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(body, options) {
97
96
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
@@ -112,15 +111,17 @@ function _GetPointHistoryData() {
112
111
  }));
113
112
  return _GetPointHistoryData.apply(this, arguments);
114
113
  }
115
- export function DownHistoryDataToExcelOrPdf(_x9, _x10) {
116
- return _DownHistoryDataToExcelOrPdf.apply(this, arguments);
114
+ export function GetPointAggregationData(_x9, _x10) {
115
+ return _GetPointAggregationData.apply(this, arguments);
117
116
  }
118
- function _DownHistoryDataToExcelOrPdf() {
119
- _DownHistoryDataToExcelOrPdf = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(body, options) {
117
+
118
+ /** 获取点位历史数据 POST /api/GatewayMicro/Point/GetPointHistoryData */
119
+ function _GetPointAggregationData() {
120
+ _GetPointAggregationData = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(body, options) {
120
121
  return _regeneratorRuntime().wrap(function _callee5$(_context5) {
121
122
  while (1) switch (_context5.prev = _context5.next) {
122
123
  case 0:
123
- return _context5.abrupt("return", request('/api/GatewayMicro/Point/DownHistoryDataToExcelOrPdf', _objectSpread({
124
+ return _context5.abrupt("return", request('/api/GatewayMicro/Point/GetPointAggregationData', _objectSpread({
124
125
  method: 'POST',
125
126
  headers: {
126
127
  'Content-Type': 'application/json-patch+json'
@@ -133,5 +134,53 @@ function _DownHistoryDataToExcelOrPdf() {
133
134
  }
134
135
  }, _callee5);
135
136
  }));
137
+ return _GetPointAggregationData.apply(this, arguments);
138
+ }
139
+ export function GetTdIndicatorAggregateData(_x11, _x12) {
140
+ return _GetTdIndicatorAggregateData.apply(this, arguments);
141
+ }
142
+
143
+ /** 历史数据导出xlsx货pdf(支持进度条) POST /api/GatewayMicro/Point/DownHistoryDataToExcelOrPdf */
144
+ function _GetTdIndicatorAggregateData() {
145
+ _GetTdIndicatorAggregateData = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(body, options) {
146
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
147
+ while (1) switch (_context6.prev = _context6.next) {
148
+ case 0:
149
+ return _context6.abrupt("return", request('/api/GatewayMicro/DeviceIndicator/GetTdIndicatorAggregateData', _objectSpread({
150
+ method: 'POST',
151
+ headers: {
152
+ 'Content-Type': 'application/json-patch+json'
153
+ },
154
+ data: body
155
+ }, options || {})));
156
+ case 1:
157
+ case "end":
158
+ return _context6.stop();
159
+ }
160
+ }, _callee6);
161
+ }));
162
+ return _GetTdIndicatorAggregateData.apply(this, arguments);
163
+ }
164
+ export function DownHistoryDataToExcelOrPdf(_x13, _x14) {
165
+ return _DownHistoryDataToExcelOrPdf.apply(this, arguments);
166
+ }
167
+ function _DownHistoryDataToExcelOrPdf() {
168
+ _DownHistoryDataToExcelOrPdf = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(body, options) {
169
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
170
+ while (1) switch (_context7.prev = _context7.next) {
171
+ case 0:
172
+ return _context7.abrupt("return", request('/api/GatewayMicro/Point/DownHistoryDataToExcelOrPdf', _objectSpread({
173
+ method: 'POST',
174
+ headers: {
175
+ 'Content-Type': 'application/json-patch+json'
176
+ },
177
+ data: body
178
+ }, options || {})));
179
+ case 1:
180
+ case "end":
181
+ return _context7.stop();
182
+ }
183
+ }, _callee7);
184
+ }));
136
185
  return _DownHistoryDataToExcelOrPdf.apply(this, arguments);
137
186
  }
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 */
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "coolcare-lite-scada-component",
3
- "version": "2.0.35",
3
+ "version": "2.0.36",
4
4
  "scripts": {
5
- "start": "umi dev",
5
+ "start": " umi dev",
6
6
  "build:prod": "UMI_ENV=prod umi build",
7
7
  "build:generalfushi": "UMI_ENV=prod REACT_APP_PLATFORM=generalfushi umi build",
8
8
  "build:yimin": "UMI_ENV=prod REACT_APP_PLATFORM=yimin umi build",