ทะเบียนประวัติ ==> loadFile

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-03-18 15:23:57 +07:00
parent ba32db6123
commit 1e1395f88a
8 changed files with 352 additions and 75 deletions

View file

@ -6,6 +6,7 @@ import { ref, onMounted } from "vue";
import http from "@/plugins/http";
import config from "@/app.config";
import { useDataStore } from "@/stores/data";
import { useRegistryDataStore } from "@/modules/10_registry/store/Main";
import type { NopaidFormType } from "@/modules/10_registry/interface/index/Main";
@ -24,6 +25,7 @@ const mode = ref<boolean>($q.screen.gt.xs);
const mixin = useCounterMixin();
const { showLoader, hideLoader, messageError, date2Thai, onSearchDataTable } =
mixin;
const { getPathUploadFlie } = useRegistryDataStore();
const modalHistory = ref<boolean>(false);
/** ตัวแปรข้อมูล */
@ -218,6 +220,8 @@ const columnsHistory = ref<QTableProps["columns"]>([
},
]);
const fileGroup = ref<string>("เอกสารบันทึกวันที่ไม่ได้รับเงินเดือน");
function onHistory(id: string) {
modalHistory.value = true;
idByRow.value = id;
@ -261,6 +265,11 @@ function getHistory() {
});
}
async function onDownloadFile(id: string, profileId: string) {
const data = await getPathUploadFlie(fileGroup.value, profileId, id);
window.open(data.downloadUrl, "_blank");
}
function onSearch() {
rows.value = onSearchDataTable(
filter.value,
@ -331,6 +340,7 @@ onMounted(async () => {
<span class="text-weight-medium">{{ col.label }}</span>
</q-th>
<q-th auto-width />
<q-th auto-width />
</q-tr>
</template>
@ -347,6 +357,20 @@ onMounted(async () => {
{{ col.value ? col.value : "-" }}
</div>
</q-td>
<q-td auto-width>
<q-btn
v-if="props.row.isUpload"
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-td>
<q-td auto-width>
<q-btn
color="info"
@ -366,20 +390,33 @@ 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
<div class="row absolute_button">
<q-btn
v-if="props.row.isUpload"
color="green"
flat
dense
round
size="14px"
icon="mdi-file-document-outline"
@click="onDownloadFile(props.row.id, props.row.profileId)"
>
</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-section class="fix_top">
<q-item-label class="text-grey-6 text-weight-medium">{{
@ -398,6 +435,7 @@ onMounted(async () => {
</template>
</d-table>
</div>
<DialogHistory
v-model:modal="modalHistory"
:title="'ประวัติแก้ไขบันทึกวันที่ไม่ได้รับเงินเดือนฯ'"
@ -417,5 +455,6 @@ onMounted(async () => {
.fix_top {
justify-content: start !important;
margin-top: 10px;
}
</style>