Browse Source

refactor(frontend): 优化设备参数调整功能

- 添加 status变量以跟踪设备参数获取状态
- 在调整参数前检查是否已获取设备参数
- 获取设备参数成功后更新 status 状态- 未获取参数时显示错误提示信息
panqiuyao 5 months ago
parent
commit
1a20522181
1 changed files with 6 additions and 0 deletions
  1. 6 0
      frontend/src/views/Developer/normal.vue

+ 6 - 0
frontend/src/views/Developer/normal.vue

@@ -141,6 +141,7 @@ const clientStore = client();
 const socketStore = socket()
 
 
+const status = ref(0);
 const editRowData = ref({
   "camera_high_motor_deviation": '',
   "camera_steering_deviation": '',
@@ -169,6 +170,7 @@ async function  get_deviation(){
       console.log('_get_deviation_data')
       console.log(result)
       if(result.code === 0){
+        status.value = true;
         editRowData.value.camera_high_motor_deviation = result.data.camera_high_motor_deviation
         editRowData.value.camera_steering_deviation = result.data.camera_steering_deviation
         editRowData.value.turntable_steering_deviation = result.data.turntable_steering_deviation
@@ -229,6 +231,10 @@ async  function  AllChangeNum (){
 
 //设置 移动 调整
 async function changeNum(action_name, type, key, min, max) {
+  if(!status.value){
+    ElMessage.error('请先获取设备参数');
+    return;
+  }
   if(key && (min || max)){
     if(editRowData.value[key] < min || editRowData.value[key] > max){
       if(editRowData.value[key] < min){