บรรจุ ทดลองงาน

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-03-13 15:46:55 +07:00
parent a8fdca1138
commit 4cfcc2d018
21 changed files with 113 additions and 199 deletions

View file

@ -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 ใช้งาน ฟังชั่น */

View file

@ -57,6 +57,7 @@ const {
showLoader,
hideLoader,
dialogConfirm,
convertDateToAPI,
} = mixin;
const route = useRoute();
const id = ref<string>("");
@ -263,7 +264,7 @@ const clickNext = async () => {
/**
* กดดอมลตอไป
*/
const getData = () => {
async function getData() {
const row = rows.value[rowIndex.value];
certificateNo.value = row.certificateNo;
issuer.value = row.issuer;
@ -271,12 +272,12 @@ const getData = () => {
expireDate.value = row.expireDate;
certificateType.value = row.certificateType;
id.value = row.id;
};
}
/**
* เชคปมดอม อน อไป าตองแสดงไหม
*/
const checkRowPage = () => {
async function checkRowPage() {
editRow.value = false;
next.value = true;
previous.value = true;
@ -286,7 +287,7 @@ const checkRowPage = () => {
if (rowIndex.value - 1 < 0) {
previous.value = false;
}
};
}
/**
* กดปมแกไขใน dialog
@ -302,7 +303,7 @@ const clickEdit = () => {
*/
const clickAdd = async () => {
editRow.value = false;
await addData();
addData();
};
/**
@ -310,9 +311,9 @@ const clickAdd = async () => {
*/
const clickSave = async () => {
if (modalEdit.value) {
await dialogConfirm($q, () => editData());
dialogConfirm($q, () => editData());
} else {
await dialogConfirm($q, () => saveData());
dialogConfirm($q, () => saveData());
}
};
@ -326,8 +327,8 @@ const saveData = async () => {
id: id.value,
certificateNo: certificateNo.value,
issuer: issuer.value,
issueDate: new Date(issueDate.value),
expireDate: new Date(expireDate.value),
issueDate: convertDateToAPI(new Date(issueDate.value)),
expireDate: convertDateToAPI(new Date(expireDate.value)),
certificateType: certificateType.value,
})
.then(async () => {
@ -353,8 +354,8 @@ const editData = async () => {
id: id.value,
certificateNo: certificateNo.value,
issuer: issuer.value,
issueDate: new Date(issueDate.value),
expireDate: new Date(expireDate.value),
issueDate: convertDateToAPI(new Date(issueDate.value)),
expireDate: convertDateToAPI(new Date(expireDate.value)),
certificateType: certificateType.value,
})
.then(async () => {

View file

@ -38,6 +38,7 @@ const {
hideLoader,
dialogRemove,
dialogConfirm,
convertDateToAPI,
} = mixin;
const props = defineProps({
@ -444,15 +445,15 @@ const saveData = async () => {
durationYear: Number(durationYear.value),
other: other.value,
fundName: fundName.value,
finishDate: dateToISO(finishDate.value),
finishDate: convertDateToAPI(finishDate.value),
startDate:
isDate.value == "true"
? new Date(startDate2.value)
: new Date(`${startDate.value}-01-01`),
? convertDateToAPI(new Date(startDate2.value))
: convertDateToAPI(new Date(`${startDate.value}-01-01`)),
endDate:
isDate.value == "true"
? new Date(endDate2.value)
: new Date(`${endDate.value}-01-01`),
? convertDateToAPI(new Date(endDate2.value))
: convertDateToAPI(new Date(`${endDate.value}-01-01`)),
isDate: isDate.value == "true",
})
.then(async () => {
@ -492,12 +493,12 @@ const editData = async () => {
finishDate: new Date(finishDate.value),
startDate:
isDate.value == "true"
? new Date(startDate2.value)
: new Date(`${startDate.value}-01-01`),
? convertDateToAPI(new Date(startDate2.value))
: convertDateToAPI(new Date(`${startDate.value}-01-01`)),
endDate:
isDate.value == "true"
? new Date(endDate2.value)
: new Date(`${endDate.value}-01-01`),
? convertDateToAPI(new Date(endDate2.value))
: convertDateToAPI(new Date(`${endDate.value}-01-01`)),
isDate: isDate.value == "true",
})
.then(async () => {

View file

@ -33,6 +33,7 @@ const {
showLoader,
hideLoader,
dialogConfirm,
convertDateToAPI,
} = mixin;
const props = defineProps({
@ -208,7 +209,7 @@ const editData = async () => {
nationality: informaData.value.nationality,
race: informaData.value.race,
religion: informaData.value.religionId,
birthDate: informaData.value.dateOfBirth,
birthDate: convertDateToAPI(informaData.value.dateOfBirth),
bloodGroup: informaData.value.bloodGroupId,
relationship: informaData.value.relationshipId,
telephoneNumber: informaData.value.telephone,