เงินเดือน => อัตราเงินเดือน แก้ไข Pagination

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-02-22 11:46:56 +07:00
parent 4ae9b4a036
commit 4a36e1b4ad

View file

@ -4,7 +4,7 @@ import { useQuasar } from "quasar";
import { useRouter, useRoute } from "vue-router"; import { useRouter, useRoute } from "vue-router";
import http from "@/plugins/http"; import http from "@/plugins/http";
import config from "@/app.config"; import config from "@/app.config";
import genReportXLSX from '@/plugins/genreportxlsx' import genReportXLSX from "@/plugins/genreportxlsx";
/** importType*/ /** importType*/
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
import type { import type {
@ -132,6 +132,8 @@ async function fetchListSalalyRate() {
`?page=${page}&pageSize=${pageSize}&keyword=${keyword}` `?page=${page}&pageSize=${pageSize}&keyword=${keyword}`
) )
.then((res) => { .then((res) => {
totalRow.value = Math.ceil(res.data.result.total / formQuery.pageSize);
rows.value = res.data.result.data; rows.value = res.data.result.data;
}) })
.catch((err) => { .catch((err) => {
@ -178,19 +180,20 @@ function onClickDelete(id: string) {
}); });
} }
function clickDownload(){ function clickDownload() {
showLoader() showLoader();
http http
.get(config.API.salaryReportByid(salaryId.value)) .get(config.API.salaryReportByid(salaryId.value))
.then((res)=>{ .then((res) => {
const dataList = res.data.result const dataList = res.data.result;
genReportXLSX(dataList,'อัตราเงินเดือน') genReportXLSX(dataList, "อัตราเงินเดือน");
}) })
.catch((e)=>{ .catch((e) => {
messageError($q,e) messageError($q, e);
}).finally(()=>{ })
hideLoader() .finally(() => {
}) hideLoader();
});
} }
onMounted(async () => { onMounted(async () => {
await fetchListSalalyRate(); await fetchListSalalyRate();
@ -231,7 +234,13 @@ watch([() => formQuery.page, () => formQuery.pageSize], async () => {
</q-btn> </q-btn>
<q-space /> <q-space />
<!-- <q-btn outline label="พิมพ์เอกสาร" icon="print" color="green" /> --> <!-- <q-btn outline label="พิมพ์เอกสาร" icon="print" color="green" /> -->
<q-btn outline label="ดาวน์โหลด" icon="download" color="blue" @click="clickDownload()"/> <q-btn
outline
label="ดาวน์โหลด"
icon="download"
color="blue"
@click="clickDownload()"
/>
</div> </div>
<div class="col-12 q-pt-sm"> <div class="col-12 q-pt-sm">
@ -260,9 +269,7 @@ watch([() => formQuery.page, () => formQuery.pageSize], async () => {
<q-td v-for="col in props.cols" :key="col.name" :props="props"> <q-td v-for="col in props.cols" :key="col.name" :props="props">
<div v-if="col.name == 'no'"> <div v-if="col.name == 'no'">
{{ {{
(formQuery.page - 1) * formQuery.pageSize + (formQuery.page - 1) * formQuery.pageSize + props.rowIndex + 1
props.rowIndex +
1
}} }}
</div> </div>
<div v-else-if="col.name === 'salaryHalf'"> <div v-else-if="col.name === 'salaryHalf'">