แก้ชื่อเอกสารตอนดาวน์โหลดตามชื่อเอกสารที่แสดง
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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue