เงินเดือน => รายการผังบัญชีเงินเดือน,ผังบัญชีค่าจ้างลูกจ้างประจำ

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-08-20 11:44:42 +07:00
parent af56b950b1
commit a589162530
12 changed files with 337 additions and 308 deletions

View file

@ -133,7 +133,7 @@ function fetchSalaryDetail(id: string) {
formData.endDate = data.endDate;
formData.details = data.details;
formData.isSpecial = data.isSpecial;
isReadonly.value = props.typeAction === 'view'? true: data.isActive;
isReadonly.value = props.typeAction === "view" ? true : data.isActive;
})
.catch((err) => {
messageError($q, err);
@ -192,7 +192,7 @@ function clearFormData() {
}
/**
* function กขอมลผงบญชเงนเดอน
* function กขอมลผงบญชเงนเดอน
*/
function onSubmit() {
dialogConfirm($q, async () => {
@ -203,13 +203,13 @@ function onSubmit() {
? config.API.salaryChart
: config.API.salaryChartByid(salaryId.value);
await http[props.typeAction === "add" ? "post" : "put"](url, formData);
success($q, "บันทีกข้อมูลสำเร็จ");
props.fetchData?.();
await props.fetchData?.();
await success($q, "บันทีกข้อมูลสำเร็จ");
closeDialog();
} catch (err) {
messageError($q, err);
} finally {
hideLoader();
closeDialog();
}
});
}

View file

@ -63,13 +63,17 @@ const title = computed(() => {
return name;
});
/** function ปืด Dialog*/
/**
* function Dialog*
*/
function closeDialog() {
modal.value = !modal.value;
clearFormData();
}
/** function เคลียข้อมูล form*/
/**
* function เคลยขอม form
*/
function clearFormData() {
formData.salaryId = "";
formData.salary = null;
@ -139,13 +143,13 @@ function onSubmit() {
? config.API.salaryRateList
: config.API.salaryRateListByid(formData.salaryId);
await http[props.typeAction === "add" ? "post" : "put"](url, body);
success($q, "บันทีกข้อมูลสำเร็จ");
props.fetchData?.();
await props.fetchData?.();
await success($q, "บันทีกข้อมูลสำเร็จ");
closeDialog();
} catch (err) {
messageError($q, err);
} finally {
hideLoader();
closeDialog();
}
});
}

View file

