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

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 () => {
link.value = await dataStore.getProFileType();
await getData();
@ -316,7 +344,19 @@ onMounted(async () => {
{{ col.value ? col.value : "-" }}
</div>
</q-td>
<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
color="info"
flat
@ -336,18 +376,31 @@ onMounted(async () => {
<div class="q-mb-xs col-xs-12 col-sm-6 col-md-4 col-lg-3">
<q-card bordered flat>
<q-list dense class="q-mt-lg relative-position">
<q-btn
icon="mdi-history"
color="info"
flat
dense
round
size="14px"
class="absolute_button"
@click="onHistory(props.row.id)"
>
<q-tooltip>ประวแกไขความสามารถพเศษ</q-tooltip>
</q-btn>
<div class="row absolute_button">
<q-btn
v-if="props.row.isUpload == true"
color="green"
flat
dense
round
size="14px"
icon="mdi-file-document-outline"
@click="onDownloadFile(props.row.id, props.row.profileId)"
>
<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-section class="fix_top">
<q-item-label class="text-grey-6 text-weight-medium">{{
@ -385,5 +438,6 @@ onMounted(async () => {
.fix_top {
justify-content: start !important;
margin-top: 10px;
}
</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() {
rows.value = onSearchDataTable(
filter.value,
@ -302,6 +330,18 @@ onMounted(async () => {
</div>
</q-td>
<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
color="info"
flat
@ -320,18 +360,31 @@ onMounted(async () => {
<div class="q-mb-xs col-xs-12 col-sm-6 col-md-4 col-lg-3">
<q-card bordered flat>
<q-list dense class="q-mt-lg relative-position">
<q-btn
icon="mdi-history"
color="info"
flat
dense
round
size="14px"
class="absolute_button"
@click="onHistory(props.row.id)"
>
<q-tooltip>ประวแกไขรายการชวยราชการ</q-tooltip>
</q-btn>
<div class="row absolute_button">
<q-btn
flat
dense
round
size="14px"
color="green"
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
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-section class="fix_top">
<q-item-label class="text-grey-6 text-weight-medium">{{
@ -369,5 +422,6 @@ onMounted(async () => {
.fix_top {
justify-content: start !important;
margin-top: 10px;
}
</style>