Skip to content
Snippets Groups Projects
Commit 025b816a authored by Timothee P's avatar Timothee P :sunflower:
Browse files

fix search feature to link

parent ddd45053
No related branches found
No related tags found
1 merge request!573REDMINE_ISSUE-17147 | Page édition signalement - recherche signalement pour liaison ne renvoie rien
...@@ -135,9 +135,9 @@ export default { ...@@ -135,9 +135,9 @@ export default {
this.$store.commit('feature/REMOVE_LINKED_FORM', this.linkedForm.dataKey); this.$store.commit('feature/REMOVE_LINKED_FORM', this.linkedForm.dataKey);
}, },
selectFeatureTo(feature) { selectFeatureTo(featureId) {
if (feature && feature.feature_id) { if (featureId) {
this.form.feature_to.value = feature.feature_id; this.form.feature_to.value = featureId;
this.updateStore(); this.updateStore();
} }
}, },
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div> <div>
<Multiselect <Multiselect
v-model="selection" v-model="selection"
:options="results" :options="options"
:options-limit="10" :options-limit="10"
:allow-empty="true" :allow-empty="true"
track-by="feature_id" track-by="feature_id"
...@@ -75,7 +75,16 @@ export default { ...@@ -75,7 +75,16 @@ export default {
computed: { computed: {
...mapState('feature', [ ...mapState('feature', [
'features' 'features'
]) ]),
options() {
return this.results.map((el) => {
return {
featureId: el.id,
title: el.properties.title
};
});
},
}, },
watch: { watch: {
...@@ -121,10 +130,11 @@ export default { ...@@ -121,10 +130,11 @@ export default {
this.text = text; this.text = text;
}, },
select(e) { select(e) {
this.$emit('select', e); this.$emit('select', e.featureId);
}, },
close() { close() { // close calls as well selectFeatureTo, in case user didn't select a value
this.$emit('close', this.selection); this.$emit('close', this.selection && this.selection.featureId ?
this.selection.featureId : this.selection);
} }
} }
}; };
......
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