เพิ่ม API รายการลา
This commit is contained in:
parent
e8bcbe5fff
commit
3546ce0ebc
3 changed files with 29 additions and 8 deletions
|
|
@ -16,4 +16,9 @@ export default {
|
||||||
specialTime: () => `${leave}/admin/edit`,
|
specialTime: () => `${leave}/admin/edit`,
|
||||||
specialTimeApprove: (id: string) => `${leave}/admin/edit/approve/${id}`,
|
specialTimeApprove: (id: string) => `${leave}/admin/edit/approve/${id}`,
|
||||||
specialTimeReject: (id: string) => `${leave}/admin/edit/reject/${id}`,
|
specialTimeReject: (id: string) => `${leave}/admin/edit/reject/${id}`,
|
||||||
|
|
||||||
|
/** รายการลา*/
|
||||||
|
leaveType: () => `${leave}/type`,
|
||||||
|
leaveList: () => `${leave}/admin`,
|
||||||
|
leaveListById: (id: string) => `${leave}/admin/${id}`,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, onMounted } from "vue";
|
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 { DateFilter } from "@/modules/09_leave/interface/request/leave";
|
||||||
import type {
|
import type {
|
||||||
|
|
@ -106,6 +108,14 @@ const optionStatusMain = ref<DataOption[]>(
|
||||||
|
|
||||||
async function fetchOption() {
|
async function fetchOption() {
|
||||||
console.log("loadOption รอ API");
|
console.log("loadOption รอ API");
|
||||||
|
// await http
|
||||||
|
// .get(config.API.leaveType())
|
||||||
|
// .then((res) => {
|
||||||
|
// console.log(res);
|
||||||
|
// })
|
||||||
|
// .catch((err) => {
|
||||||
|
// console.log(err);
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -69,12 +69,13 @@ function resetFilter() {
|
||||||
filterRef.value.focus();
|
filterRef.value.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateRowsPerPage(newPagination: any) {
|
||||||
|
pagination.value = newPagination;
|
||||||
|
currentPage.value = 1;
|
||||||
|
}
|
||||||
|
|
||||||
function filterFn() {
|
function filterFn() {
|
||||||
updatePaging(
|
updatePaging(1, Number(pagination.value.rowsPerPage), filter.value);
|
||||||
currentPage.value,
|
|
||||||
Number(pagination.value.rowsPerPage),
|
|
||||||
filter.value
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function updatePaging(p: number, pS: number, key: string) {
|
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], () => {
|
watch([() => currentPage.value, () => pagination.value.rowsPerPage], () => {
|
||||||
filterFn();
|
emit(
|
||||||
|
"update:queryString",
|
||||||
|
currentPage.value,
|
||||||
|
Number(pagination.value.rowsPerPage),
|
||||||
|
filter.value
|
||||||
|
);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -109,7 +115,6 @@ watch([() => currentPage.value, () => pagination.value.rowsPerPage], () => {
|
||||||
ref="filterRef"
|
ref="filterRef"
|
||||||
@keydown.enter.prevent="filterFn"
|
@keydown.enter.prevent="filterFn"
|
||||||
outlined
|
outlined
|
||||||
debounce="300"
|
|
||||||
placeholder="ค้นหา"
|
placeholder="ค้นหา"
|
||||||
style="max-width: 200px"
|
style="max-width: 200px"
|
||||||
class="col-xs-12 col-sm-3 col-md-2"
|
class="col-xs-12 col-sm-3 col-md-2"
|
||||||
|
|
@ -148,8 +153,9 @@ watch([() => currentPage.value, () => pagination.value.rowsPerPage], () => {
|
||||||
virtual-scroll
|
virtual-scroll
|
||||||
:virtual-scroll-sticky-size-start="48"
|
:virtual-scroll-sticky-size-start="48"
|
||||||
dense
|
dense
|
||||||
v-model:pagination="pagination"
|
|
||||||
:rows-per-page-options="[10, 25, 50, 100]"
|
:rows-per-page-options="[10, 25, 50, 100]"
|
||||||
|
:pagination="pagination"
|
||||||
|
@update:pagination="updateRowsPerPage"
|
||||||
>
|
>
|
||||||
<template v-slot:header="props">
|
<template v-slot:header="props">
|
||||||
<q-tr :props="props">
|
<q-tr :props="props">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue