แก้รายการลา

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'">

View file

@ -10,7 +10,7 @@ interface QuerySting {
type: string; //*Id ประเภทการลา
status: string; //*สถานะการของลา
page: number; //*หน้า
pageSize: number; //*จำนวนแถวต่อหน้า
rowsPerPage: number; //*จำนวนแถวต่อหน้า
keyword: string; //keyword ค้นหา
profileType: string;
sortBy?: string;

View file

@ -31,7 +31,7 @@ export const useLeavelistDataStore = defineStore("leave", () => {
/**ข้อมูลใน Table*/
const mainData = ref<any>([]);
const rows = ref<DataRows[]>([]);
const rows = ref<any[]>([]);
const columns = ref<QTableProps["columns"]>([]);
const visibleColumns = ref<string[]>([]);
@ -70,7 +70,7 @@ export const useLeavelistDataStore = defineStore("leave", () => {
status: e.status && convertSatatus(e.status),
}));
mainData.value = datalist;
rows.value = mainData.value;
rows.value = datalist;
}
/**
@ -173,7 +173,7 @@ export const useLeavelistDataStore = defineStore("leave", () => {
dataToobar.value = val.map((e: any) => ({
id: e.id,
name: e.name,
code:e.code
code: e.code,
}));
}