fix === > แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย ทุกระบบ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-11-29 14:28:21 +07:00
parent bcd5d1d56c
commit d9bb320b16
17 changed files with 514 additions and 348 deletions

View file

@ -36,6 +36,7 @@ const myForm = ref<QForm | null>(null);
const edit = ref<boolean>(false); //
const dataProfile = ref<DataProfile>(); //
const fullname = ref<string>(""); //
const mainData = ref<any>();
/** form แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย*/
const organizationPositionOld = ref<string>(""); ///
@ -45,16 +46,16 @@ const dateEnd = ref<Date | null>(null); // ถึงวันที่
const reason = ref<string>(""); //
const status = ref<string>("");
/**
* fetch อมลรายละเอยด
*/
/** fetch ข้อมูลรายละเอียด*/
async function getData() {
showLoader();
await http
.get(config.API.officerDetail(dataId))
.then((res: resHelpDetail) => {
const data = res.data.result;
mainData.value = res.data.result;
dataProfile.value = res.data.result as unknown as DataProfile;
fullname.value = `${data.prefix}${data.firstName} ${data.lastName}`;
organizationPositionOld.value = data.organizationPositionOld
? data.organizationPositionOld
@ -73,13 +74,11 @@ async function getData() {
});
}
/**
* นยนการบนทกขอม
*/
/** ยืนยันการบันทึกข้อมูลลงบัญชีแนบท้าย*/
function onSubmit() {
dialogConfirm(
$q,
() => {
async () => {
showLoader();
const body = {
organizationPositionOld: organizationPositionOld.value,
@ -88,7 +87,7 @@ function onSubmit() {
dateEnd: dateEnd.value,
reason: reason.value,
};
http
await http
.put(config.API.officerMainEdit(dataId), body)
.then(async () => {
await getData();
@ -107,28 +106,32 @@ function onSubmit() {
);
}
/**
* ยกเลกการแกไขขอมลเพอลงบญชแนบทาย
*/
/** ยกเลิกการแก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย*/
function cancelBtn() {
edit.value = !edit;
const data = mainData.value;
if (data) {
organizationPositionOld.value = data.organizationPositionOld
? data.organizationPositionOld
: findOrgName(data);
organization.value = data.organization;
dateStart.value = data.dateStart;
dateEnd.value = data.dateEnd;
reason.value = data.reason;
status.value = data.status;
}
myForm.value?.resetValidation();
getData();
}
/**
* class Input
*/
const getClass = (val: boolean) => {
/** class Input*/
function getClass(val: boolean) {
return {
"full-width inputgreen cursor-pointer": val,
"full-width cursor-pointer": !val,
};
};
}
/**
* ทำงานเมอมการเรยกใช Components
*/
/** ทำงานเมื่อมีการเรียกใช้ Components*/
onMounted(() => {
getData();
});
@ -147,7 +150,7 @@ onMounted(() => {
class="q-mr-sm"
@click="router.push(`/placement/help-government`)"
/>
รายละเอยดการชวยราชการ{{ fullname }}
รายละเอยดการชวยราชการ {{ fullname }}
</div>
<CardProfile :data="dataProfile as DataProfile" />
@ -265,7 +268,7 @@ onMounted(() => {
dense
:readonly="!edit"
:borderless="!edit"
:rules="[(val:string) => !!val || `${'กรุณาเลือกตั้งแต่วัน'}`]"
:rules="edit?[(val:string) => !!val || `${'กรุณาเลือกตั้งแต่วัน'}`]:[]"
:model-value="
dateStart !== null ? date2Thai(dateStart) : null
"
@ -314,7 +317,7 @@ onMounted(() => {
:model-value="
dateEnd !== null ? date2Thai(dateEnd) : null
"
:rules="[(val:string) => !!val || `${'กรุณาเลือกตั้งแต่วัน'}`]"
:rules="edit ? [(val:string) => !!val || `${'กรุณาเลือกตั้งแต่วัน'}`]:[]"
hide-bottom-space
:label="`${'ถึงวันที่'}`"
>