แก้รายการลา

This commit is contained in:
setthawutttty 2025-04-04 14:33:20 +07:00
parent fe30256a6b
commit dec7214200
5 changed files with 26 additions and 20 deletions

View file

@ -28,9 +28,7 @@ const querySting = ref<QuerySting>({
type: leaveStore.filter.type, //*Id
status: leaveStore.filter.status, //*
page: 1, //*
pageSize: 10, //*
sortBy: "dateSendLeave",
descending: true,
rowsPerPage: 10,
keyword: leaveStore.filter.keyword, //keyword
profileType: "ALL", //profileType
});
@ -47,13 +45,18 @@ async function fecthLeaveList() {
: querySting.value.type);
if (querySting.value.status != null && querySting.value.type != null) {
// rowsPerPage
const { rowsPerPage, ...queryStingData } = querySting.value;
showLoader();
await http
.post(config.API.leaveList(), querySting.value)
.post(config.API.leaveList(), {
...queryStingData,
pageSize: querySting.value.rowsPerPage,
})
.then(async (res) => {
const data = res.data.result;
const data = await res.data.result;
totalList.value = Math.ceil(
res.data.result.total / querySting.value.pageSize
res.data.result.total / querySting.value.rowsPerPage
);
total.value = res.data.result.total;
await leaveStore.fetchListLeave(data.data); /** ส่งข้อมูลไป stores*/
@ -87,7 +90,7 @@ function getSearch() {
}
watch(
() => querySting.value.pageSize,
() => querySting.value.rowsPerPage,
async () => {
getSearch();
}

View file

@ -30,9 +30,7 @@ const querySting = ref<QuerySting>({
type: leaveStore.filter.type, //*Id
status: leaveStore.filter.status, //*
page: 1, //*
pageSize: 10, //*
sortBy: "dateSendLeave",
descending: true,
rowsPerPage: 10, //*
keyword: leaveStore.filter.keyword, //keyword
profileType: "ALL", //profileType
});
@ -48,13 +46,17 @@ async function fecthLeaveList() {
: querySting.value.type);
if (querySting.value.status != null && querySting.value.type != null) {
const { rowsPerPage, ...queryStingData } = querySting.value;
showLoader();
await http
.post(config.API.leaveListDelete(), querySting.value)
.post(config.API.leaveList(), {
...queryStingData,
pageSize: querySting.value.rowsPerPage,
})
.then((res) => {
const data = res.data.result;
totalList.value = Math.ceil(
res.data.result.total / querySting.value.pageSize
res.data.result.total / querySting.value.rowsPerPage
);
total.value = res.data.result.total;
fetchListLeaveReject(data.data); /** ส่งข้อมูลไป stores*/
@ -88,7 +90,7 @@ function getSearch() {
}
watch(
() => querySting.value.pageSize,
() => querySting.value.rowsPerPage,
async () => {
getSearch();
}

View file

@ -236,7 +236,7 @@ function redirectToDetail(id: string) {
function updatePagination(newPagination: any) {
pagination.value.page = 1;
pagination.value.pageSize = newPagination.rowsPerPage;
pagination.value.rowsPerPage = newPagination.rowsPerPage;
}
/**
@ -280,7 +280,6 @@ onMounted(() => {
:paging="true"
dense
class="custom-header-table"
v-model:pagination="pagination"
:visible-columns="leaveStore.visibleColumns"
:rows-per-page-options="[10, 25, 50, 100]"
@update:pagination="updatePagination"
@ -311,7 +310,9 @@ onMounted(() => {
<q-td v-for="col in props.cols" :key="col.name" :props="props">
<div v-if="col.name == 'no'">
{{
(pagination.page - 1) * pagination.pageSize + props.rowIndex + 1
(pagination.page - 1) * pagination.rowsPerPage +
props.rowIndex +
1
}}
</div>
<div v-else-if="col.name == 'leaveTypeName'">