coolcare-lite-scada-component 1.0.41 → 1.0.43
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.
|
@@ -22,6 +22,7 @@ var EleSwitchComponent = function EleSwitchComponent(_ref) {
|
|
|
22
22
|
value = _useState2[0],
|
|
23
23
|
setValue = _useState2[1];
|
|
24
24
|
var payload = node === null || node === void 0 ? void 0 : node.getData();
|
|
25
|
+
var premission = payload === null || payload === void 0 ? void 0 : payload.premission;
|
|
25
26
|
var configPoint = payload === null || payload === void 0 ? void 0 : (_payload$pointList = payload.pointList) === null || _payload$pointList === void 0 ? void 0 : _payload$pointList[0];
|
|
26
27
|
var pointData = usePointWatch(configPoint, payload === null || payload === void 0 ? void 0 : (_payload$mittMeta = payload.mittMeta) === null || _payload$mittMeta === void 0 ? void 0 : _payload$mittMeta.namespace);
|
|
27
28
|
var tooltipTitle = null;
|
|
@@ -50,7 +51,7 @@ var EleSwitchComponent = function EleSwitchComponent(_ref) {
|
|
|
50
51
|
pointId: 'pointId' in configPoint ? configPoint.pointId : undefined,
|
|
51
52
|
deviceId: 'deviceId' in configPoint ? configPoint.deviceId : undefined,
|
|
52
53
|
value: val ? checkedValue : unCheckedValue
|
|
53
|
-
});
|
|
54
|
+
}, premission);
|
|
54
55
|
setValue(val);
|
|
55
56
|
}
|
|
56
57
|
});
|
package/es/element/type.d.ts
CHANGED
|
@@ -99,12 +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, _x5) {
|
|
103
103
|
return _pointWrite.apply(this, arguments);
|
|
104
104
|
}
|
|
105
105
|
function _pointWrite() {
|
|
106
|
-
_pointWrite = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
|
|
107
|
-
var _query$premission;
|
|
106
|
+
_pointWrite = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params, premission) {
|
|
108
107
|
var query, deviceId, value, pointId, deviceInfo, pointInfo, writeFunction, res;
|
|
109
108
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
110
109
|
while (1) switch (_context3.prev = _context3.next) {
|
|
@@ -116,13 +115,14 @@ function _pointWrite() {
|
|
|
116
115
|
}
|
|
117
116
|
return _context3.abrupt("return");
|
|
118
117
|
case 3:
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
console.log(premission);
|
|
119
|
+
if (!(premission === null || premission === void 0 ? void 0 : premission.includes('49'))) {
|
|
120
|
+
_context3.next = 7;
|
|
121
121
|
break;
|
|
122
122
|
}
|
|
123
123
|
message.error('您没有点位写入权限');
|
|
124
124
|
return _context3.abrupt("return");
|
|
125
|
-
case
|
|
125
|
+
case 7:
|
|
126
126
|
// eslint-disable-next-line prefer-const
|
|
127
127
|
deviceId = params.deviceId, value = params.value, pointId = params.pointId; // 如果没有 deviceId(device 场景下),则从 url query 里获取
|
|
128
128
|
if (!deviceId) {
|
|
@@ -130,74 +130,74 @@ function _pointWrite() {
|
|
|
130
130
|
deviceId = parseInt(query.deviceId, 10);
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
-
_context3.next =
|
|
133
|
+
_context3.next = 11;
|
|
134
134
|
return fetchDeviceInfo(deviceId);
|
|
135
|
-
case
|
|
135
|
+
case 11:
|
|
136
136
|
deviceInfo = _context3.sent;
|
|
137
137
|
if (deviceInfo) {
|
|
138
|
-
_context3.next =
|
|
138
|
+
_context3.next = 14;
|
|
139
139
|
break;
|
|
140
140
|
}
|
|
141
141
|
return _context3.abrupt("return", false);
|
|
142
|
-
case
|
|
142
|
+
case 14:
|
|
143
143
|
if ([0, 1].includes(deviceInfo.protocol)) {
|
|
144
|
-
_context3.next =
|
|
144
|
+
_context3.next = 17;
|
|
145
145
|
break;
|
|
146
146
|
}
|
|
147
147
|
message.info('暂不支持该协议网关的写入');
|
|
148
148
|
return _context3.abrupt("return", false);
|
|
149
|
-
case
|
|
149
|
+
case 17:
|
|
150
150
|
if (params.pointId) {
|
|
151
|
-
_context3.next =
|
|
151
|
+
_context3.next = 22;
|
|
152
152
|
break;
|
|
153
153
|
}
|
|
154
|
-
_context3.next =
|
|
154
|
+
_context3.next = 20;
|
|
155
155
|
return getDevicePoint(deviceId, params.identifierName);
|
|
156
|
-
case
|
|
156
|
+
case 20:
|
|
157
157
|
pointInfo = _context3.sent;
|
|
158
158
|
if (pointInfo) {
|
|
159
159
|
pointId = pointInfo.pointId;
|
|
160
160
|
}
|
|
161
|
-
case
|
|
161
|
+
case 22:
|
|
162
162
|
writeFunction = deviceInfo.protocol === 0 ? ModbusMqttWritePointData : CommonMqttWritePointData;
|
|
163
|
-
_context3.prev =
|
|
164
|
-
_context3.next =
|
|
163
|
+
_context3.prev = 23;
|
|
164
|
+
_context3.next = 26;
|
|
165
165
|
return writeFunction(_defineProperty({}, pointId, value));
|
|
166
|
-
case
|
|
166
|
+
case 26:
|
|
167
167
|
res = _context3.sent;
|
|
168
168
|
if (!(res.data === '指令已下发')) {
|
|
169
|
-
_context3.next =
|
|
169
|
+
_context3.next = 30;
|
|
170
170
|
break;
|
|
171
171
|
}
|
|
172
172
|
message.success('指令已下发');
|
|
173
173
|
return _context3.abrupt("return", true);
|
|
174
|
-
case
|
|
174
|
+
case 30:
|
|
175
175
|
if (res.success) {
|
|
176
|
-
_context3.next =
|
|
176
|
+
_context3.next = 33;
|
|
177
177
|
break;
|
|
178
178
|
}
|
|
179
179
|
message.error(res.message);
|
|
180
180
|
return _context3.abrupt("return", false);
|
|
181
|
-
case
|
|
181
|
+
case 33:
|
|
182
182
|
if (!(res.data && pointId in res.data)) {
|
|
183
|
-
_context3.next =
|
|
183
|
+
_context3.next = 36;
|
|
184
184
|
break;
|
|
185
185
|
}
|
|
186
186
|
message.error('写入失败');
|
|
187
187
|
return _context3.abrupt("return", false);
|
|
188
|
-
case
|
|
189
|
-
_context3.next =
|
|
188
|
+
case 36:
|
|
189
|
+
_context3.next = 42;
|
|
190
190
|
break;
|
|
191
|
-
case
|
|
192
|
-
_context3.prev =
|
|
193
|
-
_context3.t0 = _context3["catch"](
|
|
191
|
+
case 38:
|
|
192
|
+
_context3.prev = 38;
|
|
193
|
+
_context3.t0 = _context3["catch"](23);
|
|
194
194
|
console.error(_context3.t0);
|
|
195
195
|
return _context3.abrupt("return", false);
|
|
196
|
-
case
|
|
196
|
+
case 42:
|
|
197
197
|
case "end":
|
|
198
198
|
return _context3.stop();
|
|
199
199
|
}
|
|
200
|
-
}, _callee3, null, [[
|
|
200
|
+
}, _callee3, null, [[23, 38]]);
|
|
201
201
|
}));
|
|
202
202
|
return _pointWrite.apply(this, arguments);
|
|
203
203
|
}
|
|
@@ -555,7 +555,9 @@ var Player = function Player(_ref) {
|
|
|
555
555
|
var _jsonConfig$cells2;
|
|
556
556
|
jsonConfig === null || jsonConfig === void 0 ? void 0 : (_jsonConfig$cells2 = jsonConfig.cells) === null || _jsonConfig$cells2 === void 0 ? void 0 : _jsonConfig$cells2.forEach(function (v) {
|
|
557
557
|
if (v.data) {
|
|
558
|
+
var _query$premission;
|
|
558
559
|
v.data.mittMeta = mittMeta;
|
|
560
|
+
v.data.premission = ((_query$premission = query.premission) === null || _query$premission === void 0 ? void 0 : _query$premission.split(',')) || [];
|
|
559
561
|
}
|
|
560
562
|
});
|
|
561
563
|
graph.fromJSON(jsonConfig);
|
package/es/typings.d.ts
CHANGED