Select vue file update..

This commit is contained in:
Cüneyt Şentürk 2020-03-13 18:08:49 +03:00
parent 1b244daf71
commit 56d63b1185
2 changed files with 22 additions and 21 deletions

View File

@ -533,7 +533,6 @@ export default {
add_new_html: '',
form: {},
new_options: false,
hide_selected: false,
}
},
@ -544,6 +543,10 @@ export default {
mounted() {
this.real_model = this.value;
if (this.multiple && !this.real_model.length) {
this.real_model = [];
}
this.$emit('interface', this.real_model);
},
@ -558,10 +561,6 @@ export default {
},
async onAddItem() {
if (this.multiple) {
this.hide_selected = this.real_model;
}
// Get Select Input value
if (this.title) {
var value = this.$children[0].$children[0].$children[0].$refs.input.value;
@ -581,9 +580,6 @@ export default {
},
addInline(value) {
if (this.multiple) {
this.hide_selected = false;
}
},
onModal(value) {
@ -679,7 +675,7 @@ export default {
this.form.loading = false;
if (response.data.success) {
if (!this.selectOptions.length) {
if (!Object.keys(this.options).length) {
this.selectOptions = {};
}
@ -697,10 +693,6 @@ export default {
this.add_new.html = '';
this.add_new_html = null;
if (this.multiple) {
this.hide_selected = false;
}
this.$emit('new', response.data.data);
this.change();
@ -732,7 +724,7 @@ export default {
this.selectOptions = options;
if (Object.keys(this.new_options).length) {
if (!this.selectOptions.length) {
if (!Object.keys(this.options).length) {
this.selectOptions = {};
}
@ -744,12 +736,6 @@ export default {
}
},
real_model: function (value) {
if (this.multiple && this.hide_selected) {
this.real_model = this.hide_selected;
}
},
value: function (value) {
if (this.multiple) {
this.real_model = value;

View File

@ -584,6 +584,10 @@ export default {
mounted() {
this.real_model = this.value;
if (this.multiple && !this.real_model.length) {
this.real_model = [];
}
this.$emit('interface', this.real_model);
},
@ -683,6 +687,10 @@ export default {
})
.then(response => {
if (response.data.success) {
if (!Object.keys(this.options).length) {
this.selectOptions = {};
}
this.selectOptions.push(response.data.data);
this.new_options[response.data.data[this.add_new.field.key]] = response.data.data;
this.real_model = response.data.data[this.add_new.field.key];
@ -800,6 +808,9 @@ export default {
this.form.loading = false;
if (response.data.success) {
if (!Object.keys(this.options).length) {
this.selectOptions = {};
}
this.selectOptions.push(response.data.data);
//this.selectOptions[response.data.data[this.add_new.field.key]] = response.data.data[this.add_new.field.value];
@ -842,6 +853,10 @@ export default {
this.selectOptions = options;
if (Object.keys(this.new_options).length) {
if (!Object.keys(this.options).length) {
this.selectOptions = {};
}
Object.values(this.new_options).forEach(item => {
this.selectOptions.push(item);
});