ปรับ ระบบ บรรจุ

This commit is contained in:
STW_TTTY\stwtt 2024-05-07 17:06:34 +07:00
parent ad66cacc1e
commit 94afaca07b
13 changed files with 770 additions and 734 deletions

View file

@ -36,7 +36,14 @@ const route = useRoute();
const $q = useQuasar();
const mixin = useCounterMixin();
const { date2Thai, success, messageError, showLoader, hideLoader } = mixin;
const {
date2Thai,
success,
messageError,
showLoader,
hideLoader,
dialogConfirm,
} = mixin;
const edit = ref<boolean>(false);
const myform = ref<QForm | null>(null);
@ -93,57 +100,62 @@ const fetchPrefix = async () => {
};
const editData = async () => {
showLoader();
// const body: ResponseObject = {
// couple: familyData.value.couple == "1",
// couplePrefixId: familyData.value.marryPrefixId,
// coupleFirstName: familyData.value.marryFirstName,
// coupleLastName: familyData.value.marryLastName,
// coupleLastNameOld: familyData.value.lastnameCOld,
// coupleCareer: familyData.value.marryOccupation,
// fatherPrefixId: familyData.value.fatherPrefixId,
// fatherFirstName: familyData.value.fatherFirstName,
// fatherLastName: familyData.value.fatherLastName,
// fatherCareer: familyData.value.fatherOccupation,
// motherPrefixId: familyData.value.motherPrefixId,
// motherFirstName: familyData.value.motherFirstName,
// motherLastName: familyData.value.motherLastName,
// motherCareer: familyData.value.motherOccupation,
// // childrens: familyData.value.childrens,
// createdFullName: "-",
// createdAt: new Date(),
// };
dialogConfirm($q, async () => {
showLoader();
// const body: ResponseObject = {
// couple: familyData.value.couple == "1",
// couplePrefixId: familyData.value.marryPrefixId,
// coupleFirstName: familyData.value.marryFirstName,
// coupleLastName: familyData.value.marryLastName,
// coupleLastNameOld: familyData.value.lastnameCOld,
// coupleCareer: familyData.value.marryOccupation,
// fatherPrefixId: familyData.value.fatherPrefixId,
// fatherFirstName: familyData.value.fatherFirstName,
// fatherLastName: familyData.value.fatherLastName,
// fatherCareer: familyData.value.fatherOccupation,
// motherPrefixId: familyData.value.motherPrefixId,
// motherFirstName: familyData.value.motherFirstName,
// motherLastName: familyData.value.motherLastName,
// motherCareer: familyData.value.motherOccupation,
// // childrens: familyData.value.childrens,
// createdFullName: "-",
// createdAt: new Date(),
// };
const body = {
couple: familyData.value.couple == "1",
couplePrefixId: familyData.value.marryPrefixId,
coupleFirstName: familyData.value.marryFirstName,
coupleLastName: familyData.value.marryLastName,
coupleLastNameOld: "",
coupleCareer: familyData.value.marryOccupation,
fatherPrefixId: familyData.value.fatherPrefixId,
fatherFirstName: familyData.value.fatherFirstName,
fatherLastName: familyData.value.fatherLastName,
fatherCareer: familyData.value.fatherOccupation,
motherPrefixId: familyData.value.motherPrefixId,
motherFirstName: familyData.value.motherFirstName,
motherLastName: familyData.value.motherLastName,
motherCareer: familyData.value.motherOccupation,
};
await http
.put(config.API.placementFamilyId(route.params.personalId.toString()), body)
.then(() => {
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
hideLoader();
edit.value = false;
emit("update:statusEdit", false);
await props.fetch();
});
const body = {
couple: familyData.value.couple == "1",
couplePrefixId: familyData.value.marryPrefixId,
coupleFirstName: familyData.value.marryFirstName,
coupleLastName: familyData.value.marryLastName,
coupleLastNameOld: "",
coupleCareer: familyData.value.marryOccupation,
fatherPrefixId: familyData.value.fatherPrefixId,
fatherFirstName: familyData.value.fatherFirstName,
fatherLastName: familyData.value.fatherLastName,
fatherCareer: familyData.value.fatherOccupation,
motherPrefixId: familyData.value.motherPrefixId,
motherFirstName: familyData.value.motherFirstName,
motherLastName: familyData.value.motherLastName,
motherCareer: familyData.value.motherOccupation,
};
await http
.put(
config.API.placementFamilyId(route.params.personalId.toString()),
body
)
.then(() => {
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
hideLoader();
edit.value = false;
emit("update:statusEdit", false);
await props.fetch();
});
});
};
const saveData = async () => {
@ -188,18 +200,18 @@ const getClass = (val: boolean) => {
<template>
<q-card flat class="col-12 q-px-lg q-py-md q-mt-md text-dark">
<HeaderTop
v-model:edit="edit"
header="ข้อมูลครอบครัว"
icon="mdi-account-group"
:save="saveData"
:history="false"
:changeBtn="changeBtn"
:disable="statusEdit"
:cancel="refreshData"
/>
<q-form ref="myform" class="col-12">
<div class="row col-12 items-center q-col-gutter-x-xs q-col-gutter-y-xs">
<q-form ref="myform" greedy @submit.prevent @validation-success="editData">
<HeaderTop
v-model:edit="edit"
header="ข้อมูลครอบครัว"
icon="mdi-account-group"
:history="false"
:changeBtn="changeBtn"
:disable="statusEdit"
:cancel="refreshData"
/>
<div class="row col-12 items-top q-col-gutter-x-xs q-col-gutter-y-xs">
<div class="col-xs-12 text-weight-bold"> ดา</div>
<div class="col-xs-12 col-sm-3 col-md-3">
<selector