coolcare-lite-scada-component 1.0.30 → 1.0.32

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.
@@ -12,9 +12,9 @@ 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 { GetDevicePoint } from "../../services/gateway/Device";
16
16
  import { GetColdChainPermissionDevicePage } from "../../services/project/ProjectUserPermission";
17
- import { useModel } from 'umi';
17
+ import { useQuery } from "../../hooks";
18
18
  var Option = Select.Option;
19
19
  var tailLayout = {
20
20
  wrapperCol: {
@@ -28,7 +28,8 @@ var ModalChoosePoint = function ModalChoosePoint(_ref) {
28
28
  onCancel = _ref.onCancel,
29
29
  companyId = _ref.companyId,
30
30
  currentDeviceId = _ref.currentDeviceId,
31
- currentPointList = _ref.currentPointList;
31
+ currentPointList = _ref.currentPointList,
32
+ projectId = _ref.projectId;
32
33
  var _Form$useForm = Form.useForm(),
33
34
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
34
35
  form = _Form$useForm2[0];
@@ -42,15 +43,7 @@ var ModalChoosePoint = function ModalChoosePoint(_ref) {
42
43
  _useState4 = _slicedToArray(_useState3, 2),
43
44
  pointList = _useState4[0],
44
45
  setPointList = _useState4[1];
45
- var _useModel = useModel('@@initialState', function (model) {
46
- var _model$initialState, _model$initialState2;
47
- return {
48
- platform: (_model$initialState = model.initialState) === null || _model$initialState === void 0 ? void 0 : _model$initialState.platform,
49
- currentProject: (_model$initialState2 = model.initialState) === null || _model$initialState2 === void 0 ? void 0 : _model$initialState2.currentProject
50
- };
51
- }),
52
- platform = _useModel.platform,
53
- currentProject = _useModel.currentProject;
46
+ var query = useQuery();
54
47
  var closeModal = function closeModal() {
55
48
  onCancel === null || onCancel === void 0 ? void 0 : onCancel();
56
49
  };
@@ -99,46 +92,31 @@ var ModalChoosePoint = function ModalChoosePoint(_ref) {
99
92
  while (1) switch (_context2.prev = _context2.next) {
100
93
  case 0:
101
94
  _context2.prev = 0;
102
- if (!(platform === 'project')) {
103
- _context2.next = 7;
104
- break;
105
- }
106
- _context2.next = 4;
95
+ _context2.next = 3;
107
96
  return GetColdChainPermissionDevicePage({
108
97
  companyId: companyId,
109
- projectId: currentProject === null || currentProject === void 0 ? void 0 : currentProject.projectId,
98
+ projectId: projectId,
110
99
  isPermission: true
111
100
  });
112
- case 4:
113
- res = _context2.sent;
114
- _context2.next = 10;
115
- break;
116
- case 7:
117
- _context2.next = 9;
118
- return GetDevicePage({
119
- companyId: companyId
120
- });
121
- case 9:
101
+ case 3:
122
102
  res = _context2.sent;
123
- case 10:
124
103
  if (res.success) {
125
104
  setDeviceList(((_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.list) || []);
126
105
  } else {
127
106
  message.error(res.message);
128
107
  }
129
- _context2.next = 16;
108
+ _context2.next = 10;
130
109
  break;
131
- case 13:
132
- _context2.prev = 13;
110
+ case 7:
111
+ _context2.prev = 7;
133
112
  _context2.t0 = _context2["catch"](0);
134
113
  message.error('获取设备列表失败');
135
- case 16:
114
+ case 10:
136
115
  case "end":
137
116
  return _context2.stop();
138
117
  }
139
- }, _callee2, null, [[0, 13]]);
140
- })), [companyId, platform, currentProject]);
141
-
118
+ }, _callee2, null, [[0, 7]]);
119
+ })), [companyId, projectId]);
142
120
  /** 提交表单且数据验证成功后回调事件 */
143
121
  var onFinish = /*#__PURE__*/function () {
144
122
  var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(val) {
@@ -181,8 +159,8 @@ var ModalChoosePoint = function ModalChoosePoint(_ref) {
181
159
  maskClosable: true,
182
160
  footer: null,
183
161
  onCancel: closeModal,
184
- visible: visible,
185
- wrapClassName: 'form-modal'
162
+ open: visible,
163
+ getContainer: false
186
164
  }, /*#__PURE__*/React.createElement(Form, {
187
165
  layout: "vertical",
188
166
  form: form,
@@ -194,6 +172,7 @@ var ModalChoosePoint = function ModalChoosePoint(_ref) {
194
172
  }, /*#__PURE__*/React.createElement(Form.Item, {
195
173
  name: "deviceId",
196
174
  label: "\u8BBE\u5907",
175
+ className: "temperatureSelect",
197
176
  rules: [{
198
177
  required: true,
199
178
  message: '请选择'
@@ -206,6 +185,9 @@ var ModalChoosePoint = function ModalChoosePoint(_ref) {
206
185
  form.setFieldsValue({
207
186
  pointIdList: []
208
187
  });
188
+ },
189
+ getPopupContainer: function getPopupContainer() {
190
+ return document.querySelector(".temperatureSelect") || document.body;
209
191
  }
210
192
  }, deviceList.map(function (item) {
211
193
  return /*#__PURE__*/React.createElement(Option, {
@@ -231,7 +213,10 @@ var ModalChoosePoint = function ModalChoosePoint(_ref) {
231
213
  showSearch: true,
232
214
  optionFilterProp: "label",
233
215
  placeholder: "\u8BF7\u9009\u62E9",
234
- disabled: !getFieldValue('deviceId')
216
+ disabled: !getFieldValue('deviceId'),
217
+ getPopupContainer: function getPopupContainer() {
218
+ return document.querySelector(".temperature2Select") || document.body;
219
+ }
235
220
  }, pointList.map(function (item) {
236
221
  return /*#__PURE__*/React.createElement(Option, {
237
222
  value: item.pointId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coolcare-lite-scada-component",
3
- "version": "1.0.30",
3
+ "version": "1.0.32",
4
4
  "scripts": {
5
5
  "start": "umi dev",
6
6
  "build:prod": "UMI_ENV=prod umi build",