apiรายละเอียดการประเมินของ
This commit is contained in:
parent
ec4dd527c4
commit
693e8008a5
6 changed files with 179 additions and 63 deletions
|
|
@ -1,7 +1,22 @@
|
|||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
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";
|
||||
|
||||
const mixin = useCounterMixin();
|
||||
const { date2Thai, showLoader, hideLoader, messageError } = mixin;
|
||||
|
||||
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() : ""
|
||||
);
|
||||
const mesasger = ref<string>("");
|
||||
const title = ref<string>("");
|
||||
const modalEvaluation = ref<boolean>(false);
|
||||
|
|
@ -9,35 +24,36 @@ const fileEvaluationUpload = ref<any>();
|
|||
const status = ref<string>("WAIT_CHECK_DOC_V1");
|
||||
const files = [
|
||||
{
|
||||
id: "x1",
|
||||
id: "file1",
|
||||
fileName: "แบบพิจารณาคุณสมบัติบุคคล",
|
||||
pathName: "12",
|
||||
pathName: "1-แบบพิจารณาคุณสมบัติบุคคล",
|
||||
},
|
||||
{
|
||||
id: "x2",
|
||||
id: "file2",
|
||||
fileName: "แบบแสดงรายละเอียดการเสนอผลงาน",
|
||||
pathName: "12",
|
||||
pathName: "2-แบบแสดงรายละเอียดการเสนอผลงาน",
|
||||
},
|
||||
{
|
||||
id: "x3",
|
||||
id: "file3",
|
||||
fileName:
|
||||
"แบบตรวจสอบความถูกต้องครบถ้วนของข้อมูลเพื่อประกอบการคัดเลือกบุคคล (เอกสารแบบ ก.)",
|
||||
pathName: "12",
|
||||
pathName:
|
||||
"3-แบบตรวจสอบความถูกต้องครบถ้วนของข้อมูลเพื่อประกอบการคัดเลือกบุคคล (เอกสารแบบ ก.)",
|
||||
},
|
||||
{
|
||||
id: "x4",
|
||||
id: "file4",
|
||||
fileName: "แบบประเมินคุณลักษณะบุคคล",
|
||||
pathName: "12",
|
||||
pathName: "4-แบบประเมินคุณลักษณะบุคคล",
|
||||
},
|
||||
{
|
||||
id: "x5",
|
||||
id: "file5",
|
||||
fileName: "แบบสรุปข้อมูลของผู้ขอรับการคัดเลือก (เอกสารหมายเลข 9)",
|
||||
pathName: "12",
|
||||
pathName: "5-แบบสรุปข้อมูลของผู้ขอรับการคัดเลือก (เอกสารหมายเลข 9)",
|
||||
},
|
||||
{
|
||||
id: "x6",
|
||||
id: "file6",
|
||||
fileName: "ผลงานที่จะส่งประเมิน (เอกสารหมายเลข 11)",
|
||||
pathName: "12",
|
||||
pathName: "6-ผลงานที่จะส่งประเมิน (เอกสารหมายเลข 11)",
|
||||
},
|
||||
];
|
||||
|
||||
|
|
@ -46,21 +62,21 @@ async function onClickDowloadFile(
|
|||
templateName: string,
|
||||
fileName: string
|
||||
) {
|
||||
// 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);
|
||||
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);
|
||||
}
|
||||
|
||||
/** ติดต่อผู้ขอประเมิน */
|
||||
|
|
@ -70,13 +86,64 @@ function openPopUp() {
|
|||
}
|
||||
|
||||
function downloadFile(name: string) {
|
||||
console.log("11");
|
||||
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(() => {});
|
||||
}
|
||||
|
||||
/** ส่งไปประกาศบนเว็บไซต์ */
|
||||
function onWebSite(){
|
||||
function onWebSite() {}
|
||||
|
||||
}
|
||||
// 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();
|
||||
// });
|
||||
// }
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
@ -195,10 +262,6 @@ function onWebSite(){
|
|||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<q-dialog v-model="modalEvaluation" persistent>
|
||||
<q-card style="min-width: 60vw">
|
||||
<q-toolbar>
|
||||
|
|
@ -249,11 +312,7 @@ function onWebSite(){
|
|||
label="ส่งข้อความ"
|
||||
>
|
||||
</q-btn>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</q-card>
|
||||
</q-dialog>
|
||||
</template>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue