coolcare-lite-scada-component 1.0.41 → 1.0.42

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.
@@ -116,13 +116,14 @@ function _pointWrite() {
116
116
  }
117
117
  return _context3.abrupt("return");
118
118
  case 3:
119
+ console.log(query.premission);
119
120
  if (!((_query$premission = query.premission) === null || _query$premission === void 0 ? void 0 : _query$premission.split(',').includes('49'))) {
120
- _context3.next = 6;
121
+ _context3.next = 7;
121
122
  break;
122
123
  }
123
124
  message.error('您没有点位写入权限');
124
125
  return _context3.abrupt("return");
125
- case 6:
126
+ case 7:
126
127
  // eslint-disable-next-line prefer-const
127
128
  deviceId = params.deviceId, value = params.value, pointId = params.pointId; // 如果没有 deviceId(device 场景下),则从 url query 里获取
128
129
  if (!deviceId) {
@@ -130,74 +131,74 @@ function _pointWrite() {
130
131
  deviceId = parseInt(query.deviceId, 10);
131
132
  }
132
133
  }
133
- _context3.next = 10;
134
+ _context3.next = 11;
134
135
  return fetchDeviceInfo(deviceId);
135
- case 10:
136
+ case 11:
136
137
  deviceInfo = _context3.sent;
137
138
  if (deviceInfo) {
138
- _context3.next = 13;
139
+ _context3.next = 14;
139
140
  break;
140
141
  }
141
142
  return _context3.abrupt("return", false);
142
- case 13:
143
+ case 14:
143
144
  if ([0, 1].includes(deviceInfo.protocol)) {
144
- _context3.next = 16;
145
+ _context3.next = 17;
145
146
  break;
146
147
  }
147
148
  message.info('暂不支持该协议网关的写入');
148
149
  return _context3.abrupt("return", false);
149
- case 16:
150
+ case 17:
150
151
  if (params.pointId) {
151
- _context3.next = 21;
152
+ _context3.next = 22;
152
153
  break;
153
154
  }
154
- _context3.next = 19;
155
+ _context3.next = 20;
155
156
  return getDevicePoint(deviceId, params.identifierName);
156
- case 19:
157
+ case 20:
157
158
  pointInfo = _context3.sent;
158
159
  if (pointInfo) {
159
160
  pointId = pointInfo.pointId;
160
161
  }
161
- case 21:
162
+ case 22:
162
163
  writeFunction = deviceInfo.protocol === 0 ? ModbusMqttWritePointData : CommonMqttWritePointData;
163
- _context3.prev = 22;
164
- _context3.next = 25;
164
+ _context3.prev = 23;
165
+ _context3.next = 26;
165
166
  return writeFunction(_defineProperty({}, pointId, value));
166
- case 25:
167
+ case 26:
167
168
  res = _context3.sent;
168
169
  if (!(res.data === '指令已下发')) {
169
- _context3.next = 29;
170
+ _context3.next = 30;
170
171
  break;
171
172
  }
172
173
  message.success('指令已下发');
173
174
  return _context3.abrupt("return", true);
174
- case 29:
175
+ case 30:
175
176
  if (res.success) {
176
- _context3.next = 32;
177
+ _context3.next = 33;
177
178
  break;
178
179
  }
179
180
  message.error(res.message);
180
181
  return _context3.abrupt("return", false);
181
- case 32:
182
+ case 33:
182
183
  if (!(res.data && pointId in res.data)) {
183
- _context3.next = 35;
184
+ _context3.next = 36;
184
185
  break;
185
186
  }
186
187
  message.error('写入失败');
187
188
  return _context3.abrupt("return", false);
188
- case 35:
189
- _context3.next = 41;
189
+ case 36:
190
+ _context3.next = 42;
190
191
  break;
191
- case 37:
192
- _context3.prev = 37;
193
- _context3.t0 = _context3["catch"](22);
192
+ case 38:
193
+ _context3.prev = 38;
194
+ _context3.t0 = _context3["catch"](23);
194
195
  console.error(_context3.t0);
195
196
  return _context3.abrupt("return", false);
196
- case 41:
197
+ case 42:
197
198
  case "end":
198
199
  return _context3.stop();
199
200
  }
200
- }, _callee3, null, [[22, 37]]);
201
+ }, _callee3, null, [[23, 38]]);
201
202
  }));
202
203
  return _pointWrite.apply(this, arguments);
203
204
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coolcare-lite-scada-component",
3
- "version": "1.0.41",
3
+ "version": "1.0.42",
4
4
  "scripts": {
5
5
  "start": " umi dev",
6
6
  "build:prod": "UMI_ENV=prod umi build",