coolcare-lite-scada-component 1.0.62 → 1.0.64

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.
@@ -17,7 +17,7 @@ import { useCallback, useEffect, useState, useRef } from 'react';
17
17
  import { Modal, Form, message, InputNumber, DatePicker, Empty, Typography, Button, Space, Tag } from 'antd';
18
18
  import moment from 'moment';
19
19
  import { useDebounceFn } from 'ahooks';
20
- import { GetPointHistoryData } from "../../services/gateway/Point";
20
+ import { GetPointHistoryData, GetTdIndicatorHistoryData } from "../../services/gateway/Point";
21
21
  import Echarts from "../ECharts";
22
22
  // @ts-ignore
23
23
 
@@ -39,6 +39,7 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
39
39
  var _ref$isSinglePoint = _ref.isSinglePoint,
40
40
  isSinglePoint = _ref$isSinglePoint === void 0 ? true : _ref$isSinglePoint,
41
41
  pointIdListProp = _ref.pointIdListProp,
42
+ indicatorNoList = _ref.indicatorNoList,
42
43
  dateRangeProp = _ref.dateRangeProp,
43
44
  intervalProp = _ref.intervalProp,
44
45
  visible = _ref.visible,
@@ -89,6 +90,10 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
89
90
  _useState16 = _slicedToArray(_useState15, 2),
90
91
  dataZoomData = _useState16[0],
91
92
  setDataZoomData = _useState16[1];
