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

This commit is contained in:
STW_TTTY\stwtt 2024-06-27 11:15:45 +07:00
parent 19d0763afc
commit 11be473f54
6 changed files with 1554 additions and 187 deletions

View file

@ -38,4 +38,7 @@ export default {
`${evaluation}/document/${val}/${id}`, `${evaluation}/document/${val}/${id}`,
loadFileDocument: (val: string, id: string, file: String) => loadFileDocument: (val: string, id: string, file: String) =>
`${evaluation}/document/${val}/${id}/${file}`, `${evaluation}/document/${val}/${id}/${file}`,
evaluationExpertise:`${evaluation}/expertise`
}; };

View file

@ -1,13 +1,52 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive } from "vue"; import { ref, reactive,watch,onMounted } from "vue";
import { useRouter } from "vue-router"; import { useRouter, useRoute } from "vue-router";
import { useCounterMixin } from "@/stores/mixin"; import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar"; import { useQuasar } from "quasar";
import type { FormRef } from "@/modules/06_evaluate/interface/evalute"; import type { FormRef } from "@/modules/06_evaluate/interface/evalute";
import axios from "axios";
import http from "@/plugins/http";
import config from "@/app.config";
import genReport from "@/plugins/genreport";
const router = useRouter();
const route = useRoute();
const evaluateId = ref<string>(route.params.id as string);
const profile = ref<any>();
const $q = useQuasar(); const $q = useQuasar();
const mixin = useCounterMixin(); const mixin = useCounterMixin();
const { dialogConfirm, messageError, showLoader, hideLoader } = mixin; const {
dialogConfirm,
messageError,
showLoader,
hideLoader,
date2Thai,
success,
} = mixin;
interface FormCommand {
commanderFullname: string;
commanderPosition: string;
commanderAboveFullname: string;
commanderAbovePosition: string;
author: string;
subject: string;
assignedPosition: string;
}
/** form ผู้เซ็นเอกสาร*/
const formCommand = reactive<FormCommand>({
commanderFullname: "",
commanderPosition: "",
commanderAboveFullname: "",
commanderAbovePosition: "",
author: "",
subject: "",
assignedPosition: "",
});
const formData = reactive<any>({ const formData = reactive<any>({
subject: "", subject: "",
author: "", author: "",
@ -17,7 +56,20 @@ const formData = reactive<any>({
commanderAbovePosition: "", commanderAbovePosition: "",
}); });
const router = useRouter(); const downloadFile1 = ref<string>("");
const downloadFile2 = ref<string>("");
const downloadFile3 = ref<string>("");
const downloadFile4 = ref<string>("");
const downloadFile5 = ref<string>("");
const downloadFile6 = ref<string>("");
/** ตัวแปร file*/
const fileEvaluation1 = ref<any>();
const fileEvaluation2 = ref<any>();
const fileEvaluation3 = ref<any>();
const fileEvaluation4 = ref<any>();
const fileEvaluation5 = ref<any>();
const fileEvaluation6 = ref<any>();
const subjectRef = ref<Object | null>(null); const subjectRef = ref<Object | null>(null);
const authorRef = ref<Object | null>(null); const authorRef = ref<Object | null>(null);
@ -41,11 +93,17 @@ const files = [
id: "file1", id: "file1",
fileName: "แบบพิจารณาคุณสมบัติบุคคล", fileName: "แบบพิจารณาคุณสมบัติบุคคล",
pathName: "1-แบบพิจารณาคุณสมบัติบุคคล", pathName: "1-แบบพิจารณาคุณสมบัติบุคคล",
tp: "EV1_005",
templateName: "template-1",
nameFile: "แบบพิจารณาคุณสมบัติบุคคล",
}, },
{ {
id: "file2", id: "file2",
fileName: "แบบแสดงรายละเอียดการเสนอผลงาน", fileName: "แบบแสดงรายละเอียดการเสนอผลงาน",
pathName: "2-แบบแสดงรายละเอียดการเสนอผลงาน", pathName: "2-แบบแสดงรายละเอียดการเสนอผลงาน",
tp: "EV1_006",
templateName: "template-2",
nameFile: "แบบแสดงรายละเอียดการเสนอผลงาน",
}, },
{ {
id: "file3", id: "file3",
@ -53,21 +111,34 @@ const files = [
"แบบตรวจสอบความถูกต้องครบถ้วนของข้อมูลเพื่อประกอบการคัดเลือกบุคคล (เอกสารแบบ ก)", "แบบตรวจสอบความถูกต้องครบถ้วนของข้อมูลเพื่อประกอบการคัดเลือกบุคคล (เอกสารแบบ ก)",
pathName: pathName:
"3-แบบตรวจสอบความถูกต้องครบถ้วนของข้อมูลเพื่อประกอบการคัดเลือกบุคคล (เอกสารแบบ ก)", "3-แบบตรวจสอบความถูกต้องครบถ้วนของข้อมูลเพื่อประกอบการคัดเลือกบุคคล (เอกสารแบบ ก)",
tp: "EV1_007",
templateName: "template-3",
nameFile:
"แบบตรวจสอบความถูกต้องครบถ้วนของข้อมูลเพื่อประกอบการคัดเลือกบุคคล (เอกสารแบบ ก)",
}, },
{ {
id: "file4", id: "file4",
fileName: "แบบประเมินคุณลักษณะบุคคล", fileName: "แบบประเมินคุณลักษณะบุคคล",
pathName: "4-แบบประเมินคุณลักษณะบุคคล", pathName: "4-แบบประเมินคุณลักษณะบุคคล",
tp: "EV1_008",
templateName: "template-4",
nameFile: "แบบประเมินคุณลักษณะบุคคล",
}, },
{ {
id: "file5", id: "file5",
fileName: "แบบสรุปข้อมูลของผู้ขอรับการคัดเลือก (เอกสารหมายเลข 9)", fileName: "แบบสรุปข้อมูลของผู้ขอรับการคัดเลือก (เอกสารหมายเลข 9)",
pathName: "5-แบบสรุปข้อมูลของผู้ขอรับการคัดเลือก (เอกสารหมายเลข 9)", pathName: "5-แบบสรุปข้อมูลของผู้ขอรับการคัดเลือก (เอกสารหมายเลข 9)",
tp: "EV1_009",
templateName: "template-5",
nameFile: "แบบสรุปข้อมูลของผู้ขอรับการคัดเลือก (เอกสารหมายเลข 9)",
}, },
{ {
id: "file6", id: "file6",
fileName: "ผลงานที่จะส่งประเมิน (เอกสารหมายเลข 11)", fileName: "ผลงานที่จะส่งประเมิน (เอกสารหมายเลข 11)",
pathName: "6-ผลงานที่จะส่งประเมิน (เอกสารหมายเลข 11)", pathName: "6-ผลงานที่จะส่งประเมิน (เอกสารหมายเลข 11)",
tp: "EV1_010",
templateName: "template-6",
nameFile: "ผลงานที่จะส่งประเมิน (เอกสารหมายเลข 11)",
}, },
]; ];
@ -93,25 +164,19 @@ async function downloadFile(name: string) {
function onSubmit() { function onSubmit() {
dialogConfirm($q, () => { dialogConfirm($q, () => {
console.log(formData); showLoader();
// showLoader(); http
// http .post(config.API.evaluationExpertise, formData)
// .post(config.API.createOrganization, formData) .then((res) => {
// .then((res) => { router.push(`/evaluate/detail/expertise/${res.data.result.id}`)
// status.value = true; })
// store.typeOrganizational = "draft"; .catch((err) => {
// store.draftId = res.data.result.id; messageError($q, err);
// success($q, ""); })
// // props.fetchActive?.(); .finally(async () => {
// }) await close();
// .catch((err) => { await hideLoader();
// messageError($q, err); });
// })
// .finally(async () => {
// modal.value = await false;
// await close();
// await hideLoader();
// });
}); });
} }
@ -132,12 +197,174 @@ function validateForm() {
} else { } else {
} }
} }
/**
* funcion ดาวนโหลดไฟล
* @param tp templatname
* @param templateName
* @param fileName ไฟล
*/
async function onClickDowloadFile(
tp: string,
templateName: string,
fileName: string
) {
showLoader();
let educations: any = [];
if (profile.value != null) {
profile.value.educations.map((e: any) => {
educations.push({
educationLevel: e.educationLevel ?? "",
finishYear:
e.finishDate == null
? ""
: new Date(e.finishDate).getFullYear() + 543,
institute: e.institute ?? "",
});
});
}
let certificates: any = [];
if (profile.value != null) {
profile.value.certificates.map((e: any) => {
certificates.push({
certificateNo: e.certificateNo ?? "",
certificateType: e.certificateType ?? "",
issuer: e.issuer ?? "",
});
});
}
let salaries: any = [];
if (profile.value != null) {
profile.value.salaries.map((e: any) => {
salaries.push({
date: e.date == null ? "" : date2Thai(new Date(e.date)),
position: e.position ?? "",
amount: e.amount ?? "",
});
});
}
let trainings: any = [];
if (profile.value != null) {
profile.value.trainings.map((e: any) => {
trainings.push({
yearly: e.yearly ?? "",
startDate: e.startDate == null ? "" : date2Thai(new Date(e.startDate)),
endDate: e.endDate == null ? "" : date2Thai(new Date(e.endDate)),
name: e.name ?? "",
topic: e.topic ?? "",
});
});
}
const data = Object.assign(
{ educations: educations },
{ 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,
tp === "EV1_007" ? { positionName: "-" } : null,
tp === "EV1_007" ? { positionLeaveName: "-" } : null
);
const body = {
template: tp,
reportName: templateName,
data: data,
};
await genReport(body, fileName); //
}
/**
* function fetch งกปโหลดไฟล
* @param volume เล
* @param id evaluate ID
* @param type ประเภทไฟล
* @param file ไฟล
*/
async function fetchPathUpload(
volume: string,
id: string | undefined,
type: string,
file: any
) {
const body = {
fileList: {
fileName: type,
metadata: {
subject: formCommand.subject,
author: formCommand.author,
},
},
};
if (id && file) {
showLoader();
await http
.post(config.API.loadPathDocument(volume, id), body)
.then((res) => {
const foundKey: string | undefined = Object.keys(res.data).find(
(key) =>
res.data[key]?.fileName !== undefined &&
res.data[key]?.fileName !== ""
);
foundKey && uploadfile(res.data[foundKey]?.uploadUrl, file);
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
downloadFile(type);
hideLoader();
});
}
}
/**
* functoin ปโหลดไฟล
* @param uploadUrl link ปโหลด
* @param file ไฟล
*/
async function uploadfile(uploadUrl: string, file: any) {
showLoader();
await axios
.put(uploadUrl, file, {
headers: {
"Content-Type": file.type,
},
})
.then(() => {
success($q, "อัปโหลไฟล์สำเร็จ");
})
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
}
</script> </script>
<template> <template>
<form @submit.prevent="validateForm"> <q-form @submit.prevent="validateForm">
<div class="col-12 row justify-center"> <div class="col-12 row justify-center">
<div class="col-xs-12 col-sm-12 col-md-11"> <div class="col-xs-12 col-sm-12 col-md-11 q-mb-sm">
<div class="toptitle text-white col-12 row items-center"> <div class="toptitle text-white col-12 row items-center">
<q-btn <q-btn
icon="mdi-arrow-left" icon="mdi-arrow-left"
@ -154,13 +381,11 @@ function validateForm() {
</div> </div>
<div class="col-xs-12 col-sm-12 col-md-11 row q-col-gutter-md"> <div class="col-xs-12 col-sm-12 col-md-11 row q-col-gutter-md">
<div class="col-12 row">
<q-card
bordered
class="col-12 row caedNone q-pa-md q-col-gutter-y-md"
>
<div class="col-12"> <div class="col-12">
<q-card bordered class="cardSp1 col-12"> <q-card bordered>
<div class="col-12 row q-pa-md q-col-gutter-y-md">
<div class="col-12">
<q-card bordered class="col-12">
<div <div
class="text-weight-medium bg-grey-1 col-12 q-py-sm q-px-md" class="text-weight-medium bg-grey-1 col-12 q-py-sm q-px-md"
> >
@ -187,7 +412,9 @@ function validateForm() {
outlined outlined
v-model="formData.author" v-model="formData.author"
label="เจ้าของผลงาน" label="เจ้าของผลงาน"
:rules="[(val) => !!val || `${'กรุณากรอกเจ้าของผลงาน'}`]" :rules="[
(val) => !!val || `${'กรุณากรอกเจ้าของผลงาน'}`,
]"
lazy-rules lazy-rules
hide-bottom-space hide-bottom-space
/> />
@ -198,7 +425,7 @@ function validateForm() {
<!-- เลอกผเซนเอกสาร --> <!-- เลอกผเซนเอกสาร -->
<div class="col-12"> <div class="col-12">
<q-card bordered class="cardSp1 col-12"> <q-card bordered class="col-12">
<div class="text-weight-medium bg-grey-1 q-py-sm q-px-md"> <div class="text-weight-medium bg-grey-1 q-py-sm q-px-md">
เลอกผเซนเอกสาร เลอกผเซนเอกสาร
</div> </div>
@ -275,7 +502,7 @@ function validateForm() {
</div> </div>
<div class="col-12"> <div class="col-12">
<q-card bordered class="cardSp1 col-12"> <q-card bordered>
<div class="text-weight-medium bg-grey-1 q-py-sm q-px-md"> <div class="text-weight-medium bg-grey-1 q-py-sm q-px-md">
ดาวนโหลดเอกสาร ดาวนโหลดเอกสาร
</div> </div>
@ -301,7 +528,13 @@ function validateForm() {
size="12px" size="12px"
color="blue" color="blue"
icon="mdi-download" icon="mdi-download"
@click="downloadFile(file.pathName)" @click="
onClickDowloadFile(
file.tp,
file.templateName,
file.nameFile
)
"
> >
<q-tooltip>ดาวนโหลดไฟล</q-tooltip> <q-tooltip>ดาวนโหลดไฟล</q-tooltip>
</q-btn> </q-btn>
@ -311,18 +544,18 @@ function validateForm() {
</q-item> </q-item>
</q-list> </q-list>
</q-card> </q-card>
<div class="q-pt-sm q-gutter-sm" align="right">
<q-btn
type="submit"
unelevated
label="บันทึกข้อมูล"
color="public"
/>
</div> </div>
</div> </div>
<q-separator />
<q-card-actions align="right">
<q-btn label="บันทึกข้อมูล" color="secondary" type="submit"
><q-tooltip>นทกขอม</q-tooltip></q-btn
>
</q-card-actions>
</q-card> </q-card>
</div> </div>
</div> </div>
</div> </div>
</form> </q-form>
</template> </template>

File diff suppressed because it is too large Load diff

View file

@ -42,7 +42,7 @@ const props = defineProps({
const emit = defineEmits(["update:pagination"]); const emit = defineEmits(["update:pagination"]);
/** ค้นหาคอลัม */ /** ค้นหาคอลัม */
const visibleColumns = ref<string[]>(["no", "type", "dateSend", "status"]); const visibleColumns = ref<string[]>(["no", "type_th", "dateSend", "status"]);
const columns = ref<QTableProps["columns"]>([ const columns = ref<QTableProps["columns"]>([
{ {
name: "no", name: "no",
@ -54,11 +54,11 @@ const columns = ref<QTableProps["columns"]>([
style: "font-size: 14px; ", style: "font-size: 14px; ",
}, },
{ {
name: "type", name: "type_th",
align: "left", align: "left",
label: "ระดับที่ยื่นขอ", label: "ระดับที่ยื่นขอ",
sortable: true, sortable: true,
field: "type", field: "type_th",
headerStyle: "font-size: 14px", headerStyle: "font-size: 14px",
style: "font-size: 14px; ", style: "font-size: 14px; ",
}, },

View file

@ -3,6 +3,7 @@ const evaluateMain = () =>
const evaluateStep = () => const evaluateStep = () =>
import("@/modules/06_evaluate/components/EvaluateStepMain.vue"); import("@/modules/06_evaluate/components/EvaluateStepMain.vue");
const expertPage = () => import('@/modules/06_evaluate/components/ExpertPage.vue') const expertPage = () => import('@/modules/06_evaluate/components/ExpertPage.vue')
const expertPageDetail = () => import('@/modules/06_evaluate/components/ExpertPageDetail.vue')
export default [ export default [
{ {
path: "/evaluate", path: "/evaluate",
@ -41,4 +42,13 @@ export default [
Key: [7], Key: [7],
}, },
}, },
{
path: "/evaluate/detail/expertise/:id",
name: "evaluate-expert-detail",
component: expertPageDetail,
meta: {
Auth: true,
Key: [7],
},
},
]; ];

View file

@ -20,7 +20,8 @@ export const useEvaluateStore = defineStore("evaluateStore", () => {
const list = data.map((e: any) => ({ const list = data.map((e: any) => ({
id: e.id, id: e.id,
typeparam: e.type, typeparam: e.type,
type: e.type === "EXPERT" ? "ชำนาญการ" : "ชำนาญการพิเศษ", type: e.type,
type_th: e.type_th,
dateSend: date2Thai(e.updatedAt), dateSend: date2Thai(e.updatedAt),
status: convertStatus(e.step), status: convertStatus(e.step),
step: e.step, step: e.step,