รายการผังบัญชีเงินเดือน => ปรับ code
This commit is contained in:
parent
215f09c8f1
commit
a1f06ed7fa
1 changed files with 62 additions and 35 deletions
|
|
@ -15,11 +15,11 @@ import type { Salary } from "@/modules/13_salary/interface/response/Main";
|
|||
import type { FormQuerySalary } from "@/modules/13_salary/interface/request/Main";
|
||||
import DialogFormUpload from "@/modules/13_salary/components/SalaryChart/DialogUpload.vue";
|
||||
import DialogFormMain from "@/modules/13_salary/components/SalaryChart/DialogFormMain.vue";
|
||||
|
||||
/** importStore*/
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
/** use*/
|
||||
const isActive = ref<boolean>(false);
|
||||
const $q = useQuasar();
|
||||
const router = useRouter();
|
||||
const {
|
||||
|
|
@ -31,7 +31,6 @@ const {
|
|||
success,
|
||||
} = useCounterMixin();
|
||||
|
||||
const total = ref<number>();
|
||||
/** modalDialog*/
|
||||
const modalDialogFormMain = ref<boolean>(false);
|
||||
const modalUpload = ref<boolean>(false);
|
||||
|
|
@ -118,22 +117,18 @@ const formQuery = reactive<FormQuerySalary>({
|
|||
keyword: "", //keyword ค้นหา
|
||||
});
|
||||
const maxPage = ref<number>(1);
|
||||
const total = ref<number>();
|
||||
const isActive = ref<boolean>(false);
|
||||
const typeAction = ref<string>("");
|
||||
const dataRow = ref<Salary>();
|
||||
|
||||
/**
|
||||
* function updatePagination
|
||||
* @param newPagination ข้อมูล Pagination ใหม่
|
||||
*/
|
||||
function updatePagination(newPagination: NewPagination) {
|
||||
formQuery.page = 1;
|
||||
formQuery.pageSize = newPagination.rowsPerPage;
|
||||
}
|
||||
|
||||
async function fetchListSalaly() {
|
||||
/** function fetch ข้อมูลรายการผังบัญชีเงินเดือน */
|
||||
function fetchListSalaly() {
|
||||
showLoader();
|
||||
const page = await formQuery.page.toString();
|
||||
const pageSize = await formQuery.pageSize.toString();
|
||||
const keyword = await formQuery.keyword.toString();
|
||||
await http
|
||||
const page = formQuery.page.toString();
|
||||
const pageSize = formQuery.pageSize.toString();
|
||||
const keyword = formQuery.keyword.toString();
|
||||
http
|
||||
.get(
|
||||
config.API.salaryChart +
|
||||
`?page=${page}&pageSize=${pageSize}&keyword=${keyword}`
|
||||
|
|
@ -152,23 +147,33 @@ async function fetchListSalaly() {
|
|||
});
|
||||
}
|
||||
|
||||
const typeAction = ref<string>("");
|
||||
const dataRow = ref<Salary>();
|
||||
async function onClickSalary(type: string, data: Salary | null) {
|
||||
/**
|
||||
* function openDialog เพิ่ม,แก้ไข ผังบัญชีเงินเดือน
|
||||
* @param type ประเภท แก่ไข,เพิ่ม
|
||||
* @param data ข้อมูลผังบัญชีเงินเดือน
|
||||
*/
|
||||
function onClickSalary(type: string, data: Salary | null) {
|
||||
modalDialogFormMain.value = !modalDialogFormMain.value;
|
||||
typeAction.value = type;
|
||||
|
||||
if (data) {
|
||||
dataRow.value = data;
|
||||
}
|
||||
}
|
||||
|
||||
async function onClickSalaryRate(id: string) {
|
||||
/**
|
||||
* function redirect to page อัตราเงินเดือน
|
||||
* @param id บัญชีเงินเดือน
|
||||
*/
|
||||
function onClickSalaryRate(id: string) {
|
||||
router.push(`/salary/rate/${id}`);
|
||||
}
|
||||
|
||||
async function onClickCoppy(id: string) {
|
||||
await http
|
||||
/**
|
||||
* function คัดลอกข้อมูลรายการผังบัญชีเงินเดือน
|
||||
* @param id บัญชีเงินเดือน
|
||||
*/
|
||||
function onClickCoppy(id: string) {
|
||||
http
|
||||
.post(config.API.salaryChartCopy, { id: id })
|
||||
.then(() => {
|
||||
success($q, "คัดลอกข้อมูลสำเร็จ");
|
||||
|
|
@ -181,9 +186,13 @@ async function onClickCoppy(id: string) {
|
|||
});
|
||||
}
|
||||
|
||||
async function onClickDelete(id: string) {
|
||||
dialogRemove($q, async () => {
|
||||
await http
|
||||
/**
|
||||
* function ลบข้อมูลรายการผังบัญชีเงินเดือน
|
||||
* @param id บัญชีเงินเดือน
|
||||
*/
|
||||
function onClickDelete(id: string) {
|
||||
dialogRemove($q, () => {
|
||||
http
|
||||
.delete(config.API.salaryChartByid(id))
|
||||
.then(() => {
|
||||
success($q, "ลบข้อมูลสำเร็จ");
|
||||
|
|
@ -197,24 +206,42 @@ async function onClickDelete(id: string) {
|
|||
});
|
||||
}
|
||||
|
||||
async function onClickUpload(type: string, id: string, active: boolean) {
|
||||
/**
|
||||
* function openDialog อัปโหลดเอกสารอ้างอิง
|
||||
* @param type
|
||||
* @param id ผังบัญชีเงินเดือน
|
||||
* @param active สถานะการใช้งาน
|
||||
*/
|
||||
function onClickUpload(type: string, id: string, active: boolean) {
|
||||
modalUpload.value = true;
|
||||
typeAction.value = type;
|
||||
rowId.value = id;
|
||||
isActive.value = active;
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await fetchListSalaly();
|
||||
/** callbackFunction ทำงานเมื่อมีการ เปลี่ยนหน่าหรือ แถว*/
|
||||
watch([() => formQuery.page, () => formQuery.pageSize], () => {
|
||||
fetchListSalaly();
|
||||
});
|
||||
|
||||
watch([() => formQuery.page, () => formQuery.pageSize], async () => {
|
||||
await fetchListSalaly();
|
||||
});
|
||||
|
||||
async function filterFn(page: number) {
|
||||
page !== 1 ? (formQuery.page = 1) : await fetchListSalaly();
|
||||
/**
|
||||
* function updatePagination
|
||||
* @param newPagination ข้อมูล Pagination ใหม่
|
||||
*/
|
||||
function updatePagination(newPagination: NewPagination) {
|
||||
formQuery.page = 1;
|
||||
formQuery.pageSize = newPagination.rowsPerPage;
|
||||
}
|
||||
|
||||
/** function ค้นหาข้อมูลตาม keyword*/
|
||||
function filterFn(page: number) {
|
||||
page !== 1 ? (formQuery.page = 1) : fetchListSalaly();
|
||||
}
|
||||
|
||||
/** hooklifecycle*/
|
||||
onMounted(() => {
|
||||
fetchListSalaly();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue