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

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

@ -43,7 +43,14 @@ const emit = defineEmits(["update:statusEdit"]);
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 addressData = ref<AddressType>(props.data);
const myform = ref<any>();
@ -138,61 +145,54 @@ const getNewData = async () => {
//
const editData = async () => {
const body = {
registrationSame: addressData.value.registSame == "1",
registrationAddress: addressData.value.registAddress,
registrationSubDistrictId: registAddress.subDistrictId,
registrationDistrictId: registAddress.districtId,
registrationProvinceId: registAddress.provinceId,
registrationZipCode: registAddress.provinceId,
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,
};
showLoader();
await http
.put(
config.API.placementAddressId(route.params.personalId.toString()),
body
)
.then(() => {
success($q, "แก้ไขข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
edit.value = false;
emit("update:statusEdit", false);
await getNewData();
await props.fetch();
// await fetchProvince();
});
};
//
const saveData = async () => {
myform.value.validate().then((success: boolean) => {
if (success) {
editData();
}
dialogConfirm($q, async() => {
const body = {
registrationSame: addressData.value.registSame == "1",
registrationAddress: addressData.value.registAddress,
registrationSubDistrictId: registAddress.subDistrictId,
registrationDistrictId: registAddress.districtId,
registrationProvinceId: registAddress.provinceId,
registrationZipCode: registAddress.provinceId,
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,
};
showLoader();
await http
.put(
config.API.placementAddressId(route.params.personalId.toString()),
body
)
.then(() => {
success($q, "แก้ไขข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
edit.value = false;
emit("update:statusEdit", false);
await getNewData();
await props.fetch();
// await fetchProvince();
});
});
};
@ -440,18 +440,18 @@ const getClass = (val: boolean) => {
<template>
<q-card class="col-12 q-px-lg q-py-md q-mt-md no-border">
<HeaderTop
v-model:edit="edit"
header="ข้อมูลที่อยู่"
icon="mdi-map-marker"
:save="saveData"
:history="false"
:changeBtn="changeBtn"
:disable="statusEdit"
:cancel="refreshData"
/>
<q-form ref="myform">
<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-map-marker"
: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">
<q-input
:class="getClass(edit)"

View file

@ -45,8 +45,15 @@ const store = useProfileDataStore();
const { profileData, changeProfileColumns } = store;
const mixin = useCounterMixin();
const { date2Thai, success, dateToISO, messageError, showLoader, hideLoader } =
mixin;
const {
date2Thai,
success,
dateToISO,
messageError,
showLoader,
hideLoader,
dialogConfirm,
} = mixin;
const route = useRoute();
const id = ref<string>("");
const certificateNo = ref<string>();
@ -313,15 +320,11 @@ const clickAdd = async () => {
* กดบนทกใน dialog
*/
const clickSave = async () => {
myForm.value.validate().then(async (result: boolean) => {
if (result) {
if (modalEdit.value) {
await editData();
} else {
await saveData();
}
}
});
if (modalEdit.value) {
await dialogConfirm($q, () => editData());
} else {
await dialogConfirm($q, () => saveData());
}
};
/**
@ -476,6 +479,7 @@ const addData = () => {
* งกนปมยกเลกการแกไขขอม
*/
const clickCancel = async () => {
myForm.value.resetValidation()
if (editRow.value == true) {
$q.dialog({
title: `ข้อมูลมีการแก้ไข`,
@ -618,7 +622,12 @@ const getClass = (val: boolean) => {
<!-- popup Edit window-->
<q-dialog v-model="modal" persistent>
<q-card style="width: 600px">
<q-form ref="myForm">
<q-form
ref="myForm"
greedy
@submit.prevent
@validation-success="clickSave"
>
<DialogHeader
:tittle="
profileType == 'employee'
@ -630,7 +639,7 @@ const getClass = (val: boolean) => {
<q-separator />
<q-card-section class="q-p-sm">
<div
class="row col-12 items-center q-col-gutter-x-xs q-col-gutter-y-xs"
class="row col-12 items-top q-col-gutter-x-xs q-col-gutter-y-xs"
>
<div class="col-xs-6 col-sm-6 col-md-6">
<q-input
@ -772,8 +781,6 @@ const getClass = (val: boolean) => {
<DialogFooter
:cancel="clickCancel"
:edit="clickEdit"
:save="clickSave"
:validate="validateData"
:clickNext="clickNext"
:clickPrevious="clickPrevious"
:clickDelete="clickDelete"

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

View file

@ -54,6 +54,7 @@ const {
modalError,
showLoader,
hideLoader,
dialogConfirm,
} = mixin;
const profileStore = useProfileDataStore();
@ -257,43 +258,45 @@ const calRetire = async (birth: Date) => {
};
const editData = async () => {
if (age.value == false) {
modalError($q, "พบข้อผิดพลาด", "วันเกิดไม่ถูกต้อง");
return;
}
dialogConfirm($q, async () => {
if (age.value == false) {
modalError($q, "พบข้อผิดพลาด", "วันเกิดไม่ถูกต้อง");
return;
}
const body: any = {
citizenId: informaData.value.idCard,
prefixId: informaData.value.prefixId,
firstName: informaData.value.firstname,
lastName: informaData.value.lastname,
genderId: informaData.value.genderId,
nationality: informaData.value.nationality,
race: informaData.value.race,
religionId: informaData.value.religionId,
birthDate: informaData.value.dateOfBirth,
bloodGroupId: informaData.value.bloodGroupId,
relationshipId: informaData.value.relationshipId,
telephoneNumber: informaData.value.telephone,
};
showLoader();
await http
.put(
config.API.placementInformationId(route.params.personalId.toString()),
body
)
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
edit.value = false;
emit("update:statusEdit", false);
await props.fetch();
await changeBirth(informaData.value.dateOfBirth ?? new Date());
});
const body: any = {
citizenId: informaData.value.idCard,
prefixId: informaData.value.prefixId,
firstName: informaData.value.firstname,
lastName: informaData.value.lastname,
genderId: informaData.value.genderId,
nationality: informaData.value.nationality,
race: informaData.value.race,
religionId: informaData.value.religionId,
birthDate: informaData.value.dateOfBirth,
bloodGroupId: informaData.value.bloodGroupId,
relationshipId: informaData.value.relationshipId,
telephoneNumber: informaData.value.telephone,
};
showLoader();
await http
.put(
config.API.placementInformationId(route.params.personalId.toString()),
body
)
.then((res) => {
success($q, "บันทึกข้อมูลสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
edit.value = false;
emit("update:statusEdit", false);
await props.fetch();
await changeBirth(informaData.value.dateOfBirth ?? new Date());
});
});
};
const saveData = async () => {
@ -328,18 +331,18 @@ const getClass = (val: boolean) => {
</script>
<template>
<q-card flat bordered class="col-12 q-px-lg q-py-md no-border">
<HeaderTop
v-model:edit="edit"
header="ข้อมูลส่วนตัว"
icon="mdi-account"
:save="saveData"
:history="false"
:changeBtn="changeBtn"
:disable="statusEdit"
:cancel="onCancel"
/>
<q-form ref="myform" class="col-12">
<div class="row col-12 items-center q-col-gutter-x-sm q-col-gutter-y-sm">
<q-form ref="myform" greedy @submit.prevent @validation-success="editData">
<HeaderTop
v-model:edit="edit"
header="ข้อมูลส่วนตัว"
icon="mdi-account"
:history="false"
:changeBtn="changeBtn"
:disable="statusEdit"
:cancel="onCancel"
/>
<div class="row col-12 items-top q-col-gutter-x-sm q-col-gutter-y-sm">
<div class="col-xs-6 col-sm-3 col-md-3">
<q-input
:class="getClass(edit)"

View file

@ -131,7 +131,7 @@ const add = () => {
round
v-if="edit"
:color="!edit ? 'grey-7' : 'public'"
@click="save"
type="submit"
icon="mdi-content-save-outline"
>
<q-tooltip>นทกขอม</q-tooltip>