ทะเบียนประวัติเพิ่มโหลไฟล์

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-03-17 17:46:39 +07:00
parent 7f4db651fc
commit ba32db6123
2 changed files with 132 additions and 24 deletions

View file

@ -238,6 +238,34 @@ function onSearch() {
); );
} }
/**
* งกนโหลไฟลเอกสารหลกฐาน
* @param id รายการทองการโหลด
*/
async function onDownloadFile(id: string, profileId: string) {
showLoader();
await http
.get(
config.API.subFileByFileName(
"ทะเบียนประวัติ",
"ประกาศเกียรติคุณ",
profileId,
id,
"เอกสารหลักฐาน"
)
)
.then(async (res) => {
const data = res.data;
window.open(data.downloadUrl, "_blank");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
onMounted(async () => { onMounted(async () => {
link.value = await dataStore.getProFileType(); link.value = await dataStore.getProFileType();
await getData(); await getData();
@ -316,7 +344,19 @@ onMounted(async () => {
{{ col.value ? col.value : "-" }} {{ col.value ? col.value : "-" }}
</div> </div>
</q-td> </q-td>
<q-td auto-width> <q-td auto-width>
<q-btn
v-if="props.row.isUpload == true"
color="green"
flat
dense
round
icon="mdi-file-document-outline"
@click="onDownloadFile(props.row.id, props.row.profileId)"
>
<q-tooltip>ดาวนโหลด</q-tooltip>
</q-btn>
<q-btn <q-btn
color="info" color="info"
flat flat
@ -336,18 +376,31 @@ onMounted(async () => {
<div class="q-mb-xs col-xs-12 col-sm-6 col-md-4 col-lg-3"> <div class="q-mb-xs col-xs-12 col-sm-6 col-md-4 col-lg-3">
<q-card bordered flat> <q-card bordered flat>
<q-list dense class="q-mt-lg relative-position"> <q-list dense class="q-mt-lg relative-position">
<q-btn <div class="row absolute_button">
icon="mdi-history" <q-btn
color="info" v-if="props.row.isUpload == true"
flat color="green"
dense flat
round dense
size="14px" round
class="absolute_button" size="14px"
@click="onHistory(props.row.id)" icon="mdi-file-document-outline"
> @click="onDownloadFile(props.row.id, props.row.profileId)"
<q-tooltip>ประวแกไขความสามารถพเศษ</q-tooltip> >
</q-btn> <q-tooltip>ดาวนโหลด</q-tooltip>
</q-btn>
<q-btn
icon="mdi-history"
color="info"
flat
dense
round
size="14px"
@click="onHistory(props.row.id)"
>
<q-tooltip>ประวแกไขความสามารถพเศษ</q-tooltip>
</q-btn>
</div>
<q-item v-for="col in props.cols" :key="col.name"> <q-item v-for="col in props.cols" :key="col.name">
<q-item-section class="fix_top"> <q-item-section class="fix_top">
<q-item-label class="text-grey-6 text-weight-medium">{{ <q-item-label class="text-grey-6 text-weight-medium">{{
@ -385,5 +438,6 @@ onMounted(async () => {
.fix_top { .fix_top {
justify-content: start !important; justify-content: start !important;
margin-top: 10px;
} }
</style> </style>

View file

@ -220,6 +220,34 @@ function getHistory() {
}); });
} }
/**
* งกนโหลไฟลเอกสารหลกฐาน
* @param id รายการทองการโหลด
*/
async function onDownloadFile(id: string, profileId: string) {
showLoader();
await http
.get(
config.API.subFileByFileName(
"ทะเบียนประวัติ",
"ช่วยราชการ",
profileId,
id,
"เอกสารหลักฐาน"
)
)
.then(async (res) => {
const data = res.data;
window.open(data.downloadUrl, "_blank");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
function onSearch() { function onSearch() {
rows.value = onSearchDataTable( rows.value = onSearchDataTable(
filter.value, filter.value,
@ -302,6 +330,18 @@ onMounted(async () => {
</div> </div>
</q-td> </q-td>
<q-td auto-width> <q-td auto-width>
<q-btn
flat
dense
round
color="green"
size="14px"
icon="mdi-file-document-outline"
v-if="props.row.isUpload"
@click="onDownloadFile(props.row.id, props.row.profileId)"
>
<q-tooltip>ดาวนโหลด</q-tooltip>
</q-btn>
<q-btn <q-btn
color="info" color="info"
flat flat
@ -320,18 +360,31 @@ onMounted(async () => {
<div class="q-mb-xs col-xs-12 col-sm-6 col-md-4 col-lg-3"> <div class="q-mb-xs col-xs-12 col-sm-6 col-md-4 col-lg-3">
<q-card bordered flat> <q-card bordered flat>
<q-list dense class="q-mt-lg relative-position"> <q-list dense class="q-mt-lg relative-position">
<q-btn <div class="row absolute_button">
icon="mdi-history" <q-btn
color="info" flat
flat dense
dense round
round size="14px"
size="14px" color="green"
class="absolute_button" icon="mdi-file-document-outline"
@click="onHistory(props.row.id)" v-if="props.row.isUpload"
> @click="onDownloadFile(props.row.id, props.row.profileId)"
<q-tooltip>ประวแกไขรายการชวยราชการ</q-tooltip> >
</q-btn> <q-tooltip>ดาวนโหลด</q-tooltip>
</q-btn>
<q-btn
icon="mdi-history"
color="info"
flat
dense
round
size="14px"
@click="onHistory(props.row.id)"
>
<q-tooltip>ประวแกไขรายการชวยราชการ</q-tooltip>
</q-btn>
</div>
<q-item v-for="col in props.cols" :key="col.name"> <q-item v-for="col in props.cols" :key="col.name">
<q-item-section class="fix_top"> <q-item-section class="fix_top">
<q-item-label class="text-grey-6 text-weight-medium">{{ <q-item-label class="text-grey-6 text-weight-medium">{{
@ -369,5 +422,6 @@ onMounted(async () => {
.fix_top { .fix_top {
justify-content: start !important; justify-content: start !important;
margin-top: 10px;
} }
</style> </style>