Merge branch 'nice' into develop

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

View file

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

View file

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

View file

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