fix bug and load ===> รายการเลื่อนค่าจ้างลูกจ้างประจำ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-07-08 16:18:42 +07:00
parent 7141e7df02
commit 6a57f6db21
2 changed files with 66 additions and 59 deletions

View file

@ -17,7 +17,7 @@ import type { DataPerson } from "@/modules/13_salary/interface/response/SalaryLi
/** importComponents*/ /** importComponents*/
import Header from "@/components/DialogHeader.vue"; import Header from "@/components/DialogHeader.vue";
/** use*/ /** use composables */
const $q = useQuasar(); const $q = useQuasar();
const store = useSalaryEmployeeListSDataStore(); const store = useSalaryEmployeeListSDataStore();
const { messageError, showLoader, hideLoader, dialogConfirm, success } = const { messageError, showLoader, hideLoader, dialogConfirm, success } =
@ -102,7 +102,9 @@ const columns = ref<QTableProps["columns"]>([
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px", style: "font-size: 14px",
format(val, row) { format(val, row) {
return `${row.posTypeShort}${row.posLevel}`; return `${row.posTypeShort ? row.posTypeShort : ""}${
row.posLevel ? row.posLevel : ""
}`;
}, },
}, },
]); ]);
@ -117,18 +119,14 @@ const formFilter = reactive<DataFilterPerson>({
}); });
const maxPage = ref<number>(1); const maxPage = ref<number>(1);
/** /** function close popup*/
* function close popup
*/
function closeModal() { function closeModal() {
modal.value = false; modal.value = false;
formFilter.page = 1; formFilter.page = 1;
formFilter.keyword = ""; formFilter.keyword = "";
} }
/** /** function เรียกรายชื่อ คนเลื่อนเงินเดือน*/
* function เรยกรายช คนเลอนเงนเดอน
*/
async function fetchListPerson() { async function fetchListPerson() {
showLoader(); showLoader();
formFilter.rootId = store.rootId; formFilter.rootId = store.rootId;
@ -157,10 +155,12 @@ async function fetchListPerson() {
*/ */
function onClickAddPerson(data: DataPerson) { function onClickAddPerson(data: DataPerson) {
data.rank = undefined; data.rank = undefined;
const body: DataPersonReq = { const body: DataPersonReq = {
id: store.groupId, id: store.groupId,
type: store.tabType, type: store.tabType,
...data, ...data,
position: data.position ? data.position : "",
}; };
dialogConfirm( dialogConfirm(
@ -186,32 +186,24 @@ function onClickAddPerson(data: DataPerson) {
); );
} }
/** /** function update Pagination*/
* function updatePage
*/
async function updatePagePagination() { async function updatePagePagination() {
fetchListPerson(); fetchListPerson();
} }
/** /** function updatePageSize*/
* function updatePageSize
*/
function updatePageSizePagination(newPagination: NewPagination) { function updatePageSizePagination(newPagination: NewPagination) {
formFilter.page = 1; formFilter.page = 1;
formFilter.pageSize = newPagination.rowsPerPage; formFilter.pageSize = newPagination.rowsPerPage;
} }
/** /** function ค้นหาข้อมูลตาม keyword*/
* function นหาขอมลตาม keyword
*/
function searchData() { function searchData() {
formFilter.page = 1; formFilter.page = 1;
fetchListPerson(); fetchListPerson();
} }
/** /** callblack function เรียกข้อมูลรายชื่อคนเลื่อนเงินเดือน เมื่อมีการเปิด Popup */
* callblack function เรยกขอมลรายชอคนเลอนเงนเดอน เมอมการเป Popup
*/
watch( watch(
() => modal.value, () => modal.value,
() => { () => {
@ -221,9 +213,7 @@ watch(
} }
); );
/** /** callblack function เรียกข้อมูลรายชื่อคนเลื่อนเงินเดือน เมื่อมีการเปลี่ยน PageSize*/
* callblack function เรยกขอมลรายชอคนเลอนเงนเดอน เมอมการเปลยน PageSize
*/
watch( watch(
() => formFilter.pageSize, () => formFilter.pageSize,
() => { () => {

View file

@ -23,7 +23,7 @@ import DialogInfoCriteria from "@/modules/13_salary/components/05_salaryListsEmp
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useSalaryEmployeeListSDataStore } from "@/modules/13_salary/store/SalaryEmployeeListsStore"; import { useSalaryEmployeeListSDataStore } from "@/modules/13_salary/store/SalaryEmployeeListsStore";
/** use*/ /** use composables */
const $q = useQuasar(); const $q = useQuasar();
const store = useSalaryEmployeeListSDataStore(); const store = useSalaryEmployeeListSDataStore();
const { messageError, showLoader, hideLoader } = useCounterMixin(); const { messageError, showLoader, hideLoader } = useCounterMixin();
@ -212,11 +212,11 @@ const formFilter = reactive<DataFilter>({
}); });
/** /**
* function เรยกขอมจำนวนโควต * งกเรยกขอมโควต
* @param id กล * @param id กล
*/ */
function fetchDataQuota(id: string) { async function fetchDataQuota(id: string) {
http await http
.get(config.API.salaryListPeriodQuotaEmp(id)) .get(config.API.salaryListPeriodQuotaEmp(id))
.then((res) => { .then((res) => {
const data = res.data.result; const data = res.data.result;
@ -243,11 +243,10 @@ function fetchDataQuota(id: string) {
} }
/** /**
* function เรยกขอมลรายช * งกเรยกขอมลรายช
* @param id กล * @param id กล
*/ */
async function fetchDataPeriod(id: string) { async function fetchDataPeriod(id: string) {
showLoader();
let formData = { let formData = {
page: formFilter.page.toString(), page: formFilter.page.toString(),
pageSize: formFilter.pageSize.toString(), pageSize: formFilter.pageSize.toString(),
@ -271,35 +270,45 @@ async function fetchDataPeriod(id: string) {
}) })
.catch((err) => { .catch((err) => {
messageError($q, err); messageError($q, err);
})
.finally(() => {
setTimeout(() => {
hideLoader();
}, 1000);
}); });
} }
/** /** ฟังก์ชันเปลี่ยนขั้น*/
* function เปลยนข async function changeTabType() {
*/ if (!store.groupId) return;
function changeTabType() {
showLoader();
try {
formFilter.page = 1; formFilter.page = 1;
formFilter.pageSize = 10; formFilter.pageSize = 10;
formFilter.keyword = ""; formFilter.keyword = "";
store.groupId && fetchDataPeriod(store.groupId); await fetchDataPeriod(store.groupId);
} catch (error) {
messageError($q, error);
} finally {
hideLoader();
}
}
/** ฟังก์ชันเรียกข้อมูลรายชื่ออีกครั้งและโควต้า */
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 เรยกขอมลรายชออกคร * งกนโหลดไฟล
*/ * @param data อมลทองการโหลด
function fetchDataPeriodNew() {
store.groupId && fetchDataPeriod(store.groupId);
store.groupId && fetchDataQuota(store.groupId);
}
/**
* function โหลดไฟล
* @param data อมลทองการโหล
* @param type ประเภทไฟล docx,xlsx * @param type ประเภทไฟล docx,xlsx
*/ */
async function onClickDownload(data: DataOption, type: string = "xlsx") { async function onClickDownload(data: DataOption, type: string = "xlsx") {
@ -359,19 +368,27 @@ async function onClickDownload(data: DataOption, type: string = "xlsx") {
} }
} }
/** /** funrion แสดงเฉพาะผู้เกษียณอายุราชการ*/
* funrion แสดงเฉพาะผเกษยณอายราชการ
*/
function updateIsShowRetire() { function updateIsShowRetire() {
isRetire.value = !isRetire.value; isRetire.value = !isRetire.value;
fetchDataPeriodNew(); fetchDataPeriodNew();
} }
onMounted(() => { /** ฟังก์ชันเรียกข้อมูลเมื่อ component ถูกเรียก */
onMounted(async () => {
if (props.rootId) { if (props.rootId) {
fetchDataQuota(store.groupId); showLoader();
fetchDataPeriod(store.groupId); try {
splitterModel.value = store.roundMainCode === "APR" ? 13 : 16; await Promise.all([
fetchDataQuota(store.groupId),
fetchDataPeriod(store.groupId),
(splitterModel.value = store.roundMainCode === "APR" ? 13 : 16),
]);
} catch (error) {
messageError($q, error);
} finally {
hideLoader();
}
} }
}); });
</script> </script>