Kaynağa Gözat

bug fix: open boussole from search failed when mapitem_id different from cid

bach 1 ay önce
ebeveyn
işleme
c90baf9a31
2 değiştirilmiş dosya ile 8 ekleme ve 3 silme
  1. 5 0
      src/App.vue
  2. 3 3
      src/stores/concernements.js

+ 5 - 0
src/App.vue

@@ -75,6 +75,7 @@ export default {
       // console.log('App couple_ids', couple_ids);
       // loop through all concernement
       for(let [concernement_id, concernement] of Object.entries(this.concernementsByID)){
+        concernement.mapitems_ids = [];
         // TODO check if more than 3 entities or if connected user if author
         if (concernement.entites.length > 3 || concernement.can_update) {
           // create the main mapitem object
@@ -113,15 +114,19 @@ export default {
                 };
                 this.mapitems.push(mapitem_superposition);
                 this.allMapItems_byid[mapitem_superposition.id] = mapitem_superposition;
+                concernement.mapitems_ids.push(mapitem_superposition.id)
               }
             }
           }
           this.mapitems.push(mapitem)
           this.allMapItems_byid[mapitem.id] = mapitem;
+          concernement.mapitems_ids.push(mapitem.id)
           
         }
       }
       console.log('App mapitems', this.mapitems);
+      console.log('this.allMapItems_byid', this.allMapItems_byid);
+      
     }
   },
   components: {

+ 3 - 3
src/stores/concernements.js

@@ -641,10 +641,10 @@ export const ConcernementsStore = defineStore({
         }
       })
     },
-    openCloseConcernements (cid, id) {
-      console.log(`openCloseConcernements cid: ${cid}, id: ${id}`);
+    openCloseConcernements (cid, mi_id) {
+      console.log(`openCloseConcernements cid: ${cid}, mi_id: ${mi_id}`);
       var state;
-      let mapitem_id = id ? id : cid;
+      let mapitem_id = mi_id ? mi_id : this.concernementsByID[cid].mapitems_ids[0];
       this.opened_concernement = null;
       this.opened_recit = null;
       this.concernements.forEach((c, i) => {