แก้ชื่อเอกสารตอนดาวน์โหลดตามชื่อเอกสารที่แสดง
This commit is contained in:
parent
6ad6b4bcab
commit
9aa0708c48
3 changed files with 21 additions and 26 deletions
|
|
@ -68,14 +68,14 @@ const downloadFile = (response: any, filename: string) => {
|
|||
link.click();
|
||||
document.body.removeChild(link);
|
||||
};
|
||||
const fileDownload = async (no: number, type: string) => {
|
||||
const fileDownload = async (no: number, type: string, fileName: string) => {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.reportTransferFile(no, type, id.value), {
|
||||
responseType: "blob",
|
||||
})
|
||||
.then(async (res) => {
|
||||
downloadFile(res, `_ครั้งที่.${type}`);
|
||||
downloadFile(res, `${fileName}.${type}`);
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
|
|
@ -463,7 +463,7 @@ onMounted(async () => {
|
|||
round
|
||||
color="red"
|
||||
icon="picture_as_pdf"
|
||||
@click="fileDownload(props.row.no, 'pdf')"
|
||||
@click="fileDownload(props.row.no, 'pdf', props.row.fileName)"
|
||||
>
|
||||
<q-tooltip>ไฟล์ PDF</q-tooltip>
|
||||
</q-btn>
|
||||
|
|
@ -473,7 +473,7 @@ onMounted(async () => {
|
|||
round
|
||||
color="blue"
|
||||
icon="mdi-file-word"
|
||||
@click="fileDownload(props.row.no, 'docx')"
|
||||
@click="fileDownload(props.row.no, 'docx', props.row.fileName)"
|
||||
>
|
||||
<q-tooltip>ไฟล์ WORD</q-tooltip>
|
||||
</q-btn>
|
||||
|
|
|
|||
|
|
@ -218,29 +218,24 @@ watchEffect(() => {
|
|||
<q-td key="no" :props="props">
|
||||
{{ props.rowIndex + 1 }}
|
||||
</q-td>
|
||||
<q-td key="prefix" :props="props">
|
||||
{{ props.row.prefix }}
|
||||
</q-td>
|
||||
<q-td key="fullname" :props="props">
|
||||
{{ props.row.fullname }}
|
||||
</q-td>
|
||||
<q-td key="positionTypeOld" :props="props">
|
||||
{{ props.row.positionTypeOld }}
|
||||
<q-td key="position" :props="props">
|
||||
{{ props.row.position }}
|
||||
</q-td>
|
||||
<q-td key="positionLevelOld" :props="props">
|
||||
{{ props.row.positionLevelOld }}
|
||||
<q-td key="positionLevel" :props="props">
|
||||
{{ props.row.positionLevel }}
|
||||
</q-td>
|
||||
<q-td key="positionNumberOld" :props="props">
|
||||
{{ props.row.positionNumberOld }}
|
||||
</q-td>
|
||||
|
||||
<q-td key="organizationPositionOld" :props="props">
|
||||
<div class="table_ellipsis">
|
||||
{{ props.row.organizationPositionOld }}
|
||||
</div>
|
||||
</q-td>
|
||||
<q-td key="datetext" :props="props">
|
||||
{{ props.row.datetext }}
|
||||
<q-td key="organization" :props="props">
|
||||
<div class="table_ellipsis">
|
||||
{{ props.row.organization }}
|
||||
</div>
|
||||
</q-td>
|
||||
<q-td key="statustext" :props="props">
|
||||
{{ props.row.statustext }}
|
||||
|
|
|
|||
|
|
@ -173,15 +173,15 @@ const fetchData = async (id: string) => {
|
|||
hideLoader();
|
||||
});
|
||||
};
|
||||
const downloadFile = (response: any, filename: string) => {
|
||||
const link = document.createElement("a");
|
||||
var fileName = filename;
|
||||
link.href = window.URL.createObjectURL(new Blob([response.data]));
|
||||
link.setAttribute("download", fileName);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
};
|
||||
// const downloadFile = (response: any, filename: string) => {
|
||||
// const link = document.createElement("a");
|
||||
// var fileName = filename;
|
||||
// link.href = window.URL.createObjectURL(new Blob([response.data]));
|
||||
// link.setAttribute("download", fileName);
|
||||
// document.body.appendChild(link);
|
||||
// link.click();
|
||||
// document.body.removeChild(link);
|
||||
// };
|
||||
|
||||
const popUp = (action: "pass" | "passNot") => {
|
||||
reasonReign.value = "";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue