1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-02-12 17:51:02 +01:00

fix foreign key dropdown with wrong value

This commit is contained in:
Giulio Ganci 2022-04-25 22:27:26 +02:00
parent dfe3728269
commit b0195260c3

View File

@ -6,14 +6,14 @@
@change="onChange" @change="onChange"
@blur="$emit('blur')" @blur="$emit('blur')"
> >
<option v-if="!isValidDefault" :value="value"> <option v-if="!isValidDefault" :value="modelValue">
{{ value === null ? 'NULL' : value }} {{ modelValue === null ? 'NULL' : modelValue }}
</option> </option>
<option <option
v-for="row in foreignList" v-for="row in foreignList"
:key="row.foreign_column" :key="row.foreign_column"
:value="row.foreign_column" :value="row.foreign_column"
:selected="row.foreign_column === value" :selected="row.foreign_column === modelValue"
> >
{{ row.foreign_column }} {{ cutText('foreign_description' in row ? ` - ${row.foreign_description}` : '') }} {{ row.foreign_column }} {{ cutText('foreign_description' in row ? ` - ${row.foreign_description}` : '') }}
</option> </option>
@ -47,7 +47,7 @@ export default {
isValidDefault () { isValidDefault () {
if (!this.foreignList.length) return true; if (!this.foreignList.length) return true;
if (this.modelValue === null) return false; if (this.modelValue === null) return false;
return this.foreignList.some(foreign => foreign.foreign_column.toString() === this.value.toString()); return this.foreignList.some(foreign => foreign.foreign_column.toString() === this.modelValue.toString());
} }
}, },
async created () { async created () {