entite are opening well in all modes
This commit is contained in:
parent
fbde40263f
commit
139db3516a
@ -72,6 +72,7 @@ export default {
|
|||||||
this.id = this.mapitem.id;
|
this.id = this.mapitem.id;
|
||||||
this.concernement = this.mapitem.concernement;
|
this.concernement = this.mapitem.concernement;
|
||||||
this.cid = this.concernement.id;
|
this.cid = this.concernement.id;
|
||||||
|
console.log('mapitem this.cid', this.cid);
|
||||||
this.active_revision = this.concernement.active_revision;
|
this.active_revision = this.concernement.active_revision;
|
||||||
|
|
||||||
// console.log(`ConcernementsMapItem ${this.id} created`);
|
// console.log(`ConcernementsMapItem ${this.id} created`);
|
||||||
@ -1388,7 +1389,7 @@ export default {
|
|||||||
// wait for routing to be finished before opening the mapItem
|
// wait for routing to be finished before opening the mapItem
|
||||||
await this.$router.push({
|
await this.$router.push({
|
||||||
name: 'concernement',
|
name: 'concernement',
|
||||||
params: {cid: this.cid},
|
params: {cid: parseInt(this.cid)},
|
||||||
query: {
|
query: {
|
||||||
mapitemid: this.id,
|
mapitemid: this.id,
|
||||||
superposition_id: this.mapitem.superposition_ids[0]
|
superposition_id: this.mapitem.superposition_ids[0]
|
||||||
@ -1429,8 +1430,12 @@ export default {
|
|||||||
// we have clicked on an entite
|
// we have clicked on an entite
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: 'concernement',
|
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}`,
|
hash: `#${this.map_mode}`,
|
||||||
params: {id: this.cid, mapitemid: this.id, eid: result.item.item_id}
|
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case "doleancer":
|
case "doleancer":
|
||||||
|
@ -4,7 +4,7 @@ import { mapActions, mapState } from 'pinia'
|
|||||||
import { ConcernementsStore } from '@stores/concernements'
|
import { ConcernementsStore } from '@stores/concernements'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['entite', 'eid'],
|
props: ['concernement', 'entite', 'eid'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
}
|
}
|
||||||
@ -15,7 +15,7 @@ export default {
|
|||||||
'ct_entite']),
|
'ct_entite']),
|
||||||
field_menace_maintien_label (){
|
field_menace_maintien_label (){
|
||||||
let str;
|
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', '')
|
str = this.ct_entite.field_menace_maintien.description.replace('/maintient', '')
|
||||||
} else {
|
} else {
|
||||||
str = this.ct_entite.field_menace_maintien.description.replace('menace/', '')
|
str = this.ct_entite.field_menace_maintien.description.replace('menace/', '')
|
||||||
@ -24,7 +24,7 @@ export default {
|
|||||||
},
|
},
|
||||||
field_sources_label () {
|
field_sources_label () {
|
||||||
let str;
|
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', '')
|
str = this.ct_entite.field_sources.description.replace('/ ce maintient', '')
|
||||||
} else {
|
} else {
|
||||||
str = this.ct_entite.field_sources.description.replace('cette menace /', '')
|
str = this.ct_entite.field_sources.description.replace('cette menace /', '')
|
||||||
|
@ -5,6 +5,12 @@ import { ConcernementsStore } from '@stores/concernements'
|
|||||||
import { UserStore } from '@/stores/user'
|
import { UserStore } from '@/stores/user'
|
||||||
// import { CommonStore } from '@/stores/common'
|
// 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 CartoucheLayout from '@components/layout/CartoucheLayout.vue';
|
||||||
import Entite from '@components/contents/Entite.vue';
|
import Entite from '@components/contents/Entite.vue';
|
||||||
|
|
||||||
@ -16,10 +22,11 @@ import { mdiChevronRight } from '@mdi/js';
|
|||||||
import { mdiChevronDown } from '@mdi/js';
|
import { mdiChevronDown } from '@mdi/js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['cid', 'eid', 'entite'],
|
props: ['cid', 'eid'],
|
||||||
data(){
|
data(){
|
||||||
return {
|
return {
|
||||||
concernement: null,
|
concernement: null,
|
||||||
|
entite: null,
|
||||||
history_value: 0,
|
history_value: 0,
|
||||||
history_slider_ops: null,
|
history_slider_ops: null,
|
||||||
infos_opened: false,
|
infos_opened: false,
|
||||||
@ -53,8 +60,12 @@ export default {
|
|||||||
|
|
||||||
console.log(`terraindevie created, cid: ${this.cid}, eid: ${this.eid}, this.concernement:`, this.concernement);
|
console.log(`terraindevie created, cid: ${this.cid}, eid: ${this.eid}, this.concernement:`, this.concernement);
|
||||||
|
|
||||||
// revisions
|
//entite
|
||||||
|
if (this.eid) {
|
||||||
|
this.loadEntite()
|
||||||
|
}
|
||||||
|
|
||||||
|
// revisions
|
||||||
let data=[];
|
let data=[];
|
||||||
this.concernement.revisions.forEach(rev => {
|
this.concernement.revisions.forEach(rev => {
|
||||||
if (rev.entites.length > 3) {
|
if (rev.entites.length > 3) {
|
||||||
@ -87,12 +98,37 @@ export default {
|
|||||||
this.setActiveRevision(this.concernement.id, n);
|
this.setActiveRevision(this.concernement.id, n);
|
||||||
},
|
},
|
||||||
deep: true
|
deep: true
|
||||||
|
},
|
||||||
|
eid: {
|
||||||
|
handler (n, o) {
|
||||||
|
console.log(`TerrainDeVie watch eid o:${o}, n:${n}`);
|
||||||
|
this.loadEntite()
|
||||||
|
},
|
||||||
|
deep: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(ConcernementsStore, ['setActiveRevision']), // 'loadConcernementsRevisions'
|
...mapActions(ConcernementsStore, ['setActiveRevision']), // 'loadConcernementsRevisions'
|
||||||
onClickInfos(){
|
onClickInfos(){
|
||||||
this.infos_opened = !this.infos_opened;
|
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: {
|
components: {
|
||||||
@ -130,7 +166,7 @@ export default {
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- entite -->
|
<!-- entite -->
|
||||||
<Entite v-if="entite" :entite="entite" :eid="eid"/>
|
<Entite v-if="entite" :concernement="concernement" :entite="entite" :eid="eid"/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-slot:footer>
|
<template v-slot:footer>
|
||||||
|
@ -94,7 +94,7 @@ export const ConcernementsStore = defineStore({
|
|||||||
|
|
||||||
// SUPERPOSITIONS
|
// SUPERPOSITIONS
|
||||||
if (entite.entite.superposition.length) {
|
if (entite.entite.superposition.length) {
|
||||||
concernement.has_superpositions = true;
|
// create properties for later
|
||||||
concernement.superpositions = {};
|
concernement.superpositions = {};
|
||||||
concernement.superposition_constraints_id = {};
|
concernement.superposition_constraints_id = {};
|
||||||
concernement.all_superposed_concernements_id = [];
|
concernement.all_superposed_concernements_id = [];
|
||||||
@ -179,6 +179,8 @@ export const ConcernementsStore = defineStore({
|
|||||||
temp_allSuperpositions.forEach(s => {
|
temp_allSuperpositions.forEach(s => {
|
||||||
if (s[0] && s[0].cid && s[0].eid && s[1] && s[1].cid && s[1].eid) {
|
if (s[0] && s[0].cid && s[0].eid && s[1] && s[1].cid && s[1].eid) {
|
||||||
this.allSuperpositions.push(s);
|
this.allSuperpositions.push(s);
|
||||||
|
this.concernementsByID[s[0].cid].has_superpositions = true;
|
||||||
|
this.concernementsByID[s[1].cid].has_superpositions = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -371,7 +373,7 @@ export const ConcernementsStore = defineStore({
|
|||||||
this.opened_concernement = null;
|
this.opened_concernement = null;
|
||||||
this.openCloseConcernements();
|
this.openCloseConcernements();
|
||||||
},
|
},
|
||||||
setOpenedEntityId(id){
|
setOpenedEntiteId(id){
|
||||||
this.opened_entite_id = id;
|
this.opened_entite_id = id;
|
||||||
},
|
},
|
||||||
setBesoinPaperId(paper_id, cid, bid, rid){
|
setBesoinPaperId(paper_id, cid, bid, rid){
|
||||||
|
@ -17,11 +17,20 @@ import PuissanceAgir from '@components/contents/PuissanceAgir.vue';
|
|||||||
import Doleancer from '@components/contents/Doleancer.vue';
|
import Doleancer from '@components/contents/Doleancer.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
// props: {
|
||||||
|
// cid: {
|
||||||
|
// type: Number
|
||||||
|
// },
|
||||||
|
// eid: {
|
||||||
|
// type: Number
|
||||||
|
// }
|
||||||
|
// },
|
||||||
props: ['cid', 'eid'],
|
props: ['cid', 'eid'],
|
||||||
data(){
|
data(){
|
||||||
return {
|
return {
|
||||||
entite: null,
|
// entite: null,
|
||||||
superposition_id: null,
|
superposition_id: null,
|
||||||
|
superposition: null,
|
||||||
opened_besoin_id: null,
|
opened_besoin_id: null,
|
||||||
arrowup_path: mdiArrowUp
|
arrowup_path: mdiArrowUp
|
||||||
}
|
}
|
||||||
@ -32,31 +41,24 @@ export default {
|
|||||||
'concernements_loaded',
|
'concernements_loaded',
|
||||||
'allSuperpositions_byid']),
|
'allSuperpositions_byid']),
|
||||||
...mapState(CommonStore,['cartouch_width']),
|
...mapState(CommonStore,['cartouch_width']),
|
||||||
// superposition_id () {
|
//
|
||||||
// console.log('superposition_id computed');
|
main_cid_eid () {
|
||||||
// if(this.$route.query.superposition_id){
|
let r = {
|
||||||
// return this.$route.query.superposition_id
|
cid: this.cid,
|
||||||
// } else {
|
eid: null
|
||||||
// return null;
|
};
|
||||||
// }
|
|
||||||
// },
|
if (this.eid) {
|
||||||
superposition () {
|
r.eid = this.eid
|
||||||
console.log('superposition computed', this.superposition_id);
|
} else if (this.map_mode === "superposition" && this.superposition) {
|
||||||
if(this.superposition_id){
|
this.superposition.forEach(s => {
|
||||||
let sid = this.$route.query.superposition_id;
|
// routeview param -> props do not respect type (Number), this.cid should be number
|
||||||
let ids = sid.match(/(\d+)_(\d+)__(\d+)_(\d+)/i)
|
if(s.cid === parseInt(this.cid)){
|
||||||
let couple_key = `${ids[1]}-${ids[3]}`
|
r.eid = s.eid;
|
||||||
console.log('superposition_id', sid, couple_key, ids);
|
}
|
||||||
if (this.allSuperpositions_byid[couple_key][sid]) {
|
});
|
||||||
let s = this.allSuperpositions_byid[couple_key][sid]
|
|
||||||
console.log(s);
|
|
||||||
return s;
|
|
||||||
}else{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
return r;
|
||||||
},
|
},
|
||||||
superposed_cid_eid () {
|
superposed_cid_eid () {
|
||||||
if (this.superposition) {
|
if (this.superposition) {
|
||||||
@ -83,7 +85,18 @@ export default {
|
|||||||
console.log("superposition", this.superposition);
|
console.log("superposition", this.superposition);
|
||||||
|
|
||||||
if(this.map_mode === "superposition" && this.$route.query.superposition_id){
|
if(this.map_mode === "superposition" && this.$route.query.superposition_id){
|
||||||
|
// get superposition_id and superposition object
|
||||||
this.superposition_id = 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
// as we have two content to show multiply the cartouch with by 2
|
// as we have two content to show multiply the cartouch with by 2
|
||||||
// necessary for mapitem opening scale and position
|
// necessary for mapitem opening scale and position
|
||||||
this.setCartoucheWidth(2)
|
this.setCartoucheWidth(2)
|
||||||
@ -95,8 +108,8 @@ export default {
|
|||||||
|
|
||||||
// when we arrived directly to the url, load the entite
|
// when we arrived directly to the url, load the entite
|
||||||
// this.eid provided by route params
|
// this.eid provided by route params
|
||||||
if (!this.entity && this.eid) {
|
if (this.map_mode === "terraindevie" && this.eid) {
|
||||||
this.openEntity();
|
this.openEntite();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -113,10 +126,10 @@ export default {
|
|||||||
eid: {
|
eid: {
|
||||||
handler (n, o){
|
handler (n, o){
|
||||||
if(n){
|
if(n){
|
||||||
this.openEntity()
|
this.openEntite()
|
||||||
}else{
|
}else{
|
||||||
this.entite = false;
|
// this.entite = false;
|
||||||
this.setOpenedEntityId(null);
|
this.setOpenedEntiteId(null);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
deep: true
|
deep: true
|
||||||
@ -124,32 +137,32 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(ConcernementsStore,['openCloseConcernements',
|
...mapActions(ConcernementsStore,['openCloseConcernements',
|
||||||
'setOpenedEntityId',
|
'setOpenedEntiteId',
|
||||||
'setMapMode',
|
'setMapMode',
|
||||||
'resetConcernementOpened']),
|
'resetConcernementOpened']),
|
||||||
...mapActions(CommonStore,['setCartoucheWidth']),
|
...mapActions(CommonStore,['setCartoucheWidth']),
|
||||||
openEntity(){
|
openEntite(){
|
||||||
this.setOpenedEntityId(parseInt(this.eid))
|
this.setOpenedEntiteId(parseInt(this.eid))
|
||||||
this.loadEntite()
|
// this.loadEntite()
|
||||||
},
|
|
||||||
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)
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
// 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(){
|
closeConcernement(){
|
||||||
this.resetConcernementOpened();
|
this.resetConcernementOpened();
|
||||||
}
|
}
|
||||||
@ -166,7 +179,7 @@ export default {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<section v-if="opened_concernement" class="concernement">
|
<section v-if="opened_concernement" class="concernement">
|
||||||
<TerrainDeVie v-if="map_mode === 'terraindevie' || map_mode === 'action'|| map_mode === 'superposition'" :cid="cid" :eid="eid" :entite="entite"/>
|
<TerrainDeVie v-if="map_mode === 'terraindevie' || map_mode === 'action'|| map_mode === 'superposition'" :cid="main_cid_eid.cid" :eid="main_cid_eid.eid"/>
|
||||||
<PuissanceAgir v-if="map_mode === 'puissancedagir'" :id="cid"/>
|
<PuissanceAgir v-if="map_mode === 'puissancedagir'" :id="cid"/>
|
||||||
<Doleancer v-if="map_mode === 'doleancer'" :id="cid"/>
|
<Doleancer v-if="map_mode === 'doleancer'" :id="cid"/>
|
||||||
</section>
|
</section>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user