permission => โครงสร้างอัตรากำลัง,อัตรากำลังลูกจ้างประจำ,ทะเบียนประวัติ, ทะเบียนประวัติลูกจ้าง,ตั้งค่าเว็บสรรหา, สอบแข่งขัน

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-08-01 18:03:39 +07:00
parent a59a9d5ee7
commit c8fef97125
34 changed files with 606 additions and 1904 deletions

View file

@ -1,29 +1,32 @@
<script setup lang="ts">
import { ref, onMounted, reactive } from "vue";
import axios from "axios";
import { ref, onMounted } from "vue";
import { checkPermission } from "@/utils/permissions";
import { useRoute, useRouter } from "vue-router";
import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import http from "@/plugins/http";
import config from "@/app.config";
import { useQuasar } from "quasar";
import axios from "axios";
/**
* importType
*/
import type { DataOption } from "@/modules/04_registryPerson/interface/index/Main";
import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/Profile";
import avatar from "@/assets/avatar_user.jpg";
/**
* importComponents
*/
import DialogHeader from "@/components/DialogHeader.vue";
import TabMain from "@/modules/04_registryPerson/components/detail/TabMain.vue";
import type { ResponseObject } from "@/modules/04_registryPerson/interface/response/Profile";
import DialogHeader from "@/components/DialogHeader.vue";
/** ถึงเเก่กรรม */
const dialogPassaway = ref<boolean>(false);
const placeDeathCertificate = ref("");
const deathCertificateNo = ref("");
const dateDeath = ref<Date>(new Date());
const filePassaway = ref<any>(null);
const reasonDeath = ref("");
/**
* importStore
*/
import { useCounterMixin } from "@/stores/mixin";
import avatar from "@/assets/avatar_user.jpg";
const dialogImage = ref<boolean>(false);
const mixin = useCounterMixin();
/**
* use
*/
const $q = useQuasar();
const router = useRouter();
const route = useRoute();
@ -37,7 +40,17 @@ const {
date2Thai,
dateToISO,
dialogMessageNotify,
} = mixin;
} = useCounterMixin();
/** ถึงเเก่กรรม */
const dialogPassaway = ref<boolean>(false);
const placeDeathCertificate = ref("");
const deathCertificateNo = ref("");
const dateDeath = ref<Date>(new Date());
const filePassaway = ref<any>(null);
const reasonDeath = ref("");
const dialogImage = ref<boolean>(false);
const profileId = ref<string>(route.params.id.toString());
const empType = ref<string>(
@ -115,7 +128,6 @@ function uploadImg() {
profileId: profileId.value,
})
.then((res) => {
console.log(res.data);
fileName.value = res.data.result.avatarName;
uploadProfile(res.data.result.avatar);
})
@ -125,8 +137,8 @@ function uploadImg() {
.finally(() => {});
}
async function uploadProfile(path: string) {
await http
function uploadProfile(path: string) {
http
.post(config.API.fileByPath(path), {
replace: true,
fileList: [
@ -135,7 +147,7 @@ async function uploadProfile(path: string) {
},
],
})
.then(async (res) => {
.then((res) => {
uploadUrl.value = res.data[fileName.value].uploadUrl;
uploadFileURL(uploadUrl.value, profileFile.value);
closeImage();
@ -148,9 +160,9 @@ async function uploadProfile(path: string) {
});
}
async function uploadFileURL(uploadUrl: string, file: any) {
function uploadFileURL(uploadUrl: string, file: any) {
showLoader();
await axios
axios
.put(uploadUrl, file, {
headers: {
"Content-Type": file.type,
@ -168,9 +180,9 @@ async function uploadFileURL(uploadUrl: string, file: any) {
});
}
async function fetchProfile(id: string) {
function fetchProfile(id: string) {
showLoader();
await http
http
.get(config.API.fileByFile("ทะเบียนประวัติ", "โปรไฟล์", id, fileName.value))
.then(async (res) => {
profilePicture.value = res.data.downloadUrl;
@ -287,140 +299,155 @@ function onClickDownloadKp7(type: string) {
});
}
/** ช่วยราชการ */
async function helpPost() {
/**
* วยราชการ
*/
function helpPost() {
const formData = new FormData();
formData.append("id", profileId.value);
dialogConfirm($q, async () => {
showLoader();
await http
.post(config.API.placemenHelpGov, formData)
.then(() => {
success($q, "ดำเนินการสำเร็จ");
.then(async () => {
await router.push("/help-government");
await success($q, "ดำเนินการสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
router.push("/help-government");
});
});
}
/** ส่งตัวกลับ */
async function repatriationPost() {
/**
* งตวกล
*/
function repatriationPost() {
const formData = new FormData();
formData.append("id", profileId.value);
dialogConfirm($q, async () => {
showLoader();
await http
.post(config.API.placemenRepatriation, formData)
.then(() => {
success($q, "ดำเนินการสำเร็จ");
.then(async () => {
await router.push("/repatriate");
await success($q, "ดำเนินการสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
router.push("/repatriate");
});
});
}
/** แต่งตังเลื่อน */
async function appointPost() {
/**
* แตงตงเลอน
*/
function appointPost() {
const formData = new FormData();
formData.append("id", profileId.value);
dialogConfirm($q, async () => {
showLoader();
await http
.post(config.API.placemenAppointment, formData)
.then(() => {
success($q, "ดำเนินการสำเร็จ");
.then(async () => {
await router.push("/appoint-promote");
await success($q, "ดำเนินการสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
router.push("/appoint-promote");
});
});
}
/** ถึงเเก่กรรม */
async function clickPassaway() {
/**
* งเเกกรรม
*/
function clickPassaway() {
dialogPassaway.value = true;
}
/** ให้ออกจากราชการ */
async function outPost() {
/**
* ใหออกจากราชการ
*/
function outPost() {
const formData = new FormData();
formData.append("id", profileId.value);
dialogConfirm($q, async () => {
showLoader();
await http
.post(config.API.retirementOut, formData)
.then(() => {
success($q, "ดำเนินการสำเร็จ");
.then(async () => {
await router.push("/dismiss-order");
await success($q, "ดำเนินการสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
router.push("/dismiss-order");
});
});
}
/** อื่นๆ */
async function otherPost() {
/**
* นๆ
*/
function otherPost() {
const formData = new FormData();
formData.append("id", profileId.value);
dialogConfirm($q, async () => {
showLoader();
await http
.post(config.API.placemenOther, formData)
.then(() => {
success($q, "ดำเนินการสำเร็จ");
.then(async () => {
await router.push("/other");
await success($q, "ดำเนินการสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
router.push("/other");
});
});
}
const appointEmployeePost = async () => {
function appointEmployeePost() {
const formData = new FormData();
formData.append("id", profileId.value);
dialogConfirm($q, async () => {
showLoader();
await http
.post(config.API.appointEmployee(), formData)
.then(() => {
success($q, "ดำเนินการสำเร็จ");
.then(async () => {
await router.push("/appoint-employee");
await success($q, "ดำเนินการสำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
router.push("/appoint-employee");
});
});
};
}
function closePassaway() {
dialogPassaway.value = false;
}
/**
* function นยนบนทกขอมลถงแกกรรม
*/
function clickSaveDeceased() {
dialogConfirm($q, async () => {
showLoader();
@ -433,9 +460,9 @@ function clickSaveDeceased() {
formData.append("ProfileId", profileId.value);
await http
.post(config.API.listDeceased(), formData)
.then(() => {
success($q, "บันทึกข้อมูลสำเร็จ");
router.push("/deceased");
.then(async () => {
await success($q, "บันทึกข้อมูลสำเร็จ");
await router.push("/deceased");
})
.catch((e) => {
messageError($q, e);
@ -446,10 +473,17 @@ function clickSaveDeceased() {
});
}
/**
* function เป popup เลอกรปภาพ
*/
function openDialogImg() {
dialogImage.value = true;
getImage();
}
/**
* function เรยกขอมลร
*/
function getImage() {
showLoader();
http
@ -470,6 +504,10 @@ function getImage() {
});
}
/**
* function เรยกขอมลร
* @param dataList
*/
function getImg(dataList: any) {
http
.get(config.API.fileByPath(`${dataList.avatar}/${dataList.avatarName}`))
@ -481,21 +519,26 @@ function getImg(dataList: any) {
...data,
};
images.value = [...images.value, newData];
console.log(images.value);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {});
});
}
/**
* funciton Popup เลอกรปภาพ
*/
function closeImage() {
dialogImage.value = false;
images.value = [];
imagesAlldata.value = [];
}
async function deletePhoto(id: string) {
/**
* funciotn นยนการลบร
* @param id ปภาพ
*/
function deletePhoto(id: string) {
dialogRemove(
$q,
() => {
@ -518,35 +561,20 @@ async function deletePhoto(id: string) {
);
}
function imageClass(n: any) {
const val = n == activeImage.value;
return {
"rounded-borders bg-grey-2 image-size-default": val,
"rounded-borders bg-grey-2 image-size-full": !val,
};
}
function getClass(n: any) {
const val = n == activeImage.value;
return {
"rounded-borders border-green shadow-1": val,
"rounded-borders shadow-1": !val,
};
}
async function selectAvatarHistory() {
console.log(activeImage.value);
/**
* function นยนการเลอกร
*/
function selectAvatarHistory() {
if (activeImage.value == null) {
dialogMessageNotify($q, "กรุณาเลือกรูปที่ต้องการเปลี่ยน");
return;
}
const data = activeImage.value;
showLoader();
await http
http
.get(config.API.orgProfileAvatar + `/select/${profileId.value}/${data.id}`)
.then(async (res) => {
.then(async () => {
closeImage();
await fetchDataPersonal();
await fetchProfile(profileId.value);
})
@ -558,10 +586,32 @@ async function selectAvatarHistory() {
});
}
/**
* class
* @param n
*/
function imageClass(n: any) {
const val = n == activeImage.value;
return {
"rounded-borders bg-grey-2 image-size-default": val,
"rounded-borders bg-grey-2 image-size-full": !val,
};
}
/**
* class input
* @param n
*/
function getClass(n: any) {
const val = n == activeImage.value;
return {
"rounded-borders border-green shadow-1": val,
"rounded-borders shadow-1": !val,
};
}
onMounted(async () => {
// fileName.value = `profile-${profileId.value}`;
await fetchDataPersonal();
// await fetchProfile(profileId.value);
});
</script>
@ -677,7 +727,6 @@ onMounted(async () => {
}}
</h2>
</div>
<!-- <div class="col-12 subtitle">{{ formDetail?.position }}</div> -->
</div>
</div>
</div>
@ -691,6 +740,7 @@ onMounted(async () => {
<q-img :src="profilePicture" />
</q-avatar>
<q-btn
v-if="checkPermission($route)?.attrIsUpdate"
round
text-color="primary"
icon="mdi-pencil-outline"
@ -739,78 +789,6 @@ onMounted(async () => {
<q-separator />
</q-card>
<!-- <q-card>
<div class="column" style="height: 120px">
<div class="col row items-center">
<div class="row col-12">
<div class="col" style="padding-left: 14%">
<div class="col-12 text-primary">
<h2
class="title q-ma-none q-pa-none"
v-if="formDetail && formDetail.firstName && formDetail.lastName"
>
{{
`${formDetail?.prefix ? formDetail?.prefix : ""}${
formDetail?.firstName
} ${formDetail?.lastName} ${leaveReason}`
}}
</h2>
</div>
</div>
</div>
</div>
<div class="absolute-center-left q-ml-lg">
<q-avatar size="90px" class="bg-grey-2">
<q-img :src="profilePicture" />
</q-avatar>
<q-btn
round
text-color="primary"
icon="mdi-pencil-outline"
@click="openDialogImg"
size="sm"
unelevated
class="bg-white btnEditImg"
>
</q-btn>
</div>
<div class="col row items-center bg-toolbar">
<div class="row col-12" style="padding-left: 14%">
<div class="col-2">
<div class="col-sm-3 col-md-3">
<div class="col text-grey-6 text-caption">
{{ empType === "" ? "ตำแหน่งในสายงาน" : "ตำแหน่ง" }}
</div>
<div class="col">{{ formDetail?.position || "-" }}</div>
</div>
</div>
<div class="col-2">
<div class="col-sm-3 col-md-3">
<div class="col text-grey-6 text-caption">
{{ empType === "" ? "ตำแหน่งประเภท" : "กลุ่มงาน" }}
</div>
<div class="col">
{{ formDetail?.posType?.posTypeName || "-" }}
</div>
</div>
</div>
<div class="col-2">
<div class="col-sm-3 col-md-3">
<div class="col text-grey-6 text-caption">
{{ empType === "" ? "ระดับ" : "ระดับชั้นงาน" }}
</div>
<div class="col">
{{ formDetail?.posLevel?.posLevelName || "-" }}
</div>
</div>
</div>
</div>
</div>
</div>
</q-card> -->
<q-card bordered class="q-mt-md rounded">
<TabMain :fetchDataPersonal="fetchDataPersonal" />
</q-card>
@ -1034,6 +1012,7 @@ h2.title {
.bg-toolbar {
background-color: #f2fbfa;
height: 60px;
}
.btnEditImg {
position: absolute;