This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-08-30 11:16:21 +07:00
parent db60969d3f
commit 2f95271b1b
5 changed files with 139 additions and 99 deletions

View file

@ -27,6 +27,8 @@ const avatarProfile = ref<string>("");
const filterKeyword = ref<string>("");
const position_line = ref<string>("");
const position_level = ref<string>("");
const position_type = ref<string>("");
const probation_status = ref<any>();
const probation_statusold = ref<string>("");
const pagination = ref({
@ -148,9 +150,9 @@ async function getAssignList() {
showLoader();
await http
.get(config.API.probationGetAssignList(personalId.value))
.then((res) => {
const data = res.data.data;
rows.value = data.map((item: FormProbationDetail) => ({
.then(async (res) => {
const data = await res.data.data;
rows.value = await data.map((item: FormProbationDetail) => ({
id: item.id,
round_no: item.round_no,
date_start: date2Thai(new Date(item.date_start)),
@ -160,7 +162,9 @@ async function getAssignList() {
chairman: item.chairman,
}));
})
.catch(() => {})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
@ -171,8 +175,8 @@ async function getpersonalList() {
showLoader();
await http
.get(config.API.personal(personalId.value))
.then((res) => {
const data = res.data.data;
.then(async (res) => {
const data = await res.data.data;
name.value = data.name;
position_line.value = data.position_line;
position_level.value = data.position_level;
@ -180,24 +184,27 @@ async function getpersonalList() {
probation_status.value = data.probation_status;
probation_statusold.value = data.probation_status;
})
.catch(() => {})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/** เปลี่ยนสถานะ */
async function selectStatus() {
function selectStatus() {
dialogConfirm(
$q,
async () => {
() => {
showLoader();
await http
http
.put(config.API.changestatusProbations(personalId.value), {
status: probation_status.value,
})
.then((res) => {
success($q, "แก้ไขสถานะสำเร็จ");
.then(async () => {
await getpersonalList();
await success($q, "แก้ไขสถานะสำเร็จ");
})
.catch((err) => {
messageError($q, err);
@ -205,7 +212,6 @@ async function selectStatus() {
})
.finally(() => {
hideLoader();
getpersonalList();
});
},
"ยืนยันการเปลี่ยนสถานะการทดลองปฏิบัติหน้าที่ราชการ",
@ -271,9 +277,7 @@ async function fetchProfilePhoto() {
/** get ค่า เมื่อโหลดหน้า */
onMounted(async () => {
await getpersonalList();
await getAssignList();
fetchProfilePhoto();
await Promise.all([getpersonalList(), getAssignList(), fetchProfilePhoto()]);
});
</script>
@ -289,7 +293,7 @@ onMounted(async () => {
class="q-mr-sm"
@click="router.push(`/probation/`)"
/>
รายละเอยดงานทไดบมอบหมายของ {{ name }}
รายละเอยดงานทไดบมอบหมายของ{{ name }}
</div>
<q-card bordered class="row col-12 text-dark">
<div class="bg-grey-1 q-pa-sm col-12 row items-center text-primary">
@ -322,7 +326,7 @@ onMounted(async () => {
<div class="col-xs-6 col-sm-2 row items-center">
<div class="col-12">
<div class="col-12 text-top">ระด</div>
<div class="col-12 text-top">ประเภทตำแหน</div>
<div class="col-12 text-detail">{{ position_level }}</div>
</div>
</div>
@ -458,8 +462,7 @@ onMounted(async () => {
<q-tooltip>รายละเอยด</q-tooltip>
</q-btn>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate
"
v-if="checkPermission($route)?.attrIsUpdate"
flat
dense
round