feat(profile/salary): select input auto insert value on blur
This commit is contained in:
parent
be436de708
commit
4a554fa225
1 changed files with 25 additions and 2 deletions
|
|
@ -281,7 +281,9 @@
|
|||
map-options
|
||||
option-label="name"
|
||||
:options="opLevel"
|
||||
@input-value="inputPositionLevel"
|
||||
@new-value="createValue"
|
||||
@blur.stop="inputPositionLevelBlur"
|
||||
option-value="name"
|
||||
hide-bottom-space
|
||||
use-input
|
||||
|
|
@ -1268,6 +1270,27 @@ const formDataSalary = reactive<FormSalaryNew>({
|
|||
doc: "",
|
||||
});
|
||||
|
||||
const tempPositionLevelInput = ref("");
|
||||
|
||||
function inputPositionLevel(v: string) {
|
||||
if (!!v) tempPositionLevelInput.value = v;
|
||||
}
|
||||
|
||||
function inputPositionLevelBlur() {
|
||||
if (tempPositionLevelInput.value === formDataSalary.levelPosition) return;
|
||||
|
||||
if (
|
||||
!optionStore.optipnLevel.some(
|
||||
(v) => v.name === tempPositionLevelInput.value
|
||||
)
|
||||
) {
|
||||
createValue(tempPositionLevelInput.value);
|
||||
}
|
||||
|
||||
formDataSalary.levelPosition = tempPositionLevelInput.value;
|
||||
tempPositionLevelInput.value = "";
|
||||
}
|
||||
|
||||
const opPos = ref<any>([]);
|
||||
const opType = ref<any>([]);
|
||||
const opLevel = ref<any>([]);
|
||||
|
|
@ -2115,7 +2138,7 @@ function coppyForm() {
|
|||
formDataSalary.doc = formDataSalary.doc;
|
||||
}
|
||||
|
||||
function createValue(val: any, done: any) {
|
||||
function createValue(val: any, done?: any) {
|
||||
if (val.length > 0) {
|
||||
const maxId = optionStore.optipnLevel.reduce((max: any, item: any) => {
|
||||
const itemId = typeof item.id === "number" ? item.id : parseInt(item.id);
|
||||
|
|
@ -2130,7 +2153,7 @@ function createValue(val: any, done: any) {
|
|||
optionStore.optipnLevel.push(newObj);
|
||||
}
|
||||
|
||||
done(newObj, "toggle");
|
||||
done?.(newObj, "toggle");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue