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