fix load ===> รายการเลื่อนเงินเดือนข้าราชการฯ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-07-08 16:32:25 +07:00
parent 6a57f6db21
commit be5f727371

View file

@ -23,7 +23,7 @@ import DialogInfoCriteria from "@/modules/13_salary/components/04_salaryLists/Di
import { useCounterMixin } from "@/stores/mixin";
import { useSalaryListSDataStore } from "@/modules/13_salary/store/SalaryListsStore";
/** use*/
/** use composables*/
const $q = useQuasar();
const store = useSalaryListSDataStore();
const { messageError, showLoader, hideLoader } = useCounterMixin();
@ -41,6 +41,8 @@ const props = defineProps({
const total = ref<number>(0);
const splitterModel = ref<number>(13);
const rows = ref<DataPeriod[]>([]);
const modalDialogInfoCriteria = ref<boolean>(false); // Dialog
const isRetire = ref<boolean>(false); //
/** itemsTab กลุ่ม*/
const itemsTabGroup = ref([
@ -208,21 +210,21 @@ const itemsCard = ref([
},
]);
/** ข้อมูลค้นหารายชื่อคขึ้นเงินเดือน*/
/** ข้อมูลค้นหารายชื่อคขึ้นเงินเดือน*/
const formFilter = reactive<DataFilter>({
page: 1,
pageSize: 10,
keyword: "",
type: store.tabType,
});
const maxPage = ref<number>(1);
const maxPage = ref<number>(1); //
/**
* function เรยกขอมจำนวนโควต
* งกเรยกขอมโควต
* @param id กล
*/
function fetchDataQuota(id: string) {
http
async function fetchDataQuota(id: string) {
await http
.get(config.API.salaryListPeriodQuota(id))
.then((res) => {
const data = res.data.result;
@ -250,12 +252,10 @@ function fetchDataQuota(id: string) {
}
/**
* function เรยกขอมลรายช
* งกเรยกขอมลรายชเลอนเงนเดอนขาราชการฯ
* @param id กล
*/
async function fetchDataPeriod(id: string) {
showLoader();
let formData = {
page: formFilter.page.toString(),
pageSize: formFilter.pageSize.toString(),
@ -279,37 +279,62 @@ async function fetchDataPeriod(id: string) {
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/**function เปลี่ยนกลุ่ม*/
function changeTabGroup() {
formFilter.page = 1;
formFilter.pageSize = 10;
formFilter.keyword = "";
store.tabType = "PENDING";
props.periodLatest &&
store.fetchPeriodLatest(props?.periodLatest, store.tabGroup);
store.groupId && fetchDataQuota(store.groupId);
store.groupId && fetchDataPeriod(store.groupId);
splitterModel.value = store.roundMainCode === "APR" ? 13 : 16;
/**ฟังก์ชันเปลี่ยนกลุ่ม*/
async function changeTabGroup() {
showLoader();
try {
await Promise.all([
(formFilter.page = 1),
(formFilter.pageSize = 10),
(formFilter.keyword = ""),
(store.tabType = "PENDING"),
props.periodLatest &&
store.fetchPeriodLatest(props?.periodLatest, store.tabGroup),
store.groupId && fetchDataQuota(store.groupId),
store.groupId && fetchDataPeriod(store.groupId),
(splitterModel.value = store.roundMainCode === "APR" ? 13 : 16),
]);
} catch (error) {
messageError($q, error);
} finally {
hideLoader();
}
}
/**function เปลี่ยนขั้น*/
function changeTabType() {
formFilter.page = 1;
formFilter.pageSize = 10;
formFilter.keyword = "";
store.groupId && fetchDataPeriod(store.groupId);
/**ฟังก์ชันเปลี่ยนขั้น*/
async function changeTabType() {
if (!store.groupId) return;
showLoader();
try {
formFilter.page = 1;
formFilter.pageSize = 10;
formFilter.keyword = "";
store.groupId && (await fetchDataPeriod(store.groupId));
} catch (error) {
messageError($q, error);
} finally {
hideLoader();
}
}
/** function เรียกข้อมูลรายชื่ออีกครั้ง*/
function fetchDataPeriodNew() {
store.groupId && fetchDataPeriod(store.groupId);
store.groupId && fetchDataQuota(store.groupId);
/** ฟังก์ชันเรียกข้อมูลรายชื่ออีกครั้งและโควต้า */
async function fetchDataPeriodNew() {
if (!store.groupId) return;
showLoader();
try {
await Promise.all([
fetchDataPeriod(store.groupId),
fetchDataQuota(store.groupId),
]);
} catch (error) {
messageError($q, error);
} finally {
hideLoader();
}
}
function onClickDownload(data: DataOption, type: string = "xlsx") {
@ -386,20 +411,29 @@ function onClickDownload(data: DataOption, type: string = "xlsx") {
}
}
const modalDialogInfoCriteria = ref<boolean>(false);
onMounted(() => {
/** ฟังก์ชันแสดงเฉพาะผู้เกษียณอายุราชการ*/
async function updateIsShowRetire() {
isRetire.value = !isRetire.value;
await fetchDataPeriodNew();
}
/** ฟังก์ชันเรียกข้อมูลเมื่อ component ถูกเรียก */
onMounted(async () => {
if (props.rootId) {
fetchDataQuota(store.groupId);
fetchDataPeriod(store.groupId);
splitterModel.value = store.roundMainCode === "APR" ? 13 : 16;
showLoader();
try {
await Promise.all([
fetchDataQuota(store.groupId),
fetchDataPeriod(store.groupId),
(splitterModel.value = store.roundMainCode === "APR" ? 13 : 16),
]);
} catch (error) {
messageError($q, error);
} finally {
hideLoader();
}
}
});
const isRetire = ref<boolean>(false);
const updateIsShowRetire = async () => {
isRetire.value = !isRetire.value;
fetchDataPeriodNew();
};
</script>
<template>