@@ -215,7 +215,8 @@ const fetchDeviceGroupTree = async () => {
215215 });
216216 }
217217 } catch (error : any ) {
218- ElMessage .error (' 获取设备组失败: ' + error .message );
218+ console .error (' 获取设备组失败:' , error );
219+ // error message is handled by global interceptor
219220 }
220221};
221222
@@ -264,21 +265,15 @@ const handleGroupCommand = async (command: string, data: TreeNode) => {
264265};
265266
266267const handleBatchOperation = async (groupId : number , operation : ' start' | ' stop' | ' reset' ) => {
267- try {
268268 await batchDeviceOperation (groupId , operation );
269269 ElMessage .success (` ${operation === ' start' ? ' 启动' : ' 停止' }成功 ` );
270- } catch (error : any ) {
271- ElMessage .error (' 操作失败: ' + error .message );
272- }
273270};
274271
275272const handleDeleteGroup = async (data : TreeNode ) => {
276- try {
277273 await ElMessageBox .confirm (` 确定删除组 "${data .name }"? ` , ' 提示' , { type: ' warning' });
278274 await deleteDeviceGroup (data .id , false );
279275 ElMessage .success (' 成功' );
280276 await fetchDeviceGroupTree ();
281- } catch {}
282277};
283278
284279const handleEditDevice = (data : TreeNode ) => handleEditDeviceByName (data .name );
@@ -292,14 +287,12 @@ const handleEditDeviceByName = async (deviceName: string) => {
292287
293288const handleDeleteDevice = (data : TreeNode ) => handleDeleteDeviceByName (data .name );
294289const handleDeleteDeviceByName = async (deviceName : string ) => {
295- try {
296- await ElMessageBox .confirm (` 确定删除 "${deviceName }"? ` , ' 提示' , { type: ' warning' });
297- const channel = (await getChannelList ()).find (c => c .name === deviceName );
298- if (channel ) {
299- await deleteChannel (channel .id );
300- window .location .reload ();
301- }
302- } catch {}
290+ await ElMessageBox .confirm (` 确定删除 "${deviceName }"? ` , ' 提示' , { type: ' warning' });
291+ const channel = (await getChannelList ()).find (c => c .name === deviceName );
292+ if (channel ) {
293+ await deleteChannel (channel .id );
294+ window .location .reload ();
295+ }
303296};
304297
305298const handleDeviceAdded = async (deviceName : string , isEdit ? : boolean , oldName ? : string ) => {
0 commit comments