ประเมินเชี่ยวชาญ

This commit is contained in:
setthawutttty 2025-04-01 16:34:24 +07:00
parent 27fb61604f
commit c45d3f8e6e
4 changed files with 135 additions and 22 deletions

View file

@ -61,6 +61,9 @@ export default {
dataUserCertificateByType: (emType: string, type: string) =>
`${org}/profile${emType}/${type}/user`,
dataUserEvaByType: (type: string) =>
`${org}/profile/${type}/user`,
dataUserOther: `${profileOrg}/other/user`,
dataUserOtherByType: (type: string) => `${org}/profile${type}/other/user`,

View file

@ -12,6 +12,9 @@ interface ProfileData {
citizenId?: string;
salary?: number|null;
birthDate?: string;
org?: string;
dateStart?: string;
dateRetireLaw?: string;
}
interface InformationData {

View file

@ -8,6 +8,7 @@ import http from "@/plugins/http";
import config from "@/app.config";
import genReport from "@/plugins/genreport";
import { useCounterMixin } from "@/stores/mixin";
import { useDataStore } from "@/stores/data";
import type {
FormRef,
@ -17,6 +18,7 @@ import type {
const $q = useQuasar();
const mixin = useCounterMixin();
const dataPerson = useDataStore();
const {
dialogConfirm,
messageError,
@ -24,12 +26,13 @@ const {
hideLoader,
date2Thai,
success,
findOrgName,
} = mixin;
const router = useRouter();
const route = useRoute();
const currentYear = new Date().getFullYear();
const evaluateId = ref<string>(route.params.id as string);
const profile = ref<any>();
let profile = ref<any>();
/** form ผู้เซ็นเอกสาร*/
const formCommand = reactive<FormCommand>({
@ -228,17 +231,81 @@ async function onClickDowloadFile(
{ certificates: certificates },
{ salaries: salaries },
{ trainings: trainings },
{ fullName: profile.value == null ? "" : profile.value.fullName },
{ position: profile.value == null ? "" : profile.value.position },
{ positionLevel: profile.value == null ? "" : profile.value.positionLevel },
{ posNo: profile.value == null ? "" : profile.value.posNo },
{ oc: profile.value == null ? "" : profile.value.oc },
{ birthDate: profile.value == null ? "" : date2Thai(profile.value.birthDate), },
{ govAge: profile.value == null ? "" : profile.value.govAge },
{ positionLevelNew: profile.value == null ? "" : profile.value.type == "EXPERT" ? "ชำนาญการ" : "ชำนาญการพิเศษ", },
tp === "EV1_005" || tp === "EV1_007" ? { organizationName: "-" } : null,
{
fullName: dataPerson.formData.firstName
? `${dataPerson.formData.prefix}${dataPerson.formData.firstName} ${dataPerson.formData.lastName}`
: "",
},
{
position: dataPerson.formData.position
? dataPerson.formData.position
: "",
},
{
positionLevel: dataPerson.formData.posLevelName
? dataPerson.formData.posLevelName
: "",
},
{ posNo: dataPerson.formData.posNo ? dataPerson.formData.posNo : "" },
{ org: dataPerson.formData ? dataPerson.formData.org : "" },
{
birthDate: dataPerson.formData.birthDate
? date2Thai(new Date(dataPerson.formData.birthDate))
: "",
},
{
govAge: profile.value.government
? `${
profile.value.government.govAge.day !== 0
? `${profile.value.government.govAge.day} วัน`
: ""
} ${
profile.value.government.govAge.month !== 0
? `${profile.value.government.govAge.month} เดือน`
: ""
} ${
profile.value.government.govAge.year !== 0
? `${profile.value.government.govAge.year} ปี`
: ""
}`
: ``,
},
{
positionLevelNew:
profile.value == null
? ""
: profile.value.type == "EXPERT"
? "ชำนาญการ"
: "ชำนาญการพิเศษ",
},
tp === "EV1_005"
? { salary: dataPerson.formData.salary ? dataPerson.formData.salary : "" }
: null,
tp === "EV1_006" ? { lastTwoYear: (currentYear - 2).toString() } : null,
tp === "EV1_006" ? { lastOneYear: (currentYear - 1).toString() } : null,
tp === "EV1_006" ? { currentYear: currentYear.toString() } : null,
tp === "EV1_006" ? { commanderFullname: formData.commanderFullname } : null,
tp === "EV1_006" ? { commanderPosition: formData.commanderPosition } : null,
tp === "EV1_006" ? { commanderOrg: "" } : null,
tp === "EV1_006"
? { commanderAboveFullname: formData.commanderAboveFullname }
: null,
tp === "EV1_006"
? { commanderAbovePosition: formData.commanderAbovePosition }
: null,
tp === "EV1_006" ? { commanderAboveOrg: "" } : null,
tp === "EV1_007" ? { positionName: "-" } : null,
tp === "EV1_007" ? { positionLeaveName: "-" } : null
tp === "EV1_007" ? { positionLeaveName: "-" } : null,
tp === "EV1_009" ? { dateStart: dataPerson.formData.dateStart } : null,
tp === "EV1_009"
? { dateRetireLaw: dataPerson.formData.dateRetireLaw }
: null,
tp === "EV1_010" ? { subject: formData.subject } : null
);
const body = {
template: tp,
@ -339,16 +406,49 @@ function getData() {
});
}
function getDetail(type: any) {
http.get(config.API.dataUserEvaByType(type)).then((res) => {
profile.value = {
...profile.value, //
[type === "salary"
? "salaries"
: type === "certificate"
? "certificates"
: type === "training"
? "trainings"
: type]: res.data.result, // (type)
};
});
}
const keyObject = ref<string[]>([
"educations",
"certificate",
"salary",
"training",
"assessments",
"government",
]);
onMounted(() => {
getData();
downloadFile("1-แบบพิจารณาคุณสมบัติบุคคล");
downloadFile("2-แบบแสดงรายละเอียดการเสนอผลงาน");
downloadFile(
"3-แบบตรวจสอบความถูกต้องครบถ้วนของข้อมูลเพื่อประกอบการคัดเลือกบุคคล (เอกสารแบบ ก)"
);
downloadFile("4-แบบประเมินคุณลักษณะบุคคล");
downloadFile("5-แบบสรุปข้อมูลของผู้ขอรับการคัดเลือก (เอกสารหมายเลข 9)");
downloadFile("6-ผลงานที่จะส่งประเมิน (เอกสารหมายเลข 11)");
showLoader();
Promise.all([getData(), ...keyObject.value.map(getDetail)])
.then(() => {})
.catch((e) => {
hideLoader();
messageError($q, e);
})
.finally(() => {
hideLoader();
});
[
"1-แบบพิจารณาคุณสมบัติบุคคล",
"2-แบบแสดงรายละเอียดการเสนอผลงาน",
"3-แบบตรวจสอบความถูกต้องครบถ้วนของข้อมูลเพื่อประกอบการคัดเลือกบุคคล (เอกสารแบบ ก)",
"4-แบบประเมินคุณลักษณะบุคคล",
"5-แบบสรุปข้อมูลของผู้ขอรับการคัดเลือก (เอกสารหมายเลข 9)",
"6-ผลงานที่จะส่งประเมิน (เอกสารหมายเลข 11)",
].forEach((fileName) => downloadFile(fileName));
});
</script>
@ -381,6 +481,7 @@ onMounted(() => {
class="text-weight-medium bg-grey-1 col-12 q-py-sm q-px-md"
>
ผลงาน
<br />
</div>
<div class="col-12"><q-separator /></div>
<div class="col-12 q-pa-sm">

View file

@ -13,7 +13,7 @@ export const useDataStore = defineStore("dataMain", () => {
const storeRegistry = useRegistryInFormationStore();
const $q = useQuasar();
const mixin = useCounterMixin();
const { messageError, showLoader, hideLoader, findPosMasterNo } = mixin;
const { messageError, showLoader, hideLoader, findPosMasterNo,findOrgName } = mixin;
// ref() คือการประกาศ state เหมือน vuex
const formData = reactive<ProfileData>({
profileId: "",
@ -28,6 +28,9 @@ export const useDataStore = defineStore("dataMain", () => {
salary: null,
birthDate: '',
posNo: "",
org: "",
dateStart: "",
dateRetireLaw: "",
});
const count = ref<number>(0);
const loader = ref<boolean>(false);
@ -110,7 +113,10 @@ export const useDataStore = defineStore("dataMain", () => {
formData.posTypeName = data.posTypeName;
formData.posExecutiveName = data.posExecutiveName;
formData.posLevelName = data.posLevelName;
formData.dateStart = data.dateStart;
formData.dateRetireLaw = data.dateRetireLaw;
formData.posNo = findPosMasterNo(data);
formData.org = findOrgName(data);
storeRegistry.profileId = data.profileId;
storeRegistry.citizenId = data.citizenId;
}