fix === > แก้ไขข้อมูลเพื่อลงบัญชีแนบท้าย ทุกระบบ
This commit is contained in:
parent
bcd5d1d56c
commit
d9bb320b16
17 changed files with 514 additions and 348 deletions
|
|
@ -31,7 +31,7 @@ const mixin = useCounterMixin();
|
|||
const dataId = route.params.id.toString();
|
||||
const {
|
||||
date2Thai,
|
||||
dialogMessage,
|
||||
dialogConfirm,
|
||||
messageError,
|
||||
showLoader,
|
||||
hideLoader,
|
||||
|
|
@ -45,6 +45,7 @@ const myForm = ref<QForm | null>(null);
|
|||
const roleAdmin = ref<boolean>(false);
|
||||
const edit = ref<boolean>(false);
|
||||
const dataProfile = ref<DataProfile>();
|
||||
const mainData = ref<any>();
|
||||
|
||||
const data = reactive<DataDetail>({
|
||||
id: "",
|
||||
|
|
@ -94,6 +95,7 @@ async function getData() {
|
|||
.get(config.API.suspendById(dataId))
|
||||
.then((res) => {
|
||||
const dataGet = res.data.result;
|
||||
mainData.value = res.data.result;
|
||||
dataProfile.value = dataGet as DataProfile;
|
||||
|
||||
data.id = dataGet.id;
|
||||
|
|
@ -134,7 +136,6 @@ async function getData() {
|
|||
data.root = dataGet.root;
|
||||
data.rootId = dataGet.rootId;
|
||||
data.rootShortName = dataGet.rootShortName;
|
||||
// getAvatar(dataGet.personId);
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
|
|
@ -144,60 +145,87 @@ async function getData() {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* ฟังชั่น ดึงรูปภาพโปรไฟล์
|
||||
* @param id id ของบุคคล
|
||||
*/
|
||||
function getAvatar(id: string) {
|
||||
if (id) {
|
||||
http
|
||||
.get(config.API.profileAvaId(id))
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
const dataList = res.data.result;
|
||||
data.avatar = dataList.avatar;
|
||||
})
|
||||
.catch((e) => {})
|
||||
.finally(() => {});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* ฟังก์ชั่น Cancle
|
||||
*/
|
||||
async function clickCancel() {
|
||||
await getData();
|
||||
edit.value = false;
|
||||
const dataGet = mainData.value;
|
||||
if (dataGet) {
|
||||
data.id = dataGet.id;
|
||||
data.personId = dataGet.personId;
|
||||
data.citizenId = dataGet.citizenId;
|
||||
data.name = `${dataGet.prefix}${dataGet.firstName} ${dataGet.lastName}`;
|
||||
data.prefix = dataGet.prefix;
|
||||
data.firstName = dataGet.firstName;
|
||||
data.lastName = dataGet.lastName;
|
||||
data.organization = dataGet.organization;
|
||||
data.position = dataGet.position;
|
||||
data.posNo = dataGet.posNo;
|
||||
data.positionLevel = dataGet.positionLevel;
|
||||
data.positionType = dataGet.positionType;
|
||||
data.salary = dataGet.salary;
|
||||
data.status = dataGet.status;
|
||||
data.descriptionSuspend = dataGet.descriptionSuspend
|
||||
? dataGet.descriptionSuspend
|
||||
: "ออกจากราชการ";
|
||||
data.startDateSuspend = dataGet.startDateSuspend;
|
||||
data.endDateSuspend = dataGet.endDateSuspend;
|
||||
data.title = dataGet.title;
|
||||
data.offenseDetails = dataGet.offenseDetails;
|
||||
data.disciplinaryFaultLevel = dataGet.disciplinaryFaultLevel;
|
||||
data.disciplinaryCaseFault = dataGet.disciplinaryCaseFault;
|
||||
data.child1 = dataGet.child1;
|
||||
data.child1Id = dataGet.child1Id;
|
||||
data.child1ShortName = dataGet.child1ShortName;
|
||||
data.child2 = dataGet.child2;
|
||||
data.child2Id = dataGet.child2Id;
|
||||
data.child2ShortName = dataGet.child2ShortName;
|
||||
data.child3 = dataGet.child3;
|
||||
data.child3Id = dataGet.child3Id;
|
||||
data.child3ShortName = dataGet.child3ShortName;
|
||||
data.child4 = dataGet.child4;
|
||||
data.child4Id = dataGet.child4Id;
|
||||
data.child4ShortName = dataGet.child4ShortName;
|
||||
data.root = dataGet.root;
|
||||
data.rootId = dataGet.rootId;
|
||||
data.rootShortName = dataGet.rootShortName;
|
||||
}
|
||||
myForm.value?.resetValidation();
|
||||
// await getData();
|
||||
}
|
||||
|
||||
/**
|
||||
* ฟังก์ชั่น Saveจาก API
|
||||
*/
|
||||
async function saveData() {
|
||||
const body = {
|
||||
organization: data.organization,
|
||||
positionType: data.positionType,
|
||||
posNo: data.posNo,
|
||||
position: data.position,
|
||||
positionLevel: data.positionLevel,
|
||||
salary: data.salary,
|
||||
descriptionSuspend: data.descriptionSuspend,
|
||||
startDateSuspend: data.startDateSuspend,
|
||||
endDateSuspend: data.endDateSuspend,
|
||||
};
|
||||
showLoader();
|
||||
await http
|
||||
.put(config.API.suspendById(dataId), body)
|
||||
.then((res: any) => {
|
||||
success($q, "แก้ไขข้อมูลเพื่อลงบัญชีแนบท้ายสำเร็จ");
|
||||
edit.value = false;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
await getData();
|
||||
hideLoader();
|
||||
});
|
||||
dialogConfirm($q, async () => {
|
||||
const body = {
|
||||
organization: data.organization,
|
||||
positionType: data.positionType,
|
||||
posNo: data.posNo,
|
||||
position: data.position,
|
||||
positionLevel: data.positionLevel,
|
||||
salary: data.salary,
|
||||
descriptionSuspend: data.descriptionSuspend,
|
||||
startDateSuspend: data.startDateSuspend,
|
||||
endDateSuspend: data.endDateSuspend,
|
||||
};
|
||||
showLoader();
|
||||
await http
|
||||
.put(config.API.suspendById(dataId), body)
|
||||
.then(async () => {
|
||||
await getData();
|
||||
success($q, "แก้ไขข้อมูลเพื่อลงบัญชีแนบท้ายสำเร็จ");
|
||||
edit.value = false;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(async () => {
|
||||
hideLoader();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -211,11 +239,6 @@ function getClass(val: boolean) {
|
|||
};
|
||||
}
|
||||
|
||||
function onclickViewinfo(id: string) {
|
||||
modalPersonal.value = true;
|
||||
personId.value = id;
|
||||
}
|
||||
|
||||
function updatemodalPersonal(modal: boolean) {
|
||||
modalPersonal.value = modal;
|
||||
}
|
||||
|
|
@ -224,7 +247,6 @@ function updatemodalPersonal(modal: boolean) {
|
|||
function changeFormDataDate() {
|
||||
const startDate = new Date(data.startDateSuspend as Date);
|
||||
const endDate = new Date(data.endDateSuspend as Date);
|
||||
|
||||
if (startDate > endDate) {
|
||||
data.endDateSuspend = null;
|
||||
}
|
||||
|
|
@ -251,13 +273,19 @@ onMounted(async () => {
|
|||
class="q-mr-sm"
|
||||
@click="router.go(-1)"
|
||||
/>
|
||||
รายละเอียดผู้ถูกพักราชการของ {{ data.name }}
|
||||
รายละเอียดผู้ถูกพักราชการ {{ data.name }}
|
||||
</div>
|
||||
|
||||
<CardProfile :data="dataProfile as DataProfile" />
|
||||
|
||||
<q-card bordered class="row col-12 text-dark q-mt-sm">
|
||||
<q-form greedy @submit.prevent @validation-success="saveData" @reset="clickCancel">
|
||||
<q-form
|
||||
ref="myForm"
|
||||
greedy
|
||||
@submit.prevent
|
||||
@validation-success="saveData"
|
||||
@reset="clickCancel"
|
||||
>
|
||||
<div class="bg-grey-1 q-pa-sm col-12 row items-center text-primary">
|
||||
<div class="q-pl-sm text-weight-bold text-dark">
|
||||
{{
|
||||
|
|
@ -267,6 +295,7 @@ onMounted(async () => {
|
|||
}}
|
||||
</div>
|
||||
<q-space />
|
||||
|
||||
<div
|
||||
v-if="
|
||||
data.status !== 'DONE' &&
|
||||
|
|
@ -423,7 +452,7 @@ onMounted(async () => {
|
|||
? date2Thai(data.startDateSuspend)
|
||||
: 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