diff --git a/src/modules/05_placement/components/Receive/AddEmployee/Main.vue b/src/modules/05_placement/components/Receive/AddEmployee/Main.vue index 276996b98..634ac32be 100644 --- a/src/modules/05_placement/components/Receive/AddEmployee/Main.vue +++ b/src/modules/05_placement/components/Receive/AddEmployee/Main.vue @@ -114,12 +114,11 @@ const fetchPerson = async () => { OpsFilter.value.genderOps = optiongenders; let optionprefixs: DataOption[] = []; - data.prefixs.map((r: DataOptioninfo) => { - optionprefixs.push({ - id: r.id.toString(), - name: r.name.toString(), - }); - }); + optionprefixs = data.prefixs.map((v: any) => ({ + id: v.id, + name: v.name, + })); + Ops.value.prefixOps = optionprefixs; OpsFilter.value.prefixOps = optionprefixs; @@ -302,22 +301,22 @@ const onSubmit = async () => { if (informaData.value.lastName != undefined) formData.append("lastName", informaData.value.lastName); if (informaData.value.genderId != undefined) - formData.append("genderId", informaData.value.genderId); + formData.append("gender", informaData.value.genderId); if (informaData.value.nationality != undefined) formData.append("nationality", informaData.value.nationality); if (informaData.value.ethnicity != undefined) formData.append("race", informaData.value.ethnicity); if (informaData.value.religionId != undefined) - formData.append("religionId", informaData.value.religionId); + formData.append("religion", informaData.value.religionId); if (informaData.value.birthDate != undefined) formData.append( "birthDate", dateToISO(informaData.value.birthDate) ?? dateToISO(new Date()) ); if (informaData.value.bloodId != undefined) - formData.append("bloodGroupId", informaData.value.bloodId); + formData.append("bloodGroup", informaData.value.bloodId); if (informaData.value.statusId != undefined) - formData.append("relationshipId", informaData.value.statusId); + formData.append("relationship", informaData.value.statusId); if (informaData.value.tel != undefined) formData.append("telephoneNumber", informaData.value.tel); if (informaData.value.employeeType != undefined) @@ -348,20 +347,6 @@ const clickBack = () => { router.push("/receive"); }; -function fetchPrefix() { - http - .get(config.API.orgPrefix) - .then((res) => { - prefixOps.value = res.data.result.map((v: any) => ({ - id: v.name, - name: v.name, - })); - }) - .catch((err) => { - messageError($q, err); - }); -} - function calculateAge(birthDate: Date | null) { if (!birthDate) return null; const birthDateTimeStamp = new Date(birthDate).getTime(); @@ -394,7 +379,6 @@ watch( onMounted(async () => { await fetchPerson(); - await fetchPrefix(); }); @@ -749,9 +733,9 @@ onMounted(async () => { dense lazy-rules class="inputgreen" - :options="prefixOps" + :options="Ops.prefixOps" option-label="name" - option-value="id" + option-value="name" map-options hide-bottom-space :rules="[ @@ -857,7 +841,7 @@ onMounted(async () => { hide-bottom-space input-debounce="0" option-label="name" - option-value="id" + option-value="name" v-model="informaData.genderId" class="inputgreen" :options="Ops.genderOps" @@ -877,7 +861,7 @@ onMounted(async () => { emit-value map-options hide-bottom-space - option-value="id" + option-value="name" option-label="name" input-debounce="0" class="inputgreen" @@ -921,7 +905,7 @@ onMounted(async () => { emit-value map-options hide-bottom-space - option-value="id" + option-value="name" option-label="name" input-debounce="0" v-model="informaData.religionId" @@ -943,7 +927,7 @@ onMounted(async () => { emit-value map-options hide-bottom-space - option-value="id" + option-value="name" option-label="name" input-debounce="0" v-model="informaData.bloodId" diff --git a/src/modules/05_placement/components/Receive/receiveDetail2.vue b/src/modules/05_placement/components/Receive/receiveDetail2.vue index 92a2b8d55..92f2fe93f 100644 --- a/src/modules/05_placement/components/Receive/receiveDetail2.vue +++ b/src/modules/05_placement/components/Receive/receiveDetail2.vue @@ -41,8 +41,8 @@ const { dialogConfirm, } = mixin; -const profileStore = useProfileDataStore(); -const { changeRetireText } = profileStore; +// const profileStore = useProfileDataStore(); +// const { changeRetireText } = profileStore; const title = ref({ fullname: "", @@ -132,10 +132,11 @@ const OpsFilter = ref({ ], }); +/*** get รายการข้อมูลเกี่ยวกับบุคคล (dropdown list) */ const fetchPerson = async () => { showLoader(); await http - .get(config.API.person) + .get(config.API.profileNewMetaMain) .then((res) => { const data = res.data.result; let optionbloodGroups: DataOption[] = []; @@ -159,12 +160,11 @@ const fetchPerson = async () => { OpsFilter.value.genderOps = optiongenders; let optionprefixs: DataOption[] = []; - data.prefixs.map((r: DataOptioninfo) => { - optionprefixs.push({ - id: r.id.toString(), - name: r.name.toString(), - }); - }); + optionprefixs = data.prefixs.map((v: any) => ({ + id: v.id, + name: v.name, + })); + Ops.value.prefixOps = optionprefixs; OpsFilter.value.prefixOps = optionprefixs; @@ -189,7 +189,9 @@ const fetchPerson = async () => { OpsFilter.value.religionOps = optionreligions; }) .catch((e: any) => {}) - .finally(() => {}); + .finally(() => { + hideLoader(); + }); }; const getData = async () => { @@ -391,14 +393,14 @@ const calRetire = async (birth: Date) => { .then((res: any) => { const data = res.data.result; informaData.value.age = data.age; - changeRetireText(data.retireDate); + // changeRetireText(data.retireDate); dateBefore.value = birth; }) .catch((e: any) => { messageError($q, e); const retire = new Date(`${birth.getFullYear() + 60}-09-30`); informaData.value.birthDate = dateBefore.value; - changeRetireText(date2Thai(retire)); + // changeRetireText(date2Thai(retire)); }) .finally(() => { hideLoader(); @@ -419,12 +421,12 @@ function saveData() { informaData.value.birthDate !== null ? dateToISO(informaData.value.birthDate) : null, - genderId: informaData.value.genderId, + gender: informaData.value.genderId, nationality: informaData.value.nationality, race: informaData.value.ethnicity, - religionId: informaData.value.religionId, - bloodGroupId: informaData.value.bloodId, - relationshipId: informaData.value.statusId, + religion: informaData.value.religionId, + bloodGroup: informaData.value.bloodId, + relationship: informaData.value.statusId, telephoneNumber: informaData.value.tel, reason: reason.value, educationOld: educationOld.value, @@ -564,7 +566,7 @@ onMounted(async () => { map-options option-label="name" :options="Ops.prefixOps" - option-value="id" + option-value="name" :label="`${'คำนำหน้าชื่อ'}`" use-input input-debounce="0" @@ -673,7 +675,7 @@ onMounted(async () => { map-options option-label="name" :options="Ops.genderOps" - option-value="id" + option-value="name" :label="`${'เพศ'}`" use-input input-debounce="0" @@ -695,7 +697,7 @@ onMounted(async () => { map-options option-label="name" :options="Ops.statusOps" - option-value="id" + option-value="name" :label="`${'สถานภาพ'}`" use-input input-debounce="0" @@ -743,7 +745,7 @@ onMounted(async () => { map-options option-label="name" :options="Ops.religionOps" - option-value="id" + option-value="name" :label="`${'ศาสนา'}`" use-input input-debounce="0" @@ -767,7 +769,7 @@ onMounted(async () => { map-options option-label="name" :options="Ops.bloodOps" - option-value="id" + option-value="name" :label="`${'หมู่เลือด'}`" use-input input-debounce="0"