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.
- package/es/element/utils/pointWrite.js +28 -27
- package/package.json +1 -1
|
@@ -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 =
|
|
121
|
+
_context3.next = 7;
|
|
121
122
|
break;
|
|
122
123
|
}
|
|
123
124
|
message.error('您没有点位写入权限');
|
|
124
125
|
return _context3.abrupt("return");
|
|
125
|
-
case
|
|
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 =
|
|
134
|
+
_context3.next = 11;
|
|
134
135
|
return fetchDeviceInfo(deviceId);
|
|
135
|
-
case
|
|
136
|
+
case 11:
|
|
136
137
|
deviceInfo = _context3.sent;
|
|
137
138
|
if (deviceInfo) {
|
|
138
|
-
_context3.next =
|
|
139
|
+
_context3.next = 14;
|
|
139
140
|
break;
|
|
140
141
|
}
|
|
141
142
|
return _context3.abrupt("return", false);
|
|
142
|
-
case
|
|
143
|
+
case 14:
|
|
143
144
|
if ([0, 1].includes(deviceInfo.protocol)) {
|
|
144
|
-
_context3.next =
|
|
145
|
+
_context3.next = 17;
|
|
145
146
|
break;
|
|
146
147
|
}
|
|
147
148
|
message.info('暂不支持该协议网关的写入');
|
|
148
149
|
return _context3.abrupt("return", false);
|
|
149
|
-
case
|
|
150
|
+
case 17:
|
|
150
151
|
if (params.pointId) {
|
|
151
|
-
_context3.next =
|
|
152
|
+
_context3.next = 22;
|
|
152
153
|
break;
|
|
153
154
|
}
|
|
154
|
-
_context3.next =
|
|
155
|
+
_context3.next = 20;
|
|
155
156
|
return getDevicePoint(deviceId, params.identifierName);
|
|
156
|
-
case
|
|
157
|
+
case 20:
|
|
157
158
|
pointInfo = _context3.sent;
|
|
158
159
|
if (pointInfo) {
|
|
159
160
|
pointId = pointInfo.pointId;
|
|
160
161
|
}
|
|
161
|
-
case
|
|
162
|
+
case 22:
|
|
162
163
|
writeFunction = deviceInfo.protocol === 0 ? ModbusMqttWritePointData : CommonMqttWritePointData;
|
|
163
|
-
_context3.prev =
|
|
164
|
-
_context3.next =
|
|
164
|
+
_context3.prev = 23;
|
|
165
|
+
_context3.next = 26;
|
|
165
166
|
return writeFunction(_defineProperty({}, pointId, value));
|
|
166
|
-
case
|
|
167
|
+
case 26:
|
|
167
168
|
res = _context3.sent;
|
|
168
169
|
if (!(res.data === '指令已下发')) {
|
|
169
|
-
_context3.next =
|
|
170
|
+
_context3.next = 30;
|
|
170
171
|
break;
|
|
171
172
|
}
|
|
172
173
|
message.success('指令已下发');
|
|
173
174
|
return _context3.abrupt("return", true);
|
|
174
|
-
case
|
|
175
|
+
case 30:
|
|
175
176
|
if (res.success) {
|
|
176
|
-
_context3.next =
|
|
177
|
+
_context3.next = 33;
|
|
177
178
|
break;
|
|
178
179
|
}
|
|
179
180
|
message.error(res.message);
|
|
180
181
|
return _context3.abrupt("return", false);
|
|
181
|
-
case
|
|
182
|
+
case 33:
|
|
182
183
|
if (!(res.data && pointId in res.data)) {
|
|
183
|
-
_context3.next =
|
|
184
|
+
_context3.next = 36;
|
|
184
185
|
break;
|
|
185
186
|
}
|
|
186
187
|
message.error('写入失败');
|
|
187
188
|
return _context3.abrupt("return", false);
|
|
188
|
-
case
|
|
189
|
-
_context3.next =
|
|
189
|
+
case 36:
|
|
190
|
+
_context3.next = 42;
|
|
190
191
|
break;
|
|
191
|
-
case
|
|
192
|
-
_context3.prev =
|
|
193
|
-
_context3.t0 = _context3["catch"](
|
|
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
|
|
197
|
+
case 42:
|
|
197
198
|
case "end":
|
|
198
199
|
return _context3.stop();
|
|
199
200
|
}
|
|
200
|
-
}, _callee3, null, [[
|
|
201
|
+
}, _callee3, null, [[23, 38]]);
|
|
201
202
|
}));
|
|
202
203
|
return _pointWrite.apply(this, arguments);
|
|
203
204
|
}
|