on multiple superpositions can switch by clicking on superposed mapitem

This commit is contained in:
2023-09-20 15:25:36 +02:00
parent 139db3516a
commit c67afa76e3
7 changed files with 102 additions and 57 deletions

View File

@@ -85,18 +85,7 @@ export default {
console.log("superposition", this.superposition);
if(this.map_mode === "superposition" && this.$route.query.superposition_id){
// get superposition_id and superposition object
this.superposition_id = this.$route.query.superposition_id;
console.log('this.superposition_id', this.superposition_id);
if(this.superposition_id){
let ids = this.superposition_id.match(/(\d+)_(\d+)__(\d+)_(\d+)/i)
let couple_key = `${ids[1]}-${ids[3]}`
// console.log('superposition_id', this.superposition_id, couple_key, ids);
if (this.allSuperpositions_byid[couple_key][this.superposition_id]) {
this.superposition = this.allSuperpositions_byid[couple_key][this.superposition_id]
console.log("this.superposition", this.superposition);
}
}
this.getSuperposition()
// as we have two content to show multiply the cartouch with by 2
// necessary for mapitem opening scale and position
this.setCartoucheWidth(2)
@@ -109,7 +98,7 @@ export default {
// when we arrived directly to the url, load the entite
// this.eid provided by route params
if (this.map_mode === "terraindevie" && this.eid) {
this.openEntite();
this.setOpenedEntiteId(this.eid)
}
},
watch: {
@@ -125,15 +114,21 @@ export default {
},
eid: {
handler (n, o){
if(n){
this.openEntite()
}else{
// this.entite = false;
this.setOpenedEntiteId(null);
this.setOpenedEntiteId(n)
},
deep: true
},
// watch superposition_id query
$route: {
handler (n, o) {
console.log("concernement view $route watcher o, n", o, n);
if (n.query && n.query.superposition_id) {
this.getSuperposition()
}
},
deep: true
}
},
methods: {
...mapActions(ConcernementsStore,['openCloseConcernements',
@@ -141,28 +136,24 @@ export default {
'setMapMode',
'resetConcernementOpened']),
...mapActions(CommonStore,['setCartoucheWidth']),
openEntite(){
this.setOpenedEntiteId(parseInt(this.eid))
// this.loadEntite()
getSuperposition(){
console.log('getSuperposition');
// get superposition_id and superposition object
if (this.$route.query.superposition_id) {
this.superposition_id = this.$route.query.superposition_id;
console.log('this.superposition_id', this.superposition_id);
if(this.superposition_id){
let ids = this.superposition_id.match(/(\d+)_(\d+)__(\d+)_(\d+)/i)
let couple_key = `${ids[1]}-${ids[3]}`
// console.log('superposition_id', this.superposition_id, couple_key, ids);
if (this.allSuperpositions_byid[couple_key][this.superposition_id]) {
this.superposition = this.allSuperpositions_byid[couple_key][this.superposition_id]
console.log("this.superposition", this.superposition);
}
}
}
},
// loadEntite(){
// const ast = gql`{
// entite (id: ${this.eid}) {
// ...EntiteFields
// }
// }
// ${EntiteFields}
// `
// console.log('ast', ast);
// GQL.post('', { query: print(ast) })
// .then(({data: { data: { entite }}}) => {
// console.log('load entite loaded', entite)
// this.entite = entite
// })
// .catch(error => {
// console.warn('Issue with load entite', error)
// })
// },
closeConcernement(){
this.resetConcernementOpened();
}