dowload show report เครื่องราช

This commit is contained in:
Thanit Konmek 2023-08-28 15:51:40 +07:00
parent 4ca00ceadb
commit 257bb32247
9 changed files with 576 additions and 1589 deletions

View file

@ -196,6 +196,9 @@ const props = defineProps({
roleUser: {
type: String,
},
roundName: {
type: String,
},
requestStatus: {
type: String,
},
@ -359,13 +362,13 @@ const downloadFile = (response: any, filename: string) => {
const downloadReport = async (type: string = "pdf") => {
showLoader();
await http
.get(config.API.reportInsignia("45", type, fileId.value), {
.get(config.API.reportInsignia("45", type, props.roundId!), {
responseType: "blob",
})
.then(async (res) => {
downloadFile(
res,
`บัญชีแสดงรายชื่อผู้ขอพระราชทานเหรียญจักรพรรดิมาลา.${type}`
`บัญชีแสดงรายชื่อผู้ขอพระราชทานเหรียญจักรพรรดิมาลา ${props.roundName}.${type}`
);
})
.catch((e) => {
@ -595,15 +598,31 @@ const paginationLabel2 = (start: number, end: number, total: number) => {
@update:model-value="DataStore.searchFilterTable"
/>
<div>
<q-btn
size="md"
icon="mdi-download"
flat
round
color="primary"
@click="downloadReport('pdf')"
>
<q-btn size="md" icon="mdi-download" flat round color="primary">
<!-- @click="downloadReport('pdf')" -->
<q-tooltip>ดาวนโหลด</q-tooltip>
<q-menu>
<q-list style="min-width: 150px">
<q-item clickable v-close-popup @click="downloadReport('pdf')">
<q-item-section avatar
><q-icon color="red" name="mdi-file-pdf"
/></q-item-section>
<q-item-section>ไฟล .PDF</q-item-section>
</q-item>
<q-item clickable v-close-popup @click="downloadReport('docx')">
<q-item-section avatar
><q-icon color="blue" name="mdi-file-word"
/></q-item-section>
<q-item-section>ไฟล .docx</q-item-section>
</q-item>
<q-item clickable v-close-popup @click="downloadReport('xlsx')">
<q-item-section avatar
><q-icon color="green" name="mdi-file-excel"
/></q-item-section>
<q-item-section>ไฟล .xlsx</q-item-section>
</q-item>
</q-list>
</q-menu>
</q-btn>
<q-btn
size="12px"

View file

@ -74,6 +74,7 @@ const fecthlistRound = async () => {
// const lastIndex = optionRound.value.length;
const lastValue = optionRound.value[0];
round.value = lastValue.id.toString();
roundName.value = lastValue.name;
fecthStat(round.value);
})
.catch((err) => {
@ -405,6 +406,7 @@ const requestSendNote = async () => {
<tab1
:tab="tab"
:roundId="round"
:roundName="roundName"
:fecthInsigniaByOc="fecthInsigniaByOc"
:role-user="roleUser"
:request-status="requestStatus"