Skip to content
Snippets Groups Projects
Commit 1e6a2824 authored by leandro's avatar leandro
Browse files

update import geojson

parent b590acbe
No related branches found
No related tags found
No related merge requests found
......@@ -217,5 +217,15 @@ export default {
this.$store.commit("feature_type/UPDATE_COLOR_STYLE");
},
},
beforeDestroy(){
this.$store.commit("feature_type/EMPTY_CUSTOM_FORM");
},
mounted() {
for (let el in this.customForm) {
if (el && this.form[el]) this.form[el].value = this.customForm[el].value;
}
},
};
</script>
......@@ -47,6 +47,9 @@ const feature_type = {
feature_types: [],
},
mutations: {
EMPTY_CUSTOM_FORM(state) {
state.customForms = [];
},
SET_FEATURE_TYPES(state, feature_types) {
state.feature_types = feature_types;
},
......@@ -56,8 +59,8 @@ const feature_type = {
UPDATE_FORM(state, payload) {
state.form = payload;
},
ADD_CUSTOM_FORM(state, dataKey) {
state.customForms = [...state.customForms, { dataKey }];
ADD_CUSTOM_FORM(state, customForm) {
state.customForms = [...state.customForms, customForm ];
},
UPDATE_CUSTOM_FORM(state, payload) {
const index = state.customForms.findIndex((el) => el.dataKey === payload.dataKey);
......
......@@ -198,7 +198,7 @@ export default {
},
addCustomForm() {
this.dataKey += 1; // * increment counter for key in v-for
this.$store.commit("feature_type/ADD_CUSTOM_FORM", this.dataKey); // * create an object with the counter in store
this.$store.commit("feature_type/ADD_CUSTOM_FORM", {dataKey: this.dataKey}); // * create an object with the counter in store
},
iniateColorsStyleFields() {
const selected = this.colorsStyleList.find(
......
......@@ -543,7 +543,7 @@ export default {
for (const [key, value] of Object.entries(this.jsonDict['features'])) {
console.log('key', key)
this.form.title.value = value['properties']['feature_type']
this.form.geom_type.value= this.toFormatGeom(value['geometry']['type'])
this.form.geom_type.value = this.toFormatGeom(value['geometry']['type'])
// TODO : FILL A ARRAY CUSTOMFORM -> VOIR AVEC TIM
let customForm = {
......@@ -553,15 +553,9 @@ export default {
}
// FOR
for (const [k, val] of Object.entries(value['properties'])) {
// console.log('k', k)
// console.log('val', val)
// console.log('customForm label', customForm['label'])
if (k=='title'){
console.log('title', val)
customForm['label']['value'] = val
customForm['name']['value'] = val
console.log(customForm)
}
if (! this.isLabelProperties(k)){
customForm['field_type']['value'] = val
......@@ -569,17 +563,15 @@ export default {
}
//ENDFOR
}
console.log(customForm)
this.customForms.push(customForm)
console.log(this.customForms)
this.addCustomForm(customForm);
}
// GO TO NEW FORM
this.toNewFeatureType()
}
},
addCustomForm(customForm) {
this.$store.commit("feature_type/ADD_CUSTOM_FORM", customForm); // * create an object with the counter in store
},
onFileChange(e) {
var files = e.target.files || e.dataTransfer.files;
if (!files.length)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment