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

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2025-07-08 10:49:27 +07:00
parent c6abf8314d
commit f33208bb71
3 changed files with 52 additions and 37 deletions

View file

@ -38,7 +38,7 @@ const props = defineProps({
revisionId: { type: String, require: true }, revisionId: { type: String, require: true },
}); });
const total = ref<number>(); const total = ref<number>(0);
const splitterModel = ref<number>(13); const splitterModel = ref<number>(13);
const rows = ref<DataPeriod[]>([]); const rows = ref<DataPeriod[]>([]);
@ -257,12 +257,7 @@ async function fetchDataPeriod(id: string) {
showLoader(); showLoader();
let formData = { let formData = {
page: page: formFilter.page.toString(),
formFilter.page !== 1 &&
formFilter.page === maxPage.value &&
rows.value.length === 1
? (formFilter.page - 1).toString()
: formFilter.page.toString(),
pageSize: formFilter.pageSize.toString(), pageSize: formFilter.pageSize.toString(),
keyword: formFilter.keyword.trim(), keyword: formFilter.keyword.trim(),
type: store.tabType, type: store.tabType,

View file

@ -2,6 +2,7 @@
import { ref, watch, computed } from "vue"; import { ref, watch, computed } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { checkPermission } from "@/utils/permissions"; import { checkPermission } from "@/utils/permissions";
import { updateCurrentPage } from "@/utils/function";
import config from "@/app.config"; import config from "@/app.config";
import http from "@/plugins/http"; import http from "@/plugins/http";
@ -33,12 +34,14 @@ const snapShot = defineModel<string>("snapShot");
const isClose = defineModel<boolean>("isClose", { required: true }); const isClose = defineModel<boolean>("isClose", { required: true });
const props = defineProps({ const props = defineProps({
rows: { type: Array }, rows: { type: Array, required: true },
fetchDataTable: { fetchDataTable: {
type: Function, type: Function,
required: true,
}, },
total: { total: {
type: Number, type: Number,
required: true,
}, },
type: { type: {
type: String, type: String,
@ -191,7 +194,7 @@ const columns = computed(() => {
const modalDialogAddPerson = ref<boolean>(false); //popup const modalDialogAddPerson = ref<boolean>(false); //popup
const modalDialogForm = ref<boolean>(false); //popup const modalDialogForm = ref<boolean>(false); //popup
const modalDialogMoveGroup = ref<boolean>(false); //popup const modalDialogMoveGroup = ref<boolean>(false); //popup
const modalDialogMoveLeve = ref<boolean>(false); //popup const modalDialogMoveLevel = ref<boolean>(false); //popup
const profileId = ref<string>(""); //id const profileId = ref<string>(""); //id
const amount = ref<number>(0); // const amount = ref<number>(0); //
@ -240,7 +243,7 @@ function onClickMoveLevel(
remarkVal: string = "" remarkVal: string = ""
) { ) {
profileId.value = id; profileId.value = id;
modalDialogMoveLeve.value = !modalDialogMoveLeve.value; modalDialogMoveLevel.value = !modalDialogMoveLevel.value;
typeLevel.value = typeVal; typeLevel.value = typeVal;
isReserve.value = isReserveVal; isReserve.value = isReserveVal;
remark.value = typeVal === "NONE" ? remarkVal : ""; remark.value = typeVal === "NONE" ? remarkVal : "";
@ -256,7 +259,7 @@ function onClickDelete(id: string) {
await http await http
.delete(config.API.salaryListPeriodProfileById(id)) .delete(config.API.salaryListPeriodProfileById(id))
.then(async () => { .then(async () => {
await props.fetchDataTable?.(); await updateCurrentPageAndfetchData();
await success($q, "ลบข้อมูลสำเร็จ"); await success($q, "ลบข้อมูลสำเร็จ");
}) })
.catch((err) => { .catch((err) => {
@ -291,6 +294,16 @@ function searchData() {
props.fetchDataTable?.(); props.fetchDataTable?.();
} }
/** ฟังก์ชันอัปเดตหน้าปัจจุบันและดึงข้อมูล */
async function updateCurrentPageAndfetchData() {
formFilter.value.page = await updateCurrentPage(
formFilter.value.page,
Number(maxPage.value),
props.rows.length
);
await props.fetchDataTable?.();
}
/** /**
* callblack function เรยกขอมลรายชอใหม เมอมการเปลยน PageSize * callblack function เรยกขอมลรายชอใหม เมอมการเปลยน PageSize
*/ */
@ -369,7 +382,7 @@ watch(
bordered bordered
:paging="true" :paging="true"
dense dense
:rows-per-page-options="[10, 25, 50, 100]" :rows-per-page-options="[1,10, 25, 50, 100]"
:visible-columns="visibleColumns" :visible-columns="visibleColumns"
@update:pagination="updatePageSizePagination" @update:pagination="updatePageSizePagination"
> >
@ -547,13 +560,13 @@ watch(
<DialogMoveGroup <DialogMoveGroup
v-model:modal="modalDialogMoveGroup" v-model:modal="modalDialogMoveGroup"
v-model:profile-id="profileId" v-model:profile-id="profileId"
:fetch-data="props.fetchDataTable" :fetch-data="updateCurrentPageAndfetchData"
:group="store.tabGroup === 'group1' ? 'กลุ่ม1' : 'กลุ่ม2'" :group="store.tabGroup === 'group1' ? 'กลุ่ม1' : 'กลุ่ม2'"
/> />
<DialogMoveLevel <DialogMoveLevel
v-model:modal="modalDialogMoveLeve" v-model:modal="modalDialogMoveLevel"
v-model:profile-id="profileId" v-model:profile-id="profileId"
:fetch-data="props.fetchDataTable" :fetch-data="updateCurrentPageAndfetchData"
:type-level="typeLevel" :type-level="typeLevel"
:is-reserve="isReserve" :is-reserve="isReserve"
:type="store.tabType" :type="store.tabType"

View file

@ -2,6 +2,7 @@
import { ref, watch } from "vue"; import { ref, watch } from "vue";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import { checkPermission } from "@/utils/permissions"; import { checkPermission } from "@/utils/permissions";
import { updateCurrentPage } from "@/utils/function";
/** importType*/ /** importType*/
import type { QTableColumn } from "quasar"; import type { QTableColumn } from "quasar";
@ -42,18 +43,22 @@ const maxPage = defineModel<Number>("maxPage", { required: true });
const snapShot = defineModel<string>("snapShot"); const snapShot = defineModel<string>("snapShot");
const isClose = defineModel<boolean>("isClose", { required: true }); const isClose = defineModel<boolean>("isClose", { required: true });
const props = defineProps({ const props = defineProps({
rows: { type: Array }, rows: { type: Array, required: true },
fetchDataTable: { fetchDataTable: {
type: Function, type: Function,
required: true,
}, },
maxPage: { maxPage: {
type: Number, type: Number,
required: true,
}, },
total: { total: {
type: Number, type: Number,
required: true,
}, },
isRetire: { isRetire: {
type: Boolean, type: Boolean,
required: true,
}, },
}); });
@ -219,8 +224,8 @@ const visibleColumns = ref<string[]>([
const modalDialogAddPerson = ref<boolean>(false); //popup const modalDialogAddPerson = ref<boolean>(false); //popup
const modalDialogForm = ref<boolean>(false); //popup const modalDialogForm = ref<boolean>(false); //popup
const modalDialogMoveGroup = ref<boolean>(false); //popup const modalDialogMoveGroup = ref<boolean>(false); //popup
const modalDialogMoveLeve = ref<boolean>(false); //popup const modalDialogMoveLevel = ref<boolean>(false); //popup
const modalDialogMoveLeveMulti = ref<boolean>(false); //popup const modalDialogMoveLevelMulti = ref<boolean>(false); //popup
const modalDialogProperties = ref<boolean>(false); const modalDialogProperties = ref<boolean>(false);
const modalDialogInfo = ref<boolean>(false); // /popup const modalDialogInfo = ref<boolean>(false); // /popup
@ -244,7 +249,7 @@ function onClickDelete(id: string) {
await http await http
.delete(config.API.salaryListPeriodProfileById(id)) .delete(config.API.salaryListPeriodProfileById(id))
.then(async () => { .then(async () => {
await props.fetchDataTable?.(); await updateCurrentPageAndfetchData();
await success($q, "ลบข้อมูลสำเร็จ"); await success($q, "ลบข้อมูลสำเร็จ");
}) })
.catch((err) => { .catch((err) => {
@ -256,9 +261,7 @@ function onClickDelete(id: string) {
}); });
} }
/** /** function openPopup เพิ่มคนเลื่อนเงินเดือน*/
* function openPopup เพมคนเลอนเงนเดอน
*/
function onClickAddPerson() { function onClickAddPerson() {
modalDialogAddPerson.value = !modalDialogAddPerson.value; modalDialogAddPerson.value = !modalDialogAddPerson.value;
} }
@ -292,29 +295,23 @@ function onClickMovieGroup(id: string) {
*/ */
function onClickMoveLevel(id: string, typeVal: string, isReserveVal: boolean) { function onClickMoveLevel(id: string, typeVal: string, isReserveVal: boolean) {
profileId.value = id; profileId.value = id;
modalDialogMoveLeve.value = !modalDialogMoveLeve.value; modalDialogMoveLevel.value = !modalDialogMoveLevel.value;
typeLevel.value = typeVal; typeLevel.value = typeVal;
isReserve.value = isReserveVal; isReserve.value = isReserveVal;
} }
/** /** function updatePageTable*/
* function updatePageTable
*/
function updatePagePagination() { function updatePagePagination() {
props.fetchDataTable?.(); props.fetchDataTable?.();
} }
/** /** function updatePageSizeTable*/
* function updatePageSizeTable
*/
function updatePageSizePagination(newPagination: NewPagination) { function updatePageSizePagination(newPagination: NewPagination) {
formFilter.value.page = 1; formFilter.value.page = 1;
formFilter.value.pageSize = newPagination.rowsPerPage; formFilter.value.pageSize = newPagination.rowsPerPage;
} }
/** /** function ค้นหาข้อมูล Table */
* function นหาขอม Table
*/
function searchData() { function searchData() {
formFilter.value.page = 1; formFilter.value.page = 1;
props.fetchDataTable?.(); props.fetchDataTable?.();
@ -335,7 +332,17 @@ function onProperties(data: any) {
/** function openPopup ย้ายกขั้น*/ /** function openPopup ย้ายกขั้น*/
function onClickMoveLevelMulti() { function onClickMoveLevelMulti() {
modalDialogMoveLeveMulti.value = !modalDialogMoveLeve.value; modalDialogMoveLevelMulti.value = !modalDialogMoveLevel.value;
}
/** ฟังก์ชันอัปเดตหน้าปัจจุบันและดึงข้อมูล */
async function updateCurrentPageAndfetchData() {
formFilter.value.page = await updateCurrentPage(
formFilter.value.page,
props.maxPage,
props.rows.length
);
await props.fetchDataTable?.();
} }
/** callblack function เรียกข้อมูลรายชื่อใหม่ เมื่อมีการเปลี่ยน PageSize*/ /** callblack function เรียกข้อมูลรายชื่อใหม่ เมื่อมีการเปลี่ยน PageSize*/
@ -590,15 +597,15 @@ function onClickViewInfo(type: string, id: string) {
<DialogMoveGroup <DialogMoveGroup
v-model:modal="modalDialogMoveGroup" v-model:modal="modalDialogMoveGroup"
v-model:profile-id="profileId" v-model:profile-id="profileId"
:fetch-data="props.fetchDataTable" :fetch-data="updateCurrentPageAndfetchData"
:group="store.tabGroup === 'group1' ? 'กลุ่ม1' : 'กลุ่ม2'" :group="store.tabGroup === 'group1' ? 'กลุ่ม1' : 'กลุ่ม2'"
/> />
<!-- เลอนข --> <!-- เลอนข -->
<DialogMoveLevel <DialogMoveLevel
v-model:modal="modalDialogMoveLeve" v-model:modal="modalDialogMoveLevel"
v-model:profile-id="profileId" v-model:profile-id="profileId"
:fetch-data="props.fetchDataTable" :fetch-data="updateCurrentPageAndfetchData"
:type-level="typeLevel" :type-level="typeLevel"
:is-reserve="isReserve" :is-reserve="isReserve"
:remark="''" :remark="''"
@ -606,7 +613,7 @@ function onClickViewInfo(type: string, id: string) {
<!-- เลอนขนเลอกหลายคน --> <!-- เลอนขนเลอกหลายคน -->
<DialogMoveLevelMulti <DialogMoveLevelMulti
v-model:modal="modalDialogMoveLeveMulti" v-model:modal="modalDialogMoveLevelMulti"
:fetch-data="props.fetchDataTable" :fetch-data="props.fetchDataTable"
:columns=" :columns="
columns.filter( columns.filter(