Kaynağa Gözat

Merge branch 'develop' of http://code.nyzhwlw.com:10202/yf_zhb/bigdata_WX into develop

leo 2 gün önce
ebeveyn
işleme
a9f1a06857
1 değiştirilmiş dosya ile 12 ekleme ve 2 silme
  1. 12 2
      pages/shuHai/devicePhoto.vue

+ 12 - 2
pages/shuHai/devicePhoto.vue

@@ -229,9 +229,10 @@ export default {
     };
   },
   async onLoad(options) {
-    const {id,img_id,currentYear,addtime} = options
+    const {id,img_id,event_id,currentYear,addtime} = options
     this.device_id = id
     this.imgOld_id = img_id
+    this.event_id = event_id || ''
     this.currentYear = currentYear
     this.addtime = this.formatTime(Number(addtime)*1000);
     this.time_begin = this.addtime;
@@ -250,6 +251,14 @@ export default {
     }
     this.pestList = [];
     await this.getEventList();
+    // 定位到跳转时携带的 event_id,找不到就默认第一个
+    const fileIndex = this.fileList.findIndex(file => file.event_id == this.event_id);
+    this.fileIndex = fileIndex > -1 ? fileIndex : 0;
+    const curFile = this.fileList[this.fileIndex];
+    if (curFile) {
+      this.event_id = curFile.event_id;
+      this.camera_id = curFile.device_id;
+    }
     await this.getPestDict();
     await this.getPestLevelMap();
     await this.getPestList();
@@ -368,7 +377,8 @@ export default {
       this.thumbnails = res?.data || [];
       this.currentImg = {};
       //如果和旧的id相同,就用旧的id不然就用第一个
-      this.img_id = this.thumbnails[0]?.id
+      const oldImg = this.thumbnails.find(item => item.id == this.imgOld_id);
+      this.img_id = oldImg?.id || this.thumbnails[0]?.id || ''
       this.getDevicePhotoDetails();
     },
     formatTime(dateString) {