无人机管理后台前端(已迁走)
chenyao
2025-08-30 e1d37bd7784a80a1863cb59967d4cd375a4ff7a3
feat:更新设备管理和注册管理
4 files modified
45 ■■■■ changed files
src/api/device-setting/index.js 10 ●●●● patch | view | raw | blame | history
src/views/device/airport.vue 10 ●●●● patch | view | raw | blame | history
src/views/device/components/DeviceSettingBox.vue 4 ●●●● patch | view | raw | blame | history
src/views/device/components/use-device-setting.js 21 ●●●●● patch | view | raw | blame | history
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 
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>
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;
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;
    }
  }