fixed auto open concernement on first load
This commit is contained in:
parent
654843bfc9
commit
962335a154
@ -62,14 +62,14 @@ export default {
|
|||||||
},
|
},
|
||||||
props: ['concernement', 'is_opened'],
|
props: ['concernement', 'is_opened'],
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(ConcernementsStore,['map_mode']),
|
...mapState(ConcernementsStore,['map_mode',
|
||||||
...mapState(ConcernementsStore,['concernementsByID']),
|
'concernementsByID',
|
||||||
...mapState(ConcernementsStore,['opened_concernement']),
|
'opened_concernement',
|
||||||
...mapState(ConcernementsStore,['opened_entite_id']),
|
'opened_entite_id']),
|
||||||
...mapState(CommonStore,['hover_elmt']),
|
...mapState(CommonStore,['hover_elmt',
|
||||||
...mapState(CommonStore,['map_item_ray']),
|
'map_item_ray',
|
||||||
...mapState(CommonStore,['cartouch_width']),
|
'cartouch_width',
|
||||||
...mapState(CommonStore,['paper_symbol_definitions'])
|
'paper_symbol_definitions'])
|
||||||
},
|
},
|
||||||
created () {
|
created () {
|
||||||
// console.log(`ConcernementsMapItem ${this.concernement.id} created`, this.canvasMap, this.matterEngine);
|
// console.log(`ConcernementsMapItem ${this.concernement.id} created`, this.canvasMap, this.matterEngine);
|
||||||
@ -122,6 +122,7 @@ export default {
|
|||||||
},
|
},
|
||||||
is_opened: {
|
is_opened: {
|
||||||
handler (n, o) {
|
handler (n, o) {
|
||||||
|
// console.log('mapItem watch is_opened', n, this.is_opened);
|
||||||
if(n){ // opened
|
if(n){ // opened
|
||||||
this.openClose(true);
|
this.openClose(true);
|
||||||
}else{ // closed
|
}else{ // closed
|
||||||
|
@ -24,9 +24,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(ConcernementsStore,['opened_concernement']),
|
...mapState(ConcernementsStore,['map_mode',
|
||||||
...mapState(ConcernementsStore,['ct_concernement']),
|
'opened_concernement',
|
||||||
...mapState(ConcernementsStore,['ct_entite']),
|
'ct_concernement',
|
||||||
|
'ct_entite']),
|
||||||
...mapState(UserStore,['name']),
|
...mapState(UserStore,['name']),
|
||||||
created(){
|
created(){
|
||||||
let d = new Date(this.opened_concernement.created);
|
let d = new Date(this.opened_concernement.created);
|
||||||
|
@ -214,7 +214,7 @@ export const ConcernementsStore = defineStore({
|
|||||||
|
|
||||||
},
|
},
|
||||||
hideShowConcernement (id, state) {
|
hideShowConcernement (id, state) {
|
||||||
console.log(`disableConcernement id: ${id}`);
|
// console.log(`disableConcernement id: ${id}`);
|
||||||
this.concernements.forEach((c, i) => {
|
this.concernements.forEach((c, i) => {
|
||||||
if (c.id === id) {
|
if (c.id === id) {
|
||||||
this.concernements[i].visible = this.concernementsByID[id].visible = state;
|
this.concernements[i].visible = this.concernementsByID[id].visible = state;
|
||||||
@ -226,9 +226,11 @@ export const ConcernementsStore = defineStore({
|
|||||||
var state;
|
var state;
|
||||||
this.concernements.forEach((c, i) => {
|
this.concernements.forEach((c, i) => {
|
||||||
state = id === c.id;
|
state = id === c.id;
|
||||||
this.concernements[i].opened = this.concernementsByID[c.id].opened = state;
|
// console.log(`openCloseConcernements foreach id: ${id}, c.id: ${c.id}, state: ${state}`, id, c.id);
|
||||||
|
c.opened = this.concernements[i].opened = this.concernementsByID[c.id].opened = state;
|
||||||
if (state) {
|
if (state) {
|
||||||
this.opened_concernement = c;
|
this.opened_concernement = c;
|
||||||
|
// console.log('openCloseConcernements', this.opened_concernement.opened);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -42,12 +42,11 @@ export default {
|
|||||||
watch: {
|
watch: {
|
||||||
concernements_loaded: {
|
concernements_loaded: {
|
||||||
handler (n, o){
|
handler (n, o){
|
||||||
console.log(`watch concernements_loaded n: ${n}, opened_concernement:${this.opened_concernement}, id:${this.id}`);
|
// console.log(`watch concernements_loaded n: ${n}, opened_concernement:${this.opened_concernement}, id:${this.id}`);
|
||||||
// when we arrived directly to the url then all concernement are loaded: do open the concernement
|
// when we arrived directly to the url then all concernement are loaded: do open the concernement
|
||||||
if (!this.opened_concernement) {
|
if (!this.opened_concernement) {
|
||||||
this.openCloseConcernements(this.id)
|
this.openCloseConcernements(parseInt(this.id))
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
deep: true
|
deep: true
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user