fix === > แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย ทุกระบบ
This commit is contained in:
parent
bcd5d1d56c
commit
d9bb320b16
17 changed files with 514 additions and 348 deletions
|
|
@ -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="`${'ถึงวันที่'}`"
|
||||
>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue