ปรับ Code ประเมืน
This commit is contained in:
parent
f9c4bb3b80
commit
5b2be2af2b
24 changed files with 603 additions and 1398 deletions
|
|
@ -1,25 +1,25 @@
|
|||
<script setup lang="ts">
|
||||
import { onMounted, ref } from "vue";
|
||||
import { useRoute } from "vue-router";
|
||||
import { useQuasar } from "quasar";
|
||||
import axios from "axios";
|
||||
import http from "@/plugins/http";
|
||||
import config from "@/app.config";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useQuasar } from "quasar";
|
||||
import keycloak from "@/plugins/keycloak";
|
||||
import genReport from "@/plugins/genreport";
|
||||
|
||||
/** importType*/
|
||||
import type { FileEvaluationRefRef } from "@/modules/12_evaluatePersonal/interface/index/evalute";
|
||||
|
||||
import genReport from "@/plugins/genreport";
|
||||
/** importStore*/
|
||||
import { useCounterMixin } from "@/stores/mixin";
|
||||
import { useEvaluateDetailStore } from "@/modules/12_evaluatePersonal/store/EvaluateDetail";
|
||||
|
||||
/** uer*/
|
||||
const store = useEvaluateDetailStore();
|
||||
|
||||
const fullName = ref<string>(
|
||||
keycloak.tokenParsed ? keycloak.tokenParsed.name!.toString() : ""
|
||||
);
|
||||
const $q = useQuasar();
|
||||
const mixin = useCounterMixin();
|
||||
const route = useRoute();
|
||||
|
||||
const {
|
||||
date2Thai,
|
||||
showLoader,
|
||||
|
|
@ -28,13 +28,9 @@ const {
|
|||
success,
|
||||
dialogConfirm,
|
||||
} = mixin;
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
||||
const id = ref<string>(route.params.id as string);
|
||||
const modalConfirm = ref<boolean>(false);
|
||||
const modalView = ref<boolean>(false);
|
||||
const pdfSrc = ref<any>();
|
||||
|
||||
const nameOfWork = ref<string>("");
|
||||
const nameOfOwner = ref<string>("");
|
||||
const position = ref<string>("");
|
||||
|
|
@ -60,6 +56,7 @@ const fileEvaluationRef: FileEvaluationRefRef = {
|
|||
fileEvaluation86: fileEvaluation86Ref,
|
||||
};
|
||||
|
||||
/** function ดาวน์โหลดไฟล์ต้นแบบ*/
|
||||
async function onClickDowloadFile(
|
||||
tp: string,
|
||||
templateName: string,
|
||||
|
|
@ -95,15 +92,11 @@ async function onClickDowloadFile(
|
|||
await genReport(body, fileName);
|
||||
}
|
||||
|
||||
function onClickViewPDF(file: any) {
|
||||
pdfSrc.value = file.webkitRelativePath;
|
||||
modalView.value = true;
|
||||
}
|
||||
|
||||
function openConfirmEvalution() {
|
||||
modalConfirm.value = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* function เรียก link อัปโหลด
|
||||
* @param name ชื่อไฟล์
|
||||
* @param file ไฟล์
|
||||
*/
|
||||
function upLoadFile(name: string, file: any) {
|
||||
if (file) {
|
||||
showLoader();
|
||||
|
|
@ -138,6 +131,11 @@ function upLoadFile(name: string, file: any) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* function อัปโหลดไฟล์
|
||||
* @param url link อัปโหลด
|
||||
* @param file ไฟล์
|
||||
*/
|
||||
function fileUpLoad(url: string, file: any) {
|
||||
axios
|
||||
.put(url, file, {
|
||||
|
|
@ -148,62 +146,11 @@ function fileUpLoad(url: string, file: any) {
|
|||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
// fileEvaluation81.value = null;
|
||||
// fileEvaluation82.value = null;
|
||||
// fileEvaluation83.value = null;
|
||||
// fileEvaluation84.value = null;
|
||||
// fileEvaluation85.value = null;
|
||||
// fileEvaluation86.value = null;
|
||||
success($q, "อัปโหลดไฟล์สำเร็จ");
|
||||
});
|
||||
}
|
||||
|
||||
// const fileEdit2 = ref<string>("");
|
||||
// function downloadFile() {
|
||||
// showLoader();
|
||||
// http
|
||||
// .get(
|
||||
// config.API.evaluationFilebyId(
|
||||
// "เล่ม 2",
|
||||
// id.value,
|
||||
// "2-เอกสารเล่ม 2 (ฉบับแก้ไข)"
|
||||
// )
|
||||
// )
|
||||
// .then((res) => {
|
||||
// fileEdit2.value = res.data.downloadUrl;
|
||||
// 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 ยืนยันผลการพิจารณา*/
|
||||
async function confirmApprove() {
|
||||
const fileEvaluationValues = [
|
||||
fileEvaluation81,
|
||||
|
|
@ -277,22 +224,25 @@ async function confirmApprove() {
|
|||
}, 100);
|
||||
}
|
||||
|
||||
/** function ยืนยันผลการพิจารณา*/
|
||||
function nextStep() {
|
||||
showLoader();
|
||||
http
|
||||
.put(config.API.evaluationNextFinish(id.value))
|
||||
// .then((res) => {})
|
||||
.then(() => {
|
||||
success($q, "ยืนยันผลการพิจารณาสำเร็จ");
|
||||
store.step = 9;
|
||||
store.currentStep = 9;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
success($q, "ยืนยันผลการพิจารณาสำเร็จ");
|
||||
store.step = 9;
|
||||
store.currentStep = 9;
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
/** function เรียกข้แมูลคุณสมบัติ*/
|
||||
async function fetchProfile() {
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -310,9 +260,9 @@ async function fetchProfile() {
|
|||
}
|
||||
|
||||
const downloadDocEditUrl = ref<string>("");
|
||||
function checkDocEdit() {
|
||||
async function checkDocEdit() {
|
||||
showLoader();
|
||||
http
|
||||
await http
|
||||
.get(
|
||||
config.API.evaluationPatchData(
|
||||
"เล่ม 2",
|
||||
|
|
@ -323,9 +273,9 @@ function checkDocEdit() {
|
|||
.then((res: any) => {
|
||||
downloadDocEditUrl.value = res.data.downloadUrl;
|
||||
})
|
||||
// .catch((e) => {
|
||||
// messageError($q, e);
|
||||
// })
|
||||
.catch(() => {
|
||||
// messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
|
|
@ -337,6 +287,11 @@ const downloadFile3 = ref<string>("");
|
|||
const downloadFile4 = ref<string>("");
|
||||
const downloadFile5 = ref<string>("");
|
||||
const downloadFile6 = ref<string>("");
|
||||
|
||||
/**
|
||||
* function ดาวน์โหลดไฟล์
|
||||
* @param fileName ชื่อไฟล์
|
||||
*/
|
||||
async function downloadFileList(fileName: string) {
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -368,6 +323,7 @@ const author = ref<string>("");
|
|||
const subject = ref<string>("");
|
||||
const assignedPosition = ref<string>("");
|
||||
|
||||
/** function เรียกข้อมูลผลงาน*/
|
||||
async function fetchDataSigner() {
|
||||
showLoader();
|
||||
await http
|
||||
|
|
@ -386,19 +342,19 @@ async function fetchDataSigner() {
|
|||
});
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchProfile();
|
||||
fetchDataSigner();
|
||||
downloadFileList(
|
||||
onMounted(async () => {
|
||||
await fetchProfile();
|
||||
await fetchDataSigner();
|
||||
await downloadFileList(
|
||||
"แบบตรวจสอบความถูกต้องครบถ้วนของข้อมูลประกอบการประเมินผลงาน (เอกสารแบบ ค)"
|
||||
);
|
||||
downloadFileList("บัญชีแสดงการรับ-ส่งผลงาน (เอกสารหมายเลข 15)");
|
||||
downloadFileList("แบบประเมินผลงาน (เอกสารหมายเลข 16)");
|
||||
downloadFileList("แบบแสดงการประเมินผลงาน (เอกสารหมายเลข 17)");
|
||||
downloadFileList("แบบรายงานผลการประเมินบุคคล (เอกสารหมายเลข 18)");
|
||||
downloadFileList("แบบสรุปผลการประเมิน (เอกสารแบบ ง)");
|
||||
await downloadFileList("บัญชีแสดงการรับ-ส่งผลงาน (เอกสารหมายเลข 15)");
|
||||
await downloadFileList("แบบประเมินผลงาน (เอกสารหมายเลข 16)");
|
||||
await downloadFileList("แบบแสดงการประเมินผลงาน (เอกสารหมายเลข 17)");
|
||||
await downloadFileList("แบบรายงานผลการประเมินบุคคล (เอกสารหมายเลข 18)");
|
||||
await downloadFileList("แบบสรุปผลการประเมิน (เอกสารแบบ ง)");
|
||||
|
||||
checkDocEdit();
|
||||
await checkDocEdit();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue