Merge branch 'develop' into devTee

This commit is contained in:
STW_TTTY\stwtt 2024-05-31 09:10:51 +07:00
commit 804cfadfe5
130 changed files with 2610 additions and 2398 deletions

View file

@ -92,7 +92,7 @@ const columns = ref<QTableProps["columns"]>([
{
name: "positionType",
align: "left",
label: "ตำแหน่งประเภท",
label: "ประเภทตำแหน่ง",
sortable: true,
field: "positionType",
headerStyle: "font-size: 14px",
@ -772,7 +772,7 @@ onMounted(() => {
lazy-rules
borderless
v-model="formDataSalary.positionType"
:label="empType == '' ? 'ตำแหน่งประเภท' : 'กลุ่มงาน'"
:label="empType == '' ? 'ประเภทตำแหน่ง' : 'กลุ่มงาน'"
emit-value
map-options
option-label="name"
@ -782,7 +782,7 @@ onMounted(() => {
use-input
input-debounce="0"
@update:model-value="updateSelectType"
:rules="empType == '' ? [(val: string) => !!val || 'กรุณาเลือกตำแหน่งประเภท' ]:[(val: string) => !!val || 'กรุณาเลือกกลุ่มงาน' ]"
:rules="empType == '' ? [(val: string) => !!val || 'กรุณาเลือกประเภทตำแหน่ง' ]:[(val: string) => !!val || 'กรุณาเลือกกลุ่มงาน' ]"
@filter="(inputValue: any,
doneFn: Function) => filterSelector(inputValue, doneFn, 'posType'
)"

View file

@ -118,7 +118,7 @@ const columns = ref<QTableProps["columns"]>([
{
name: "positionType",
align: "left",
label: "ตำแหน่งประเภท",
label: "ประเภทตำแหน่ง",
sortable: true,
field: "positionType",
headerStyle: "font-size: 14px",

View file

@ -183,12 +183,66 @@ async function fetchProfile(id: string) {
});
}
const reasonStatus = ref<boolean>(false);
const leaveReason = ref<string>("");
const reasonOptions = ref<DataOption[]>([
{
id: "RETIRE",
name: "เกษียณอายุราชการ",
},
{
id: "RESIGN",
name: "ลาออก",
},
{
id: "TRANSFER",
name: "ให้โอน",
},
{
id: "DEATH",
name: "ถึงแก่กรรม",
},
{
id: "LAYOFF",
name: "ให้ออก",
},
{
id: "DISCHARGE",
name: "ปลดออก",
},
{
id: "DISMISS",
name: "ไล่ออก",
},
{
id: "OTHER",
name: "อื่นๆ",
},
]);
async function fetchDataPersonal() {
showLoader();
await http
.get(config.API.registryNewByProfileId(profileId.value, empType.value))
.then((res) => {
formDetail.value = res.data.result;
if (res.data.result.leaveReason) {
//
const reason = reasonOptions.value.filter(
(r: DataOption) => r.id == res.data.result.leaveReason
);
if (reason.length > 0) {
leaveReason.value = ` (พ้นจากราชการด้วยสาเหตุ: ${reason[0].name})`;
} else if (
res.data.result.leaveReason !== null &&
res.data.result.leaveReason !== ""
) {
leaveReason.value = ` (พ้นจากราชการด้วยสาเหตุ: ${res.data.result.leaveReason})`;
}
reasonStatus.value = reason.length > 0 ? true : false;
}
fileName.value = res.data.result.avatarName;
if (formDetail.value?.avatarName) {
fetchProfile(profileId.value);
@ -205,11 +259,32 @@ async function fetchDataPersonal() {
}
function onClickDownloadKp7(type: string) {
if (type === "FULL") {
window.open(config.API.profileReportId(profileId.value));
} else if (type === "SHORT") {
window.open(config.API.profileKp7ShortId(profileId.value));
}
showLoader();
const url =
type === "FULL"
? config.API.profileReportId(profileId.value)
: config.API.profileKp7ShortId(profileId.value);
const fileName = type === "FULL" ? "ก.พ.7/ก.ก.1" : "ประวัติแบบย่อ";
http
.get(url, {
responseType: "arraybuffer", //
})
.then((res) => {
const data = res.data;
const blob = new Blob([data], { type: "application/pdf" });
const url = URL.createObjectURL(blob);
const link = document.createElement("a");
link.href = url;
link.download = `${fileName}.pdf`;
document.body.appendChild(link);
link.click();
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
/** ช่วยราชการ */
@ -593,7 +668,7 @@ onMounted(async () => {
v-if="formDetail && formDetail.firstName && formDetail.lastName"
>
{{
`${formDetail?.prefix}${formDetail?.firstName} ${formDetail?.lastName}`
`${formDetail?.prefix}${formDetail?.firstName} ${formDetail?.lastName} ${leaveReason}`
}}
</h2>
</div>