2023-12-14 12:23:34 +07:00
|
|
|
<script setup lang="ts">
|
2023-12-21 16:33:54 +07:00
|
|
|
import { ref, onMounted } from "vue";
|
|
|
|
|
import { useRouter, useRoute } from "vue-router";
|
|
|
|
|
import axios from "axios";
|
|
|
|
|
import http from "@/plugins/http";
|
|
|
|
|
import config from "@/app.config";
|
|
|
|
|
import keycloak from "@/plugins/keycloak";
|
|
|
|
|
import { useCounterMixin } from "@/stores/mixin";
|
|
|
|
|
import genReport from "@/plugins/genreport";
|
2023-12-14 12:23:34 +07:00
|
|
|
|
2023-12-21 16:33:54 +07:00
|
|
|
const mixin = useCounterMixin();
|
|
|
|
|
const { date2Thai, showLoader, hideLoader, messageError } = mixin;
|
2023-12-20 14:00:56 +07:00
|
|
|
|
2023-12-21 16:33:54 +07:00
|
|
|
const router = useRouter();
|
|
|
|
|
const route = useRoute();
|
|
|
|
|
const id = ref<string>(route.params.id as string);
|
|
|
|
|
const fullName = ref<string>(
|
|
|
|
|
keycloak.tokenParsed ? keycloak.tokenParsed.name!.toString() : ""
|
|
|
|
|
);
|
2023-12-20 14:00:56 +07:00
|
|
|
const mesasger = ref<string>("");
|
|
|
|
|
const title = ref<string>("");
|
|
|
|
|
const modalEvaluation = ref<boolean>(false);
|
|
|
|
|
const fileEvaluationUpload = ref<any>();
|
2023-12-14 12:23:34 +07:00
|
|
|
const status = ref<string>("WAIT_CHECK_DOC_V1");
|
2023-12-20 14:00:56 +07:00
|
|
|
const files = [
|
|
|
|
|
{
|
2023-12-21 16:33:54 +07:00
|
|
|
id: "file1",
|
2023-12-20 14:00:56 +07:00
|
|
|
fileName: "แบบพิจารณาคุณสมบัติบุคคล",
|
2023-12-21 16:33:54 +07:00
|
|
|
pathName: "1-แบบพิจารณาคุณสมบัติบุคคล",
|
2023-12-20 14:00:56 +07:00
|
|
|
},
|
|
|
|
|
{
|
2023-12-21 16:33:54 +07:00
|
|
|
id: "file2",
|
2023-12-20 14:00:56 +07:00
|
|
|
fileName: "แบบแสดงรายละเอียดการเสนอผลงาน",
|
2023-12-21 16:33:54 +07:00
|
|
|
pathName: "2-แบบแสดงรายละเอียดการเสนอผลงาน",
|
2023-12-20 14:00:56 +07:00
|
|
|
},
|
|
|
|
|
{
|
2023-12-21 16:33:54 +07:00
|
|
|
id: "file3",
|
2023-12-20 14:00:56 +07:00
|
|
|
fileName:
|
|
|
|
|
"แบบตรวจสอบความถูกต้องครบถ้วนของข้อมูลเพื่อประกอบการคัดเลือกบุคคล (เอกสารแบบ ก.)",
|
2023-12-21 16:33:54 +07:00
|
|
|
pathName:
|
|
|
|
|
"3-แบบตรวจสอบความถูกต้องครบถ้วนของข้อมูลเพื่อประกอบการคัดเลือกบุคคล (เอกสารแบบ ก.)",
|
2023-12-20 14:00:56 +07:00
|
|
|
},
|
|
|
|
|
{
|
2023-12-21 16:33:54 +07:00
|
|
|
id: "file4",
|
2023-12-20 14:00:56 +07:00
|
|
|
fileName: "แบบประเมินคุณลักษณะบุคคล",
|
2023-12-21 16:33:54 +07:00
|
|
|
pathName: "4-แบบประเมินคุณลักษณะบุคคล",
|
2023-12-20 14:00:56 +07:00
|
|
|
},
|
|
|
|
|
{
|
2023-12-21 16:33:54 +07:00
|
|
|
id: "file5",
|
2023-12-20 14:00:56 +07:00
|
|
|
fileName: "แบบสรุปข้อมูลของผู้ขอรับการคัดเลือก (เอกสารหมายเลข 9)",
|
2023-12-21 16:33:54 +07:00
|
|
|
pathName: "5-แบบสรุปข้อมูลของผู้ขอรับการคัดเลือก (เอกสารหมายเลข 9)",
|
2023-12-20 14:00:56 +07:00
|
|
|
},
|
|
|
|
|
{
|
2023-12-21 16:33:54 +07:00
|
|
|
id: "file6",
|
2023-12-20 14:00:56 +07:00
|
|
|
fileName: "ผลงานที่จะส่งประเมิน (เอกสารหมายเลข 11)",
|
2023-12-21 16:33:54 +07:00
|
|
|
pathName: "6-ผลงานที่จะส่งประเมิน (เอกสารหมายเลข 11)",
|
2023-12-20 14:00:56 +07:00
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
async function onClickDowloadFile(
|
|
|
|
|
tp: string,
|
|
|
|
|
templateName: string,
|
|
|
|
|
fileName: string
|
|
|
|
|
) {
|
2023-12-21 16:33:54 +07:00
|
|
|
showLoader();
|
|
|
|
|
const data = Object.assign(
|
|
|
|
|
{ fullName: fullName.value },
|
|
|
|
|
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);
|
2023-12-20 14:00:56 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** ติดต่อผู้ขอประเมิน */
|
|
|
|
|
function openPopUp() {
|
|
|
|
|
console.log("12");
|
|
|
|
|
modalEvaluation.value = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function downloadFile(name: string) {
|
2023-12-21 16:33:54 +07:00
|
|
|
showLoader();
|
|
|
|
|
http
|
|
|
|
|
.get(config.API.evaluationFilebyId("เล่ม 1", id.value, name))
|
|
|
|
|
.then((res) => {
|
|
|
|
|
const link = res.data.downloadUrl;
|
|
|
|
|
const type = res.data.fileType;
|
|
|
|
|
const fileName = res.data.fileName;
|
|
|
|
|
getPDF(link, type, fileName);
|
|
|
|
|
})
|
|
|
|
|
.catch((e) => {})
|
|
|
|
|
.finally(() => {
|
|
|
|
|
hideLoader();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getPDF(url: string, type: string, fileName: string) {
|
|
|
|
|
axios
|
|
|
|
|
.get(url, {
|
|
|
|
|
method: "GET",
|
|
|
|
|
responseType: "blob",
|
|
|
|
|
headers: {
|
|
|
|
|
"Content-Type": "application/json",
|
|
|
|
|
Accept: type, // ถ้ามีการระบุเมื่ออัปโหลด
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
.then(async (res) => {
|
|
|
|
|
console.log(res);
|
|
|
|
|
const a = document.createElement("a");
|
|
|
|
|
a.href = window.URL.createObjectURL(res.data);
|
|
|
|
|
a.download = fileName;
|
|
|
|
|
// a.download = res.data.fileName + `.${mime.getExtension(res.data.fileType)}`
|
|
|
|
|
a.click();
|
|
|
|
|
})
|
|
|
|
|
.catch((e) => {})
|
|
|
|
|
.finally(() => {});
|
2023-12-20 14:00:56 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** ส่งไปประกาศบนเว็บไซต์ */
|
2023-12-21 16:33:54 +07:00
|
|
|
function onWebSite() {}
|
2023-12-20 14:00:56 +07:00
|
|
|
|
2023-12-21 16:33:54 +07:00
|
|
|
// function getFileList() {
|
|
|
|
|
// showLoader();
|
|
|
|
|
// http
|
|
|
|
|
// .get(config.API.evaluationFilebyId("เล่ม 1", id.value))
|
|
|
|
|
// .then((res) => {
|
|
|
|
|
// const fileList = res.data;
|
|
|
|
|
// files.forEach((file, index) => {
|
|
|
|
|
// const apiFile = fileList[index];
|
|
|
|
|
// file.pathName = apiFile.pathname;
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
// console.log(files);
|
|
|
|
|
// })
|
|
|
|
|
// .catch((e) => {})
|
|
|
|
|
// .finally(() => {
|
|
|
|
|
// hideLoader();
|
|
|
|
|
// });
|
|
|
|
|
// }
|
2023-12-14 12:23:34 +07:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2023-12-20 14:00:56 +07:00
|
|
|
<div class="row q-col-gutter-md">
|
|
|
|
|
<div class="col-12">
|
|
|
|
|
<q-card bordered style="border: 1px solid #d6dee1">
|
|
|
|
|
<div class="text-weight-medium bg-grey-1 q-py-sm q-px-md">
|
|
|
|
|
เอกสารเล่มที่ 1
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-12"><q-separator /></div>
|
|
|
|
|
|
|
|
|
|
<q-list
|
|
|
|
|
v-for="file in files"
|
|
|
|
|
:key="file.id"
|
|
|
|
|
class="full-width"
|
|
|
|
|
bordered
|
|
|
|
|
separator
|
|
|
|
|
>
|
|
|
|
|
<q-item clickable v-ripple>
|
|
|
|
|
<q-item-section>{{ file.fileName }}</q-item-section>
|
|
|
|
|
<q-item-section avatar>
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div>
|
|
|
|
|
<q-btn
|
|
|
|
|
dense
|
|
|
|
|
flat
|
|
|
|
|
round
|
|
|
|
|
size="12px"
|
|
|
|
|
color="blue"
|
|
|
|
|
icon="mdi-download-outline"
|
|
|
|
|
@click="downloadFile(file.pathName)"
|
|
|
|
|
>
|
|
|
|
|
<q-tooltip>ดาวน์โหลดไฟล์</q-tooltip>
|
|
|
|
|
</q-btn>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</q-item-section>
|
|
|
|
|
</q-item>
|
|
|
|
|
</q-list>
|
|
|
|
|
</q-card>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-12">
|
|
|
|
|
<q-card bordered style="border: 1px solid #d6dee1">
|
|
|
|
|
<div class="text-weight-medium bg-grey-1 q-py-sm q-px-md">
|
|
|
|
|
แบบประเมินคุณลักษณะบุคคล
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-12"><q-separator /></div>
|
|
|
|
|
<div class="row">
|
|
|
|
|
<div class="col-12 q-pa-sm">
|
|
|
|
|
<div class="row q-col-gutter-md col-12">
|
|
|
|
|
<div class="col-xs-12 col-sm-6 row">
|
|
|
|
|
<q-btn
|
|
|
|
|
class="col-12"
|
|
|
|
|
outline
|
|
|
|
|
icon="download"
|
|
|
|
|
label="ดาวน์โหลดต้นแบบ"
|
|
|
|
|
color="primary"
|
|
|
|
|
@click="
|
|
|
|
|
onClickDowloadFile(
|
|
|
|
|
'EV1_008',
|
|
|
|
|
'template-4',
|
|
|
|
|
'แบบประเมินคุณลักษณะบุคคล'
|
|
|
|
|
)
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
<q-tooltip> ดาวน์โหลดต้นแบบ </q-tooltip></q-btn
|
|
|
|
|
>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-xs-12 col-sm-6 row">
|
|
|
|
|
<q-btn
|
|
|
|
|
v-if="fileEvaluationUpload"
|
|
|
|
|
class="col-12"
|
|
|
|
|
outline
|
|
|
|
|
icon="visibility"
|
|
|
|
|
label="ดูไฟล์เอกสาร"
|
|
|
|
|
color="primary"
|
|
|
|
|
>
|
|
|
|
|
<q-tooltip> ดูไฟล์เอกสาร </q-tooltip></q-btn
|
|
|
|
|
>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-xs-12 col-sm-11 row">
|
|
|
|
|
<q-file
|
|
|
|
|
v-model="fileEvaluationUpload"
|
|
|
|
|
class="col-12"
|
|
|
|
|
outlined
|
|
|
|
|
dense
|
|
|
|
|
hide-bottom-space
|
|
|
|
|
lazy-rules
|
|
|
|
|
accept=".pdf"
|
|
|
|
|
>
|
|
|
|
|
<template v-slot:prepend>
|
|
|
|
|
<q-icon name="attach_file" />
|
|
|
|
|
</template>
|
|
|
|
|
</q-file>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-1 self-center text-center q-pl-none">
|
|
|
|
|
<q-btn flat round dense color="primary" icon="mdi-upload"
|
|
|
|
|
><q-tooltip>อัปโหลดไฟล์</q-tooltip></q-btn
|
|
|
|
|
>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</q-card>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-12">
|
|
|
|
|
<div class="q-mt-xs q-gutter-md" align="right">
|
|
|
|
|
<q-btn label="ติดต่อผู้ขอประเมิน" color="info" @click="openPopUp" />
|
|
|
|
|
<q-btn
|
|
|
|
|
unelevated
|
|
|
|
|
label="ส่งไปประกาศบนเว็บไซต์"
|
|
|
|
|
color="public"
|
|
|
|
|
@click="onWebSite"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2023-12-14 12:23:34 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-12-20 14:00:56 +07:00
|
|
|
|
|
|
|
|
<q-dialog v-model="modalEvaluation" persistent>
|
|
|
|
|
<q-card style="min-width: 60vw">
|
|
|
|
|
<q-toolbar>
|
|
|
|
|
<q-toolbar-title class="text-subtitle2 text-bold">
|
|
|
|
|
ติดต่อผู้ขอประเมิน
|
|
|
|
|
</q-toolbar-title>
|
|
|
|
|
<q-btn
|
|
|
|
|
icon="close"
|
|
|
|
|
unelevated
|
|
|
|
|
round
|
|
|
|
|
dense
|
|
|
|
|
@click="modalEvaluation = false"
|
|
|
|
|
style="color: #ff8080; background-color: #ffdede"
|
|
|
|
|
/>
|
|
|
|
|
</q-toolbar>
|
|
|
|
|
<q-separator />
|
|
|
|
|
<q-card-section class="q-pa-md bg-grey-1">
|
|
|
|
|
<div class="row q-col-gutter-sm">
|
|
|
|
|
<div class="col-12">
|
|
|
|
|
<q-input
|
|
|
|
|
v-model="title"
|
|
|
|
|
label="หัวข้อ"
|
|
|
|
|
outlined
|
|
|
|
|
dense
|
|
|
|
|
bg-color="white"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col-12">
|
|
|
|
|
<q-input
|
|
|
|
|
v-model="mesasger"
|
|
|
|
|
label="ข้อความ"
|
|
|
|
|
type="textarea"
|
|
|
|
|
outlined
|
|
|
|
|
dense
|
|
|
|
|
bg-color="white"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</q-card-section>
|
|
|
|
|
<q-separator />
|
|
|
|
|
|
|
|
|
|
<div class="row justify-end q-px-md q-py-sm items-center">
|
|
|
|
|
<q-btn
|
|
|
|
|
dense
|
|
|
|
|
color="public"
|
|
|
|
|
id="onSubmit"
|
|
|
|
|
class="q-px-md q-py-xs"
|
|
|
|
|
label="ส่งข้อความ"
|
|
|
|
|
>
|
|
|
|
|
</q-btn>
|
|
|
|
|
</div>
|
|
|
|
|
</q-card>
|
|
|
|
|
</q-dialog>
|
2023-12-14 12:23:34 +07:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style scoped></style>
|