เงืนเดือนค่าจ้่าง => แสเดงรายการทั้งหมด

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-04-26 10:48:47 +07:00
parent 40cbf40b6f
commit d04c6f30f5
6 changed files with 56 additions and 19 deletions

View file

@ -22,7 +22,6 @@ import config from "@/app.config";
const posTypeOp = ref<DataOption[]>([]); const posTypeOp = ref<DataOption[]>([]);
const posType = ref<string>(""); const posType = ref<string>("");
const maxPage = ref<number>(1);
const $q = useQuasar(); const $q = useQuasar();
const { const {
date2Thai, date2Thai,
@ -147,6 +146,8 @@ const formFilter = reactive({
pageSize: 10, pageSize: 10,
keyword: "", keyword: "",
}); });
const maxPage = ref<number>(1);
const totalList = ref<number>(0);
function filterFn() { function filterFn() {
formFilter.page = 1; formFilter.page = 1;
@ -171,7 +172,7 @@ function getData() {
) )
.then((res) => { .then((res) => {
const data = res.data.result.data; const data = res.data.result.data;
const total = res.data.result.total; totalList.value = res.data.result.total;
maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize); maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize);
rows.value = data.map((item: ResponseData) => ({ rows.value = data.map((item: ResponseData) => ({
id: item.id, id: item.id,
@ -271,7 +272,10 @@ onMounted(() => {
<template v-if="posType" v-slot:append> <template v-if="posType" v-slot:append>
<q-icon <q-icon
name="cancel" name="cancel"
@click.stop.prevent="posType = '';getData()" @click.stop.prevent="
posType = '';
getData();
"
class="cursor-pointer" class="cursor-pointer"
/> />
</template> </template>
@ -409,6 +413,7 @@ onMounted(() => {
</q-tr> </q-tr>
</template> </template>
<template v-slot:pagination="scope"> <template v-slot:pagination="scope">
งหมด {{ totalList }} รายการ
<q-pagination <q-pagination
v-model="formFilter.page" v-model="formFilter.page"
active-color="primary" active-color="primary"

View file

@ -39,6 +39,7 @@ const formFilter = reactive<FormFilter>({
keyword: "", keyword: "",
}); });
const maxPage = ref<number>(1); const maxPage = ref<number>(1);
const totalList = ref<number>(0);
/** ข้อมูล Table*/ /** ข้อมูล Table*/
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
@ -119,6 +120,7 @@ function fetchListChart() {
) )
.then((res) => { .then((res) => {
rows.value = res.data.result.data; rows.value = res.data.result.data;
totalList.value = res.data.result.total;
maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize); maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize);
}) })
.catch((err) => { .catch((err) => {
@ -349,6 +351,7 @@ onMounted(() => {
</q-tr> </q-tr>
</template> </template>
<template v-slot:pagination="scope"> <template v-slot:pagination="scope">
งหมด {{ totalList }} รายการ
<q-pagination <q-pagination
v-model="formFilter.page" v-model="formFilter.page"
active-color="primary" active-color="primary"

View file

@ -483,6 +483,7 @@ function redirectToPage(id: string, status: string) {
bordered bordered
dense dense
class="custom-header-table" class="custom-header-table"
:rows-per-page-options="[10, 25, 50, 100, 500]"
:visible-columns="visibleColumns" :visible-columns="visibleColumns"
v-model:pagination="pagination" v-model:pagination="pagination"
> >

View file

@ -100,6 +100,7 @@ const formFilter = reactive<FormFilter>({
keyword: "", keyword: "",
}); });
const maxPage = ref<number>(1); const maxPage = ref<number>(1);
const totalList = ref<number>(0);
const pagination = ref({ const pagination = ref({
page: formFilter.page, page: formFilter.page,
@ -127,6 +128,7 @@ function fetchSalalyEmployeeRate() {
.then((res) => { .then((res) => {
rows.value = res.data.result.data; rows.value = res.data.result.data;
maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize); maxPage.value = Math.ceil(res.data.result.total / formFilter.pageSize);
totalList.value = res.data.result.total;
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
@ -346,6 +348,7 @@ onMounted(() => {
</q-tr> </q-tr>
</template> </template>
<template v-slot:pagination="scope"> <template v-slot:pagination="scope">
งหมด {{ totalList }} รายการ
<q-pagination <q-pagination
v-model="formFilter.page" v-model="formFilter.page"
active-color="primary" active-color="primary"

View file

@ -33,7 +33,7 @@ const {
hideLoader, hideLoader,
} = useCounterMixin(); } = useCounterMixin();
const isActive = ref<boolean>(false) const isActive = ref<boolean>(false);
const salaryId = ref<string>(route.params.id.toString()); const salaryId = ref<string>(route.params.id.toString());
/** modalDialog*/ /** modalDialog*/
@ -121,7 +121,8 @@ const formQuery = reactive<FormQuerySalary>({
pageSize: 100, //* pageSize: 100, //*
keyword: "", //keyword keyword: "", //keyword
}); });
const totalRow = ref<number>(1); const maxPage = ref<number>(1);
const totalRow = ref<number>(0);
async function fetchListSalalyRate() { async function fetchListSalalyRate() {
showLoader(); showLoader();
@ -134,7 +135,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); maxPage.value = Math.ceil(res.data.result.total / formQuery.pageSize);
totalRow.value = res.data.result.total;
rows.value = res.data.result.data; rows.value = res.data.result.data;
}) })
@ -202,14 +204,14 @@ function clickDownload() {
hideLoader(); hideLoader();
}); });
} }
function fetchList(){ function fetchList() {
http http
.get(config.API.salaryChartByid(salaryId.value)) .get(config.API.salaryChartByid(salaryId.value))
.then((res)=>{ .then((res) => {
isActive.value = res.data.result.isActive isActive.value = res.data.result.isActive;
}) })
.catch((e)=>{}) .catch((e) => {})
.finally(()=>{}) .finally(() => {});
} }
onMounted(async () => { onMounted(async () => {
await fetchList(); await fetchList();
@ -240,7 +242,7 @@ watch([() => formQuery.page, () => formQuery.pageSize], async () => {
<q-card flat bordered class="q-pa-md"> <q-card flat bordered class="q-pa-md">
<div class="col-12 row"> <div class="col-12 row">
<q-btn <q-btn
v-if="!isActive" v-if="!isActive"
flat flat
round round
dense dense
@ -285,7 +287,12 @@ watch([() => formQuery.page, () => formQuery.pageSize], async () => {
</template> </template>
<template v-slot:body="props"> <template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer"> <q-tr :props="props" class="cursor-pointer">
<q-td v-for="col in props.cols" :key="col.name" :props="props" :class="props.row.isNext === true ? 'text-edit text-bold':''"> <q-td
v-for="col in props.cols"
:key="col.name"
:props="props"
:class="props.row.isNext === true ? 'text-edit text-bold' : ''"
>
<div v-if="col.name == 'no'"> <div v-if="col.name == 'no'">
{{ {{
(formQuery.page - 1) * formQuery.pageSize + props.rowIndex + 1 (formQuery.page - 1) * formQuery.pageSize + props.rowIndex + 1
@ -335,7 +342,7 @@ watch([() => formQuery.page, () => formQuery.pageSize], async () => {
</q-td> </q-td>
<q-td> <q-td>
<q-btn <q-btn
v-if="!isActive" v-if="!isActive"
flat flat
dense dense
icon="mdi-dots-vertical" icon="mdi-dots-vertical"
@ -376,11 +383,12 @@ watch([() => formQuery.page, () => formQuery.pageSize], async () => {
</q-tr> </q-tr>
</template> </template>
<template v-slot:pagination="scope"> <template v-slot:pagination="scope">
งหมด {{ totalRow }} รายการ
<q-pagination <q-pagination
v-model="formQuery.page" v-model="formQuery.page"
active-color="primary" active-color="primary"
color="dark" color="dark"
:max="totalRow" :max="maxPage"
size="sm" size="sm"
boundary-links boundary-links
direction-links direction-links

View file

@ -1,6 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { getDateMeta } from "@fullcalendar/core/internal"; import { ref, watch, onMounted } from "vue";
import { ref, reactive, onMounted } from "vue";
import { useSalaryDataStore } from "@/modules/13_salary/store/SalaryStore"; import { useSalaryDataStore } from "@/modules/13_salary/store/SalaryStore";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import type { QTableProps } from "quasar"; import type { QTableProps } from "quasar";
@ -37,6 +36,7 @@ const effectiveDate = ref<Date | null>(null);
const yearData = ref<number | null>(0); const yearData = ref<number | null>(0);
const maxPage = ref<number>(1); const maxPage = ref<number>(1);
const totalList = ref<number>(0);
const currentPage = ref<number>(1); const currentPage = ref<number>(1);
const page = ref<number>(1); const page = ref<number>(1);
@ -128,6 +128,7 @@ function getData() {
.then((res) => { .then((res) => {
dataStore.fetchDataMap(res.data.result.data); dataStore.fetchDataMap(res.data.result.data);
maxPage.value = Math.ceil(res.data.result.total / rowsPerPage.value); maxPage.value = Math.ceil(res.data.result.total / rowsPerPage.value);
totalList.value = res.data.result.total;
}) })
.catch((e) => { .catch((e) => {
messageError($q, e); messageError($q, e);
@ -137,6 +138,7 @@ function getData() {
}); });
} }
function dataUpdate() { function dataUpdate() {
page.value = 1;
getData(); getData();
} }
/** set ปี ทั้งหมด */ /** set ปี ทั้งหมด */
@ -211,6 +213,18 @@ onMounted(async () => {
dataStore.visibleColumns = visibleColumns.value; dataStore.visibleColumns = visibleColumns.value;
dataStore.columns = columns.value; dataStore.columns = columns.value;
}); });
function updatePageSize(newPagination: any) {
page.value = 1;
rowsPerPage.value = newPagination.rowsPerPage;
}
watch(
() => rowsPerPage.value,
() => {
getData();
}
);
</script> </script>
<template> <template>
@ -330,8 +344,10 @@ onMounted(async () => {
:visible-columns="dataStore.visibleColumns" :visible-columns="dataStore.visibleColumns"
v-model:pagination="pagination" v-model:pagination="pagination"
:rows-per-page-options="[10, 25, 50, 100]" :rows-per-page-options="[10, 25, 50, 100]"
@update:pagination="updatePageSize"
> >
<template v-slot:pagination="scope"> <template v-slot:pagination="scope">
งหมด {{ totalList }} รายการ
<q-pagination <q-pagination
v-model="currentPage" v-model="currentPage"
active-color="primary" active-color="primary"
@ -340,6 +356,7 @@ onMounted(async () => {
size="sm" size="sm"
boundary-links boundary-links
direction-links direction-links
@update:model-value="getData"
></q-pagination> ></q-pagination>
</template> </template>
<template v-slot:header="props"> <template v-slot:header="props">