update detail ทุน

This commit is contained in:
Warunee Tamkoo 2024-04-11 14:47:53 +07:00
parent db363a7392
commit 9f01c9ac4c

View file

@ -401,12 +401,53 @@ function upDate(data: DataPerson) {
}
}
const fileBackReceived = ref<string>("");
async function checkFileBackReceived(id: string) {
showLoader();
await http
.get(
config.API.file("ระบบพัฒนาบุคคล", "ฟอร์มรายงานตัวกลับเข้ารับราชการ", id)
)
.then(async (res) => {
fileBackReceived.value = res.data.length > 0 ? res.data[0].fileName : "";
})
.catch(() => {})
.finally(() => {
hideLoader();
});
}
function downloadFileBackReceived() {
showLoader();
http
.get(
config.API.fileByFile(
"ระบบพัฒนาบุคคล",
"ฟอร์มรายงานตัวกลับเข้ารับราชการ",
id,
fileBackReceived.value
)
)
.then((res) => {
const data = res.data.downloadUrl;
window.open(data, "_blank");
})
.catch((e) => {
messageError($q, e);
})
.finally(async () => {
hideLoader();
});
}
onMounted(() => {
if (scholarshipId.value) {
fetchDataDetail(scholarshipId.value);
checkFileBackReceived(scholarshipId.value);
}
});
</script>
<template>
<div class="row items-center">
<div class="toptitle text-dark items-center">
@ -422,13 +463,17 @@ onMounted(() => {
{{ `${title}ข้าราชการฯที่ได้รับทุนการศึกษา/ฝึกอบรม` }}
</div>
<q-space />
<q-icon
name="download"
class="cursor-pointer"
size="sm"
style="color: var(--q-primary)"
<q-btn
v-if="fileBackReceived != ''"
flat
round
dense
icon="download"
color="blue"
@click="downloadFileBackReceived()"
>
</q-icon>
<q-tooltip>ดาวนโหลด</q-tooltip>
</q-btn>
<div class="row q-ml-md" v-if="scholarshipId">
<div class="q-gutter-sm" v-if="isStatus === 'PENDING'">
<q-btn