浏览代码

refactor(Photography): 优化重拍功能流程

- 修改 editRow 组件中的 mode_type 字段路径
- 重构 shot 组件中的重拍功能逻辑,增加设备配置获取和提示步骤
-优化用户交互体验,增加加载状态和提示消息
panqiuyao 4 月之前
父节点
当前提交
1e1a09d606
共有 2 个文件被更改,包括 78 次插入15 次删除
  1. 1 1
      frontend/src/views/Photography/components/editRow.vue
  2. 77 14
      frontend/src/views/Photography/shot.vue

+ 1 - 1
frontend/src/views/Photography/components/editRow.vue

@@ -188,7 +188,7 @@ function testShoesFlip(){
         camera_angle:  Number(editRowData.value.camera_angle),
         led_switch:editRowData.value.led_switch,
         id:0,
-        mode_type:editRowData.mode_type,
+        mode_type:editRowData.value.mode_type,
         turntable_position:Number(editRowData.value.turntable_position),
         action_name:editRowData.value.action_name || '测试',
         turntable_angle: Number(editRowData.value.turntable_angle),

+ 77 - 14
frontend/src/views/Photography/shot.vue

@@ -469,27 +469,90 @@ const reTakePicture = async (img)=>{
     cancelButtonText: '取消',
   })
 
-  socketStore.sendMessage({
-    type: 're_take_picture',
-    "data":{"record_id":img.id},
-  })
+  runLoading.value = true;
+  runAction.value.goods_art_no = img.goods_art_no
+  runAction.value.action = 're_take_picture'
+  let params = {
+    id: img.action_id
+  }
 
-  clientStore.ipc.removeAllListeners(icpList.socket.message + '_re_take_picture');
+  clientStore.ipc.removeAllListeners(icpList.setting.getDeviceConfigDetail);
 
-  clientStore.ipc.on(icpList.socket.message + '_re_take_picture', (event, result) => {
-    console.log('_re_take_picture')
+  clientStore.ipc.send(icpList.setting.getDeviceConfigDetail, params);
+
+
+  clientStore.ipc.on(icpList.setting.getDeviceConfigDetail, (event, result) => {
+
+    console.log('getDeviceConfigDetail')
     console.log(result)
-    if(result.code === 0){
-      getPhotoRecords()
-      setTimeout(()=>{
-        showlastPhoto.value = false
-      },6000)
-    }else if(result.msg) {
+    if(result.code == 0 && result.data){
+      clientStore.ipc.removeAllListeners(icpList.setting.getDeviceConfigDetail);
+
+      this_run_mcu_single(result.data)
+    }else if(result.msg){
       ElMessage.error(result.msg)
     }
+  });
+
+  function  this_run_mcu_single(data){
+
+    clientStore.ipc.removeAllListeners(icpList.socket.message+'_run_mcu_single');
+    socketStore.sendMessage({
+      type: 'run_mcu_single',
+      data: {
+        camera_height: Number(data.camera_height),
+        camera_angle:  Number(data.camera_angle),
+        led_switch:data.led_switch,
+        id:0,
+        mode_type:data.mode_type,
+        turntable_position:Number(data.turntable_position),
+        action_name:data.action_name || '测试',
+        turntable_angle: Number(data.turntable_angle),
+        shoe_upturn: Number(data.shoe_upturn),
+        action_index:1,
+        number_focus:0,
+        take_picture:false,
+        pre_delay:0,
+        after_delay:0,
+      }
+    });
+
+
+    clientStore.ipc.on(icpList.socket.message+'_run_mcu_single', async (event, result) => {
+      console.log('_run_mcu_single_row')
+      clientStore.ipc.removeAllListeners(icpList.socket.message+'_run_mcu_single');
+        this_re_take_picture()
+    })
+  }
+  async function this_re_take_picture(){
+
+    await ElMessageBox.alert('已把鞋子摆放完毕,点击按钮确认开始重拍', '提示')
+
+
+    socketStore.sendMessage({
+      type: 're_take_picture',
+      "data":{"record_id":img.id},
+    })
     clientStore.ipc.removeAllListeners(icpList.socket.message + '_re_take_picture');
+    clientStore.ipc.on(icpList.socket.message + '_re_take_picture', (event, result) => {
+      console.log('_re_take_picture')
+      console.log(result)
+
+      runLoading.value = false;
+      if(result.code === 0){
+        getPhotoRecords()
+        setTimeout(()=>{
+          showlastPhoto.value = false
+        },6000)
+      }else if(result.msg) {
+        ElMessage.error(result.msg)
+      }
+      clientStore.ipc.removeAllListeners(icpList.socket.message + '_re_take_picture');
+
+    })
+  }
+
 
-  })
 }
 
 const reNosObj = ref({