@ -56,7 +56,7 @@ const itemsDocument = ref<any>([]);
/**
* function fetch อมลรายการ ไฟล
* @param id
* @param id ไฟล
*/
function fetchDocumentFile(id: string) {
showLoader();
@ -74,13 +74,17 @@ function fetchDocumentFile(id: string) {
});
}
/** function ปืด Dialog*/
/**
* function Dialog*
*/
function closeDialog() {
modal.value = !modal.value;
clearFormData();
}
/** function เคลียข้อมูล form*/
/**
* function เคลยขอม form*
*/
function clearFormData() {
formData.salaryType = "";
formData.posTypeId = "";
@ -95,10 +99,12 @@ function clearFormData() {
itemsDocument.value = [];
}
/** function เรียก path อัปโหลดไฟล์*/
/**
* function เรยก path ปโหลดไฟล
*/
async function uploadDocumentFile() {
const fileName = documentFile.value.name.replace(/\.(xlsx|docx|pdf)$/, "");
showLoader();
const fileName = documentFile.value.name.replace(/\.(xlsx|docx|pdf)$/, "");
const formData = new FormData();
formData.append("file", documentFile.value);
const body = {
@ -109,20 +115,17 @@ async function uploadDocumentFile() {
};
await http
.post(config.API.salaryChartFile(salaryId.value), body)
.then((res) => {
console.log(res);
.then(async (res) => {
const foundKey: any = Object.keys(res.data).find(
(key) =>
res.data[key]?.fileName !== undefined &&
res.data[key]?.fileName !== ""
);
const link = res.data[foundKey]?.uploadUrl;
fileUpLoad(link);
await fileUpLoad(link);
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
@ -136,15 +139,15 @@ function fileUpLoad(url: string) {
headers: { "Content-Type": documentFile.value?.type },
onUploadProgress: (e) => console.log(e),
})
.then(() => {
success($q, "อัปโหลดไฟล์สำเร็จ");
.then(async () => {
await fetchDocumentFile(salaryId.value);
await success($q, "อัปโหลดไฟล์สำเร็จ");
documentFile.value = null;
fetchDocumentFile(salaryId.value);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {});
hideLoader();
});
}
/**
@ -156,11 +159,11 @@ function onClickDeleteFile(fileName: string) {
showLoader();
await http
.delete(config.API.salaryChartDelFile(salaryId.value, fileName))
.then(() => {
setTimeout(() => {
fetchDocumentFile(salaryId.value);
success($q, "ลบไฟล์สำเร็จ");
}, 1000);
.then(async () => {
setTimeout(async () => {
await fetchDocumentFile(salaryId.value);
await success($q, "ลบไฟล์สำเร็จ");
}, 1500);
})
.catch((err) => {
messageError($q, err);
@ -168,7 +171,7 @@ function onClickDeleteFile(fileName: string) {
.finally(() => {
setTimeout(() => {
hideLoader();
}, 1000);
}, 2000);
});
});
}
@ -181,9 +184,9 @@ function onClickDonwload(fileName: string) {
showLoader();
http
.get(config.API.salaryChartDelFile(salaryId.value, fileName))
.then((res) => {
.then(async (res) => {
const data = res.data;
downloadFile(data.downloadUrl, data.fileType, fileName);
await downloadFile(data.downloadUrl, data.fileType, fileName);
})
.catch((err) => {
messageError($q, err);
@ -239,99 +242,93 @@ watch(
<template>
<q-dialog v-model="modal" persistent>
<q-card class="col-12" style="width: 40%">
<q-card style="width: 700px; max-width: 80vw">
<Header :tittle="`อัปโหลดเอกสารอ้างอิง`" :close="closeDialog" />
<q-separator />
<q-card-section class="scroll" style="max-height: 70vh">
<div class="row col-12 q-col-gutter-sm">
<div class="col-md-12">
<div class="col-xs-12 col-md-3">
<div class="row col-12 q-col-gutter-y-sm">
<div class="col-12 row">
<div v-if="!props.isActive" class="full-width">
<q-file
v-if="
props.typeAction === 'edit' &&
checkPermission($route)?.attrIsUpdate
"
class="col-12"
outlined
<div class="row col-12 q-col-gutter-y-sm">
<div class="col-12 row">
<div v-if="!props.isActive" class="full-width">
<q-file
v-if="
props.typeAction === 'edit' &&
checkPermission($route)?.attrIsUpdate
"
class="col-12"
outlined
dense
v-model="documentFile"
label="เอกสารอ้างอิง"
hide-bottom-space
>
<template v-slot:prepend>
<q-icon name="attach_file" color="primary" />
</template>
<template v-slot:after>
<q-btn
v-if="documentFile"
size="14px"
flat
round
dense
v-model="documentFile"
label="เอกสารอ้างอิง"
hide-bottom-space
color="add"
icon="mdi-upload"
@click="uploadDocumentFile"
><q-tooltip>ปโหลดเอกสาร</q-tooltip></q-btn
>
<template v-slot:prepend>
<q-icon name="attach_file" color="primary" />
</template>
<template v-slot:after>
</template>
</q-file>
</div>
</div>
<div v-if="itemsDocument.length > 0" class="col-xs-12 row">
<q-list class="full-width rounded-borders" bordered separator>
<q-item
v-for="file in itemsDocument"
:key="file.id"
clickable
v-ripple
>
<q-item-section>{{ file.name }}</q-item-section>
<q-item-section avatar>
<div class="row q-col-gutter-md">
<div>
<q-btn
v-if="documentFile"
size="14px"
dense
flat
round
dense
color="add"
icon="mdi-upload"
@click="uploadDocumentFile"
><q-tooltip>ปโหลดเอกสาร</q-tooltip></q-btn
color="blue"
icon="mdi-download"
@click="onClickDonwload(file.name)"
>
</template>
</q-file>
</div>
</div>
<q-tooltip>ดาวนโหลดไฟล</q-tooltip>
</q-btn>
</div>
<div
v-if="
!props.isActive &&
checkPermission($route)?.attrIsUpdate
"
>
<q-btn
dense
flat
round
color="red"
icon="delete"
@click="onClickDeleteFile(file.name)"
><q-tooltip>ลบไฟล</q-tooltip></q-btn
>
</div>
</div>
</q-item-section>
</q-item>
</q-list>
</div>
<div v-if="itemsDocument.length > 0" class="col-xs-12 row">
<q-list class="full-width rounded-borders" bordered separator>
<q-item
v-for="file in itemsDocument"
:key="file.id"
clickable
v-ripple
>
<q-item-section>{{ file.name }}</q-item-section>
<q-item-section avatar>
<div class="row q-col-gutter-md">
<div>
<q-btn
dense
flat
round
size="12px"
color="blue"
icon="mdi-download-outline"
@click="onClickDonwload(file.name)"
>
<q-tooltip>ดาวนโหลดไฟล</q-tooltip>
</q-btn>
</div>
<div
v-if="
!props.isActive &&
checkPermission($route)?.attrIsUpdate
"
>
<q-btn
dense
flat
round
size="12px"
color="red"
icon="mdi-delete-outline"
@click="onClickDeleteFile(file.name)"
><q-tooltip>ลบไฟล</q-tooltip></q-btn
>
</div>
</div>
</q-item-section>
</q-item>
</q-list>
</div>
<div class="col-12" v-else>
<q-card class="q-pa-md" bordered> ไมรายการเอกสาร </q-card>
</div>
</div>
<div class="col-12" v-else>
<q-card class="q-pa-md" bordered> ไมรายการเอกสาร </q-card>
</div>
</div>
</div>

View file

@ -87,8 +87,8 @@ function onSubmit() {
: config.API.salaryEmployeeChartByid(props.data.id);
await http[!props.isStatusEdit ? "post" : "put"](url, formData);
await props.fetchData?.();
closeDialog();
success($q, "บันทีกข้อมูลสำเร็จ");
closeDialog();
} catch (err) {
messageError($q, err);
} finally {

View file

@ -92,13 +92,13 @@ function onSubmit() {
? config.API.salaryEmployeeRateList
: config.API.salaryEmployeeRateListByid(props?.data?.id);
await http[!props.isStatusEdit ? "post" : "put"](url, body);
success($q, "บันทีกข้อมูลสำเร็จ");
props.fetchData?.();
await props.fetchData?.();
await success($q, "บันทีกข้อมูลสำเร็จ");
closeDialog();
} catch (err) {
messageError($q, err);
hideLoader();
} finally {
closeDialog();
hideLoader();
}
});
}

View file

@ -71,20 +71,17 @@ async function uploadDocumentFile() {
};
await http
.post(config.API.salaryEmployeeChartFile(salaryId.value), body)
.then((res) => {
console.log(res);
.then(async (res) => {
const foundKey: any = Object.keys(res.data).find(
(key) =>
res.data[key]?.fileName !== undefined &&
res.data[key]?.fileName !== ""
);
const link = res.data[foundKey]?.uploadUrl;
fileUpLoad(link);
await fileUpLoad(link);
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
@ -98,15 +95,17 @@ function fileUpLoad(url: string) {
headers: { "Content-Type": documentFile.value?.type },
onUploadProgress: (e) => console.log(e),
})
.then(() => {
success($q, "อัปโหลดไฟล์สำเร็จ");
.then(async () => {
await fetchDocumentFile(salaryId.value);
await success($q, "อัปโหลดไฟล์สำเร็จ");
documentFile.value = null;
fetchDocumentFile(salaryId.value);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {});
.finally(() => {
hideLoader();
});
}
/**
@ -118,11 +117,11 @@ function onClickDeleteFile(fileName: string) {
showLoader();
await http
.delete(config.API.salaryEmployeeChartDelFile(salaryId.value, fileName))
.then(() => {
setTimeout(() => {
fetchDocumentFile(salaryId.value);
success($q, "ลบไฟล์สำเร็จ");
}, 1000);
.then(async () => {
await setTimeout(async () => {
await fetchDocumentFile(salaryId.value);
await success($q, "ลบไฟล์สำเร็จ");
}, 1500);
})
.catch((err) => {
messageError($q, err);
@ -130,7 +129,7 @@ function onClickDeleteFile(fileName: string) {
.finally(() => {
setTimeout(() => {
hideLoader();
}, 1000);
}, 2000);
});
});
}
@ -199,100 +198,92 @@ watch(
<template>
<q-dialog v-model="modal" persistent>
<q-card class="col-12" style="width: 80%">
<q-card style="width: 700px; max-width: 80vw">
<Header :tittle="`อัปโหลดเอกสารอ้างอิง`" :close="closeDialog" />
<q-separator />
<q-card-section class="scroll" style="max-height: 70vh">
<div class="row col-12 q-col-gutter-sm">
<div class="col-md-12">
<div class="col-xs-12 col-md-3">
<div class="row col-12 q-col-gutter-y-sm">
<div class="col-12 row">
<div
v-if="
!props.isActive && checkPermission($route)?.attrIsUpdate
"
class="full-width"
>
<q-file
class="col-12"
outlined
<div class="row q-col-gutter-sm">
<div class="row col-12 q-col-gutter-y-sm">
<div class="col-12 row">
<div
v-if="!props.isActive && checkPermission($route)?.attrIsUpdate"
class="full-width"
>
<q-file
class="col-12"
outlined
dense
v-model="documentFile"
label="เอกสารอ้างอิง"
hide-bottom-space
>
<template v-slot:prepend>
<q-icon name="attach_file" color="primary" />
</template>
<template v-slot:after>
<q-btn
v-if="documentFile"
size="14px"
flat
round
dense
v-model="documentFile"
label="เอกสารอ้างอิง"
hide-bottom-space
color="add"
icon="mdi-upload"
@click="uploadDocumentFile"
><q-tooltip>ปโหลดเอกสาร</q-tooltip></q-btn
>
<template v-slot:prepend>
<q-icon name="attach_file" color="primary" />
</template>
<template v-slot:after>
</template>
</q-file>
</div>
</div>
<div v-if="itemsDocument.length > 0" class="col-xs-12 row">
<q-list class="full-width rounded-borders" bordered separator>
<q-item
v-for="file in itemsDocument"
:key="file.id"
clickable
v-ripple
>
<q-item-section>{{ file.name }}</q-item-section>
<q-item-section avatar>
<div class="row q-col-gutter-md">
<div>
<q-btn
v-if="documentFile"
size="14px"
dense
flat
round
dense
color="add"
icon="mdi-upload"
@click="uploadDocumentFile"
><q-tooltip>ปโหลดเอกสาร</q-tooltip></q-btn
color="blue"
icon="mdi-download"
@click="onClickDonwload(file.name)"
>
</template>
</q-file>
</div>
</div>
<q-tooltip>ดาวนโหลดไฟล</q-tooltip>
</q-btn>
</div>
<div
v-if="
!props.isActive &&
checkPermission($route)?.attrIsUpdate
"
>
<q-btn
dense
flat
round
color="red"
icon="delete"
@click="onClickDeleteFile(file.name)"
><q-tooltip>ลบไฟล</q-tooltip></q-btn
>
</div>
</div>
</q-item-section>
</q-item>
</q-list>
</div>
<div v-if="itemsDocument.length > 0" class="col-xs-12 row">
<q-list class="full-width rounded-borders" bordered separator>
<q-item
v-for="file in itemsDocument"
:key="file.id"
clickable
v-ripple
>
<q-item-section>{{ file.name }}</q-item-section>
<q-item-section avatar>
<div class="row q-col-gutter-md">
<div>
<q-btn
dense
flat
round
size="12px"
color="blue"
icon="mdi-download-outline"
@click="onClickDonwload(file.name)"
>
<q-tooltip>ดาวนโหลดไฟล</q-tooltip>
</q-btn>
</div>
<div
v-if="
!props.isActive &&
checkPermission($route)?.attrIsUpdate
"
>
<q-btn
dense
flat
round
size="12px"
color="red"
icon="mdi-delete-outline"
@click="onClickDeleteFile(file.name)"
><q-tooltip>ลบไฟล</q-tooltip></q-btn
>
</div>
</div>
</q-item-section>
</q-item>
</q-list>
</div>
<div class="col-12" v-else>
<q-card class="q-pa-md" bordered> ไมรายการเอกสาร </q-card>
</div>
</div>
<div class="col-12" v-else>
<q-card class="q-pa-md" bordered> ไมรายการเอกสาร </q-card>
</div>
</div>
</div>

View file

@ -108,8 +108,8 @@ function onSubmit() {
await http[!isEdit.value ? "post" : "put"](url, body)
.then(async () => {
await props.getDataMain?.();
closeDialog();
await success($q, "บันทึกข้อมูลสำเร็จ");
closeDialog();
})
.catch((e) => {
messageError($q, e);
@ -575,7 +575,7 @@ const getClass = (val: boolean) => {
</q-card-section>
<q-separator />
<q-card-actions align="right" class="bg-white text-teal">
<q-card-actions v-if="!isReadonly" align="right">
<q-btn label="บันทึก" color="secondary" type="submit"
><q-tooltip>นทกขอม</q-tooltip></q-btn
>

View file

@ -28,6 +28,7 @@ const { dialogRemove, messageError, showLoader, hideLoader, success } =
useCounterMixin();
/** ข้อมูล Table*/
const rows = ref<ListData[]>([]);
const columns = ref<QTableProps["columns"]>([
{
name: "no",
@ -120,7 +121,6 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px",
},
]);
const visibleColumns = ref<string[]>([
"no",
"posType",
@ -133,8 +133,6 @@ const visibleColumns = ref<string[]>([
"rateHighMax",
"reson",
]);
const rows = ref<ListData[]>([]);
const formFilter = reactive({
page: 1,
pageSize: 10,
@ -246,9 +244,9 @@ function onClickDelete(id: string) {
showLoader();
http
.delete(config.API.salaryFormula() + `/${id}`)
.then(() => {
success($q, "ลบข้อมูลสำเร็จ");
getData();
.then(async () => {
await getData();
await success($q, "ลบข้อมูลสำเร็จ");
})
.catch((err) => {
messageError($q, err);
@ -397,7 +395,7 @@ onMounted(() => {
<q-separator />
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-tr :props="props">
<q-td auto-width>
<q-btn
v-if="checkPermission($route)?.attrIsGet"

View file

@ -13,8 +13,8 @@ import type { FormFilter } from "@/modules/13_salary/interface/request/EmployeeC
import type { EmployeeSalary } from "@/modules/13_salary/interface/response/salaryEmployeeChart";
/** importComponents*/
import DialogEmployeeChart from "@/modules/13_salary/components/salaryEmployeeChart/DialogEmployeeChart.vue";
import DialogEmployeeUpload from "@/modules/13_salary/components/salaryEmployeeChart/DialogEmployeeUpload.vue";
import DialogEmployeeChart from "@/modules/13_salary/components/salaryEmployeeChart/DialogEmployeeChart.vue"; //
import DialogEmployeeUpload from "@/modules/13_salary/components/salaryEmployeeChart/DialogEmployeeUpload.vue"; //
/** importStore*/
import { useCounterMixin } from "@/stores/mixin";
@ -45,6 +45,7 @@ const activeType = ref<string>("");
const dataRow = ref<EmployeeSalary>();
/** ข้อมูล Table*/
const rows = ref<EmployeeSalary[]>([]);
const columns = ref<QTableProps["columns"]>([
{
name: "name",
@ -83,7 +84,6 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px",
},
]);
const rows = ref<EmployeeSalary[]>([]);
const visibleColumns = ref<string[]>([
"name",
"group",
@ -91,7 +91,9 @@ const visibleColumns = ref<string[]>([
"isActive",
]);
/** function fetch ข้แมูลรายาการผังบัญชีค่าจ้างลูกจ้างประจำ */
/**
* fetch แมลรายาการผงบญชาจางลกจางประจำ
*/
function fetchListChart() {
showLoader();
http
@ -112,32 +114,8 @@ function fetchListChart() {
});
}
// /**
// * function
// * @param type
// * @param data
// */
// function onClickAction(type: string, data: EmployeeSalary) {
// switch (type) {
// case "edit":
// onEdit(data);
// break;
// case "upload":
// onUpload(data.id, data.isActive);
// break;
// case "salaryRate":
// onSalaryRate(data.id);
// break;
// case "copy":
// onCoppy(data.id);
// break;
// default:
// break;
// }
// }
/**
* function openDialog แกไขผงบญชาจางลกจางประจำ
* openDialog แกไขผงบญชาจางลกจางประจำ
* @param data อมลผงบญชาจางลกจางประจำ
*/
function onEdit(data: EmployeeSalary, type: string) {
@ -175,6 +153,7 @@ function onSalaryRate(id: string) {
* @param id งบญชาจางลกจางประจำ
*/
function onCoppy(id: string) {
showLoader();
http
.post(config.API.salaryEmployeeChartCopy, { id: id })
.then(async () => {
@ -183,6 +162,9 @@ function onCoppy(id: string) {
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
@ -192,6 +174,7 @@ function onCoppy(id: string) {
*/
function onClickDelete(id: string) {
dialogRemove($q, () => {
showLoader();
http
.delete(config.API.salaryEmployeeChartByid(id))
.then(async () => {
@ -200,17 +183,24 @@ function onClickDelete(id: string) {
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
});
}
/** function เปิด dialog เพิ่มผังบัญชีค่าจ้างลูกจ้างประจำ*/
/**
* function เป dialog เพมผงบญชาจางลกจางประจำ
*/
function onClickAdd() {
isStatusEdit.value = false;
modalDialogEmployeeChart.value = true;
}
/** functionn fetch ข้อมูลรายการหน้าแรก*/
/**
* functionn fetch อมลรายการหนาแรก*
*/
function filterFn() {
formFilter.page = 1;
fetchListChart();
@ -253,7 +243,7 @@ onMounted(() => {
icon="add"
@click="onClickAdd()"
>
<q-tooltip>เพ </q-tooltip>
<q-tooltip>เพอม </q-tooltip>
</q-btn>
<q-space />
<q-input
@ -306,7 +296,7 @@ onMounted(() => {
<q-separator />
</template>
<template v-slot:body="props">
<q-tr :props="props" class="cursor-pointer">
<q-tr :props="props">
<q-td>
<q-btn
v-if="
@ -465,6 +455,7 @@ onMounted(() => {
</template>
</d-table>
<!-- งบญชาจางลกจางประจำ -->
<DialogEmployeeChart
v-model:modal="modalDialogEmployeeChart"
:isStatusEdit="isStatusEdit"
@ -473,6 +464,7 @@ onMounted(() => {
:activeType="activeType"
/>
<!-- ปโหลดเอกสารอางอ -->
<DialogEmployeeUpload
v-model:modal="modalDialogUpload"
:id="salaryChartId"