Merge branch 'develop' into devTee

This commit is contained in:
setthawutttty 2025-07-07 17:44:16 +07:00
commit e9b6e34f38
2 changed files with 53 additions and 19 deletions

View file

@ -171,9 +171,15 @@ function onClickCoppy(id: string) {
* @param id ญชเงนเดอน
*/
function onClickDelete(id: string) {
dialogRemove($q, () => {
dialogRemove($q, async () => {
showLoader();
http
formQuery.page =
formQuery.page !== 1 &&
formQuery.page === maxPage.value &&
rows.value.length === 1
? formQuery.page - 1
: formQuery.page;
await http
.delete(config.API.salaryChartByid(id))
.then(async () => {
await fetchListSalaly();
@ -218,11 +224,14 @@ function filterFn(page: number) {
}
/**
* callbackFunction ทำงานเมอมการ เปลยนหนาหร แถว
* callbackFunction ทำงานเมอมการ เปลยนแถว
*/
watch([() => formQuery.page, () => formQuery.pageSize], () => {
fetchListSalaly();
});
watch(
() => formQuery.pageSize,
() => {
fetchListSalaly();
}
);
/** hooklifecycle*/
onMounted(() => {
@ -483,6 +492,7 @@ onMounted(() => {
boundary-links
direction-links
:max-pages="5"
@update:model-value="fetchListSalaly()"
></q-pagination>
</template>
</d-table>

View file

@ -138,8 +138,7 @@ const dataSalaryRate = ref<SalaryRate>(); //ข้อมูลรายการ
/**
* fetch รายการอตราเงนเดอน
*/
async function fetchListSalalyRate() {
showLoader();
async function fetchListSalaryRate() {
const page = formQuery.page.toString();
const pageSize = formQuery.pageSize.toString();
const keyword = formQuery.keyword.toString();
@ -156,9 +155,6 @@ async function fetchListSalalyRate() {
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
@ -180,12 +176,18 @@ function onClickSalaryRate(type: string, data: SalaryRate | null) {
* @param id รายการอตราเงนเดอน
*/
function onClickDelete(id: string) {
dialogRemove($q, () => {
dialogRemove($q, async () => {
showLoader();
http
formQuery.page =
formQuery.page !== 1 &&
formQuery.page === maxPage.value &&
rows.value.length === 1
? formQuery.page - 1
: formQuery.page;
await http
.delete(config.API.salaryRateListByid(id))
.then(async () => {
await fetchListSalalyRate();
await fetchListSalaryRateNew();
await success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
@ -241,15 +243,36 @@ function updatePagination(newPagination: NewPagination) {
formQuery.pageSize = newPagination.rowsPerPage;
}
async function fetchListSalaryRateNew() {
try {
showLoader();
await fetchListSalaryRate();
} catch (error) {
messageError($q, error);
} finally {
hideLoader();
}
}
/**
* ทำงานเมอมการ เปลยนหนาหร แถว
*/
watch([() => formQuery.page, () => formQuery.pageSize], async () => {
await fetchListSalalyRate();
});
watch(
() => formQuery.pageSize,
async () => {
await fetchListSalaryRateNew();
}
);
onMounted(async () => {
await Promise.all([fetchDataSalary(), fetchListSalalyRate()]);
try {
showLoader();
await Promise.all([fetchDataSalary(), fetchListSalaryRate()]);
} catch (error) {
messageError($q, error);
} finally {
hideLoader();
}
});
</script>
@ -405,6 +428,7 @@ onMounted(async () => {
boundary-links
direction-links
:max-pages="5"
@update:model-value="fetchListSalaryRateNew()"
></q-pagination>
</template>
</d-table>
@ -414,7 +438,7 @@ onMounted(async () => {
<DialogFormRate
v-model:modal="modalDialogFormRate"
:type-action="typeAction"
:fetch-data="fetchListSalalyRate"
:fetch-data="fetchListSalaryRateNew"
:data="dataSalaryRate"
/>
</template>