หากไม่มี ตัวเลือกให้กรอกเอง
This commit is contained in:
parent
a24354c063
commit
16f0cb273f
1 changed files with 21 additions and 1 deletions
|
|
@ -274,13 +274,14 @@
|
||||||
:readonly="!edit"
|
:readonly="!edit"
|
||||||
:borderless="!edit"
|
:borderless="!edit"
|
||||||
v-model="formDataSalary.levelPosition"
|
v-model="formDataSalary.levelPosition"
|
||||||
:rules="[(val: string) => !!val || `${'กรุณาเลือกระดับ'}`]"
|
:rules="[(val: string) => !!val || `${'กรุณาเลือกระดับ หรือหากกรอกเอง กรุณากด enter'}`]"
|
||||||
:label="`${'ระดับ'}`"
|
:label="`${'ระดับ'}`"
|
||||||
@update:modelValue="clickEditRow"
|
@update:modelValue="clickEditRow"
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
option-label="name"
|
option-label="name"
|
||||||
:options="opLevel"
|
:options="opLevel"
|
||||||
|
@new-value="createValue"
|
||||||
option-value="name"
|
option-value="name"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
use-input
|
use-input
|
||||||
|
|
@ -2113,6 +2114,25 @@ function coppyForm() {
|
||||||
formDataSalary.templateDoc = formDataSalary.templateDoc;
|
formDataSalary.templateDoc = formDataSalary.templateDoc;
|
||||||
formDataSalary.doc = formDataSalary.doc;
|
formDataSalary.doc = formDataSalary.doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
return itemId > max ? itemId : max;
|
||||||
|
}, 0);
|
||||||
|
const newId = isNaN(maxId) ? 1 : maxId + 1;
|
||||||
|
const newObj = {
|
||||||
|
id: typeof val === "number" ? val : newId,
|
||||||
|
name: val,
|
||||||
|
};
|
||||||
|
if (!optionStore.optipnLevel.some((item: any) => item.id === newObj.id)) {
|
||||||
|
optionStore.optipnLevel.push(newObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
done(newObj, "toggle");
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.modalfix {
|
.modalfix {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue