เงินเดือน => รายการผังบัญชีเงินเดือน,ผังบัญชีค่าจ้างลูกจ้างประจำ
This commit is contained in:
parent
af56b950b1
commit
a589162530
12 changed files with 337 additions and 308 deletions
|
|
@ -6,15 +6,23 @@ import { useRouter } from "vue-router";
|
|||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
|
||||
/** importType*/
|
||||
/**
|
||||
* importType
|
||||
*/
|
||||
import type { QTableProps } from "quasar";
|
||||
import type { NewPagination } from "@/modules/13_salary/interface/index/Main";
|
||||
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*/
|
||||
/**
|
||||
* importComponents
|
||||
*/
|
||||
import DialogFormMain from "@/modules/13_salary/components/SalaryChart/DialogFormMain.vue"; // ผังบัญชีเงินเดือน
|
||||
import DialogFormUpload from "@/modules/13_salary/components/SalaryChart/DialogUpload.vue"; // อัปโหลดเอกสารอ้างอิง
|
||||
|
||||
/**
|
||||
*importStore
|
||||
*/
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
/** use*/
|
||||
|
|
@ -33,6 +41,7 @@ const {
|
|||
const modalDialogFormMain = ref<boolean>(false);
|
||||
const modalUpload = ref<boolean>(false);
|
||||
const rowId = ref<string>("");
|
||||
|
||||
/** Table*/
|
||||
const rows = ref<Salary[]>([]);
|
||||
const columns = ref<QTableProps["columns"]>([
|
||||
|
|
@ -93,7 +102,7 @@ const typeAction = ref<string>("");
|
|||
const dataRow = ref<Salary>();
|
||||
|
||||
/**
|
||||
* function fetch ข้อมูลรายการผังบัญชีเงินเดือน
|
||||
* fetch ข้อมูลรายการผังบัญชีเงินเดือน
|
||||
*/
|
||||
function fetchListSalaly() {
|
||||
showLoader();
|
||||
|
|
@ -105,11 +114,11 @@ function fetchListSalaly() {
|
|||
config.API.salaryChart +
|
||||
`?page=${page}&pageSize=${pageSize}&keyword=${keyword}`
|
||||
)
|
||||
.then((res) => {
|
||||
.then(async (res) => {
|
||||
total.value = res.data.result.total;
|
||||
maxPage.value = Math.ceil(res.data.result.total / formQuery.pageSize);
|
||||
const data = res.data.result.data;
|
||||
rows.value = data;
|
||||
const data = await res.data.result.data;
|
||||
rows.value = await data;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
@ -145,16 +154,18 @@ function onClickSalaryRate(id: string) {
|
|||
* @param id บัญชีเงินเดือน
|
||||
*/
|
||||
function onClickCoppy(id: string) {
|
||||
showLoader();
|
||||
http
|
||||
.post(config.API.salaryChartCopy, { id: id })
|
||||
.then(() => {
|
||||
success($q, "คัดลอกข้อมูลสำเร็จ");
|
||||
.then(async () => {
|
||||
await fetchListSalaly();
|
||||
await success($q, "คัดลอกข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
fetchListSalaly();
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -164,16 +175,18 @@ function onClickCoppy(id: string) {
|
|||
*/
|
||||
function onClickDelete(id: string) {
|
||||
dialogRemove($q, () => {
|
||||
showLoader();
|
||||
http
|
||||
.delete(config.API.salaryChartByid(id))
|
||||
.then(() => {
|
||||
success($q, "ลบข้อมูลสำเร็จ");
|
||||
.then(async () => {
|
||||
await fetchListSalaly();
|
||||
await success($q, "ลบข้อมูลสำเร็จ");
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
fetchListSalaly();
|
||||
hideLoader();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
@ -481,12 +494,15 @@ onMounted(() => {
|
|||
</div>
|
||||
</q-card>
|
||||
|
||||
<!-- popup ผังบัญชีเงินเดือน -->
|
||||
<DialogFormMain
|
||||
v-model:modal="modalDialogFormMain"
|
||||
:typeAction="typeAction"
|
||||
:data="dataRow"
|
||||
:fetchData="fetchListSalaly"
|
||||
/>
|
||||
|
||||
<!-- popup อัปโหลดเอกสารอ้างอิง -->
|
||||
<DialogFormUpload
|
||||
v-model:modal="modalUpload"
|
||||
:typeAction="typeAction"
|
||||
|
|
|
|||
|
|
@ -110,6 +110,9 @@ const pagination = ref({
|
|||
const isActive = ref<boolean>(false);
|
||||
const groupSalary = ref<string>("");
|
||||
|
||||
/**
|
||||
* fetch ข้อมูลอัตราค่าจ้าง
|
||||
*/
|
||||
function fetchDataDetail() {
|
||||
http
|
||||
.get(config.API.salaryEmployeeChartByid(salaryEmployeeId.value))
|
||||
|
|
@ -122,6 +125,9 @@ function fetchDataDetail() {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* fetch อัตราค่าจ้าง
|
||||
*/
|
||||
function fetchSalalyEmployeeRate() {
|
||||
showLoader();
|
||||
http
|
||||
|
|
@ -146,12 +152,20 @@ const modalDialogEmployeeRate = ref<boolean>(false);
|
|||
const isStatusEdit = ref<boolean>(false);
|
||||
const dataRow = ref<EmployeeRateSalary>();
|
||||
|
||||
/**
|
||||
* แก่ไขข้อมูลรายการอัตราค่าจ้าง
|
||||
* @param data ข้อมูลรายการอัตราค่าจ้าง
|
||||
*/
|
||||
function onEdit(data: EmployeeRateSalary) {
|
||||
modalDialogEmployeeRate.value = true;
|
||||
isStatusEdit.value = true;
|
||||
dataRow.value = data;
|
||||
}
|
||||
|
||||
/**
|
||||
* ลบรายการอัตราค่าจ้าง
|
||||
* @param id รายการอัตราค่าจ้าง
|
||||
*/
|
||||
function onDelete(id: string) {
|
||||
dialogRemove($q, () => {
|
||||
http
|
||||
|
|
@ -168,6 +182,9 @@ function onDelete(id: string) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* เพิ่มข้อมูลรายการอัตราค่าจ้าง
|
||||
*/
|
||||
function onClickAdd() {
|
||||
modalDialogEmployeeRate.value = true;
|
||||
isStatusEdit.value = false;
|
||||
|
|
@ -188,9 +205,9 @@ function clickDownload() {
|
|||
showLoader();
|
||||
http
|
||||
.get(config.API.salaryReportemployeeByid(salaryEmployeeId.value))
|
||||
.then((res) => {
|
||||
.then(async (res) => {
|
||||
const dataList = res.data.result;
|
||||
genReportXLSX(dataList, "อัตราค่าจ้าง");
|
||||
await genReportXLSX(dataList, "อัตราค่าจ้าง");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
|
|
@ -272,7 +289,7 @@ onMounted(async () => {
|
|||
<q-separator />
|
||||
</template>
|
||||
<template v-slot:body="props">
|
||||
<q-tr :props="props" class="cursor-pointer">
|
||||
<q-tr :props="props">
|
||||
<q-td v-if="!isActive">
|
||||
<q-btn
|
||||
v-if="!isActive && checkPermission($route)?.attrIsUpdate"
|
||||
|
|
|
|||
|
|
@ -6,7 +6,10 @@ import { useRouter, useRoute } from "vue-router";
|
|||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import genReportXLSX from "@/plugins/genreportxlsx";
|
||||
/** importType*/
|
||||
|
||||
/**
|
||||
* importType
|
||||
*/
|
||||
import type { QTableProps } from "quasar";
|
||||
import type {
|
||||
NewPagination,
|
||||
|
|
@ -15,24 +18,22 @@ import type {
|
|||
import type { SalaryRate } from "@/modules/13_salary/interface/response/Main";
|
||||
import type { FormQuerySalary } from "@/modules/13_salary/interface/request/Main";
|
||||
|
||||
/** importComponents*/
|
||||
/**
|
||||
* importComponents
|
||||
*/
|
||||
import DialogFormRate from "@/modules/13_salary/components/SalaryChart/DialogFormRate.vue";
|
||||
|
||||
/** importStore*/
|
||||
/**
|
||||
* importStore
|
||||
*/
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
|
||||
/** use*/
|
||||
const $q = useQuasar();
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const {
|
||||
date2Thai,
|
||||
dialogRemove,
|
||||
success,
|
||||
messageError,
|
||||
showLoader,
|
||||
hideLoader,
|
||||
} = useCounterMixin();
|
||||
const { dialogRemove, success, messageError, showLoader, hideLoader } =
|
||||
useCounterMixin();
|
||||
|
||||
const isActive = ref<boolean>(false);
|
||||
const posType = ref<string>("");
|
||||
|
|
@ -126,7 +127,14 @@ const formQuery = reactive<FormQuerySalary>({
|
|||
});
|
||||
const maxPage = ref<number>(1);
|
||||
const totalRow = ref<number>(0);
|
||||
const pagination = ref({
|
||||
page: 1,
|
||||
rowsPerPage: 100,
|
||||
});
|
||||
|
||||
/**
|
||||
* fetch รายการอัตราเงินเดือน
|
||||
*/
|
||||
async function fetchListSalalyRate() {
|
||||
showLoader();
|
||||
const page = await formQuery.page.toString();
|
||||
|
|
@ -140,7 +148,6 @@ async function fetchListSalalyRate() {
|
|||
.then((res) => {
|
||||
maxPage.value = Math.ceil(res.data.result.total / formQuery.pageSize);
|
||||
totalRow.value = res.data.result.total;
|
||||
|
||||
rows.value = res.data.result.data;
|
||||
})
|
||||
.catch((err) => {
|
||||
|
|
@ -151,20 +158,6 @@ async function fetchListSalalyRate() {
|
|||
});
|
||||
}
|
||||
|
||||
/** ตั้งค่าเริ่มต้น paging */
|
||||
const pagination = ref({
|
||||
page: 1,
|
||||
rowsPerPage: 100,
|
||||
});
|
||||
/**
|
||||
* function updatePagination
|
||||
* @param newPagination ข้อมูล Pagination ใหม่
|
||||
*/
|
||||
function updatePagination(newPagination: NewPagination) {
|
||||
formQuery.page = 1;
|
||||
formQuery.pageSize = newPagination.rowsPerPage;
|
||||
}
|
||||
|
||||
const typeAction = ref<string>("");
|
||||
const dataRow = ref<SalaryRate>();
|
||||
function onClickSalaryRate(type: string, data: SalaryRate | null) {
|
||||
|
|
@ -175,6 +168,10 @@ function onClickSalaryRate(type: string, data: SalaryRate | null) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ลบรายการอัตราเงินเดือน
|
||||
* @param id รายการอัตราเงินเดือน
|
||||
*/
|
||||
function onClickDelete(id: string) {
|
||||
dialogRemove($q, () => {
|
||||
showLoader();
|
||||
|
|
@ -193,13 +190,16 @@ function onClickDelete(id: string) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* ดาวน์โหลดไฟล์
|
||||
*/
|
||||
function clickDownload() {
|
||||
showLoader();
|
||||
http
|
||||
.get(config.API.salaryReportByid(salaryId.value))
|
||||
.then((res) => {
|
||||
.then(async (res) => {
|
||||
const dataList = res.data.result;
|
||||
genReportXLSX(dataList, "อัตราเงินเดือน");
|
||||
await genReportXLSX(dataList, "อัตราเงินเดือน");
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
|
|
@ -208,7 +208,11 @@ function clickDownload() {
|
|||
hideLoader();
|
||||
});
|
||||
}
|
||||
function fetchList() {
|
||||
|
||||
/**
|
||||
* fetch ข้อมูลอัตราเงินเดือน
|
||||
*/
|
||||
function fetchDataSalary() {
|
||||
http
|
||||
.get(config.API.salaryChartByid(salaryId.value))
|
||||
.then((res) => {
|
||||
|
|
@ -219,8 +223,18 @@ function fetchList() {
|
|||
messageError($q, e);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* function updatePagination
|
||||
* @param newPagination ข้อมูล Pagination ใหม่
|
||||
*/
|
||||
function updatePagination(newPagination: NewPagination) {
|
||||
formQuery.page = 1;
|
||||
formQuery.pageSize = newPagination.rowsPerPage;
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await fetchList();
|
||||
fetchDataSalary();
|
||||
await fetchListSalalyRate();
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue