entite are opening well in all modes

This commit is contained in:
2023-09-20 12:28:19 +02:00
parent fbde40263f
commit 139db3516a
5 changed files with 120 additions and 64 deletions

View File

@@ -72,6 +72,7 @@ export default {
this.id = this.mapitem.id;
this.concernement = this.mapitem.concernement;
this.cid = this.concernement.id;
console.log('mapitem this.cid', this.cid);
this.active_revision = this.concernement.active_revision;
// console.log(`ConcernementsMapItem ${this.id} created`);
@@ -1388,7 +1389,7 @@ export default {
// wait for routing to be finished before opening the mapItem
await this.$router.push({
name: 'concernement',
params: {cid: this.cid},
params: {cid: parseInt(this.cid)},
query: {
mapitemid: this.id,
superposition_id: this.mapitem.superposition_ids[0]
@@ -1429,8 +1430,12 @@ export default {
// we have clicked on an entite
this.$router.push({
name: 'concernement',
params: {cid: this.cid, eid: result.item.item_id},
query: {
mapitemid: this.id,
superposition_id: this.mapitem.superposition_ids[0]
},
hash: `#${this.map_mode}`,
params: {id: this.cid, mapitemid: this.id, eid: result.item.item_id}
});
break;
case "doleancer":

View File

@@ -4,7 +4,7 @@ import { mapActions, mapState } from 'pinia'
import { ConcernementsStore } from '@stores/concernements'
export default {
props: ['entite', 'eid'],
props: ['concernement', 'entite', 'eid'],
data() {
return {
}
@@ -15,7 +15,7 @@ export default {
'ct_entite']),
field_menace_maintien_label (){
let str;
if (this.opened_concernement.entites_byid[this.eid].menacemaintien < 0) {
if (this.concernement.entites_byid[this.eid].menacemaintien < 0) {
str = this.ct_entite.field_menace_maintien.description.replace('/maintient', '')
} else {
str = this.ct_entite.field_menace_maintien.description.replace('menace/', '')
@@ -24,7 +24,7 @@ export default {
},
field_sources_label () {
let str;
if (this.opened_concernement.entites_byid[this.eid].menacemaintien < 0) {
if (this.concernement.entites_byid[this.eid].menacemaintien < 0) {
str = this.ct_entite.field_sources.description.replace('/ ce maintient', '')
} else {
str = this.ct_entite.field_sources.description.replace('cette menace /', '')

View File

@@ -5,6 +5,12 @@ import { ConcernementsStore } from '@stores/concernements'
import { UserStore } from '@/stores/user'
// import { CommonStore } from '@/stores/common'
import { print } from 'graphql/language/printer'
import gql from 'graphql-tag'
import GQL from '@api/graphql-axios'
import EntiteFields from '@api/gql/entite.fragment.gql'
import CartoucheLayout from '@components/layout/CartoucheLayout.vue';
import Entite from '@components/contents/Entite.vue';
@@ -16,10 +22,11 @@ import { mdiChevronRight } from '@mdi/js';
import { mdiChevronDown } from '@mdi/js';
export default {
props: ['cid', 'eid', 'entite'],
props: ['cid', 'eid'],
data(){
return {
concernement: null,
entite: null,
history_value: 0,
history_slider_ops: null,
infos_opened: false,
@@ -53,8 +60,12 @@ export default {
console.log(`terraindevie created, cid: ${this.cid}, eid: ${this.eid}, this.concernement:`, this.concernement);
// revisions
//entite
if (this.eid) {
this.loadEntite()
}
// revisions
let data=[];
this.concernement.revisions.forEach(rev => {
if (rev.entites.length > 3) {
@@ -87,12 +98,37 @@ export default {
this.setActiveRevision(this.concernement.id, n);
},
deep: true
},
eid: {
handler (n, o) {
console.log(`TerrainDeVie watch eid o:${o}, n:${n}`);
this.loadEntite()
},
deep: true
}
},
methods: {
...mapActions(ConcernementsStore, ['setActiveRevision']), // 'loadConcernementsRevisions'
onClickInfos(){
this.infos_opened = !this.infos_opened;
},
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)
})
}
},
components: {
@@ -130,7 +166,7 @@ export default {
</template>
<!-- entite -->
<Entite v-if="entite" :entite="entite" :eid="eid"/>
<Entite v-if="entite" :concernement="concernement" :entite="entite" :eid="eid"/>
</template>
<template v-slot:footer>