เพิ่ม API รายการลา

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2023-11-29 15:59:17 +07:00
parent e8bcbe5fff
commit 3546ce0ebc
3 changed files with 29 additions and 8 deletions

View file

@ -16,4 +16,9 @@ export default {
specialTime: () => `${leave}/admin/edit`,
specialTimeApprove: (id: string) => `${leave}/admin/edit/approve/${id}`,
specialTimeReject: (id: string) => `${leave}/admin/edit/reject/${id}`,
/** รายการลา*/
leaveType: () => `${leave}/type`,
leaveList: () => `${leave}/admin`,
leaveListById: (id: string) => `${leave}/admin/${id}`,
};

View file

@ -1,5 +1,7 @@
<script setup lang="ts">
import { ref, reactive, onMounted } from "vue";
import http from "@/plugins/http";
import config from "@/app.config";
import type { DateFilter } from "@/modules/09_leave/interface/request/leave";
import type {
@ -106,6 +108,14 @@ const optionStatusMain = ref<DataOption[]>(
async function fetchOption() {
console.log("loadOption รอ API");
// await http
// .get(config.API.leaveType())
// .then((res) => {
// console.log(res);
// })
// .catch((err) => {
// console.log(err);
// });
}
/**

View file

@ -69,12 +69,13 @@ function resetFilter() {
filterRef.value.focus();
}
function updateRowsPerPage(newPagination: any) {
pagination.value = newPagination;
currentPage.value = 1;
}
function filterFn() {
updatePaging(
currentPage.value,
Number(pagination.value.rowsPerPage),
filter.value
);
updatePaging(1, Number(pagination.value.rowsPerPage), filter.value);
}
function updatePaging(p: number, pS: number, key: string) {
@ -82,7 +83,12 @@ function updatePaging(p: number, pS: number, key: string) {
}
watch([() => currentPage.value, () => pagination.value.rowsPerPage], () => {
filterFn();
emit(
"update:queryString",
currentPage.value,
Number(pagination.value.rowsPerPage),
filter.value
);
});
</script>
@ -109,7 +115,6 @@ watch([() => currentPage.value, () => pagination.value.rowsPerPage], () => {
ref="filterRef"
@keydown.enter.prevent="filterFn"
outlined
debounce="300"
placeholder="ค้นหา"
style="max-width: 200px"
class="col-xs-12 col-sm-3 col-md-2"
@ -148,8 +153,9 @@ watch([() => currentPage.value, () => pagination.value.rowsPerPage], () => {
virtual-scroll
:virtual-scroll-sticky-size-start="48"
dense
v-model:pagination="pagination"
:rows-per-page-options="[10, 25, 50, 100]"
:pagination="pagination"
@update:pagination="updateRowsPerPage"
>
<template v-slot:header="props">
<q-tr :props="props">