coolcare-lite-scada-component 1.0.44 → 1.0.45
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.
|
@@ -51,7 +51,7 @@ var EleSwitchComponent = function EleSwitchComponent(_ref) {
|
|
|
51
51
|
pointId: 'pointId' in configPoint ? configPoint.pointId : undefined,
|
|
52
52
|
deviceId: 'deviceId' in configPoint ? configPoint.deviceId : undefined,
|
|
53
53
|
value: val ? checkedValue : unCheckedValue
|
|
54
|
-
}
|
|
54
|
+
});
|
|
55
55
|
setValue(val);
|
|
56
56
|
}
|
|
57
57
|
});
|
|
@@ -64,7 +64,7 @@ var EleSwitchComponent = function EleSwitchComponent(_ref) {
|
|
|
64
64
|
}
|
|
65
65
|
}, [pointData === null || pointData === void 0 ? void 0 : pointData.value, payload === null || payload === void 0 ? void 0 : payload.checkedValue]);
|
|
66
66
|
return /*#__PURE__*/React.createElement("div", {
|
|
67
|
-
className: styles.wrap,
|
|
67
|
+
className: "".concat(styles.wrap, " ").concat(premission.includes("49") ? "" : styles.hide),
|
|
68
68
|
id: "switch-".concat(pointData === null || pointData === void 0 ? void 0 : pointData.deviceId)
|
|
69
69
|
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
70
70
|
title: tooltipTitle
|
|
@@ -99,11 +99,11 @@ function _getDevicePoint() {
|
|
|
99
99
|
}));
|
|
100
100
|
return _getDevicePoint.apply(this, arguments);
|
|
101
101
|
}
|
|
102
|
-
export function pointWrite(_x4
|
|
102
|
+
export function pointWrite(_x4) {
|
|
103
103
|
return _pointWrite.apply(this, arguments);
|
|
104
104
|
}
|
|
105
105
|
function _pointWrite() {
|
|
106
|
-
_pointWrite = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params
|
|
106
|
+
_pointWrite = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
|
|
107
107
|
var query, deviceId, value, pointId, deviceInfo, pointInfo, writeFunction, res;
|
|
108
108
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
109
109
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -115,14 +115,6 @@ function _pointWrite() {
|
|
|
115
115
|
}
|
|
116
116
|
return _context3.abrupt("return");
|
|
117
117
|
case 3:
|
|
118
|
-
console.log(premission);
|
|
119
|
-
if (!(premission === null || premission === void 0 ? void 0 : premission.includes('49'))) {
|
|
120
|
-
_context3.next = 7;
|
|
121
|
-
break;
|
|
122
|
-
}
|
|
123
|
-
message.error('您没有点位写入权限');
|
|
124
|
-
return _context3.abrupt("return");
|
|
125
|
-
case 7:
|
|
126
118
|
// eslint-disable-next-line prefer-const
|
|
127
119
|
deviceId = params.deviceId, value = params.value, pointId = params.pointId; // 如果没有 deviceId(device 场景下),则从 url query 里获取
|
|
128
120
|
if (!deviceId) {
|
|
@@ -130,74 +122,74 @@ function _pointWrite() {
|
|
|
130
122
|
deviceId = parseInt(query.deviceId, 10);
|
|
131
123
|
}
|
|
132
124
|
}
|
|
133
|
-
_context3.next =
|
|
125
|
+
_context3.next = 7;
|
|
134
126
|
return fetchDeviceInfo(deviceId);
|
|
135
|
-
case
|
|
127
|
+
case 7:
|
|
136
128
|
deviceInfo = _context3.sent;
|
|
137
129
|
if (deviceInfo) {
|
|
138
|
-
_context3.next =
|
|
130
|
+
_context3.next = 10;
|
|
139
131
|
break;
|
|
140
132
|
}
|
|
141
133
|
return _context3.abrupt("return", false);
|
|
142
|
-
case
|
|
134
|
+
case 10:
|
|
143
135
|
if ([0, 1].includes(deviceInfo.protocol)) {
|
|
144
|
-
_context3.next =
|
|
136
|
+
_context3.next = 13;
|
|
145
137
|
break;
|
|
146
138
|
}
|
|
147
139
|
message.info('暂不支持该协议网关的写入');
|
|
148
140
|
return _context3.abrupt("return", false);
|
|
149
|
-
case
|
|
141
|
+
case 13:
|
|
150
142
|
if (params.pointId) {
|
|
151
|
-
_context3.next =
|
|
143
|
+
_context3.next = 18;
|
|
152
144
|
break;
|
|
153
145
|
}
|
|
154
|
-
_context3.next =
|
|
146
|
+
_context3.next = 16;
|
|
155
147
|
return getDevicePoint(deviceId, params.identifierName);
|
|
156
|
-
case
|
|
148
|
+
case 16:
|
|
157
149
|
pointInfo = _context3.sent;
|
|
158
150
|
if (pointInfo) {
|
|
159
151
|
pointId = pointInfo.pointId;
|
|
160
152
|
}
|
|
161
|
-
case
|
|
153
|
+
case 18:
|
|
162
154
|
writeFunction = deviceInfo.protocol === 0 ? ModbusMqttWritePointData : CommonMqttWritePointData;
|
|
163
|
-
_context3.prev =
|
|
164
|
-
_context3.next =
|
|
155
|
+
_context3.prev = 19;
|
|
156
|
+
_context3.next = 22;
|
|
165
157
|
return writeFunction(_defineProperty({}, pointId, value));
|
|
166
|
-
case
|
|
158
|
+
case 22:
|
|
167
159
|
res = _context3.sent;
|
|
168
160
|
if (!(res.data === '指令已下发')) {
|
|
169
|
-
_context3.next =
|
|
161
|
+
_context3.next = 26;
|
|
170
162
|
break;
|
|
171
163
|
}
|
|
172
164
|
message.success('指令已下发');
|
|
173
165
|
return _context3.abrupt("return", true);
|
|
174
|
-
case
|
|
166
|
+
case 26:
|
|
175
167
|
if (res.success) {
|
|
176
|
-
_context3.next =
|
|
168
|
+
_context3.next = 29;
|
|
177
169
|
break;
|
|
178
170
|
}
|
|
179
171
|
message.error(res.message);
|
|
180
172
|
return _context3.abrupt("return", false);
|
|
181
|
-
case
|
|
173
|
+
case 29:
|
|
182
174
|
if (!(res.data && pointId in res.data)) {
|
|
183
|
-
_context3.next =
|
|
175
|
+
_context3.next = 32;
|
|
184
176
|
break;
|
|
185
177
|
}
|
|
186
178
|
message.error('写入失败');
|
|
187
179
|
return _context3.abrupt("return", false);
|
|
188
|
-
case
|
|
189
|
-
_context3.next =
|
|
180
|
+
case 32:
|
|
181
|
+
_context3.next = 38;
|
|
190
182
|
break;
|
|
191
|
-
case
|
|
192
|
-
_context3.prev =
|
|
193
|
-
_context3.t0 = _context3["catch"](
|
|
183
|
+
case 34:
|
|
184
|
+
_context3.prev = 34;
|
|
185
|
+
_context3.t0 = _context3["catch"](19);
|
|
194
186
|
console.error(_context3.t0);
|
|
195
187
|
return _context3.abrupt("return", false);
|
|
196
|
-
case
|
|
188
|
+
case 38:
|
|
197
189
|
case "end":
|
|
198
190
|
return _context3.stop();
|
|
199
191
|
}
|
|
200
|
-
}, _callee3, null, [[
|
|
192
|
+
}, _callee3, null, [[19, 34]]);
|
|
201
193
|
}));
|
|
202
194
|
return _pointWrite.apply(this, arguments);
|
|
203
195
|
}
|