93
+ var _useState17 = useState('point'),
94
+ _useState18 = _slicedToArray(_useState17, 2),
95
+ valueType = _useState18[0],
96
+ setValueType = _useState18[1];
92
97
  var closeModal = function closeModal() {
93
98
  form.resetFields();
94
99
  setLoading(false);
@@ -101,12 +106,12 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
101
106
 
102
107
  /** 获取点位历史数据 */
103
108
  var fetchPointHistory = useCallback(/*#__PURE__*/function () {
104
- var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(idList, ranges, interval) {
105
- var diff, res, data, series, yAxisData;
109
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(idList, indicatorNo, ranges, interval) {
110
+ var diff, fun, res, data, series, yAxisData;
106
111
  return _regeneratorRuntime().wrap(function _callee$(_context) {
107
112
  while (1) switch (_context.prev = _context.next) {
108
113
  case 0:
109
- if (idList === null || idList === void 0 ? void 0 : idList.length) {
114
+ if (!(!(idList === null || idList === void 0 ? void 0 : idList.length) && !(indicatorNo === null || indicatorNo === void 0 ? void 0 : indicatorNo.length))) {
110
115
  _context.next = 2;
111
116
  break;
112
117
  }
@@ -119,35 +124,41 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
119
124
  message.info('请选择时间范围');
120
125
  return _context.abrupt("return");
121
126
  case 5:
127
+ if (!idList.length) {
128
+ _context.next = 9;
129
+ break;
130
+ }
122
131
  if (!(typeof interval !== 'number' || interval < 0)) {
123
- _context.next = 8;
132
+ _context.next = 9;
124
133
  break;
125
134
  }
126
135
  message.info('请正确输入时间间隔');
127
136
  return _context.abrupt("return");
128
- case 8:
129
- _context.prev = 8;
137
+ case 9:
138
+ _context.prev = 9;
130
139
  diff = moment(ranges[1]).valueOf() - moment(ranges[0]).valueOf();
131
140
  if (!(diff > oneYearTime)) {
132
- _context.next = 13;
141
+ _context.next = 14;
133
142
  break;
134
143
  }
135
144
  message.error('历史数据最大查询范围是一年');
136
145
  return _context.abrupt("return");
137
- case 13:
146
+ case 14:
138
147
  // 获取点位数据
139
148
  setLoading(true);
140
149
  setTagList([]);
141
- _context.next = 17;
142
- return GetPointHistoryData({
150
+ fun = indicatorNo.length ? GetTdIndicatorHistoryData : GetPointHistoryData;
151
+ _context.next = 19;
152
+ return fun({
143
153
  timeQuantum: {
144
154
  startDate: moment(ranges[0]).format('YYYY-MM-DD HH:mm'),
145
155
  endDate: moment(ranges[1]).format('YYYY-MM-DD HH:mm')
146
156
  },
157
+ indicatorNoList: indicatorNo,
147
158
  pointIdList: idList,
148
159
  interval: interval
149
160
  });
150
- case 17:
161
+ case 19:
151
162
  res = _context.sent;
152
163
  if (res.success) {
153
164
  data = res.data;
@@ -160,18 +171,18 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
160
171
  yAxisData = [];
161
172
  setDeviceId(data[0].deviceId);
162
173
  if (data.every(function (v) {
163
- var _v$pointDataList;
164
- return ((_v$pointDataList = v.pointDataList) === null || _v$pointDataList === void 0 ? void 0 : _v$pointDataList.length) === 0 || !v.pointDataList;
174
+ var _ref3;
175
+ return ((_ref3 = v.pointDataList || v.indicatorDataList) === null || _ref3 === void 0 ? void 0 : _ref3.length) === 0 || !v.pointDataList && !v.indicatorDataList;
165
176
  })) {
166
177
  setIsNoData(true);
167
178
  } else {
168
179
  setIsNoData(false);
169
180
  }
170
181
  data.forEach(function (item) {
171
- var _item$pointDataList;
182
+ var _ref4;
172
183
  setTagList(function (old) {
173
184
  return [].concat(_toConsumableArray(old), [{
174
- name: "".concat(item.deviceName, "-").concat(item.pointName),
185
+ name: "".concat(item.deviceName, "-").concat(item.pointName || item.indicatorName),
175
186
  key: item.pointId
176
187
  }]);
177
188
  });
@@ -236,7 +247,7 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
236
247
  // 配置曲线数据
237
248
  series.push({
238
249
  animation: false,
239
- name: "".concat(item.deviceName, "-").concat(item.pointName),
250
+ name: "".concat(item.deviceName, "-").concat(item.pointName || item.indicatorName),
240
251
  type: interval == 0 ? 'scatter' : 'line',
241
252
  unit: item.unit,
242
253
  yAxisIndex: yAxisData.findIndex(function (yAxis) {
@@ -245,7 +256,7 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
245
256
  smooth: false,
246
257
  showAllSymbol: true,
247
258
  symbolSize: 1.5,
248
- data: (_item$pointDataList = item.pointDataList) === null || _item$pointDataList === void 0 ? void 0 : _item$pointDataList.map(function (dataItem) {
259
+ data: (_ref4 = item.pointDataList || item.indicatorDataList) === null || _ref4 === void 0 ? void 0 : _ref4.map(function (dataItem) {
249
260
  return [new Date(dataItem.ts).getTime(), dataItem.val];
250
261
  }),
251
262
  markPoint: {
@@ -318,25 +329,25 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
318
329
  setIsNoData(true);
319
330
  message.error(res.message);
320
331
  }
321
- _context.next = 26;
332
+ _context.next = 28;
322
333
  break;
323
- case 21:
324
- _context.prev = 21;
325
- _context.t0 = _context["catch"](8);
334
+ case 23:
335
+ _context.prev = 23;
336
+ _context.t0 = _context["catch"](9);
326
337
  console.error(_context.t0);
327
338
  setIsNoData(true);
328
339
  setChartOptions(undefined);
329
- case 26:
330
- _context.prev = 26;
340
+ case 28:
341
+ _context.prev = 28;
331
342
  setLoading(false);
332
- return _context.finish(26);
333
- case 29:
343
+ return _context.finish(28);
344
+ case 31:
334
345
  case "end":
335
346
  return _context.stop();
336
347
  }
337
- }, _callee, null, [[8, 21, 26, 29]]);
348
+ }, _callee, null, [[9, 23, 28, 31]]);
338
349
  }));
339
- return function (_x, _x2, _x3) {
350
+ return function (_x, _x2, _x3, _x4) {
340
351
  return _ref2.apply(this, arguments);
341
352
  };
342
353
  }(), []);
@@ -345,7 +356,7 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
345
356
  }),
346
357
  fetchPointHistoryDebounce = _useDebounceFn.run;
347
358
  var handleSubmit = /*#__PURE__*/function () {
348
- var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
359
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
349
360
  var _yield$form$validateF, dateRange, interval;
350
361
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
351
362
  while (1) switch (_context2.prev = _context2.next) {
@@ -356,37 +367,46 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
356
367
  _yield$form$validateF = _context2.sent;
357
368
  dateRange = _yield$form$validateF.dateRange;
358
369
  interval = _yield$form$validateF.interval;
359
- fetchPointHistoryDebounce(pointIdList, dateRange, interval);
360
- case 6:
370
+ setValueType(indicatorNoList.length ? 'indicator' : 'point');
371
+ fetchPointHistoryDebounce(indicatorNoList.length ? [] : pointIdList, indicatorNoList.length ? pointIdList : [], dateRange, interval);
372
+ case 7:
361
373
  case "end":
362
374
  return _context2.stop();
363
375
  }
364
376
  }, _callee2);
365
377
  }));
366
378
  return function handleSubmit() {
367
- return _ref3.apply(this, arguments);
379
+ return _ref5.apply(this, arguments);
368
380
  };
369
381
  }();
370
382
  useEffect(function () {
371
383
  var _form$getFieldsValue = form.getFieldsValue(),
372
384
  dateRange = _form$getFieldsValue.dateRange,
373
385
  interval = _form$getFieldsValue.interval;
374
- fetchPointHistoryDebounce(pointIdList, dateRange, interval);
386
+ setValueType(indicatorNoList.length ? 'indicator' : 'point');
387
+ fetchPointHistoryDebounce(indicatorNoList.length ? [] : pointIdList, indicatorNoList.length ? pointIdList : [], dateRange, interval);
375
388
  }, [pointIdList]);
376
389
 
377
390
  /** 打开弹框,初始化数据,获取曲线图形 */
378
391
  useEffect(function () {
379
- if (visible && (pointIdListProp === null || pointIdListProp === void 0 ? void 0 : pointIdListProp.length)) {
392
+ if (visible) {
380
393
  var ranges = dateRangeProp || [moment(moment().subtract(1, 'days').format('YYYY-MM-DD 00:00')), moment(moment().format('YYYY-MM-DD 23:59'))];
381
394
  var interval = typeof intervalProp === 'number' && intervalProp ? intervalProp : defaultInterval;
382
395
  form.setFieldsValue({
383
396
  dateRange: ranges,
384
397
  interval: interval
385
398
  });
386
- setPointIdList(pointIdListProp);
387
- fetchPointHistoryDebounce(pointIdListProp, ranges, interval);
399
+ if (pointIdListProp === null || pointIdListProp === void 0 ? void 0 : pointIdListProp.length) {
400
+ setPointIdList(pointIdListProp);
401
+ setValueType('point');
402
+ fetchPointHistoryDebounce(pointIdListProp, [], ranges, interval);
403
+ } else if (indicatorNoList === null || indicatorNoList === void 0 ? void 0 : indicatorNoList.length) {
404
+ setPointIdList(indicatorNoList);
405
+ setValueType('indicator');
406
+ fetchPointHistoryDebounce([], indicatorNoList, ranges, interval);
407
+ }
388
408
  }
389
- }, [visible, form, pointIdListProp, dateRangeProp, intervalProp]);
409
+ }, [visible, form, pointIdListProp, dateRangeProp, intervalProp, indicatorNoList]);
390
410
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Modal, {
391
411
  title: "\u5386\u53F2\u6570\u636E\u66F2\u7EBF",
392
412
  open: visible,
@@ -432,9 +452,9 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
432
452
  },
433
453
  format: "YYYY-MM-DD HH:mm",
434
454
  getPopupContainer: function getPopupContainer() {
435
- return document.querySelector(".temperatureDateRange") || document.body;
455
+ return document.querySelector('.temperatureDateRange') || document.body;
436
456
  }
437
- })), /*#__PURE__*/React.createElement(Form.Item, {
457
+ })), indicatorNoList.length ? null : /*#__PURE__*/React.createElement(Form.Item, {
438
458
  name: "interval",
439
459
  label: "\u95F4\u9694\uFF08\u5206\u949F\uFF09",
440
460
  rules: [{
@@ -612,6 +632,8 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
612
632
  });
613
633
  },
614
634
  currentDeviceId: deviceId,
635
+ key: valueType,
636
+ valueType: valueType,
615
637
  companyId: companyId,
616
638
  projectId: projectId,
617
639
  onCancel: function onCancel() {
@@ -25,6 +25,7 @@ import DeviceSelect from "../DeviceSelect";
25
25
  import PointSelect from "../PointSelect";
26
26
  import { GetDataConfigure } from "../../services/energy";
27
27
  import { useQuery } from "../../hooks";
28
+ import IndicatorSelect from "../PointSelect/IndicatorSelect";
28
29
  var Text = Typography.Text,
29
30
  Link = Typography.Link;
30
31
  var FormItem = Form.Item;
@@ -83,7 +84,8 @@ var FreedomSceneFormBindPoint = function FreedomSceneFormBindPoint(_ref) {
83
84
  deviceId: undefined,
84
85
  deviceType: 'device',
85
86
  pointId: undefined,
86
- identifierName: ''
87
+ identifierName: '',
88
+ valueType: 'point'
87
89
  }],
88
90
  unitShow: true
89
91
  });
