coolcare-lite-scada-component 1.0.29 → 1.0.31

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.
@@ -77,6 +77,10 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
77
77
  _useState12 = _slicedToArray(_useState11, 2),
78
78
  haveAlarm = _useState12[0],
79
79
  setHaveAlarm = _useState12[1];
80
+ var _useState13 = useState(undefined),
81
+ _useState14 = _slicedToArray(_useState13, 2),
82
+ deviceId = _useState14[0],
83
+ setDeviceId = _useState14[1];
80
84
  var closeModal = function closeModal() {
81
85
  form.resetFields();
82
86
  setLoading(false);
@@ -91,7 +95,7 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
91
95
  /** 获取点位历史数据 */
92
96
  var fetchPointHistory = useCallback(/*#__PURE__*/function () {
93
97
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(idList, ranges, interval) {
94
- var diff, res, data, series, yAxisData, xAxisData;
98
+ var diff, res, data, series, yAxisData;
95
99
  return _regeneratorRuntime().wrap(function _callee$(_context) {
96
100
  while (1) switch (_context.prev = _context.next) {
97
101
  case 0:
@@ -147,7 +151,7 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
147
151
  // 图形处理
148
152
  series = [];
149
153
  yAxisData = [];
150
- xAxisData = [];
154
+ setDeviceId(data[0].deviceId);
151
155
  if (data.every(function (v) {
152
156
  var _v$pointDataList;
153
157
  return ((_v$pointDataList = v.pointDataList) === null || _v$pointDataList === void 0 ? void 0 : _v$pointDataList.length) === 0 || !v.pointDataList;
@@ -157,7 +161,7 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
157
161
  setIsNoData(false);
158
162
  }
159
163
  data.forEach(function (item) {
160
- var _item$pointAlarmTimeF, _item$pointDataList, _item$pointDataList2;
164
+ var _item$pointAlarmTimeF, _item$pointDataList;
161
165
  // @ts-ignore
162
166
  if ((_item$pointAlarmTimeF = item.pointAlarmTimeFrameList) === null || _item$pointAlarmTimeF === void 0 ? void 0 : _item$pointAlarmTimeF.length) {
163
167
  setHaveAlarm(true);
@@ -220,12 +224,6 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
220
224
  }
221
225
  yAxisData.push(yAxis);
222
226
  }
223
- // 配置x坐标轴数据
224
- if ((_item$pointDataList = item.pointDataList) === null || _item$pointDataList === void 0 ? void 0 : _item$pointDataList.length) {
225
- xAxisData = item.pointDataList.map(function (pointDataItem) {
226
- return pointDataItem.ts;
227
- });
228
- }
229
227
  // 配置曲线数据
230
228
  series.push({
231
229
  animation: false,
@@ -238,7 +236,7 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
238
236
  smooth: false,
239
237
  showAllSymbol: true,
240
238
  symbolSize: 1.5,
241
- data: (_item$pointDataList2 = item.pointDataList) === null || _item$pointDataList2 === void 0 ? void 0 : _item$pointDataList2.map(function (dataItem) {
239
+ data: (_item$pointDataList = item.pointDataList) === null || _item$pointDataList === void 0 ? void 0 : _item$pointDataList.map(function (dataItem) {
242
240
  return [new Date(dataItem.ts).getTime(), dataItem.val];
243
241
  }),
244
242
  markPoint: {
@@ -303,7 +301,6 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
303
301
  splitLine: {
304
302
  show: false
305
303
  }
306
- // data: xAxisData,
307
304
  },
308
305
  series: series
309
306
  });
@@ -467,6 +464,8 @@ var DialogPointHistory = function DialogPointHistory(_ref) {
467
464
  return _toConsumableArray(new Set([].concat(_toConsumableArray(pre), _toConsumableArray(val))));
468
465
  });
469
466
  },
467
+ currentDeviceId: deviceId,
468
+ currentPointList: pointIdList,
470
469
  companyId: companyId,
471
470
  projectId: projectId,
472
471
  onCancel: function onCancel() {
@@ -27,7 +27,8 @@ var ModalChoosePoint = function ModalChoosePoint(_ref) {
27
27
  onSubmit = _ref.onSubmit,
28
28
  onCancel = _ref.onCancel,
29
29
  companyId = _ref.companyId,
30
- projectId = _ref.projectId;
30
+ currentDeviceId = _ref.currentDeviceId,
31
+ currentPointList = _ref.currentPointList;
31
32
  var _Form$useForm = Form.useForm(),
32
33
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
33
34
  form = _Form$useForm2[0];
@@ -43,7 +44,6 @@ var ModalChoosePoint = function ModalChoosePoint(_ref) {
43
44
  setPointList = _useState4[1];
44
45
  var query = useQuery();
45
46
  var closeModal = function closeModal() {
46
- form.resetFields();
47
47
  onCancel === null || onCancel === void 0 ? void 0 : onCancel();
48
48
  };
49
49
 
@@ -116,7 +116,6 @@ var ModalChoosePoint = function ModalChoosePoint(_ref) {
116
116
  }
117
117
  }, _callee2, null, [[0, 7]]);
118
118
  })), [companyId, projectId]);
119
-
120
119
  /** 提交表单且数据验证成功后回调事件 */
121
120
  var onFinish = /*#__PURE__*/function () {
122
121
  var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(val) {
@@ -145,6 +144,13 @@ var ModalChoosePoint = function ModalChoosePoint(_ref) {
145
144
  fetchDeviceList();
146
145
  }
147
146
  }, [visible, deviceList.length]);
147
+ useEffect(function () {
148
+ if (currentDeviceId) {
149
+ fetchPointList(currentDeviceId);
150
+ form.setFieldValue("deviceId", currentDeviceId);
151
+ form.setFieldValue("pointIdList", currentPointList);
152
+ }
153
+ }, [currentDeviceId]);
148
154
  return /*#__PURE__*/React.createElement(Modal, {
149
155
  title: '选择属性',
150
156
  closable: false,
@@ -172,13 +178,13 @@ var ModalChoosePoint = function ModalChoosePoint(_ref) {
172
178
  }]
173
179
  }, /*#__PURE__*/React.createElement(Select, {
174
180
  placeholder: "\u8BF7\u9009\u62E9",
181
+ defaultValue: currentDeviceId,
175
182
  onChange: function onChange(value) {
176
183
  fetchPointList(value);
177
184
  form.setFieldsValue({
178
185
  pointIdList: []
179
186
  });
180
187
  },
181
- showSearch: true,
182
188
  getPopupContainer: function getPopupContainer() {
183
189
  return document.querySelector(".temperatureSelect") || document.body;
184
190
  }
@@ -199,8 +205,7 @@ var ModalChoosePoint = function ModalChoosePoint(_ref) {
199
205
  rules: [{
200
206
  required: true,
201
207
  message: '请选择'
202
- }],
203
- className: "temperature2Select"
208
+ }]
204
209
  }, /*#__PURE__*/React.createElement(Select, {
205
210
  allowClear: true,
206
211
  mode: 'multiple',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coolcare-lite-scada-component",
3
- "version": "1.0.29",
3
+ "version": "1.0.31",
4
4
  "scripts": {
5
5
  "start": "umi dev",
6
6
  "build:prod": "UMI_ENV=prod umi build",