无人机管理后台前端(已迁走)
罗广辉
2025-09-02 b87fc6206ba7f5257f54e255f5b3ff73a477e23e
src/views/device/components/use-device-setting.js
@@ -7,6 +7,7 @@
  NightLightsStateEnum,
  DistanceLimitStatusEnum,
} from '@/types/device-setting';
import { messages } from '@/lang';
export function useDeviceSetting() {
  // 生成参数
@@ -51,16 +52,15 @@
  // 设置设备属性
  async function setDeviceProps(sn, body) {
    try {
      const { code, message: msg } = await putDeviceProps(sn, body);
      if (code === 0) {
        return true;
      }
      throw msg;
    } catch (e) {
      ElMessage({
        message: '设备属性设置失败',
        type: 'error',
       await putDeviceProps(sn, body).then(res => {
         if (res.data.code === 0) {
           ElMessage({
             message: '设备属性设置成功!',
             type: 'success',
           });
         }
      });
    } catch (e) {
      return false;
    }
  }