@@ -115,6 +117,8 @@ var FreedomSceneFormBindPoint = function FreedomSceneFormBindPoint(_ref) {
115
117
  var unitShow = form.getFieldValue('unitShow');
116
118
  pointList[index].identifierName = undefined;
117
119
  pointList[index].pointId = undefined;
120
+ pointList[index].pointId = undefined;
121
+ pointList[index].valueType = 'point';
118
122
  form.setFieldsValue({
119
123
  pointList: pointList,
120
124
  unitShow: unitShow
@@ -125,7 +129,7 @@ var FreedomSceneFormBindPoint = function FreedomSceneFormBindPoint(_ref) {
125
129
  unitShow = _ref2.unitShow;
126
130
  if (!activeCell) return;
127
131
  var list = pointList.filter(function (v) {
128
- return v.identifierName || v.meterId;
132
+ return v.identifierName || v.meterId || v.indicatorNo;
129
133
  });
130
134
  var payload = activeCell.getData();
131
135
  activeCell.setData({
@@ -137,7 +141,9 @@ var FreedomSceneFormBindPoint = function FreedomSceneFormBindPoint(_ref) {
137
141
  deviceType: v.deviceType,
138
142
  pointId: v.pointId,
139
143
  dataType: v.dataType,
140
- meterId: v.meterId
144
+ meterId: v.meterId,
145
+ valueType: v.indicatorNo ? 'indicator' : 'point',
146
+ indicatorNo: v.indicatorNo
141
147
  });
142
148
  }),
143
149
  unitShow: unitShow
@@ -186,7 +192,7 @@ var FreedomSceneFormBindPoint = function FreedomSceneFormBindPoint(_ref) {
186
192
  return remove(name);
187
193
  }
188
194
  }, /*#__PURE__*/React.createElement(DeleteOutlined, null)))), /*#__PURE__*/React.createElement(Form.Item, _extends({}, restField, {
189
- label: "\u7C7B\u578B\xA0",
195
+ label: "\u8868\u7C7B\u578B",
190
196
  name: [name, 'deviceType'],
191
197
  className: "!ml-3"
192
198
  }), /*#__PURE__*/React.createElement(Select, {
@@ -207,7 +213,8 @@ var FreedomSceneFormBindPoint = function FreedomSceneFormBindPoint(_ref) {
207
213
  identifierName: undefined,
208
214
  pointId: undefined,
209
215
  dataType: undefined,
210
- meterId: undefined
216
+ meterId: undefined,
217
+ indicatorNo: undefined
211
218
  });
212
219
  form.setFieldsValue({
213
220
  pointList: pointList
@@ -223,9 +230,48 @@ var FreedomSceneFormBindPoint = function FreedomSceneFormBindPoint(_ref) {
223
230
  }), /*#__PURE__*/React.createElement(DeviceSelect, {
224
231
  onChange: function onChange(_ref5) {
225
232
  var deviceId = _ref5.deviceId;
226
- return handleDeviceChange(deviceId, index);
233
+ handleDeviceChange(deviceId, index);
234
+ // 清空关联的指标值
235
+ var pointList = form.getFieldValue('pointList');
236
+ pointList[index] = _objectSpread(_objectSpread({}, pointList[index]), {}, {
237
+ deviceId: deviceId,
238
+ indicatorNo: undefined,
239
+ // 清空指标值
240
+ valueType: 'point'
241
+ });
242
+ form.setFieldsValue({
243
+ pointList: pointList
244
+ });
227
245
  }
228
246
  })), /*#__PURE__*/React.createElement(Form.Item, _extends({}, restField, {
247
+ label: "\u503C\u7C7B\u578B",
248
+ name: [name, 'valueType'],
249
+ className: "!ml-3"
250
+ }), /*#__PURE__*/React.createElement(Select, {
251
+ defaultValue: "point",
252
+ options: [{
253
+ label: '点位',
254
+ value: 'point'
255
+ }, {
256
+ label: '指标',
257
+ value: 'indicator'
258
+ }],
259
+ onChange: function onChange(value) {
260
+ var pointList = form.getFieldValue('pointList');
261
+ // 清空相关字段
262
+ pointList[name] = _objectSpread(_objectSpread({}, pointList[name]), {}, {
263
+ valueType: value,
264
+ identifierName: undefined,
265
+ pointId: undefined,
266
+ dataType: undefined,
267
+ meterId: undefined,
268
+ indicatorNo: undefined
269
+ });
270
+ form.setFieldsValue({
271
+ pointList: pointList
272
+ });
273
+ }
274
+ })), form.getFieldValue(['pointList', name, 'valueType']) == 'point' ? /*#__PURE__*/React.createElement(Form.Item, _extends({}, restField, {
229
275
  label: "\u70B9\u4F4D\xA0",
230
276
  name: [name, 'identifierName'],
231
277
  className: "!ml-3",
@@ -240,6 +286,20 @@ var FreedomSceneFormBindPoint = function FreedomSceneFormBindPoint(_ref) {
240
286
  }), /*#__PURE__*/React.createElement(PointSelect, {
241
287
  deviceId: form.getFieldValue(['pointList', name, 'deviceId']),
242
288
  disabledUnWriteable: payload === null || payload === void 0 ? void 0 : payload.pointSelect_disabledUnWriteable
289
+ })) : /*#__PURE__*/React.createElement(Form.Item, _extends({}, restField, {
290
+ label: "\u6307\u6807\xA0",
291
+ name: [name, 'indicatorNo'],
292
+ className: "!ml-3",
293
+ normalize: function normalize(pointInfo) {
294
+ var pointList = form.getFieldValue('pointList');
295
+ pointList[index].indicatorNo = pointInfo.indicatorNo;
296
+ form.setFieldsValue({
297
+ pointList: pointList
298
+ });
299
+ return pointInfo.indicatorNo;
300
+ }
301
+ }), /*#__PURE__*/React.createElement(IndicatorSelect, {
302
+ deviceId: form.getFieldValue(['pointList', name, 'deviceId'])
243
303
  })), /*#__PURE__*/React.createElement(Form.Item, _extends({
244
304
  hidden: true
245
305
  }, restField, {
@@ -12,7 +12,7 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
12
12
  import React from "react";
13
13
  import { useCallback, useEffect, useState } from 'react';
14
14
  import { Modal, Button, Form, Space, message, Select } from 'antd';
15
- import { GetDevicePage, GetDevicePoint } from "../../services/gateway/Device";
15
+ import { GetDeviceIndicator, GetDevicePage, GetDevicePoint } from "../../services/gateway/Device";
16
16
  var Option = Select.Option;
17
17
  var tailLayout = {
18
18
  wrapperCol: {
@@ -26,7 +26,8 @@ var ModalChoosePoint = function ModalChoosePoint(_ref) {
26
26
  onCancel = _ref.onCancel,
27
27
  companyId = _ref.companyId,
28
28
  projectId = _ref.projectId,
29
- currentDeviceId = _ref.currentDeviceId;
29
+ currentDeviceId = _ref.currentDeviceId,
30
+ valueType = _ref.valueType;
30
31
  var _Form$useForm = Form.useForm(),
31
32
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
32
33
  form = _Form$useForm2[0];
@@ -47,34 +48,56 @@ var ModalChoosePoint = function ModalChoosePoint(_ref) {
47
48
  /** 获取产品最新发布版本点位列表 */
48
49
  var fetchPointList = useCallback(/*#__PURE__*/function () {
49
50
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(val) {
50
- var res;
51
+ var res, _yield$GetDeviceIndic, success, data, _message;
51
52
  return _regeneratorRuntime().wrap(function _callee$(_context) {
52
53
  while (1) switch (_context.prev = _context.next) {
53
54
  case 0:
54
55
  _context.prev = 0;
55
- _context.next = 3;
56
+ if (!(valueType == 'point')) {
57
+ _context.next = 8;
58
+ break;
59
+ }
60
+ _context.next = 4;
56
61
  return GetDevicePoint({
57
62
  deviceIdList: [val]
58
63
  });
59
- case 3:
64
+ case 4:
60
65
  res = _context.sent;
61
66
  if (res.success) {
62
67
  setPointList(res.data || []);
63
68
  } else {
64
69
  message.error(res.message);
65
70
  }
66
- _context.next = 11;
71
+ _context.next = 15;
72
+ break;
73
+ case 8:
74
+ _context.next = 10;
75
+ return GetDeviceIndicator({
76
+ deviceIdList: [val]
77
+ });
78
+ case 10:
79
+ _yield$GetDeviceIndic = _context.sent;
80
+ success = _yield$GetDeviceIndic.success;
81
+ data = _yield$GetDeviceIndic.data;
82
+ _message = _yield$GetDeviceIndic.message;
83
+ if (success) {
84
+ setPointList(data || []);
85
+ } else {
86
+ _message.error(_message);
87
+ }
88
+ case 15:
89
+ _context.next = 21;
67
90
  break;
68
- case 7:
69
- _context.prev = 7;
91
+ case 17:
92
+ _context.prev = 17;
70
93
  _context.t0 = _context["catch"](0);
71
94
  console.error(_context.t0);
72
95
  message.error('获取属性列表失败');
73
- case 11:
96
+ case 21:
74
97
  case "end":
75
98
  return _context.stop();
76
99
  }
77
- }, _callee, null, [[0, 7]]);
100
+ }, _callee, null, [[0, 17]]);
78
101
  }));
79
102
  return function (_x) {
80
103
  return _ref2.apply(this, arguments);
@@ -91,7 +114,7 @@ var ModalChoosePoint = function ModalChoosePoint(_ref) {
91
114
  _context2.next = 3;
92
115
  return GetDevicePage({
93
116
  companyId: companyId,
94
- projectIdList: projectId ? [projectId] : undefined
117
+ projectIdList: isNaN(projectId) ? undefined : [projectId]
95
118
  });
96
119
  case 3:
97
120
  res = _context2.sent;
@@ -148,7 +171,7 @@ var ModalChoosePoint = function ModalChoosePoint(_ref) {
148
171
  }
149
172
  }, [currentDeviceId]);
150
173
  return /*#__PURE__*/React.createElement(Modal, {
151
- title: '选择属性',
174
+ title: "\u9009\u62E9".concat(valueType == 'point' ? '点位' : '指标'),
152
175
  closable: false,
153
176
  width: 300,
154
177
  maskClosable: true,
@@ -186,7 +209,7 @@ var ModalChoosePoint = function ModalChoosePoint(_ref) {
186
209
  });
187
210
  },
188
211
  getPopupContainer: function getPopupContainer() {
189
- return document.querySelector(".temperatureDeviceSelect") || document.body;
212
+ return document.querySelector('.temperatureDeviceSelect') || document.body;
190
213
  }
191
214
  }, deviceList.map(function (item) {
192
215
  return /*#__PURE__*/React.createElement(Option, {
@@ -215,14 +238,14 @@ var ModalChoosePoint = function ModalChoosePoint(_ref) {
215
238
  placeholder: "\u8BF7\u9009\u62E9",
216
239
  disabled: !getFieldValue('deviceId'),
217
240
  getPopupContainer: function getPopupContainer() {
218
- return document.querySelector(".temperaturePointSelect") || document.body;
241
+ return document.querySelector('.temperaturePointSelect') || document.body;
219
242
  }
220
243
  }, pointList.map(function (item) {
221
244
  return /*#__PURE__*/React.createElement(Option, {
222
- value: item.pointId,
223
- label: item.pointName,
224
- key: item.pointId
225
- }, item.pointName);
245
+ value: item.pointId || item.indicatorNo,
246
+ label: item.pointName || item.indicatorName,
247
+ key: item.pointId || item.indicatorNo
248
+ }, item.pointName || item.indicatorName);
226
249
  })));
227
250
  }), /*#__PURE__*/React.createElement(Form.Item, _extends({}, tailLayout, {
228
251
  noStyle: true,
@@ -0,0 +1,111 @@
1
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
2
+ 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."); }
3
+ 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; } }
4
+ 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; }
5
+ 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; } }
6
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
7
+ import React from "react";
8
+ import { Table, Input, Space } from 'antd';
9
+ import { useState, useMemo } from 'react';
10
+ import { CloseOutlined } from '@ant-design/icons';
11
+ import styles from "./index.css";
12
+ var Search = Input.Search;
13
+ var ProductIndicatorTypeEnum = ['能耗', '温度', '库门', '制冷', '化霜', '过热度', '膨胀阀', '压缩机', '自定义', '单位库容能耗', '用水量', '用气量'];
14
+ var columns = [{
15
+ title: '指标名称',
16
+ dataIndex: 'indicatorName',
17
+ key: 'indicatorName'
18
+ }, {
19
+ title: '最近值',
20
+ dataIndex: 'value',
21
+ key: 'value',
22
+ width: 70,
23
+ render: function render(value, record, index) {
24
+ return record.indicatorData ? record.indicatorData.val : 0;
25
+ }
26
+ }, {
27
+ title: '数据更新时间',
28
+ dataIndex: 'updateTime',
29
+ key: 'updateTime',
30
+ width: 150,
31
+ render: function render(value, record, index) {
32
+ return record.indicatorData ? record.indicatorData.ts : '--/--';
33
+ }
34
+ }, {
35
+ title: '指标类型',
36
+ dataIndex: 'indicatorType',
37
+ render: function render(value, record, index) {
38
+ return ProductIndicatorTypeEnum[value];
39
+ }
40
+ }];
41
+ var DeviceIndicatorTable = function DeviceIndicatorTable(_ref) {
42
+ var _onChange = _ref.onChange,
43
+ onClose = _ref.onClose,
44
+ data = _ref.data,
45
+ indicatorId = _ref.indicatorId,
46
+ loading = _ref.loading;
47
+ var _useState = useState(''),
48
+ _useState2 = _slicedToArray(_useState, 2),
49
+ filterText = _useState2[0],
50
+ setFilterText = _useState2[1];
51
+ var onSearch = function onSearch(value) {
52
+ setFilterText(value);
53
+ };
54
+ var tableData = useMemo(function () {
55
+ if (!data) {
56
+ return [];
57
+ }
58
+ return data.filter(function (v) {
59
+ var _v$indicatorName, _v$indicatorIdentifie;
60
+ return !filterText || ((_v$indicatorName = v.indicatorName) === null || _v$indicatorName === void 0 ? void 0 : _v$indicatorName.toLocaleLowerCase().includes(filterText.toLocaleLowerCase())) || ((_v$indicatorIdentifie = v.indicatorIdentifier) === null || _v$indicatorIdentifie === void 0 ? void 0 : _v$indicatorIdentifie.toLocaleLowerCase().includes(filterText.toLocaleLowerCase()));
61
+ });
62
+ }, [data, filterText]);
63
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
64
+ className: "mb-4 flex justify-between items-center"
65
+ }, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Search, {
66
+ size: "small",
67
+ placeholder: "\u641C\u7D22\u6307\u6807\u540D\u79F0\u6216\u6807\u8BC6\u7B26",
68
+ allowClear: true,
69
+ onSearch: onSearch,
70
+ style: {
71
+ width: 210
72
+ }
73
+ })), /*#__PURE__*/React.createElement(CloseOutlined, {
74
+ onClick: onClose,
75
+ className: "cursor-pointer"
76
+ })), /*#__PURE__*/React.createElement(Table, {
77
+ columns: columns,
78
+ dataSource: tableData,
79
+ size: "small",
80
+ rowKey: "indicatorIdentifier",
81
+ loading: loading,
82
+ rowClassName: styles.row,
83
+ onRow: function onRow(record) {
84
+ return {
85
+ onClick: function onClick() {
86
+ _onChange(record);
87
+ }
88
+ };
89
+ },
90
+ pagination: false,
91
+ scroll: {
92
+ y: 340
93
+ },
94
+ rowSelection: {
95
+ type: 'radio',
96
+ getCheckboxProps: function getCheckboxProps(record) {
97
+ return {
98
+ name: "".concat(record.indicatorId),
99
+ disabled: false
100
+ };
101
+ },
102
+ selectedRowKeys: indicatorId ? [indicatorId] : [],
103
+ onChange: function onChange(selectedRowKeys, _ref2) {
104
+ var _ref3 = _slicedToArray(_ref2, 1),
105
+ selectedRow = _ref3[0];
106
+ _onChange(selectedRow);
107
+ }
108
+ }
109
+ }));
110
+ };
111
+ export default DeviceIndicatorTable;