refs #1511 multi_select_remote_group fixes
This commit is contained in:
parent
a96d6f22bc
commit
fc97798d0b
@ -480,14 +480,14 @@ export default {
|
|||||||
},
|
},
|
||||||
value: {
|
value: {
|
||||||
type: [String, Number, Array],
|
type: [String, Number, Array],
|
||||||
default: null,
|
default: '',
|
||||||
description: "Selectbox selected value"
|
description: "Selectbox selected value"
|
||||||
},
|
},
|
||||||
options: null,
|
options: null,
|
||||||
|
|
||||||
model: {
|
model: {
|
||||||
type: [String, Number],
|
type: [String, Number],
|
||||||
default: '',
|
default: null,
|
||||||
description: "Selectbox selected model"
|
description: "Selectbox selected model"
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -598,10 +598,22 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.real_model = this.value;
|
|
||||||
|
|
||||||
if (this.multiple && !this.real_model.length) {
|
if (this.multiple) {
|
||||||
|
if (!this.value.length) {
|
||||||
this.real_model = [];
|
this.real_model = [];
|
||||||
|
} else {
|
||||||
|
let pre_value = [];
|
||||||
|
|
||||||
|
this.value.forEach(item => {
|
||||||
|
pre_value.push(item.toString());
|
||||||
|
});
|
||||||
|
|
||||||
|
this.real_model = pre_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this.real_model = this.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$emit('interface', this.real_model);
|
this.$emit('interface', this.real_model);
|
||||||
@ -650,13 +662,18 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
change() {
|
change() {
|
||||||
if (typeof(this.real_model) === 'object') {
|
if (typeof(this.real_model) === 'object' && !Array.isArray(this.real_model)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Array.isArray(this.real_model) && !this.real_model.length) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$emit('interface', this.real_model);
|
this.$emit('interface', this.real_model);
|
||||||
this.$emit('change', this.real_model);
|
this.$emit('change', this.real_model);
|
||||||
|
|
||||||
|
if (Array.isArray(this.selectOptions)) {
|
||||||
this.selectOptions.forEach(item => {
|
this.selectOptions.forEach(item => {
|
||||||
if (item.id == this.real_model) {
|
if (item.id == this.real_model) {
|
||||||
this.$emit('label', item.name);
|
this.$emit('label', item.name);
|
||||||
@ -665,6 +682,7 @@ export default {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onPressEnter() {
|
onPressEnter() {
|
||||||
@ -887,9 +905,37 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
real_model: function (value) {
|
||||||
|
if (this.multiple) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.real_model != value) {
|
||||||
|
this.change();
|
||||||
|
}
|
||||||
|
|
||||||
|
let e = $.Event('keyup');
|
||||||
|
e.keyCode= 9; // tab
|
||||||
|
$('#' + this.name).trigger(e);
|
||||||
|
|
||||||
|
let event = new window.KeyboardEvent('keydown', { keyCode: 9 }); // Tab key
|
||||||
|
|
||||||
|
window.dispatchEvent(event);
|
||||||
|
},
|
||||||
|
|
||||||
value: function (value) {
|
value: function (value) {
|
||||||
if (this.multiple) {
|
if (this.multiple) {
|
||||||
|
if (Array.isArray(this.real_model) && !this.real_model.length) {
|
||||||
this.real_model = value;
|
this.real_model = value;
|
||||||
|
} else {
|
||||||
|
let pre_value = [];
|
||||||
|
|
||||||
|
value.forEach(item => {
|
||||||
|
pre_value.push(item.toString());
|
||||||
|
});
|
||||||
|
|
||||||
|
this.real_model = pre_value;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
//this.real_model = value.toString();
|
//this.real_model = value.toString();
|
||||||
this.real_model = value;
|
this.real_model = value;
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
name="{{ $name }}"
|
name="{{ $name }}"
|
||||||
:options="{{ json_encode($values) }}"
|
:options="{{ json_encode($values) }}"
|
||||||
|
|
||||||
@if (isset($selected) || old($name))
|
@if (!empty($selected) || old($name))
|
||||||
:value="{{ json_encode(old($name, $selected)) }}"
|
:value="{{ json_encode(old($name, $selected)) }}"
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@ -62,7 +62,7 @@
|
|||||||
@endif
|
@endif
|
||||||
|
|
||||||
remote-action="{{ $attributes['remote_action'] }}"
|
remote-action="{{ $attributes['remote_action'] }}"
|
||||||
remote-type="'{{ $attributes['remote_type'] }}"
|
remote-type="{{ $attributes['remote_type'] }}"
|
||||||
|
|
||||||
@if (!empty($attributes['currecny_code']))
|
@if (!empty($attributes['currecny_code']))
|
||||||
currency-code="{{ $attributes['currecny_code'] }}"
|
currency-code="{{ $attributes['currecny_code'] }}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user