|
@@ -162,9 +162,11 @@ export default {
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
...mapActions(CommonStore,['setHoverElmt']),
|
|
...mapActions(CommonStore,['setHoverElmt']),
|
|
- ...mapActions(ConcernementsStore,['openCloseConcernements']),
|
|
|
|
- ...mapActions(ConcernementsStore,['hideShowConcernement']),
|
|
|
|
- ...mapActions(ConcernementsStore,['setBesoinPaperId']),
|
|
|
|
|
|
+ ...mapActions(ConcernementsStore,['openCloseConcernements',
|
|
|
|
+ 'hideShowConcernement',
|
|
|
|
+ 'setBesoinPaperId',
|
|
|
|
+ 'setOpenedDoleanceField']),
|
|
|
|
+
|
|
// getResponsiveRay(){
|
|
// getResponsiveRay(){
|
|
// return Math.min(this.canvas.width, this.canvas.height) * 0.08;
|
|
// return Math.min(this.canvas.width, this.canvas.height) * 0.08;
|
|
// },
|
|
// },
|
|
@@ -450,7 +452,14 @@ export default {
|
|
if (this.concernement.has_doleance) {
|
|
if (this.concernement.has_doleance) {
|
|
this.addNewPaperSymbolInstance('doleance_bg');
|
|
this.addNewPaperSymbolInstance('doleance_bg');
|
|
this.addNewPaperSymbolInstance('doleance_icon');
|
|
this.addNewPaperSymbolInstance('doleance_icon');
|
|
- this.paper_main_object.addChild(this.setPaperDoleanceSteps());
|
|
|
|
|
|
+ let g = new paper.Group({
|
|
|
|
+ pivot: new paper.Point({x:0,y:0}),
|
|
|
|
+ name: `doleances`
|
|
|
|
+ });
|
|
|
|
+ this.concernement.doleances.forEach((d) => {
|
|
|
|
+ g.addChild(this.setPaperDoleanceSteps(d))
|
|
|
|
+ });
|
|
|
|
+ this.paper_main_object.addChild(g);
|
|
}
|
|
}
|
|
// console.log(`initPaperObjects ${this.id}`, this.paper_main_object);
|
|
// console.log(`initPaperObjects ${this.id}`, this.paper_main_object);
|
|
|
|
|
|
@@ -635,12 +644,13 @@ export default {
|
|
|
|
|
|
return g;
|
|
return g;
|
|
},
|
|
},
|
|
- setPaperDoleanceSteps(){
|
|
|
|
|
|
+ setPaperDoleanceSteps(doleance){
|
|
let g = new paper.Group({
|
|
let g = new paper.Group({
|
|
pivot: new paper.Point({x:0,y:0}),
|
|
pivot: new paper.Point({x:0,y:0}),
|
|
- name: 'doleance_steps'
|
|
|
|
|
|
+ name: `doleance_${doleance.id}`,
|
|
|
|
+ doleance_id: doleance.id
|
|
});
|
|
});
|
|
- let doleance = this.concernement.doleances[0];
|
|
|
|
|
|
+ // let doleance = this.concernement.doleances[0];
|
|
let all_fields = [
|
|
let all_fields = [
|
|
[
|
|
[
|
|
'leprobleme',
|
|
'leprobleme',
|
|
@@ -717,8 +727,7 @@ export default {
|
|
|
|
|
|
// let fontsize = 4;
|
|
// let fontsize = 4;
|
|
|
|
|
|
- // //
|
|
|
|
- // // POINTS CARDINAUX
|
|
|
|
|
|
+ // TODO POINTS CARDINAUX
|
|
// //
|
|
// //
|
|
// // le problème
|
|
// // le problème
|
|
// //
|
|
// //
|
|
@@ -760,7 +769,10 @@ export default {
|
|
strokeWidth: 2,
|
|
strokeWidth: 2,
|
|
fillColor: "rgba(255, 255, 255, 0.4)",
|
|
fillColor: "rgba(255, 255, 255, 0.4)",
|
|
item_type: 'doleance_step',
|
|
item_type: 'doleance_step',
|
|
- item_id: 'lenquete'
|
|
|
|
|
|
+ item_id: `lenquete`,
|
|
|
|
+ did: doleance.id,
|
|
|
|
+ field: 'lenquete',
|
|
|
|
+ field_index: null
|
|
});
|
|
});
|
|
cam.add({x: this.pos.x , y: this.pos.y + dr});
|
|
cam.add({x: this.pos.x , y: this.pos.y + dr});
|
|
cam.lineTo({x: this.pos.x, y: this.pos.y + r});
|
|
cam.lineTo({x: this.pos.x, y: this.pos.y + r});
|
|
@@ -791,7 +803,10 @@ export default {
|
|
fillColor: "rgba(255, 255, 255, 0.4)",
|
|
fillColor: "rgba(255, 255, 255, 0.4)",
|
|
closed: true,
|
|
closed: true,
|
|
item_type: 'doleance_step',
|
|
item_type: 'doleance_step',
|
|
- item_id: 'probleme_initial_resolu',
|
|
|
|
|
|
+ item_id: `probleme_initial_resolu`,
|
|
|
|
+ did: doleance.id,
|
|
|
|
+ field: 'probleme_initial_resolu',
|
|
|
|
+ field_index: null
|
|
});
|
|
});
|
|
rescam.add({x: this.pos.x + n, y: this.pos.y + n});
|
|
rescam.add({x: this.pos.x + n, y: this.pos.y + n});
|
|
rescam.lineTo({x: this.pos.x + m , y: this.pos.y + m});
|
|
rescam.lineTo({x: this.pos.x + m , y: this.pos.y + m});
|
|
@@ -850,7 +865,9 @@ export default {
|
|
fillColor: "rgba(255, 255, 255, 0.4)",
|
|
fillColor: "rgba(255, 255, 255, 0.4)",
|
|
item_type: 'doleance_step',
|
|
item_type: 'doleance_step',
|
|
item_id: `${mf.field_name}-${i}`,
|
|
item_id: `${mf.field_name}-${i}`,
|
|
- item_field: mf.field_name
|
|
|
|
|
|
+ did: doleance.id,
|
|
|
|
+ field: mf.field_name,
|
|
|
|
+ field_index: i
|
|
});
|
|
});
|
|
p.add([x1,y1]);
|
|
p.add([x1,y1]);
|
|
p.lineTo([x2,y2]);
|
|
p.lineTo([x2,y2]);
|
|
@@ -978,14 +995,18 @@ export default {
|
|
if (this.map_mode === "doleancer") {
|
|
if (this.map_mode === "doleancer") {
|
|
if (!this.is_opened) {
|
|
if (!this.is_opened) {
|
|
this.paper_main_object.children.doleance_icon.visible = true;
|
|
this.paper_main_object.children.doleance_icon.visible = true;
|
|
- this.paper_main_object.children.doleance_steps.visible = false;
|
|
|
|
|
|
+ this.paper_main_object.children.doleances.visible = false;
|
|
} else {
|
|
} else {
|
|
this.paper_main_object.children.doleance_icon.visible = false;
|
|
this.paper_main_object.children.doleance_icon.visible = false;
|
|
- this.paper_main_object.children.doleance_steps.visible = true;
|
|
|
|
|
|
+ this.paper_main_object.children.doleances.visible = true;
|
|
|
|
+ // display the right (opened) doleance
|
|
|
|
+ this.concernement.doleances.forEach((d) => {
|
|
|
|
+ this.paper_main_object.children.doleances.children[`doleance_${d.id}`].visible = d.id === this.concernement.opened_doleance;
|
|
|
|
+ })
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
this.paper_main_object.children.doleance_icon.visible = false;
|
|
this.paper_main_object.children.doleance_icon.visible = false;
|
|
- this.paper_main_object.children.doleance_steps.visible = false;
|
|
|
|
|
|
+ this.paper_main_object.children.doleances.visible = false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1019,20 +1040,20 @@ export default {
|
|
let paper_group_tohit;
|
|
let paper_group_tohit;
|
|
switch (this.map_mode) {
|
|
switch (this.map_mode) {
|
|
case "terraindevie":
|
|
case "terraindevie":
|
|
- paper_group_tohit = 'entites';
|
|
|
|
|
|
+ paper_group_tohit = this.paper_main_object.children['entites'];
|
|
break;
|
|
break;
|
|
case "action":
|
|
case "action":
|
|
- paper_group_tohit = 'agissantes';
|
|
|
|
|
|
+ paper_group_tohit = this.paper_main_object.children['agissantes'];
|
|
break;
|
|
break;
|
|
case "puissancedagir":
|
|
case "puissancedagir":
|
|
- paper_group_tohit = 'puissanceagir_besoins';
|
|
|
|
|
|
+ paper_group_tohit = this.paper_main_object.children['puissanceagir_besoins'];
|
|
break;
|
|
break;
|
|
case "doleancer":
|
|
case "doleancer":
|
|
- paper_group_tohit = 'doleance_steps';
|
|
|
|
|
|
+ paper_group_tohit = this.paper_main_object.children['doleances'].children[`doleance_${this.concernement.opened_doleance}`];
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
- let result = this.paper_main_object.children[paper_group_tohit].hitTest(event.point);
|
|
|
|
|
|
+ let result = paper_group_tohit.hitTest(event.point);
|
|
// console.log('move result', result);
|
|
// console.log('move result', result);
|
|
if (result && result.item.item_id) {
|
|
if (result && result.item.item_id) {
|
|
// console.log('move has result', result);
|
|
// console.log('move has result', result);
|
|
@@ -1066,8 +1087,8 @@ export default {
|
|
|
|
|
|
this.paper_main_object.onClick = function(event){
|
|
this.paper_main_object.onClick = function(event){
|
|
console.log('paper concernement onClick');
|
|
console.log('paper concernement onClick');
|
|
- if (!this.is_opened) {
|
|
|
|
- if (!this.opened_concernement) {
|
|
|
|
|
|
+ if (!this.is_opened) { // si ce concernement n'est pas ouvet
|
|
|
|
+ if (!this.opened_concernement) { // si aucun concernement n'est ouvert
|
|
console.log(`Open me ${this.id}`);
|
|
console.log(`Open me ${this.id}`);
|
|
// open/close all concernements
|
|
// open/close all concernements
|
|
this.openCloseConcernements(this.id)
|
|
this.openCloseConcernements(this.id)
|
|
@@ -1080,32 +1101,39 @@ export default {
|
|
// reset the mousehover
|
|
// reset the mousehover
|
|
this.resetHoverElmt();
|
|
this.resetHoverElmt();
|
|
}
|
|
}
|
|
- } else {
|
|
|
|
|
|
+ } else { // si ce concernement est ouvert
|
|
// lets define some options regarding the map_mode
|
|
// lets define some options regarding the map_mode
|
|
- // debugger;
|
|
|
|
- let op = {pg: null};
|
|
|
|
|
|
+ let group_to_hit = null;
|
|
switch (this.map_mode) {
|
|
switch (this.map_mode) {
|
|
case "terraindevie":
|
|
case "terraindevie":
|
|
- op = {
|
|
|
|
- pg: 'entites', // paper group to hittest
|
|
|
|
- }
|
|
|
|
|
|
+ group_to_hit = this.paper_main_object.children['entites'];
|
|
break;
|
|
break;
|
|
case "action":
|
|
case "action":
|
|
- op = {
|
|
|
|
- pg: 'agissantes', // paper group to hittest
|
|
|
|
- }
|
|
|
|
|
|
+ group_to_hit = this.paper_main_object.children['agissantes'];
|
|
|
|
+ break;
|
|
|
|
+ case "doleancer":
|
|
|
|
+ group_to_hit = this.paper_main_object.children['doleances'].children[`doleance_${this.concernement.opened_doleance}`];
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
- if (op.pg) {
|
|
|
|
- let result = this.paper_main_object.children[op.pg].hitTest(event.point);
|
|
|
|
- // console.log('click result', result);
|
|
|
|
|
|
+ if (group_to_hit) {
|
|
|
|
+ let result = group_to_hit.hitTest(event.point);
|
|
|
|
+ console.log('click result', result);
|
|
if (result) {
|
|
if (result) {
|
|
- // we have clicked on an entite
|
|
|
|
- this.$router.push({
|
|
|
|
- name: 'concernement',
|
|
|
|
- hash: `#${this.map_mode}`,
|
|
|
|
- params: {id: this.opened_concernement.id, eid: result.item.item_id}
|
|
|
|
- });
|
|
|
|
|
|
+ switch (this.map_mode) {
|
|
|
|
+ case "terraindevie":
|
|
|
|
+ case "action":
|
|
|
|
+ // we have clicked on an entite
|
|
|
|
+ this.$router.push({
|
|
|
|
+ name: 'concernement',
|
|
|
|
+ hash: `#${this.map_mode}`,
|
|
|
|
+ params: {id: this.id, eid: result.item.item_id}
|
|
|
|
+ });
|
|
|
|
+ break;
|
|
|
|
+ case "doleancer":
|
|
|
|
+ this.setOpenedDoleanceField(this.id, result.item.did, result.item.field, result.item.field_index);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+
|
|
} else {
|
|
} else {
|
|
// otherwise we close the entite and come back to the concernement
|
|
// otherwise we close the entite and come back to the concernement
|
|
this.$router.push({
|
|
this.$router.push({
|