From e1d37bd7784a80a1863cb59967d4cd375a4ff7a3 Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Sat, 30 Aug 2025 14:58:14 +0800
Subject: [PATCH] feat:更新设备管理和注册管理

---
 src/api/device-setting/index.js                   |   10 ++--------
 src/views/device/components/DeviceSettingBox.vue  |    4 ++--
 src/views/device/components/use-device-setting.js |   21 +++++++++++++--------
 src/views/device/airport.vue                      |   10 +++++-----
 4 files changed, 22 insertions(+), 23 deletions(-)

diff --git a/src/api/device-setting/index.js b/src/api/device-setting/index.js
index c0e6db9..3ccc262 100644
--- a/src/api/device-setting/index.js
+++ b/src/api/device-setting/index.js
@@ -15,20 +15,14 @@
 const workspaceId = localStorage.getItem(ELocalStorageKey.WorkspaceId) || ''
 
 export const putDeviceProps = (deviceSn, body) => {
+  console.log(deviceSn, body, workspaceId, '8888')
   return request({
     url: `/drone-device-core/manage/api/v1/devices/${workspaceId}/devices/${deviceSn}/property`,
     method: 'put',
-    body,
+    data: body,
   })
 }
 
-export const putDevicePropsNew = (deviceSn, body, workspaceId) => {
-  return request({
-    url: `/drone-device-core/manage/api/v1/devices/${workspaceId}/devices/${deviceSn}/property`,
-    method: 'put',
-    body,
-  })
-}
 /**
  * 设置调色盘
  * @param {机场编码} deviceSn 
diff --git a/src/views/device/airport.vue b/src/views/device/airport.vue
index 097295e..d49d587 100644
--- a/src/views/device/airport.vue
+++ b/src/views/device/airport.vue
@@ -57,7 +57,7 @@
       </template>
       <template #menu="scope">
         <el-dropdown>
-              <el-button type="primary" text icon="el-icon-paperclip" v-if="permission.oss_set">更 多</el-button>
+              <el-button type="primary" text icon="el-icon-more" v-if="permission.oss_set">更 多</el-button>
               <template #dropdown v-if="scope.row.domain == 3">
                 <el-dropdown-menu teleported>
                   <el-dropdown-item command="a">
@@ -71,10 +71,10 @@
                     v-if="permission.rang_con && scope.row.domain == 3"
                     @click.stop="handleOpenRemoteDebugging(scope.row, scope.index)">远程调试</el-button>
                   </el-dropdown-item>
-                  <el-dropdown-item command="d"><el-button type="primary" text icon="el-icon-setting" v-if="permission.fly_device_offline"
+                  <el-dropdown-item command="d"><el-button type="primary" text icon="el-icon-collection" v-if="permission.fly_device_offline"
                         @click.stop="rollFirmware(scope.row)">固件版本管理</el-button>
                   </el-dropdown-item>
-                  <el-dropdown-item command="e"><el-button type="primary" text icon="el-icon-setting" v-if="permission.fly_device_offline"
+                  <el-dropdown-item command="e"><el-button type="primary" text icon="el-icon-document-delete" v-if="permission.fly_device_offline"
                     @click.stop="handleDeviceOffline(scope.row)">注销</el-button>
                   </el-dropdown-item>
                 </el-dropdown-menu>
@@ -82,10 +82,10 @@
               <template #dropdown v-else>
                 <el-dropdown-menu teleported>
                   <el-dropdown-item command="a">
-                    <el-button type="primary" text icon="el-icon-paperclip" @click.stop="rowDel(scope.row, scope.index)">删除</el-button>
+                    <el-button type="primary" text icon="el-icon-circle-close" @click.stop="rowDel(scope.row, scope.index)">删除</el-button>
                   </el-dropdown-item>
                   <el-dropdown-item command="a">
-                    <el-button type="primary" text icon="el-icon-paperclip" v-if="permission.operate_password_set" @click.stop="handleOperatePassword(scope.row, scope.index)">操控密码设置</el-button>
+                    <el-button type="primary" text icon="el-icon-key" v-if="permission.operate_password_set" @click.stop="handleOperatePassword(scope.row, scope.index)">操控密码设置</el-button>
                   </el-dropdown-item>
                 </el-dropdown-menu>
               </template>
diff --git a/src/views/device/components/DeviceSettingBox.vue b/src/views/device/components/DeviceSettingBox.vue
index b292ccc..92a4b44 100644
--- a/src/views/device/components/DeviceSettingBox.vue
+++ b/src/views/device/components/DeviceSettingBox.vue
@@ -357,7 +357,7 @@
   deviceSetting.value[settingKey].popConfirm.loading = true;
   const body = genDevicePropsBySettingKey(settingKey, deviceSettingFormModel.value);
   localStorage.setItem(ELocalStorageKey.WorkspaceId, props.deviceInfo.workspace_id)
-  await setDeviceProps(props.sn, body, props.deviceInfo.workspace_id);
+  await setDeviceProps(props.sn, body);
   deviceSetting.value[settingKey].popConfirm.loading = false;
   deviceSetting.value[settingKey].popConfirm.visible = false;
 }
@@ -368,7 +368,7 @@
 
 <style lang="scss" scoped>
 .device-setting-wrapper {
-  border-bottom: 1px solid #515151;
+  //border-bottom: 1px solid #515151;
 
   .device-setting-header {
     font-size: 14px;
diff --git a/src/views/device/components/use-device-setting.js b/src/views/device/components/use-device-setting.js
index b767d76..c1d803f 100644
--- a/src/views/device/components/use-device-setting.js
+++ b/src/views/device/components/use-device-setting.js
@@ -1,12 +1,13 @@
 import { ElMessage } from 'element-plus';
 
-import { putDeviceProps, putDevicePropsNew } from '@/api/device-setting';
+import { putDeviceProps } from '@/api/device-setting';
 import {
   DeviceSettingKeyEnum,
   ObstacleAvoidanceStatusEnum,
   NightLightsStateEnum,
   DistanceLimitStatusEnum,
 } from '@/types/device-setting';
+import { messages } from '@/lang';
 
 export function useDeviceSetting() {
   // 生成参数
@@ -49,18 +50,22 @@
   }
 
   // 设置设备属性
-  async function setDeviceProps(sn, body, workspaceId) {
+  async function setDeviceProps(sn, body) {
     try {
-      const { code, message: msg } = await putDevicePropsNew(sn, body, workspaceId);
+      const { code, message: msg } = await putDeviceProps(sn, body);
+      console.log(code,messages)
       if (code === 0) {
-        return true;
+        ElMessage({
+          message: '设备属性设置成功!',
+          type: 'success',
+        });
       }
       throw msg;
     } catch (e) {
-      ElMessage({
-        message: '设备属性设置失败',
-        type: 'error',
-      });
+      // ElMessage({
+      //   message: '设备属性设置失败',
+      //   type: 'error',
+      // });
       return false;
     }
   }

--
Gitblit v1.9.3