Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/dev-frontend'

panqiuyao 7 mesi fa
parent
commit
cb804b939a

+ 3 - 0
electron/controller/socket.js

@@ -11,6 +11,9 @@ const typeToMessage = {
   run_mcu_single_finish:"seeting",
   get_deviation_data:"developer",
   set_deviation:"developer",
+  get_mcu_other_info:"developer",
+  set_mcu_other_info:"developer",
+  send_command:"developer"
 }
 class SocketController extends Controller {
   constructor(ctx) {

+ 2 - 2
frontend/src/components/header-bar/index.vue

@@ -80,7 +80,7 @@ const menuType = reactive({
   },
   developer: {
     name: '开发者设置',
-    icon: iconykq,
+    icon: iconsz,
     click: openDeveloper
   }
 });
@@ -153,7 +153,7 @@ function openDeveloper(){
   let params = {
     title: '开发者设置',
     width: 900,
-    height: 620,
+    height: 700,
     frame: true,
     id: "developer",
     url: getRouterUrl(href)

+ 1 - 1
frontend/src/router/index.ts

@@ -5,7 +5,7 @@ import { authGuard } from './plugins/authGuard'
 const routes: RouteRecordRaw[] = [
     {
         path: "/",
-        redirect: "/photography/check"
+        redirect: "/home"
     },
     {
         path: "/home",

+ 124 - 0
frontend/src/views/Developer/cmd.vue

@@ -0,0 +1,124 @@
+<template>
+
+
+  <headerBar
+    title="开发者配置"
+  />
+
+  <el-row class="mar-top-10" >
+    <el-col :span="2"></el-col>
+    <el-col :span="20">
+
+      <el-input type="textarea"
+      v-model="command"
+                :rows="5"
+      />
+    </el-col>
+    <el-col :span="2"></el-col>
+  </el-row>
+
+    <el-row align="middle" justify="middle" class="mar-top-10">
+      <el-col :span="24">
+        <el-button type="primary" @click="send_command">发送</el-button>
+      </el-col>
+    </el-row>
+
+
+  <el-row align="middle" justify="middle" class="mar-top-10">
+    <el-col :span="2"></el-col>
+      <el-col :span="20">
+
+
+        <el-input type="textarea"
+                  v-model="command1"
+                  :rows="5"
+                  disabled
+        />
+      </el-col>
+    <el-col :span="2"></el-col>
+    </el-row>
+
+</template>
+
+<script setup lang="ts">
+
+import {ref,reactive,onMounted} from "vue";
+
+import client from "@/stores/modules/client";
+import  icpList from '@/utils/ipc'
+import socket from "@/stores/modules/socket";
+import {ElMessage} from "element-plus";
+const clientStore = client();
+const socketStore = socket()
+
+
+const command = ref('0x01 0x42 0x6C 0x6b'); // 当前编辑行的数据
+const command1 = ref(''); // 当前编辑行的数据
+
+
+
+//设置 移动 调整
+async function send_command() {
+
+  socketStore.sendMessage({
+    type: 'send_command',
+    data:{
+      command:command.value
+    }
+  })
+
+
+  clientStore.ipc.on(icpList.socket.message+'_send_command', (event, result) => {
+    console.log('_send_command')
+    console.log(result)
+    if(result.code === 0){
+      if(result.data.type === 'input')  command.value = result.data.command
+      if(result.data.type === 'output'){
+        command1.value = result.data.command
+        clientStore.ipc.removeAllListeners(icpList.socket.message+'_send_command');
+      }
+
+    }
+  });
+
+
+
+}
+
+
+
+</script>
+
+<style scoped lang="scss">
+.bottom-wrap {
+  position: fixed;
+  bottom:0px;
+  left: 0;
+  right: 0;
+  padding: 10px 0;
+  background: #fff;
+}
+.page {
+  padding-bottom: 60px;
+}
+.el-col {
+    position: relative;
+  ::v-deep {
+    .error-msg{
+      display: none;
+      position: absolute;
+      top: 41px;
+      top: 28px;
+      left: 8px;
+      z-index: 22;
+      color: #dc2626;
+      font-size: 12px;
+    }
+    &:hover{
+      .error-msg{
+        display: block;
+      }
+    }
+  }
+}
+</style>

+ 32 - 239
frontend/src/views/Developer/index.vue

@@ -1,263 +1,56 @@
 <template>
 
-
   <headerBar
     title="开发者配置"
   />
 
-  <el-row>
-    <el-col :span="24"><h3>相机设置</h3></el-col>
-  </el-row>
-  <el-row>
-    <el-col :span="6">电机偏移mm:</el-col>
-    <el-col :span="12"><el-input
-        @change="changeNum('相机电机','move_deviation','camera_high_motor_deviation',0, 400)"
-        :min="0" :max="400"
-        :step="1"
-        v-model="editRowData.camera_high_motor_deviation" type="number"/>
-         <div class="error-msg">最小0,最大400</div>
-    </el-col>
-    <el-col :span="6"><el-button
-        @click="changeNum('相机电机','set_deviation','camera_high_motor_deviation',0, 400)"
-    >设定</el-button></el-col>
-  </el-row>
-  <el-row class="mar-top-10">
-    <el-col :span="6">舵机偏移(度):</el-col>
-
-    <el-col :span="12"><el-input
-        @change="changeNum('相机舵机','move_deviation','camera_steering_deviation',-40, 40)"
-        :min="-40" :max="40"
-        :step="0.1"
-        v-model="editRowData.camera_steering_deviation" type="number"/>
-      <div class="error-msg">最小-40,最大40</div>
-    </el-col>
-    <el-col :span="6"><el-button @click="changeNum('相机舵机','set_deviation','camera_steering_deviation',-40, 40)">设定</el-button></el-col>
-  </el-row>
-
-
-
-  <el-row>
-    <el-col :span="24"><h3>转盘设置</h3></el-col>
-  </el-row>
-  <el-row>
-    <el-col :span="6">角度偏移 (度):</el-col>
-    <el-col :span="12"><el-input
-        @change="changeNum('转盘舵机','move_deviation','turntable_steering_deviation',-720, 720)"
-        :min="-720" :max="720"
-        :step="1"
-        v-model="editRowData.turntable_steering_deviation" type="number"/>
-      <div class="error-msg">最小-720,最大720</div>
-    </el-col>
-    <el-col :span="6"><el-button  @click="changeNum('转盘舵机','set_deviation','turntable_steering_deviation',-720, 720)">设定</el-button></el-col>
-  </el-row>
-  <el-row class="mar-top-10">
-    <el-col :span="6">前后偏移:</el-col>
-
-    <el-col :span="12"><el-input
-        @change="changeNum('转盘前后电机','move_deviation','turntable_front_end_deviation',0, 950)"
-        :min="0" :max="950"
-        :step="1"
-        v-model="editRowData.turntable_front_end_deviation" type="number"/>
-      <div class="error-msg">最小0,最大950</div>
-    </el-col>
-    <el-col :span="6"><el-button @click="changeNum('转盘前后电机','set_deviation','turntable_front_end_deviation',0, 950)">设定</el-button></el-col>
-  </el-row>
-
-
-
-  <el-row>
-    <el-col :span="24"><h3>翻版舵机</h3></el-col>
-  </el-row>
-  <el-row>
-    <el-col :span="6">中位:</el-col>
 
-    <el-col :span="12"><el-input
-        @change="changeNum('翻板舵机中位','move_deviation','overturn_steering_middle',0, 180)"
-        :min="0" :max="180"
-        :step="0.5"
-        v-model="editRowData.overturn_steering_middle" type="number"/>
-      <div class="error-msg">最小0,最大180</div>
-    </el-col>
-    <el-col :span="6"><el-button @click="changeNum('翻板舵机中位','set_deviation','overturn_steering_middle',0, 180)">设定</el-button></el-col>
-  </el-row>
-  <el-row class="mar-top-10">
-    <el-col :span="6">高位:</el-col>
-    <el-col :span="12"><el-input
-        @change="changeNum('翻板舵机高位','move_deviation','overturn_steering_high',0, 180)"
-        :min="0" :max="180"
-        :step="0.5"
-        v-model="editRowData.overturn_steering_high" type="number"/>
-      <div class="error-msg">最小0,最大180</div>
-    </el-col>
-    <el-col :span="6"><el-button  @click="changeNum('翻板舵机高位','set_deviation','overturn_steering_high',0, 180)">设定</el-button></el-col>
-  </el-row>
-  <el-row class="mar-top-10">
-    <el-col :span="6">上升速度:</el-col>
-    <el-col :span="12"><el-input
-        @change="changeNum('翻板舵机上升速度','move_deviation','overturn_steering_up_speed',0, 10)"
-        :min="0" :max="10"
-        :step="1"
-        v-model="editRowData.overturn_steering_up_speed" type="number"/>
-      <div class="error-msg">最小0,最大10</div>
-    </el-col>
-    <el-col :span="6"><el-button @click="changeNum('翻板舵机上升速度','set_deviation','overturn_steering_up_speed',0, 10)">设定</el-button></el-col>
-  </el-row>
-  <el-row class="mar-top-10">
-    <el-col :span="6">下降速度:</el-col>
-    <el-col :span="12"><el-input
-        @change="changeNum('翻板舵机下降速度','move_deviation','overturn_steering_down_speed',0, 10)"
-        :min="0" :max="10"
-        :step="1"
-        v-model="editRowData.overturn_steering_down_speed" type="number"/>
-      <div class="error-msg">最小0,最大10</div>
-    </el-col>
-    <el-col :span="6"><el-button  @click="changeNum('翻板舵机下降速度','set_deviation','overturn_steering_down_speed',0, 10)">设定</el-button></el-col>
-  </el-row>
+  <div class="page">
+  <div class="tabs">
+    <div class="tab" @click="handleSelect(1)" :class="{active:activeIndex == 1}">设置</div>
+    <div class="tab" @click="handleSelect(2)" :class="{active:activeIndex == 2}">MCU其他配置设置</div>
+    <div class="tab" @click="handleSelect(3)" :class="{active:activeIndex == 3}">RS485调试发送</div>
+  </div>
 
 
-  <el-row align="middle" justify="middle" class="mar-top-20">
-    <el-col :span="24">
-      <el-button type="primary" @click="get_deviation">读取偏移量</el-button>
-      <el-button type="primary" @click="connect_mcu__init">设备初始化</el-button>
-    </el-col>
-  </el-row>
+  <normal v-if="activeIndex == 1"/>
+  <mcu v-if="activeIndex == 2"/>
+  <cmd v-if="activeIndex == 3"/>
 
+  </div>
 
 </template>
 
 <script setup lang="ts">
+import headerBar from '@/components/header-bar/index.vue'
+import normal  from './normal'
+import mcu  from './mcu'
+import cmd  from './cmd'
 
-import {ref,reactive,onMounted} from "vue";
-
-import client from "@/stores/modules/client";
-import  icpList from '@/utils/ipc'
-import socket from "@/stores/modules/socket";
-import {ElMessage} from "element-plus";
-const clientStore = client();
-const socketStore = socket()
-
-
-const editRowData = ref({
-  "camera_high_motor_deviation": '',
-  "camera_steering_deviation": '',
-  "turntable_steering_deviation": '',
-  "turntable_front_end_deviation":'',
-  "overturn_steering_middle": '',
-  "overturn_steering_high": '',
-  "overturn_steering_up_speed": '',
-  "overturn_steering_down_speed": ''
-}); // 当前编辑行的数据
-
-onMounted(()=>{
-  get_deviation()
-})
-
-//获取配置
-async function  get_deviation(){
-  if(clientStore.isClient){
-
-    socketStore.sendMessage({
-      type: 'get_deviation',
-      data:"get_deviation"
-    })
-
-
-    clientStore.ipc.on(icpList.socket.message+'_get_deviation_data', (event, result) => {
-      console.log('_get_deviation_data')
-      console.log(result)
-      if(result.code === 0){
-        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
-        editRowData.value.turntable_front_end_deviation = result.data.turntable_front_end_deviation
-
-        editRowData.value.overturn_steering_middle = result.data.overturn_steering_middle
-        editRowData.value.overturn_steering_high = result.data.overturn_steering_high
-        editRowData.value.overturn_steering_up_speed = result.data.overturn_steering_up_speed
-        editRowData.value.overturn_steering_down_speed = result.data.overturn_steering_down_speed
-      }else if(result.msg){
-        ElMessage.error(result.msg)
-      }
-      clientStore.ipc.removeAllListeners(icpList.socket.message+'_get_deviation_data');
-    });
-  }
-}
-
-
-
-//MCU初始化
-async function  connect_mcu__init(){
-  if(clientStore.isClient){
-
-    socketStore.sendMessage({
-      type: 'init_mcu',
-      data:{
-        value:true
-      }
-    })
-  }
-}
-
+import { ref } from 'vue'
 
+const activeIndex = ref('1')
 
-
-//设置 移动 调整
-async function changeNum(action_name, type, key, min, max) {
-  if(key && (min || max)){
-    if(editRowData.value[key] < min || editRowData.value[key] > max){
-      if(editRowData.value[key] < min){
-        editRowData.value[key] = min;
-      }else{
-        editRowData.value[key] = max;
-      }
-      ElMessage.error(`${action_name}值应在${min}到${max}之间`);
-    }
-  }
-  socketStore.sendMessage({
-    type,
-    data: {
-      action_name,
-      value:Number(editRowData.value[key]) || 0
-    }
-  });
-
-  clientStore.ipc.removeAllListeners(icpList.socket.message+'_set_deviation');
-  clientStore.ipc.on(icpList.socket.message+'_set_deviation', (event, result) => {
-    console.log('set_deviation')
-    console.log(result)
-    if(result.code === 0){
-      ElMessage.success(result.msg)
-    }else if(result.msg){
-      ElMessage.error(result.msg)
-    }
-    clientStore.ipc.removeAllListeners(icpList.socket.message+'_get_deviation_data');
-  });
-
+const handleSelect = (key) => {
+  activeIndex.value = key
 }
-
-
-
 </script>
 
 <style scoped lang="scss">
-.el-col {
-    position: relative;
-  ::v-deep {
-    .error-msg{
-      display: none;
-      position: absolute;
-      top: 41px;
-      top: 28px;
-      left: 8px;
-      z-index: 22;
-      color: #dc2626;
-      font-size: 12px;
-    }
-    &:hover{
-      .error-msg{
-        display: block;
-      }
-    }
+.page {
+  min-height: calc(100vh - 30px);
+}
+.tabs {
+  height: 40px;
+  line-height: 40px;
+  position: sticky;
+  top:30px;
+  background: #fff;
+  z-index: 100;
+  .tab {
+    height: 38px;
+    line-height: 40px;
+
   }
 }
 </style>

+ 136 - 0
frontend/src/views/Developer/mcu.vue

@@ -0,0 +1,136 @@
+<template>
+
+
+  <headerBar
+    title="开发者配置"
+  />
+
+  <div class="page">
+  <el-row v-for="item,key in editRowData" :key="index" class="mar-top-10">
+    <el-col :span="12">{{key}}</el-col>
+    <el-col :span="10">
+      <el-input
+          v-model="editRowData[key]"
+          type="number"
+      />
+    </el-col>
+  </el-row>
+
+  <el-row align="middle" justify="middle" class="bottom-wrap">
+    <el-col :span="24">
+      <el-button type="primary" @click="get_deviation">读取配置</el-button>
+      <el-button type="primary" @click="set_deviation">设置配置</el-button>
+    </el-col>
+  </el-row>
+  </div>
+
+</template>
+
+<script setup lang="ts">
+
+import {ref,reactive,onMounted} from "vue";
+
+import client from "@/stores/modules/client";
+import  icpList from '@/utils/ipc'
+import socket from "@/stores/modules/socket";
+import {ElMessage} from "element-plus";
+const clientStore = client();
+const socketStore = socket()
+
+
+const editRowData = ref({
+}); // 当前编辑行的数据
+
+onMounted(()=>{
+  get_deviation()
+})
+
+//获取配置
+async function  get_deviation(){
+  if(clientStore.isClient){
+    socketStore.sendMessage({
+      type: 'get_mcu_other_info',
+      data:"get_mcu_other_info"
+    })
+
+
+    clientStore.ipc.on(icpList.socket.message+'_get_mcu_other_info', (event, result) => {
+      console.log('_get_mcu_other_info')
+      console.log(result)
+      if(result.code === 0){
+        editRowData.value =  result.data
+
+      }else if(result.msg){
+        ElMessage.error(result.msg)
+      }
+      clientStore.ipc.removeAllListeners(icpList.socket.message+'_get_mcu_other_info');
+    });
+  }
+}
+
+
+
+
+//设置 移动 调整
+async function set_deviation(action_name, type, key, min, max) {
+
+  socketStore.sendMessage({
+    type: 'set_mcu_other_info',
+    data:{
+      ...editRowData.value
+    }
+  })
+
+
+  clientStore.ipc.on(icpList.socket.message+'_set_mcu_other_info', (event, result) => {
+    console.log('_set_mcu_other_info')
+    console.log(result)
+    if(result.code === 0){
+
+      ElMessage.success('设置成功')
+
+    }
+    clientStore.ipc.removeAllListeners(icpList.socket.message+'_set_mcu_other_info');
+  });
+
+
+
+}
+
+
+
+</script>
+
+<style scoped lang="scss">
+.bottom-wrap {
+  position: fixed;
+  bottom:0px;
+  left: 0;
+  right: 0;
+  padding: 10px 0;
+  background: #fff;
+}
+.page {
+  padding-bottom: 60px;
+}
+.el-col {
+    position: relative;
+  ::v-deep {
+    .error-msg{
+      display: none;
+      position: absolute;
+      top: 41px;
+      top: 28px;
+      left: 8px;
+      z-index: 22;
+      color: #dc2626;
+      font-size: 12px;
+    }
+    &:hover{
+      .error-msg{
+        display: block;
+      }
+    }
+  }
+}
+</style>

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

@@ -0,0 +1,275 @@
+<template>
+
+
+  <headerBar
+    title="开发者配置"
+  />
+
+  <div class="page">
+  <el-row>
+    <el-col :span="24"><h3>相机设置</h3></el-col>
+  </el-row>
+  <el-row>
+    <el-col :span="6">电机偏移mm:</el-col>
+    <el-col :span="12"><el-input
+        @change="changeNum('相机电机','move_deviation','camera_high_motor_deviation',0, 400)"
+        :min="0" :max="400"
+        :step="1"
+        v-model="editRowData.camera_high_motor_deviation" type="number"/>
+         <div class="error-msg">最小0,最大400</div>
+    </el-col>
+    <el-col :span="6"><el-button
+        @click="changeNum('相机电机','set_deviation','camera_high_motor_deviation',0, 400)"
+    >设定</el-button></el-col>
+  </el-row>
+  <el-row class="mar-top-10">
+    <el-col :span="6">舵机偏移(度):</el-col>
+
+    <el-col :span="12"><el-input
+        @change="changeNum('相机舵机','move_deviation','camera_steering_deviation',-90, 90)"
+        :min="-90" :max="90"
+        :step="0.1"
+        v-model="editRowData.camera_steering_deviation" type="number"/>
+      <div class="error-msg">最小-90,最大90</div>
+    </el-col>
+    <el-col :span="6"><el-button @click="changeNum('相机舵机','set_deviation','camera_steering_deviation',-90, 90)">设定</el-button></el-col>
+  </el-row>
+
+
+
+  <el-row>
+    <el-col :span="24"><h3>转盘设置</h3></el-col>
+  </el-row>
+  <el-row>
+    <el-col :span="6">角度偏移 (度):</el-col>
+    <el-col :span="12"><el-input
+        @change="changeNum('转盘舵机','move_deviation','turntable_steering_deviation',-720, 720)"
+        :min="-720" :max="720"
+        :step="1"
+        v-model="editRowData.turntable_steering_deviation" type="number"/>
+      <div class="error-msg">最小-720,最大720</div>
+    </el-col>
+    <el-col :span="6"><el-button  @click="changeNum('转盘舵机','set_deviation','turntable_steering_deviation',-720, 720)">设定</el-button></el-col>
+  </el-row>
+  <el-row class="mar-top-10">
+    <el-col :span="6">前后偏移:</el-col>
+
+    <el-col :span="12"><el-input
+        @change="changeNum('转盘前后电机','move_deviation','turntable_front_end_deviation',0, 950)"
+        :min="0" :max="950"
+        :step="1"
+        v-model="editRowData.turntable_front_end_deviation" type="number"/>
+      <div class="error-msg">最小0,最大950</div>
+    </el-col>
+    <el-col :span="6"><el-button @click="changeNum('转盘前后电机','set_deviation','turntable_front_end_deviation',0, 950)">设定</el-button></el-col>
+  </el-row>
+
+
+
+  <el-row>
+    <el-col :span="24"><h3>翻版舵机</h3></el-col>
+  </el-row>
+  <el-row>
+    <el-col :span="6">中位:</el-col>
+
+    <el-col :span="12"><el-input
+        @change="changeNum('翻板舵机中位','move_deviation','overturn_steering_middle',0, 180)"
+        :min="0" :max="180"
+        :step="0.5"
+        v-model="editRowData.overturn_steering_middle" type="number"/>
+      <div class="error-msg">最小0,最大180</div>
+    </el-col>
+    <el-col :span="6"><el-button @click="changeNum('翻板舵机中位','set_deviation','overturn_steering_middle',0, 180)">设定</el-button></el-col>
+  </el-row>
+  <el-row class="mar-top-10">
+    <el-col :span="6">高位:</el-col>
+    <el-col :span="12"><el-input
+        @change="changeNum('翻板舵机高位','move_deviation','overturn_steering_high',0, 180)"
+        :min="0" :max="180"
+        :step="0.5"
+        v-model="editRowData.overturn_steering_high" type="number"/>
+      <div class="error-msg">最小0,最大180</div>
+    </el-col>
+    <el-col :span="6"><el-button  @click="changeNum('翻板舵机高位','set_deviation','overturn_steering_high',0, 180)">设定</el-button></el-col>
+  </el-row>
+  <el-row class="mar-top-10">
+    <el-col :span="6">上升速度:</el-col>
+    <el-col :span="12"><el-input
+        @change="changeNum('翻板舵机上升速度','move_deviation','overturn_steering_up_speed',0, 10)"
+        :min="0" :max="10"
+        :step="1"
+        v-model="editRowData.overturn_steering_up_speed" type="number"/>
+      <div class="error-msg">最小0,最大10</div>
+    </el-col>
+    <el-col :span="6"><el-button @click="changeNum('翻板舵机上升速度','set_deviation','overturn_steering_up_speed',0, 10)">设定</el-button></el-col>
+  </el-row>
+  <el-row class="mar-top-10">
+    <el-col :span="6">下降速度:</el-col>
+    <el-col :span="12"><el-input
+        @change="changeNum('翻板舵机下降速度','move_deviation','overturn_steering_down_speed',0, 10)"
+        :min="0" :max="10"
+        :step="1"
+        v-model="editRowData.overturn_steering_down_speed" type="number"/>
+      <div class="error-msg">最小0,最大10</div>
+    </el-col>
+    <el-col :span="6"><el-button  @click="changeNum('翻板舵机下降速度','set_deviation','overturn_steering_down_speed',0, 10)">设定</el-button></el-col>
+  </el-row>
+
+
+  <el-row align="middle" justify="middle" class="mar-top-20 bottom-wrap">
+    <el-col :span="24">
+      <el-button type="primary" @click="get_deviation">读取偏移量</el-button>
+      <el-button type="primary" @click="connect_mcu__init">设备初始化</el-button>
+    </el-col>
+  </el-row>
+  </div>
+
+
+
+</template>
+
+<script setup lang="ts">
+
+import {ref,reactive,onMounted} from "vue";
+
+import client from "@/stores/modules/client";
+import  icpList from '@/utils/ipc'
+import socket from "@/stores/modules/socket";
+import {ElMessage} from "element-plus";
+const clientStore = client();
+const socketStore = socket()
+
+
+const editRowData = ref({
+  "camera_high_motor_deviation": '',
+  "camera_steering_deviation": '',
+  "turntable_steering_deviation": '',
+  "turntable_front_end_deviation":'',
+  "overturn_steering_middle": '',
+  "overturn_steering_high": '',
+  "overturn_steering_up_speed": '',
+  "overturn_steering_down_speed": ''
+}); // 当前编辑行的数据
+
+onMounted(()=>{
+  get_deviation()
+})
+
+//获取配置
+async function  get_deviation(){
+  if(clientStore.isClient){
+    socketStore.sendMessage({
+      type: 'get_deviation',
+      data:"get_deviation"
+    })
+
+
+    clientStore.ipc.on(icpList.socket.message+'_get_deviation_data', (event, result) => {
+      console.log('_get_deviation_data')
+      console.log(result)
+      if(result.code === 0){
+        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
+        editRowData.value.turntable_front_end_deviation = result.data.turntable_front_end_deviation
+
+        editRowData.value.overturn_steering_middle = result.data.overturn_steering_middle
+        editRowData.value.overturn_steering_high = result.data.overturn_steering_high
+        editRowData.value.overturn_steering_up_speed = result.data.overturn_steering_up_speed
+        editRowData.value.overturn_steering_down_speed = result.data.overturn_steering_down_speed
+      }else if(result.msg){
+        ElMessage.error(result.msg)
+      }
+      clientStore.ipc.removeAllListeners(icpList.socket.message+'_get_deviation_data');
+    });
+  }
+}
+
+
+
+//MCU初始化
+async function  connect_mcu__init(){
+  if(clientStore.isClient){
+
+    socketStore.sendMessage({
+      type: 'init_mcu',
+      data:{
+        value:true
+      }
+    })
+  }
+}
+
+
+
+
+//设置 移动 调整
+async function changeNum(action_name, type, key, min, max) {
+  if(key && (min || max)){
+    if(editRowData.value[key] < min || editRowData.value[key] > max){
+      if(editRowData.value[key] < min){
+        editRowData.value[key] = min;
+      }else{
+        editRowData.value[key] = max;
+      }
+      ElMessage.error(`${action_name}值应在${min}到${max}之间`);
+    }
+  }
+  socketStore.sendMessage({
+    type,
+    data: {
+      action_name,
+      value:Number(editRowData.value[key]) || 0
+    }
+  });
+
+  clientStore.ipc.removeAllListeners(icpList.socket.message+'_set_deviation');
+  clientStore.ipc.on(icpList.socket.message+'_set_deviation', (event, result) => {
+    console.log('set_deviation')
+    console.log(result)
+    if(result.code === 0){
+      ElMessage.success(result.msg)
+    }else if(result.msg){
+      ElMessage.error(result.msg)
+    }
+    clientStore.ipc.removeAllListeners(icpList.socket.message+'_get_deviation_data');
+  });
+
+}
+
+
+
+</script>
+
+<style scoped lang="scss">
+.bottom-wrap {
+  position: fixed;
+  bottom:0px;
+  left: 0;
+  right: 0;
+  padding: 10px 0;
+  background: #fff;
+}
+.page {
+  padding-bottom: 60px;
+}
+.el-col {
+    position: relative;
+  ::v-deep {
+    .error-msg{
+      display: none;
+      position: absolute;
+      top: 28px;
+      left: 8px;
+      z-index: 22;
+      color: #dc2626;
+      font-size: 12px;
+    }
+    &:hover{
+      .error-msg{
+        display: block;
+      }
+    }
+  }
+}
+</style>

+ 30 - 4
frontend/src/views/Photography/shot.vue

@@ -54,7 +54,7 @@
         </div>
         <div class="step-number flex-col"><span class="text_22">2</span></div>
         <div class="step-two flex-col justify-between">
-          <span class="step-title">第二步:启动拍摄(根据左右脚按遥控器左右键启动)</span>
+          <span class="step-title">第二步:启动拍摄(根据按遥控器左右键启动)</span>
           <div class="shooting-container flex-col">
             <div class="shooting-tips flex-row justify-between">
               <img class="info-icon" referrerpolicy="no-referrer" src="@/assets/images/Photography/info-icon.png" />
@@ -181,6 +181,9 @@ const menu = computed(()=>{
         type:'setting'
       },
       {
+        type:'remoteControl'
+      },
+      {
         type:'developer'
       }
     ]
@@ -190,6 +193,9 @@ const menu = computed(()=>{
   return [
     {
       type:'setting'
+    },
+    {
+      type:'remoteControl'
     }
   ]
 
@@ -249,15 +255,12 @@ async function getPhotoRecords(params?:{}) {
  * @param data - 包含拍摄所需的数据对象。
  */
 async function runGoods(data) {
-  console.log('aa2')
   await socketStore.connectSocket();
 
-  console.log('aa3')
   socketStore.sendMessage({
     type: 'run_mcu',
     data,
   })
-
   ElMessage.success('开始拍摄,请稍后')
   runLoading.value = true;
   runAction.value = data
@@ -358,6 +361,9 @@ onMounted(async () => {
     }
   });
 
+  window.addEventListener('storage', handleStorageEvent);
+
+
 
   await getPhotoRecords();
   // 监听图片处理完成事件
@@ -422,6 +428,25 @@ onMounted(async () => {
 
 })
 
+
+
+const handleStorageEvent = (e) => {
+  if(e.key === 'run_mcu' && e.newValue){
+    if(!goods_art_no.value){
+      ElMessage.error('请先扫描货号或者手动输入货号!')
+      localStorage.setItem('run_mcu','')
+      return;
+    }
+    let action = '执行左脚程序'
+    if(e.newValue  === 'right')  action = '执行右脚程序'
+    runGoods({
+      "action": action,
+      "goods_art_no": goods_art_no.value,
+    })
+    localStorage.setItem('run_mcu','')
+
+  }
+};
 const checkInfoStore = checkInfo()
 checkInfoStore.set_blue_tooth_scan_NO('')
 watchEffect(async ()=>{
@@ -442,6 +467,7 @@ onBeforeUnmount(() => {
   clientStore.ipc.removeAllListeners(icpList.socket.message + '_run_mcu');
   clientStore.ipc.removeAllListeners(icpList.socket.message + '_photo_take');
   clientStore.ipc.removeAllListeners(icpList.socket.message + '_photo_take_finish');
+  window.removeEventListener('storage', handleStorageEvent);
 
 
 })

+ 41 - 7
frontend/src/views/RemoteControl/index.vue

@@ -8,24 +8,33 @@
   <div class="main-container">
     <el-row align="middle">
       <el-col :span="8"></el-col>
-      <el-col :span="8"><div class="button up">上</div></el-col>
       <el-col :span="8"></el-col>
+<!--      <el-col :span="8"><div class="button up">上</div></el-col>-->
+      <el-col :span="8"></el-col>
+    </el-row>
+    <el-row align="middle">
+      <el-col :span="8"><div class="button up" @click="runLeft">左脚</div></el-col>
+      <el-col :span="8"><div class="button up" @click="run_take_picture">拍照</div></el-col>
+      <el-col :span="8"><div class="button up" @click="runRight">右脚</div></el-col>
     </el-row>
     <el-row align="middle">
-      <el-col :span="8"><div class="button up">左脚</div></el-col>
-      <el-col :span="8"><div class="button up">拍照</div></el-col>
-      <el-col :span="8"><div class="button up">右脚</div></el-col>
+      <el-col :span="2"></el-col>
+      <el-col :span="20" class="fs-12">获取商品货号后,点击左右键启动拍摄程序,在拍摄程序结束后,可点击拍照启动单独拍照程序</el-col>
+      <el-col :span="2"></el-col>
     </el-row>
     <el-row align="middle">
       <el-col :span="8"></el-col>
-      <el-col :span="8"><div class="button up">下</div></el-col>
+      <el-col :span="8"></el-col>
+<!--      <el-col :span="8"><div class="button up">下</div></el-col>-->
       <el-col :span="8"></el-col>
     </el-row>
     <el-row align="middle" class="mar-top-50">
       <el-col :span="3"></el-col>
-      <el-col :span="8"><div class="button up">继续</div></el-col>
+      <el-col :span="8"></el-col>
+<!--      <el-col :span="8"><div class="button up">继续</div></el-col>-->
       <el-col :span="2"></el-col>
-      <el-col :span="8"><div class="button up">停止</div></el-col>
+      <el-col :span="8"></el-col>
+<!--      <el-col :span="8"><div class="button up">停止</div></el-col>-->
       <el-col :span="3"></el-col>
     </el-row>
   </div>
@@ -34,6 +43,31 @@
 
 <script setup lang="ts">
 import headerBar from '@/components/header-bar/index.vue'
+import icpList from '@/utils/ipc'
+import client from "@/stores/modules/client";
+import socket from "@/stores/modules/socket";
+
+const clientStore = client();
+// 初始化 WebSocket 状态管理
+const socketStore = socket()
+
+const runLeft = async () => {
+  localStorage.setItem('run_mcu','left')
+}
+
+
+const runRight = async () => {
+  localStorage.setItem('run_mcu','right')
+}
+
+
+
+const run_take_picture = () => {
+  socketStore.sendMessage({
+    type: 'handler_take_picture',
+  })
+}
+
 </script>
 
 <style scoped lang="scss">