API ประเมิน step 1-4
This commit is contained in:
parent
d305b753bf
commit
0e5d15dc7c
12 changed files with 444 additions and 191 deletions
|
|
@ -40,13 +40,13 @@ async function fetchCheckSpec(id: string) {
|
|||
.get(config.API.evaluationCheckspecByid(id))
|
||||
.then((res) => {
|
||||
const data = res.data.result;
|
||||
formData.isEducationalQft = data.IsEducationalQft;
|
||||
formData.isGovermantServiceHtr = data.IsGovermantServiceHtr;
|
||||
formData.isOperatingExp = data.IsOperatingExp;
|
||||
formData.isMinPeriodOfTenure = data.IsMinPeriodOfTenure;
|
||||
formData.isHaveSpecificQft = data.IsHaveSpecificQft;
|
||||
formData.isHaveProLicense = data.IsHaveProLicense;
|
||||
formData.isHaveMinPeriodOrHoldPos = data.IsHaveMinPeriodOrHoldPos;
|
||||
formData.isEducationalQft = data.isEducationalQft;
|
||||
formData.isGovermantServiceHtr = data.isGovermantServiceHtr;
|
||||
formData.isOperatingExp = data.isOperatingExp;
|
||||
formData.isMinPeriodOfTenure = data.isMinPeriodOfTenure;
|
||||
formData.isHaveSpecificQft = data.isHaveSpecificQft;
|
||||
formData.isHaveProLicense = data.isHaveProLicense;
|
||||
formData.isHaveMinPeriodOrHoldPos = data.isHaveMinPeriodOrHoldPos;
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
|
|
@ -57,7 +57,9 @@ async function fetchCheckSpec(id: string) {
|
|||
}
|
||||
|
||||
onMounted(() => {
|
||||
store.step === 1 && props.evaluateId && fetchCheckSpec(props.evaluateId);
|
||||
console.log(store.step);
|
||||
|
||||
props.evaluateId && fetchCheckSpec(props.evaluateId);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@ import keycloak from "@/plugins/keycloak";
|
|||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import genReport from "@/plugins/genreport";
|
||||
import { useQuasar, type StringDictionary } from "quasar";
|
||||
import { VuePDF, usePDF } from "@tato30/vue-pdf";
|
||||
import { useQuasar } from "quasar";
|
||||
import axios from "axios";
|
||||
|
||||
import type { FormCommand } from "@/modules/06_evaluate/interface/evalute";
|
||||
|
||||
|
|
@ -76,7 +78,7 @@ const page = ref<number>(1);
|
|||
const pdfSrc = ref<any>();
|
||||
|
||||
function onClickViewPDF(file: any) {
|
||||
pdfSrc.value = file.webkitRelativePath;
|
||||
// pdfSrc.value = file.webkitRelativePath;
|
||||
modalView.value = true;
|
||||
}
|
||||
|
||||
|
|
@ -115,24 +117,56 @@ async function onClickDowloadFile(
|
|||
await genReport(body, fileName);
|
||||
}
|
||||
|
||||
async function fetchPathUpload(volume: string, id: string) {
|
||||
showLoader();
|
||||
async function fetchPathUpload(
|
||||
volume: string,
|
||||
id: string | undefined,
|
||||
type: string,
|
||||
file: any
|
||||
) {
|
||||
const body = {
|
||||
fileList: [
|
||||
"1-แบบพิจารณาคุณสมบัติบุคคล",
|
||||
"2-แบบแสดงรายละเอียดการเสนอผลงาน",
|
||||
"3-แบบตรวจสอบความถูกต้องครบถ้วนของข้อมูลเพื่อประกอบการคัดเลือกบุคคล (เอกสารแบบ ก.)",
|
||||
"4-แบบประเมินคุณลักษณะบุคคล",
|
||||
"5-แบบสรุปข้อมูลของผู้ขอรับการคัดเลือก (เอกสารหมายเลข 9)",
|
||||
"6-ผลงานที่จะส่งประเมิน (เอกสารหมายเลข 11)",
|
||||
],
|
||||
fileList: type,
|
||||
replace: true,
|
||||
// "1-แบบพิจารณาคุณสมบัติบุคคล",
|
||||
// "2-แบบแสดงรายละเอียดการเสนอผลงาน",
|
||||
// "3-แบบตรวจสอบความถูกต้องครบถ้วนของข้อมูลเพื่อประกอบการคัดเลือกบุคคล (เอกสารแบบ ก.)",
|
||||
// "4-แบบประเมินคุณลักษณะบุคคล",
|
||||
// "5-แบบสรุปข้อมูลของผู้ขอรับการคัดเลือก (เอกสารหมายเลข 9)",
|
||||
// "6-ผลงานที่จะส่งประเมิน (เอกสารหมายเลข 11)",
|
||||
};
|
||||
await http
|
||||
.post(config.API.loadPathDocument(volume, id), body)
|
||||
.then((res) => {})
|
||||
.catch((err) => {})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
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(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function uploadfile(uploadUrl: string, file: any) {
|
||||
console.log(uploadUrl);
|
||||
await axios
|
||||
.put(uploadUrl, file, {
|
||||
headers: {
|
||||
"Content-Type": file.type,
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -150,7 +184,6 @@ onMounted(async () => {
|
|||
fileEvaluation6Ref: fileEvaluation6Ref.value,
|
||||
};
|
||||
emit("update:form", formCommand, ref);
|
||||
props.evaluateId && (await fetchPathUpload("เล่ม 1", props.evaluateId));
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
@ -215,7 +248,20 @@ onMounted(async () => {
|
|||
</q-file>
|
||||
</div>
|
||||
<div class="col-2 self-center text-center q-pl-none">
|
||||
<q-btn flat round dense color="primary" icon="mdi-upload"
|
||||
<q-btn
|
||||
flat
|
||||
round
|
||||
dense
|
||||
color="primary"
|
||||
icon="mdi-upload"
|
||||
@click="
|
||||
fetchPathUpload(
|
||||
'เล่ม 1',
|
||||
props.evaluateId,
|
||||
'1-แบบพิจารณาคุณสมบัติบุคคล',
|
||||
fileEvaluation1
|
||||
)
|
||||
"
|
||||
><q-tooltip>อัปโหลดไฟล์</q-tooltip></q-btn
|
||||
>
|
||||
</div>
|
||||
|
|
@ -283,7 +329,20 @@ onMounted(async () => {
|
|||
</q-file>
|
||||
</div>
|
||||
<div class="col-2 self-center text-center q-pl-none">
|
||||
<q-btn flat round dense color="primary" icon="mdi-upload"
|
||||
<q-btn
|
||||
flat
|
||||
round
|
||||
dense
|
||||
color="primary"
|
||||
icon="mdi-upload"
|
||||
@click="
|
||||
fetchPathUpload(
|
||||
'เล่ม 1',
|
||||
props.evaluateId,
|
||||
'2-แบบแสดงรายละเอียดการเสนอผลงาน',
|
||||
fileEvaluation2
|
||||
)
|
||||
"
|
||||
><q-tooltip>อัปโหลดไฟล์</q-tooltip></q-btn
|
||||
>
|
||||
</div>
|
||||
|
|
@ -352,7 +411,20 @@ onMounted(async () => {
|
|||
</q-file>
|
||||
</div>
|
||||
<div class="col-2 self-center text-center q-pl-none">
|
||||
<q-btn flat round dense color="primary" icon="mdi-upload"
|
||||
<q-btn
|
||||
flat
|
||||
round
|
||||
dense
|
||||
color="primary"
|
||||
icon="mdi-upload"
|
||||
@click="
|
||||
fetchPathUpload(
|
||||
'เล่ม 1',
|
||||
props.evaluateId,
|
||||
'3-แบบตรวจสอบความถูกต้องครบถ้วนของข้อมูลเพื่อประกอบการคัดเลือกบุคคล (เอกสารแบบ ก.)',
|
||||
fileEvaluation3
|
||||
)
|
||||
"
|
||||
><q-tooltip>อัปโหลดไฟล์</q-tooltip></q-btn
|
||||
>
|
||||
</div>
|
||||
|
|
@ -420,7 +492,20 @@ onMounted(async () => {
|
|||
</q-file>
|
||||
</div>
|
||||
<div class="col-2 self-center text-center q-pl-none">
|
||||
<q-btn flat round dense color="primary" icon="mdi-upload"
|
||||
<q-btn
|
||||
flat
|
||||
round
|
||||
dense
|
||||
color="primary"
|
||||
icon="mdi-upload"
|
||||
@click="
|
||||
fetchPathUpload(
|
||||
'เล่ม 1',
|
||||
props.evaluateId,
|
||||
'4-แบบประเมินคุณลักษณะบุคคล',
|
||||
fileEvaluation4
|
||||
)
|
||||
"
|
||||
><q-tooltip>อัปโหลดไฟล์</q-tooltip></q-btn
|
||||
>
|
||||
</div>
|
||||
|
|
@ -487,7 +572,20 @@ onMounted(async () => {
|
|||
</q-file>
|
||||
</div>
|
||||
<div class="col-2 self-center text-center q-pl-none">
|
||||
<q-btn flat round dense color="primary" icon="mdi-upload"
|
||||
<q-btn
|
||||
flat
|
||||
round
|
||||
dense
|
||||
color="primary"
|
||||
icon="mdi-upload"
|
||||
@click="
|
||||
fetchPathUpload(
|
||||
'เล่ม 1',
|
||||
props.evaluateId,
|
||||
'5-แบบสรุปข้อมูลของผู้ขอรับการคัดเลือก (เอกสารหมายเลข 9)',
|
||||
fileEvaluation5
|
||||
)
|
||||
"
|
||||
><q-tooltip>อัปโหลดไฟล์</q-tooltip></q-btn
|
||||
>
|
||||
</div>
|
||||
|
|
@ -555,7 +653,20 @@ onMounted(async () => {
|
|||
</q-file>
|
||||
</div>
|
||||
<div class="col-2 self-center text-center q-pl-none">
|
||||
<q-btn flat round dense color="primary" icon="mdi-upload"
|
||||
<q-btn
|
||||
flat
|
||||
round
|
||||
dense
|
||||
color="primary"
|
||||
icon="mdi-upload"
|
||||
@click="
|
||||
fetchPathUpload(
|
||||
'เล่ม 1',
|
||||
props.evaluateId,
|
||||
'6-ผลงานที่จะส่งประเมิน (เอกสารหมายเลข 11)',
|
||||
fileEvaluation6
|
||||
)
|
||||
"
|
||||
><q-tooltip>อัปโหลดไฟล์</q-tooltip></q-btn
|
||||
>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,19 +1,82 @@
|
|||
<script setup lang="ts">
|
||||
import { reactive, ref } from "vue";
|
||||
import { reactive, ref, onMounted } from "vue";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useQuasar } from "quasar";
|
||||
import axios from "axios";
|
||||
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useEvaluateStore } from "@/modules/06_evaluate/store";
|
||||
|
||||
const $q = useQuasar();
|
||||
const store = useEvaluateStore();
|
||||
const mixin = useCounterMixin();
|
||||
const { date2Thai } = mixin;
|
||||
const { date2Thai, showLoader, hideLoader, messageError } = mixin;
|
||||
|
||||
const props = defineProps({
|
||||
evaluateId: {
|
||||
type: String,
|
||||
},
|
||||
});
|
||||
const emit = defineEmits(["update:file"]);
|
||||
|
||||
const selectedItem = ref(1);
|
||||
const fileName = ref([
|
||||
"1-แบบพิจารณาคุณสมบัติบุคคล",
|
||||
"2-แบบแสดงรายละเอียดการเสนอผลงาน",
|
||||
"3-แบบตรวจสอบความถูกต้องครบถ้วนของข้อมูลเพื่อประกอบการคัดเลือกบุคคล (เอกสารแบบ ก.)",
|
||||
"4-แบบประเมินคุณลักษณะบุคคล",
|
||||
"5-แบบสรุปข้อมูลของผู้ขอรับการคัดเลือก (เอกสารหมายเลข 9)",
|
||||
"6-ผลงานที่จะส่งประเมิน (เอกสารหมายเลข 11)",
|
||||
]);
|
||||
|
||||
function handleItemClick(itemNumber: number) {
|
||||
store.tabPanels = itemNumber.toString();
|
||||
selectedItem.value = itemNumber;
|
||||
fetchDocument(fileName.value[itemNumber - 1]);
|
||||
}
|
||||
async function fetchDocument(fileName: string) {
|
||||
showLoader();
|
||||
props.evaluateId &&
|
||||
(await http
|
||||
.get(config.API.loadFileDocument("เล่ม 1", props.evaluateId, fileName))
|
||||
.then((res) => {
|
||||
console.log(res.data.downloadUrl);
|
||||
downloadFile(res.data.downloadUrl);
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
}));
|
||||
}
|
||||
|
||||
async function downloadFile(url: string) {
|
||||
await axios
|
||||
.get(url, {
|
||||
responseType: "blob",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
})
|
||||
.then((res) => {
|
||||
const blob = new Blob([res.data]);
|
||||
const objectUrl = URL.createObjectURL(blob);
|
||||
console.log(blob);
|
||||
|
||||
console.log(objectUrl);
|
||||
|
||||
emit("update:file", objectUrl);
|
||||
})
|
||||
.catch((err) => {
|
||||
messageError($q, err);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await fetchDocument(fileName.value[selectedItem.value - 1]);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue