บรรจุ ทดลองงาน
This commit is contained in:
parent
a8fdca1138
commit
4cfcc2d018
21 changed files with 113 additions and 199 deletions
|
|
@ -1,7 +1,7 @@
|
|||
<script setup lang="ts">
|
||||
import { watch, reactive, type PropType, ref } from "vue";
|
||||
import { useQuasar } from "quasar";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { useRoute } from "vue-router";
|
||||
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
|
@ -20,8 +20,6 @@ import type {
|
|||
Family,
|
||||
AddressData,
|
||||
AddressOps,
|
||||
Address,
|
||||
optionData,
|
||||
} from "@/modules/05_placement/interface/index/Main";
|
||||
|
||||
import Header from "@/components/DialogHeader.vue";
|
||||
|
|
@ -34,10 +32,9 @@ const idCard = defineModel<string>("idCard", { required: true });
|
|||
|
||||
const $q = useQuasar();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const mixin = useCounterMixin();
|
||||
const profileStore = useProfileDataStore();
|
||||
const { changeRetireText, changeBirth } = profileStore;
|
||||
const { changeBirth } = profileStore;
|
||||
const {
|
||||
showLoader,
|
||||
hideLoader,
|
||||
|
|
@ -45,6 +42,7 @@ const {
|
|||
dialogConfirm,
|
||||
modalError,
|
||||
success,
|
||||
convertDateToAPI,
|
||||
} = mixin;
|
||||
const store = useLinkageStore();
|
||||
|
||||
|
|
@ -116,80 +114,26 @@ function closeDialog() {
|
|||
}
|
||||
|
||||
function onSubmit() {
|
||||
const body = {
|
||||
citizenId: formInformations.idCard,
|
||||
prefix: formInformations.prefixId,
|
||||
firstName: formInformations.firstname,
|
||||
lastName: formInformations.lastname,
|
||||
gender: formInformations.genderId,
|
||||
nationality: formInformations.nationality,
|
||||
race: formInformations.race,
|
||||
religion: formInformations.religionId,
|
||||
birthDate: formInformations.dateOfBirth,
|
||||
bloodGroup: formInformations.bloodGroupId,
|
||||
relationship: formInformations.relationshipId,
|
||||
telephoneNumber: formInformations.telephone,
|
||||
|
||||
registrationSame: addressData.value.registSame == "1",
|
||||
registrationAddress: addressData.value.registAddress,
|
||||
registrationSubDistrictId: registAddress.subDistrictId,
|
||||
registrationDistrictId: registAddress.districtId,
|
||||
registrationProvinceId: registAddress.provinceId,
|
||||
registrationZipCode: registAddress.zipCode,
|
||||
currentAddress:
|
||||
addressData.value.registSame == "1"
|
||||
? addressData.value.registAddress
|
||||
: addressData.value.currentAddress,
|
||||
currentSubDistrictId:
|
||||
addressData.value.registSame == "1"
|
||||
? registAddress.subDistrictId
|
||||
: currentAddress.subDistrictId,
|
||||
currentDistrictId:
|
||||
addressData.value.registSame == "1"
|
||||
? registAddress.districtId
|
||||
: currentAddress.districtId,
|
||||
currentProvinceId:
|
||||
addressData.value.registSame == "1"
|
||||
? registAddress.provinceId
|
||||
: currentAddress.provinceId,
|
||||
currentZipCode:
|
||||
addressData.value.registSame == "1"
|
||||
? registAddress.zipCode
|
||||
: currentAddress.zipCode,
|
||||
|
||||
couple: familyData.value.couple == "1",
|
||||
couplePrefix: familyData.value.marryPrefixId,
|
||||
coupleFirstName: familyData.value.marryFirstName,
|
||||
coupleLastName: familyData.value.marryLastName,
|
||||
coupleLastNameOld: "",
|
||||
coupleCareer: familyData.value.marryOccupation,
|
||||
|
||||
fatherPrefix: familyData.value.fatherPrefixId,
|
||||
fatherFirstName: familyData.value.fatherFirstName,
|
||||
fatherLastName: familyData.value.fatherLastName,
|
||||
fatherCareer: familyData.value.fatherOccupation,
|
||||
|
||||
motherPrefix: familyData.value.motherPrefixId,
|
||||
motherFirstName: familyData.value.motherFirstName,
|
||||
motherLastName: familyData.value.motherLastName,
|
||||
motherCareer: familyData.value.motherOccupation,
|
||||
};
|
||||
|
||||
dialogConfirm($q, async () => {
|
||||
if (age.value == false) {
|
||||
modalError($q, "พบข้อผิดพลาด", "วันเกิดไม่ถูกต้อง");
|
||||
return;
|
||||
} else {
|
||||
showLoader();
|
||||
await upDateInfomation();
|
||||
await upDateAddress();
|
||||
await upDateFamily();
|
||||
try {
|
||||
showLoader();
|
||||
await upDateInfomation();
|
||||
await upDateAddress();
|
||||
await upDateFamily();
|
||||
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
closeDialog();
|
||||
await props.getAll?.();
|
||||
await changeBirth(formInformations.dateOfBirth ?? new Date());
|
||||
hideLoader();
|
||||
success($q, "บันทึกข้อมูลสำเร็จ");
|
||||
closeDialog();
|
||||
await props.getAll?.();
|
||||
await changeBirth(formInformations.dateOfBirth ?? new Date());
|
||||
} catch (err) {
|
||||
messageError($q, err);
|
||||
} finally {
|
||||
hideLoader();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -222,49 +166,12 @@ async function amiRequest() {
|
|||
|
||||
familyData.value.fatherFirstName = data.value.fatherName;
|
||||
familyData.value.motherFirstName = data.value.motherName;
|
||||
|
||||
// data.value = {
|
||||
// titleCode: 3,
|
||||
// titleDesc: "นาย",
|
||||
// titleName: "นาย",
|
||||
// titleSex: 1,
|
||||
// firstName: "สุพลชัย",
|
||||
// middleName: "",
|
||||
// lastName: "พูลสวัสดิ์",
|
||||
// genderCode: 1,
|
||||
// genderDesc: "ชาย",
|
||||
// dateOfBirth: 25211228,
|
||||
// nationalityCode: 99,
|
||||
// nationalityDesc: "ไทย",
|
||||
// ownerStatusDesc: "เจ้าบ้าน",
|
||||
// statusOfPersonCode: 0,
|
||||
// statusOfPersonDesc: "บุคคลนี้มีภูมิลำเนาอยู่ในบ้านนี้",
|
||||
// dateOfMoveIn: 25580728,
|
||||
// age: 45,
|
||||
|
||||
// fatherPersonalID: 3102100621479,
|
||||
// fatherName: "บุญเชิด",
|
||||
// fatherNationalityCode: 99,
|
||||
// fatherNationalityDesc: "ไทย",
|
||||
|
||||
// motherPersonalID: 3102100621487,
|
||||
// motherName: "พยอม",
|
||||
// motherNationalityCode: 99,
|
||||
// motherNationalityDesc: "ไทย",
|
||||
|
||||
// fullnameAndRank: "นายสุพลชัย พูลสวัสดิ์",
|
||||
// englishTitleDesc: "MR.",
|
||||
// englishFirstName: "SUPHONCHAI",
|
||||
// englishMiddleName: "",
|
||||
// englishLastName: "PHOONSAWAT",
|
||||
// };
|
||||
}
|
||||
|
||||
/**
|
||||
* อัพเดตข้อมูลส่วนตัว
|
||||
*/
|
||||
async function upDateInfomation() {
|
||||
showLoader();
|
||||
const body: any = {
|
||||
citizenId: formInformations.idCard,
|
||||
prefix: formInformations.prefixId,
|
||||
|
|
@ -274,24 +181,18 @@ async function upDateInfomation() {
|
|||
nationality: formInformations.nationality,
|
||||
race: formInformations.race,
|
||||
religion: formInformations.religionId,
|
||||
birthDate: formInformations.dateOfBirth,
|
||||
birthDate: convertDateToAPI(formInformations.dateOfBirth),
|
||||
bloodGroup: formInformations.bloodGroupId,
|
||||
relationship: formInformations.relationshipId,
|
||||
telephoneNumber: formInformations.telephone,
|
||||
};
|
||||
showLoader();
|
||||
await http
|
||||
.put(
|
||||
config.API.placementInformationId(route.params.personalId.toString()),
|
||||
body
|
||||
)
|
||||
.then(async () => {})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
hideLoader();
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -332,12 +233,10 @@ async function upDateAddress() {
|
|||
config.API.placementAddressId(route.params.personalId.toString()),
|
||||
body
|
||||
)
|
||||
.then(async () => {})
|
||||
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
hideLoader();
|
||||
})
|
||||
.finally(() => {});
|
||||
});
|
||||
}
|
||||
|
||||
/** อัพเดตข้อมูลครอบครัว */
|
||||
|
|
@ -360,12 +259,9 @@ async function upDateFamily() {
|
|||
};
|
||||
await http
|
||||
.put(config.API.placementFamilyId(route.params.personalId.toString()), body)
|
||||
.then(async () => {})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
hideLoader();
|
||||
})
|
||||
.finally(() => {});
|
||||
});
|
||||
}
|
||||
|
||||
/** เช็คค่า modal เมื่อเป็น true ใช้งาน ฟังชั่น */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue