fix bug and load ===> รายการเลื่อนค่าจ้างลูกจ้างประจำ
This commit is contained in:
parent
7141e7df02
commit
6a57f6db21
2 changed files with 66 additions and 59 deletions
|
|
@ -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,
|
||||||
() => {
|
() => {
|
||||||
|
|
|
||||||
|
|
@ -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() {
|
|
||||||
formFilter.page = 1;
|
showLoader();
|
||||||
formFilter.pageSize = 10;
|
try {
|
||||||
formFilter.keyword = "";
|
formFilter.page = 1;
|
||||||
store.groupId && fetchDataPeriod(store.groupId);
|
formFilter.pageSize = 10;
|
||||||
|
formFilter.keyword = "";
|
||||||
|
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>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue