fix CurrentPage ===> อัตราค่าจ้าง
This commit is contained in:
parent
1513eecd15
commit
c9f699bbcf
1 changed files with 41 additions and 25 deletions
|
|
@ -4,6 +4,7 @@ import { useQuasar } from "quasar";
|
|||
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import { checkPermission } from "@/utils/permissions";
|
||||
import { updateCurrentPage } from "@/utils/function";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
|
@ -110,9 +111,7 @@ const itemMenu = ref<ItemsMenu[]>([
|
|||
const isActive = ref<boolean>(false); //สถานะการใช้งาน
|
||||
const groupSalary = ref<string>(""); //ชื่ออัตราค่าจ้าง
|
||||
|
||||
/**
|
||||
* fetch ข้อมูลอัตราค่าจ้าง
|
||||
*/
|
||||
/** ฟังก์ชันดึงข้อมูลรายละเอียดอัตราค่าจ้าง */
|
||||
async function fetchDataDetail() {
|
||||
await http
|
||||
.get(config.API.salaryEmployeeChartByid(salaryEmployeeId.value))
|
||||
|
|
@ -125,11 +124,8 @@ async function fetchDataDetail() {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* fetch อัตราค่าจ้าง
|
||||
*/
|
||||
async function fetchSalalyEmployeeRate() {
|
||||
showLoader();
|
||||
/** ฟังก์ชันดึงข้อมูลรายการอัตราค่าจ้าง */
|
||||
async function fetchSalaryEmployeeRate() {
|
||||
await http
|
||||
.get(
|
||||
config.API.salaryEmployeeRateListByid(salaryEmployeeId.value) +
|
||||
|
|
@ -143,9 +139,6 @@ async function fetchSalalyEmployeeRate() {
|
|||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -169,7 +162,12 @@ function onDelete(id: string) {
|
|||
http
|
||||
.delete(config.API.salaryEmployeeRateListByid(id))
|
||||
.then(async () => {
|
||||
await fetchSalalyEmployeeRate();
|
||||
formFilter.page = await updateCurrentPage(
|
||||
formFilter.page,
|
||||
maxPage.value,
|
||||
rows.value.length
|
||||
);
|
||||
await fetchSalaryEmployeeRate();
|
||||
await success($q, "ลบข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
@ -181,9 +179,7 @@ function onDelete(id: string) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* เพิ่มข้อมูลรายการอัตราค่าจ้าง
|
||||
*/
|
||||
/** ฟังก์ชันเปิด Popup เพิ่มข้อมูลรายการอัตราค่าจ้าง */
|
||||
function onClickAdd() {
|
||||
modalDialogEmployeeRate.value = true;
|
||||
isStatusEdit.value = false;
|
||||
|
|
@ -193,9 +189,16 @@ function onClickAdd() {
|
|||
* ฟังก์ชันเปลี่ยนหน้าข้อมูล
|
||||
* @param val หน้าที่จ้องการไป
|
||||
*/
|
||||
function updatePage(val: number) {
|
||||
formFilter.page = val;
|
||||
fetchSalalyEmployeeRate();
|
||||
async function updatePage(val: number) {
|
||||
try {
|
||||
showLoader();
|
||||
formFilter.page = val;
|
||||
await fetchSalaryEmployeeRate();
|
||||
} catch (error) {
|
||||
messageError($q, error);
|
||||
} finally {
|
||||
hideLoader();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -207,9 +210,7 @@ function updatePageSize(newPagination: NewPagination) {
|
|||
formFilter.pageSize = newPagination.rowsPerPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* click download
|
||||
*/
|
||||
/** ฟังก์ชันดาวน์โหลดรายงาน */
|
||||
function clickDownload() {
|
||||
showLoader();
|
||||
http
|
||||
|
|
@ -228,15 +229,30 @@ function clickDownload() {
|
|||
|
||||
watch(
|
||||
() => formFilter.pageSize,
|
||||
() => {
|
||||
fetchSalalyEmployeeRate();
|
||||
async () => {
|
||||
try {
|
||||
showLoader();
|
||||
await fetchSalaryEmployeeRate();
|
||||
} catch (error) {
|
||||
messageError($q, error);
|
||||
} finally {
|
||||
hideLoader();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
onMounted(async () => {
|
||||
await Promise.all([fetchDataDetail(), fetchSalalyEmployeeRate()]);
|
||||
try {
|
||||
showLoader();
|
||||
await Promise.all([fetchDataDetail(), fetchSalaryEmployeeRate()]);
|
||||
} catch (error) {
|
||||
messageError($q, error);
|
||||
} finally {
|
||||
hideLoader();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="row items-center">
|
||||
<div class="toptitle text-dark row items-center q-py-xs">
|
||||
|
|
@ -345,7 +361,7 @@ onMounted(async () => {
|
|||
<DialogEmployeeRate
|
||||
v-model:modal="modalDialogEmployeeRate"
|
||||
:is-status-edit="isStatusEdit"
|
||||
:fetch-data="fetchSalalyEmployeeRate"
|
||||
:fetch-data="fetchSalaryEmployeeRate"
|
||||
:data="dataRow as EmployeeRateSalary"
|
||||
/>
|
||||
</template>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue