Select vue file update..
This commit is contained in:
parent
1b244daf71
commit
56d63b1185
@ -533,7 +533,6 @@ export default {
|
|||||||
add_new_html: '',
|
add_new_html: '',
|
||||||
form: {},
|
form: {},
|
||||||
new_options: false,
|
new_options: false,
|
||||||
hide_selected: false,
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -544,6 +543,10 @@ export default {
|
|||||||
mounted() {
|
mounted() {
|
||||||
this.real_model = this.value;
|
this.real_model = this.value;
|
||||||
|
|
||||||
|
if (this.multiple && !this.real_model.length) {
|
||||||
|
this.real_model = [];
|
||||||
|
}
|
||||||
|
|
||||||
this.$emit('interface', this.real_model);
|
this.$emit('interface', this.real_model);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -558,10 +561,6 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async onAddItem() {
|
async onAddItem() {
|
||||||
if (this.multiple) {
|
|
||||||
this.hide_selected = this.real_model;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get Select Input value
|
// Get Select Input value
|
||||||
if (this.title) {
|
if (this.title) {
|
||||||
var value = this.$children[0].$children[0].$children[0].$refs.input.value;
|
var value = this.$children[0].$children[0].$children[0].$refs.input.value;
|
||||||
@ -581,9 +580,6 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
addInline(value) {
|
addInline(value) {
|
||||||
if (this.multiple) {
|
|
||||||
this.hide_selected = false;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onModal(value) {
|
onModal(value) {
|
||||||
@ -679,7 +675,7 @@ export default {
|
|||||||
this.form.loading = false;
|
this.form.loading = false;
|
||||||
|
|
||||||
if (response.data.success) {
|
if (response.data.success) {
|
||||||
if (!this.selectOptions.length) {
|
if (!Object.keys(this.options).length) {
|
||||||
this.selectOptions = {};
|
this.selectOptions = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -697,10 +693,6 @@ export default {
|
|||||||
this.add_new.html = '';
|
this.add_new.html = '';
|
||||||
this.add_new_html = null;
|
this.add_new_html = null;
|
||||||
|
|
||||||
if (this.multiple) {
|
|
||||||
this.hide_selected = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$emit('new', response.data.data);
|
this.$emit('new', response.data.data);
|
||||||
|
|
||||||
this.change();
|
this.change();
|
||||||
@ -732,7 +724,7 @@ export default {
|
|||||||
this.selectOptions = options;
|
this.selectOptions = options;
|
||||||
|
|
||||||
if (Object.keys(this.new_options).length) {
|
if (Object.keys(this.new_options).length) {
|
||||||
if (!this.selectOptions.length) {
|
if (!Object.keys(this.options).length) {
|
||||||
this.selectOptions = {};
|
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) {
|
value: function (value) {
|
||||||
if (this.multiple) {
|
if (this.multiple) {
|
||||||
this.real_model = value;
|
this.real_model = value;
|
||||||
|
@ -584,6 +584,10 @@ export default {
|
|||||||
mounted() {
|
mounted() {
|
||||||
this.real_model = this.value;
|
this.real_model = this.value;
|
||||||
|
|
||||||
|
if (this.multiple && !this.real_model.length) {
|
||||||
|
this.real_model = [];
|
||||||
|
}
|
||||||
|
|
||||||
this.$emit('interface', this.real_model);
|
this.$emit('interface', this.real_model);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -683,6 +687,10 @@ export default {
|
|||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.data.success) {
|
if (response.data.success) {
|
||||||
|
if (!Object.keys(this.options).length) {
|
||||||
|
this.selectOptions = {};
|
||||||
|
}
|
||||||
|
|
||||||
this.selectOptions.push(response.data.data);
|
this.selectOptions.push(response.data.data);
|
||||||
this.new_options[response.data.data[this.add_new.field.key]] = 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];
|
this.real_model = response.data.data[this.add_new.field.key];
|
||||||
@ -800,7 +808,10 @@ export default {
|
|||||||
this.form.loading = false;
|
this.form.loading = false;
|
||||||
|
|
||||||
if (response.data.success) {
|
if (response.data.success) {
|
||||||
|
if (!Object.keys(this.options).length) {
|
||||||
|
this.selectOptions = {};
|
||||||
|
}
|
||||||
|
|
||||||
this.selectOptions.push(response.data.data);
|
this.selectOptions.push(response.data.data);
|
||||||
//this.selectOptions[response.data.data[this.add_new.field.key]] = response.data.data[this.add_new.field.value];
|
//this.selectOptions[response.data.data[this.add_new.field.key]] = response.data.data[this.add_new.field.value];
|
||||||
this.new_options[response.data.data[this.add_new.field.key]] = response.data.data[this.add_new.field.value];
|
this.new_options[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;
|
this.selectOptions = options;
|
||||||
|
|
||||||
if (Object.keys(this.new_options).length) {
|
if (Object.keys(this.new_options).length) {
|
||||||
|
if (!Object.keys(this.options).length) {
|
||||||
|
this.selectOptions = {};
|
||||||
|
}
|
||||||
|
|
||||||
Object.values(this.new_options).forEach(item => {
|
Object.values(this.new_options).forEach(item => {
|
||||||
this.selectOptions.push(item);
|
this.selectOptions.push(item);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user