แก้รายการลา
This commit is contained in:
parent
fe30256a6b
commit
dec7214200
5 changed files with 26 additions and 20 deletions
|
|
@ -28,9 +28,7 @@ const querySting = ref<QuerySting>({
|
||||||
type: leaveStore.filter.type, //*Id ประเภทการลา
|
type: leaveStore.filter.type, //*Id ประเภทการลา
|
||||||
status: leaveStore.filter.status, //*สถานะการของลา
|
status: leaveStore.filter.status, //*สถานะการของลา
|
||||||
page: 1, //*สถานะการของลา
|
page: 1, //*สถานะการของลา
|
||||||
pageSize: 10, //*สถานะการของลา
|
rowsPerPage: 10,
|
||||||
sortBy: "dateSendLeave",
|
|
||||||
descending: true,
|
|
||||||
keyword: leaveStore.filter.keyword, //keyword ค้นหา
|
keyword: leaveStore.filter.keyword, //keyword ค้นหา
|
||||||
profileType: "ALL", //profileType
|
profileType: "ALL", //profileType
|
||||||
});
|
});
|
||||||
|
|
@ -47,13 +45,18 @@ async function fecthLeaveList() {
|
||||||
: querySting.value.type);
|
: querySting.value.type);
|
||||||
|
|
||||||
if (querySting.value.status != null && querySting.value.type != null) {
|
if (querySting.value.status != null && querySting.value.type != null) {
|
||||||
|
// เอาฟิลrowsPerPage ออก
|
||||||
|
const { rowsPerPage, ...queryStingData } = querySting.value;
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.post(config.API.leaveList(), querySting.value)
|
.post(config.API.leaveList(), {
|
||||||
|
...queryStingData,
|
||||||
|
pageSize: querySting.value.rowsPerPage,
|
||||||
|
})
|
||||||
.then(async (res) => {
|
.then(async (res) => {
|
||||||
const data = res.data.result;
|
const data = await res.data.result;
|
||||||
totalList.value = Math.ceil(
|
totalList.value = Math.ceil(
|
||||||
res.data.result.total / querySting.value.pageSize
|
res.data.result.total / querySting.value.rowsPerPage
|
||||||
);
|
);
|
||||||
total.value = res.data.result.total;
|
total.value = res.data.result.total;
|
||||||
await leaveStore.fetchListLeave(data.data); /** ส่งข้อมูลไป stores*/
|
await leaveStore.fetchListLeave(data.data); /** ส่งข้อมูลไป stores*/
|
||||||
|
|
@ -87,7 +90,7 @@ function getSearch() {
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => querySting.value.pageSize,
|
() => querySting.value.rowsPerPage,
|
||||||
async () => {
|
async () => {
|
||||||
getSearch();
|
getSearch();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,9 +30,7 @@ const querySting = ref<QuerySting>({
|
||||||
type: leaveStore.filter.type, //*Id ประเภทการลา
|
type: leaveStore.filter.type, //*Id ประเภทการลา
|
||||||
status: leaveStore.filter.status, //*สถานะการของลา
|
status: leaveStore.filter.status, //*สถานะการของลา
|
||||||
page: 1, //*สถานะการของลา
|
page: 1, //*สถานะการของลา
|
||||||
pageSize: 10, //*สถานะการของลา
|
rowsPerPage: 10, //*สถานะการของลา
|
||||||
sortBy: "dateSendLeave",
|
|
||||||
descending: true,
|
|
||||||
keyword: leaveStore.filter.keyword, //keyword ค้นหา
|
keyword: leaveStore.filter.keyword, //keyword ค้นหา
|
||||||
profileType: "ALL", //profileType
|
profileType: "ALL", //profileType
|
||||||
});
|
});
|
||||||
|
|
@ -48,13 +46,17 @@ async function fecthLeaveList() {
|
||||||
: querySting.value.type);
|
: querySting.value.type);
|
||||||
|
|
||||||
if (querySting.value.status != null && querySting.value.type != null) {
|
if (querySting.value.status != null && querySting.value.type != null) {
|
||||||
|
const { rowsPerPage, ...queryStingData } = querySting.value;
|
||||||
showLoader();
|
showLoader();
|
||||||
await http
|
await http
|
||||||
.post(config.API.leaveListDelete(), querySting.value)
|
.post(config.API.leaveList(), {
|
||||||
|
...queryStingData,
|
||||||
|
pageSize: querySting.value.rowsPerPage,
|
||||||
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
const data = res.data.result;
|
const data = res.data.result;
|
||||||
totalList.value = Math.ceil(
|
totalList.value = Math.ceil(
|
||||||
res.data.result.total / querySting.value.pageSize
|
res.data.result.total / querySting.value.rowsPerPage
|
||||||
);
|
);
|
||||||
total.value = res.data.result.total;
|
total.value = res.data.result.total;
|
||||||
fetchListLeaveReject(data.data); /** ส่งข้อมูลไป stores*/
|
fetchListLeaveReject(data.data); /** ส่งข้อมูลไป stores*/
|
||||||
|
|
@ -88,7 +90,7 @@ function getSearch() {
|
||||||
}
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => querySting.value.pageSize,
|
() => querySting.value.rowsPerPage,
|
||||||
async () => {
|
async () => {
|
||||||
getSearch();
|
getSearch();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -236,7 +236,7 @@ function redirectToDetail(id: string) {
|
||||||
|
|
||||||
function updatePagination(newPagination: any) {
|
function updatePagination(newPagination: any) {
|
||||||
pagination.value.page = 1;
|
pagination.value.page = 1;
|
||||||
pagination.value.pageSize = newPagination.rowsPerPage;
|
pagination.value.rowsPerPage = newPagination.rowsPerPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -280,7 +280,6 @@ onMounted(() => {
|
||||||
:paging="true"
|
:paging="true"
|
||||||
dense
|
dense
|
||||||
class="custom-header-table"
|
class="custom-header-table"
|
||||||
v-model:pagination="pagination"
|
|
||||||
:visible-columns="leaveStore.visibleColumns"
|
:visible-columns="leaveStore.visibleColumns"
|
||||||
:rows-per-page-options="[10, 25, 50, 100]"
|
:rows-per-page-options="[10, 25, 50, 100]"
|
||||||
@update:pagination="updatePagination"
|
@update:pagination="updatePagination"
|
||||||
|
|
@ -311,7 +310,9 @@ onMounted(() => {
|
||||||
<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'">
|
||||||
{{
|
{{
|
||||||
(pagination.page - 1) * pagination.pageSize + props.rowIndex + 1
|
(pagination.page - 1) * pagination.rowsPerPage +
|
||||||
|
props.rowIndex +
|
||||||
|
1
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
<div v-else-if="col.name == 'leaveTypeName'">
|
<div v-else-if="col.name == 'leaveTypeName'">
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ interface QuerySting {
|
||||||
type: string; //*Id ประเภทการลา
|
type: string; //*Id ประเภทการลา
|
||||||
status: string; //*สถานะการของลา
|
status: string; //*สถานะการของลา
|
||||||
page: number; //*หน้า
|
page: number; //*หน้า
|
||||||
pageSize: number; //*จำนวนแถวต่อหน้า
|
rowsPerPage: number; //*จำนวนแถวต่อหน้า
|
||||||
keyword: string; //keyword ค้นหา
|
keyword: string; //keyword ค้นหา
|
||||||
profileType: string;
|
profileType: string;
|
||||||
sortBy?: string;
|
sortBy?: string;
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ export const useLeavelistDataStore = defineStore("leave", () => {
|
||||||
|
|
||||||
/**ข้อมูลใน Table*/
|
/**ข้อมูลใน Table*/
|
||||||
const mainData = ref<any>([]);
|
const mainData = ref<any>([]);
|
||||||
const rows = ref<DataRows[]>([]);
|
const rows = ref<any[]>([]);
|
||||||
const columns = ref<QTableProps["columns"]>([]);
|
const columns = ref<QTableProps["columns"]>([]);
|
||||||
const visibleColumns = ref<string[]>([]);
|
const visibleColumns = ref<string[]>([]);
|
||||||
|
|
||||||
|
|
@ -70,7 +70,7 @@ export const useLeavelistDataStore = defineStore("leave", () => {
|
||||||
status: e.status && convertSatatus(e.status),
|
status: e.status && convertSatatus(e.status),
|
||||||
}));
|
}));
|
||||||
mainData.value = datalist;
|
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) => ({
|
dataToobar.value = val.map((e: any) => ({
|
||||||
id: e.id,
|
id: e.id,
|
||||||
name: e.name,
|
name: e.name,
|
||||||
code:e.code
|
code: e.code,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue