Merge branch 'develop' into devTee

This commit is contained in:
setthawutttty 2024-12-24 15:17:33 +07:00
commit e1573bc968
2 changed files with 55 additions and 22 deletions

View file

@ -156,6 +156,7 @@ function classInput(val: boolean) {
const checkFile = ref<null | false | "img" | "doc">(null); // null , false , "img" , "doc"
const urlDownload = ref<string>(""); // url
const fileDownloadName = ref<string>("");
/**
* function หาชอไฟล
* @param id รายการยนคำรองขอแกไขขอม
@ -196,8 +197,9 @@ async function downloadUrl(id: string, fileName: string) {
fileName
)
)
.then((res) => {
.then(async (res) => {
urlDownload.value = res.data.downloadUrl;
fileDownloadName.value = res.data.fileName;
if (dataRequest.value.topic == "ขอแก้ไขรูปภาพประจำตัว") {
checkFile.value = "img";
} else {
@ -254,6 +256,34 @@ function fetchCheckIsofficer() {
}
}
async function onDownloadFil() {
try {
// URL
const response = await fetch(urlDownload.value);
if (!response.ok) {
throw new Error("ไม่สามารถดาวน์โหลดไฟล์ได้");
}
// Blob
const blob = await response.blob();
// URL
const url = URL.createObjectURL(blob);
// <a>
const link = document.createElement("a");
link.href = url;
link.download = fileDownloadName.value;
link.click();
// URL
URL.revokeObjectURL(url);
} catch (error) {
console.error("เกิดข้อผิดพลาด:", error);
}
}
onMounted(async () => {
await Promise.all([fetchDataRequest(), fetchCheckIsofficer()]);
});
@ -272,7 +302,7 @@ onMounted(async () => {
class="q-mr-sm"
@click="router.go(-1)"
/>
รายละเอยดคำรองขอแกไขทะเบยนประวของ{{ dataRequest.fullname }}
รายละเอยดคำรองขอแกไขทะเบยนประว {{ dataRequest.fullname }}
<q-space />
<q-btn
v-if="
@ -402,11 +432,16 @@ onMounted(async () => {
icon="mdi-download"
dense
flat
:label="checkFile == 'img' ? 'ดาวน์โหลดรูปภาพประจำตัว':'ดาวน์โหลดเอกสารหลักฐาน'"
:label="
checkFile == 'img'
? 'ดาวน์โหลดรูปภาพประจำตัว'
: 'ดาวน์โหลดเอกสารหลักฐาน'
"
color="blue"
:href="urlDownload"
target="_blank"
@click="onDownloadFil"
/>
<!-- target="_blank" -->
<!-- :href="urlDownload" -->
</div>
</div>
</div>

View file

@ -83,9 +83,7 @@ const columns = ref<QTableProps["columns"]>([
format(val, row) {
return `${
row.firstName
? `${row.prefix ?? ""}${row.firstName ?? ""} ${
row.lastName ?? ""
}`
? `${row.prefix ?? ""}${row.firstName ?? ""} ${row.lastName ?? ""}`
: "-"
}`;
},
@ -317,22 +315,23 @@ onMounted(async () => {
<q-card flat bordered class="col-12 q-mt-sm">
<div class="row q-pa-md">
<div class="col-12">
<div class="row col-12">
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
@click="sendToCommand()"
size="14px"
flat
round
color="primary"
icon="mdi-account-arrow-right"
>
<q-tooltip>งไปออกคำสงแตงต-เลอน-าย</q-tooltip>
</q-btn>
<div class="row col-12 q-col-gutter-sm">
<div>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
@click="sendToCommand()"
size="14px"
flat
round
color="primary"
icon="mdi-account-arrow-right"
>
<q-tooltip>งไปออกคำสงแตงต-เลอน-าย</q-tooltip>
</q-btn>
</div>
<q-space />
<q-input
class="col-xs-12 col-sm-3 col-md-2"
standout
dense
v-model="filterKeyword"
@ -358,7 +357,6 @@ onMounted(async () => {
:options="columns"
option-value="name"
style="min-width: 140px"
class="col-xs-12 col-sm-3 col-md-2 q-ml-sm"
/>
</div>