Просмотр исходного кода

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

panqiuyao 7 месяцев назад
Родитель
Сommit
05259df09e
2 измененных файлов с 27 добавлено и 13 удалено
  1. 6 1
      electron/controller/takephoto.js
  2. 21 12
      frontend/src/views/Photography/shot.vue

+ 6 - 1
electron/controller/takephoto.js

@@ -5,6 +5,7 @@ const errData = {
   msg :'请求失败,请联系管理员',
   code:999
 }
+let id = 1;
 
 
 /**
@@ -30,8 +31,12 @@ class takePhotoController extends Controller {
   async getPhotoRecords (params) {
     console.log('getPhotoRecords')
     try {
+
+      console.log(id +'getPhotoRecords start print_time:'+new Date().toLocaleString())  // 打印当前时间
       const result = await getPhotoRecords(params);
-      console.log('getPhotoRecords result')
+      console.log(id+'getPhotoRecords result')
+      console.log(id + 'getPhotoRecords result print_time:'+new Date().toLocaleString())  // 打印当前时间
+      id++;
       if(result.data)  return result.data
       return errData;
     } catch (error) {

+ 21 - 12
frontend/src/views/Photography/shot.vue

@@ -258,8 +258,8 @@ function saveGoodsArtNo(){
  * @param params - 可选参数,用于分页或其他筛选条件。
  */
 async function getPhotoRecords(params?:{}) {
-  clientStore.ipc.removeAllListeners(icpList.takePhoto.getPhotoRecords);
-  loading.true = true;
+  if(loading.value) return;
+  loading.value = true;
   clientStore.ipc.send(icpList.takePhoto.getPhotoRecords,{
     ...params,
     page:1,
@@ -267,12 +267,13 @@ async function getPhotoRecords(params?:{}) {
   });
   clientStore.ipc.on(icpList.takePhoto.getPhotoRecords, (event, result) => {
 
-    loading.true = false;
-    clientStore.ipc.removeAllListeners(icpList.takePhoto.getPhotoRecords);
+    loading.value = false;
     if(result.code === 0){
 
-      console.log('======================');
-      console.log(runAction.value);
+      clientStore.ipc.removeAllListeners(icpList.takePhoto.getPhotoRecords);
+
+      console.log('getPhotoRecords  print_time:'+new Date().toLocaleString())  // 打印当前时间
+      console.log('getPhotoRecords  print_time:'+JSON.stringify(result.data.list))  // 打印当前时间
      goodsList.value = result.data.list
       if(isDelGoodsGetList.value){
         isDelGoodsGetList.value = false;
@@ -662,23 +663,31 @@ const  getLastPhotoRecord = async ()=>{
 
 // 监听拍照完成后的最终状态事件
 clientStore.ipc.on(icpList.socket.message + '_run_mcu_update', (event, result) => {
-  console.log('_run_mcu_update')
-  console.log(result)
-  console.log('run_mcu_update:'+new Date().toLocaleString())  // 打印当前时间
+  console.log('run_mcu_updat print_time:'+new Date().toLocaleString())  // 打印当前时间
+  console.log('run_mcu_update  print_time:'+JSON.stringify(result))
 
   if(result.code === 0){
-    if(lastPhoto.value?.file_path){
+    if(result.data?.file_path){
       if(  lastPhoto.value?.file_path == result.data?.file_path) return;
 
       if(runAction.value.goods_art_no === result.data?.goods_art_no){
         showlastPhoto.value = true
-        getPhotoRecords()
+        goodsList.value.map(item=>{
+          if(item.goods_art_no === result.data?.goods_art_no){
+            console.log('========item');
+            console.log(item);
+            item.items[result.data.image_index].image_path = result.data?.file_path
+            console.log(item);
+            console.log( goodsList.value);
+          }
+        })
+       // getPhotoRecords()
         setTimeout(()=>{
           getPhotoRecords()
         },2000)
       }
+      lastPhoto.value = result.data
     }
-    lastPhoto.value = result.data
   }else if(result.msg) {
     ElMessage.error(result.msg)
   }