Selaa lähdekoodia

refactor(前端): 修改智能射手座拍照逻辑

- 更新拍照请求类型为 'smart_shooter_photo_take'
- 增加对结果的错误处理和加载状态管理- 优化拍照后的处理流程,包括显示最近照片和重置状态
panqiuyao 4 kuukautta sitten
vanhempi
commit
27de016e50
1 muutettua tiedostoa jossa 28 lisäystä ja 7 poistoa
  1. 28 7
      frontend/src/views/Photography/shot.vue

+ 28 - 7
frontend/src/views/Photography/shot.vue

@@ -545,7 +545,7 @@ const reTakePicture = async (img)=>{
 
     clientStore.ipc.removeAllListeners(icpList.socket.message + '_digicam_take_picture');
     socketStore.sendMessage({
-      type: 'digicam_take_picture',
+      type: 'smart_shooter_photo_take',
       "data":{"id":img.id,"goods_art_no":img.goods_art_no},
     })
     clientStore.ipc.on(icpList.socket.message + '_digicam_take_picture', (event, result) => {
@@ -864,13 +864,34 @@ let smartShooterTimeout = null; // 在合适的位置定义一个全局变量用
 clientStore.ipc.on(icpList.socket.message+'_smart_shooter_photo_take', async (event, result) => {
   console.log('_smart_shooter_photo_take');
   console.log(result);
-  if(result.code === 0 && result.data?.photo_file_name){
-    if (smartShooterTimeout) {
-      clearTimeout(smartShooterTimeout);
+
+  if( reNosObj.value.goods_art_no ){
+
+
+    runLoading.value = false;
+    if(result.code === 0){
+      getPhotoRecords()
+      setTimeout(()=>{
+        showlastPhoto.value = false
+      },6000)
+    }else if(result.msg) {
+
+      runLoading.value = false;
+      reNosObj.value.goods_art_no = ''
+      reNosObj.value.action = ''
+      ElMessage.error(result.msg)
+    }
+
+  }else{
+
+    if(result.code === 0 && result.data?.photo_file_name){
+      if (smartShooterTimeout) {
+        clearTimeout(smartShooterTimeout);
+      }
+      smartShooterTimeout = setTimeout(() => {
+        getPhotoRecords();
+      }, 2000);
     }
-    smartShooterTimeout = setTimeout(() => {
-      getPhotoRecords();
-    }, 2000);
   }
 
 })