ปรับ Code ประเมืน

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-01-11 13:26:46 +07:00
parent f9c4bb3b80
commit 5b2be2af2b
24 changed files with 603 additions and 1398 deletions

View file

@ -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>