หน้ารายการประเมิน

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-01-03 17:04:45 +07:00
parent c2e0e5cb59
commit d271ff96b8
16 changed files with 386 additions and 134 deletions

View file

@ -34,7 +34,8 @@ function getFile(volume: number) {
.then((res) => {
const link = res.data.downloadUrl;
const type = res.data.fileType;
getPDF(link,type);
getPDF(link, type);
})
.catch((e) => {
// messageError($q, e);
@ -44,7 +45,7 @@ function getFile(volume: number) {
});
}
function getPDF(url: string,type:string) {
function getPDF(url: string, type: string) {
axios
.get(url, {
method: "GET",
@ -55,25 +56,26 @@ function getPDF(url: string,type:string) {
},
})
.then(async (res) => {
store.log = 0
console.log(res);
store.log = 0;
store.urlDownloadFile = url;
const blob = new Blob([res.data]);
const objectUrl = URL.createObjectURL(blob);
const pdfData = await usePDF(`${objectUrl}`);
showLoader();
setTimeout(() => {
store.log = 1
store.log = 1;
store.pdfSrcStore = pdfData.pdf.value;
store.numOfPagesStore = pdfData.pages.value;
hideLoader();
}, 1500);
}).catch((e)=>{
messageError($q,e)
})
.finally(()=>{
store.log = 0
.catch((e) => {
messageError($q, e);
})
.finally(() => {
store.log = 0;
});
}
function numToThai(val: number) {

View file

@ -34,6 +34,7 @@ const messenger = ref<string>("");
const title = ref<string>("");
const modalEvaluation = ref<boolean>(false);
const fileEvaluationUpload = ref<any>();
const fileEvaluationUploadRef = ref<any>();
const status = ref<string>("WAIT_CHECK_DOC_V1");
const files = [
{
@ -153,22 +154,31 @@ function getPDF(url: string, type: string, fileName: string) {
/** ส่งไปประกาศบนเว็บไซต์ */
function onWebSite() {
dialogConfirm(
$q,
() => {
showLoader();
http
.put(config.API.evaluationApproveDoc1(id.value))
.then((res) => {})
.catch((e) => {})
.finally(() => {
success($q, "ส่งไปประกาศบนเว็บไซต์สำเร็จ");
getStep();
});
},
"ยืนยันการส่งไปประกาศบนเว็บไซต์",
"ยืนยันการส่งไปประกาศบนเว็บไซต์ใช่หรือไม่?"
);
download10Url.value === ""
? (fileEvaluationUpload.value = "")
: fileEvaluationUpload.value;
fileEvaluationUploadRef.value.validate();
if (
fileEvaluationUploadRef.value.hasError === false &&
download10Url.value !== ""
) {
dialogConfirm(
$q,
() => {
showLoader();
http
.put(config.API.evaluationApproveDoc1(id.value))
.then((res) => {})
.catch((e) => {})
.finally(() => {
success($q, "ส่งไปประกาศบนเว็บไซต์สำเร็จ");
getStep();
});
},
"ยืนยันการส่งไปประกาศบนเว็บไซต์",
"ยืนยันการส่งไปประกาศบนเว็บไซต์ใช่หรือไม่?"
);
}
}
function getStep() {
@ -248,7 +258,6 @@ function fileUpLoad(url: string) {
messageError($q, e);
})
.finally(() => {
fileEvaluationUpload.value = null;
checkDoc10();
success($q, "อัปโหลดไฟล์สำเร็จ");
});
@ -408,6 +417,7 @@ onMounted(() => {
<div v-if="store.currentStep == 4" class="row col-12">
<div class="col-xs-12 col-sm-11 row">
<q-file
ref="fileEvaluationUploadRef"
v-model="fileEvaluationUpload"
class="col-12"
outlined
@ -415,6 +425,11 @@ onMounted(() => {
hide-bottom-space
lazy-rules
accept=".pdf"
:rules="
download10Url === ''
? [(val) => !!val || 'กรุณาเลือกไฟล์']
: []
"
>
<template v-slot:prepend>
<q-icon name="attach_file" />

View file

@ -37,6 +37,7 @@ const AnnouncementEndDate = ref<string | null>();
const id = ref<string>(route.params.id as string);
const pdfSrc = ref<any>();
const fileEvaluation5 = ref<any>();
const fileEvaluation5Ref = ref<any>();
const status = ref<string>("ANNOUNCE_WEB");
const website = ref<string>("https://bma-ehr.frappet.com/");
@ -80,21 +81,30 @@ function deleteFile(name: string) {
}
function save() {
dialogConfirm($q, () => {
showLoader();
http
.put(config.API.evaluationNext5To6(id.value))
// .then((res) => {})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
success($q, "บันทึกแจ้งผลการประกาศคัดเลือกสำเร็จ");
store.step = 6;
store.currentStep = 6;
hideLoader();
});
});
download10Url.value === ""
? (fileEvaluation5.value = "")
: fileEvaluation5.value;
fileEvaluation5Ref.value.validate();
if (
fileEvaluation5Ref.value.hasError === false &&
download10Url.value !== ""
) {
dialogConfirm($q, () => {
showLoader();
http
.put(config.API.evaluationNext5To6(id.value))
// .then((res) => {})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
success($q, "บันทึกแจ้งผลการประกาศคัดเลือกสำเร็จ");
store.step = 6;
store.currentStep = 6;
hideLoader();
});
});
}
}
function upLoadFile() {
@ -135,7 +145,6 @@ function fileUpLoad(url: string) {
messageError($q, e);
})
.finally(() => {
fileEvaluation5.value = null;
checkDocResult();
success($q, "อัปโหลดไฟล์สำเร็จ");
});
@ -356,7 +365,7 @@ onMounted(() => {
<div v-if="store.currentStep == 5" class="row col-12">
<div class="col-xs-12 col-sm-10 row">
<q-file
ref="fileEvaluation1Ref"
ref="fileEvaluation5Ref"
v-model="fileEvaluation5"
class="col-12"
outlined
@ -365,6 +374,11 @@ onMounted(() => {
hide-bottom-space
lazy-rules
accept=".pdf"
:rules="
download10Url === ''
? [(val) => !!val || 'กรุณาเลือกไฟล์']
: []
"
>
<template v-slot:prepend>
<q-icon name="attach_file" />

View file

@ -1,5 +1,5 @@
<script setup lang="ts">
import { reactive, ref,onMounted } from "vue";
import { reactive, ref, onMounted } from "vue";
import { VuePDF, usePDF } from "@tato30/vue-pdf";
import { useCounterMixin } from "@/stores/mixin";
import { useEvaluateDetailStore } from "@/modules/12_evaluatePersonal/store/EvaluateDetail";
@ -30,14 +30,14 @@ function handleItemClick(itemNumber: number) {
// evaluationFilebyId
function getFile(volume: number) {
const fileText = numToThai(volume);
console.log(fileText)
console.log(fileText);
showLoader();
http
.get(config.API.evaluationFilebyId("เล่ม 2", id.value, fileText))
.then((res) => {
const link = res.data.downloadUrl;
const type = res.data.fileType;
console.log(link,type)
console.log(link, type);
getPDF(link, type);
})
.catch((e) => {
@ -67,6 +67,7 @@ function getPDF(url: string, type: string) {
const pdfData = await usePDF(`${objectUrl}`);
showLoader();
setTimeout(() => {
store.urlDownloadFile = url;
store.log = 1;
store.pdfSrcStore = pdfData.pdf.value;
store.numOfPagesStore = pdfData.pages.value;
@ -90,9 +91,9 @@ function numToThai(val: number) {
}
}
onMounted(()=>{
getFile(1)
})
onMounted(() => {
getFile(1);
});
</script>
<template>

View file

@ -8,6 +8,8 @@ import { useCounterMixin } from "@/stores/mixin";
import { useQuasar } from "quasar";
import keycloak from "@/plugins/keycloak";
import type { FileEvaluationRefRef } from "@/modules/12_evaluatePersonal/interface/index/evalute";
import genReport from "@/plugins/genreport";
import { useEvaluateDetailStore } from "@/modules/12_evaluatePersonal/store/EvaluateDetail";
@ -42,7 +44,21 @@ const fileEvaluation83 = ref<any>();
const fileEvaluation84 = ref<any>();
const fileEvaluation85 = ref<any>();
const fileEvaluation86 = ref<any>();
const fileEvaluation81Ref = ref<object | null>(null);
const fileEvaluation82Ref = ref<object | null>(null);
const fileEvaluation83Ref = ref<object | null>(null);
const fileEvaluation84Ref = ref<object | null>(null);
const fileEvaluation85Ref = ref<object | null>(null);
const fileEvaluation86Ref = ref<object | null>(null);
const profile = ref<any>();
const fileEvaluationRef: FileEvaluationRefRef = {
fileEvaluation81: fileEvaluation81Ref,
fileEvaluation82: fileEvaluation82Ref,
fileEvaluation83: fileEvaluation83Ref,
fileEvaluation84: fileEvaluation84Ref,
fileEvaluation85: fileEvaluation85Ref,
fileEvaluation86: fileEvaluation86Ref,
};
async function onClickDowloadFile(
tp: string,
@ -127,12 +143,12 @@ 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;
// fileEvaluation81.value = null;
// fileEvaluation82.value = null;
// fileEvaluation83.value = null;
// fileEvaluation84.value = null;
// fileEvaluation85.value = null;
// fileEvaluation86.value = null;
success($q, "อัปโหลดไฟล์สำเร็จ");
});
}
@ -183,38 +199,77 @@ function fileUpLoad(url: string, file: any) {
// .finally(() => {});
// }
function confirmApprove() {
dialogConfirm(
$q,
() => {
const data = {
metadata: {
additionalProp1: nameOfWork.value,
additionalProp2: nameOfOwner.value,
additionalProp3: position.value,
async function confirmApprove() {
const fileEvaluationValues = [
fileEvaluation81,
fileEvaluation82,
fileEvaluation83,
fileEvaluation84,
fileEvaluation85,
fileEvaluation86,
];
const downloadFileValues = [
downloadFile1,
downloadFile2,
downloadFile3,
downloadFile4,
downloadFile5,
downloadFile6,
];
for (let i = 0; i < downloadFileValues.length; i++) {
if (downloadFileValues[i].value === "") {
fileEvaluationValues[i].value = null;
}
}
setTimeout(() => {
const hasError = [];
for (const key in fileEvaluationRef) {
if (Object.prototype.hasOwnProperty.call(fileEvaluationRef, key)) {
const property = fileEvaluationRef[key];
if (property.value && typeof property.value.validate === "function") {
const isValid = property.value.validate();
hasError.push(isValid);
}
}
}
if (hasError.every((result) => result === true)) {
dialogConfirm(
$q,
() => {
const data = {
metadata: {
additionalProp1: nameOfWork.value,
additionalProp2: nameOfOwner.value,
additionalProp3: position.value,
},
};
showLoader();
http
.patch(
config.API.evaluationPatchData(
"เล่ม 2",
id.value,
"1-เอกสารเล่ม 2"
),
data
)
.then(() => {})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
nextStep();
modalConfirm.value = false;
hideLoader();
});
},
};
showLoader();
http
.patch(
config.API.evaluationPatchData("เล่ม 2", id.value, "1-เอกสารเล่ม 2"),
data
)
.then((res) => {
console.log(res);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
nextStep();
modalConfirm.value = false;
hideLoader();
});
},
"ยืนยันผลการพิจารณา",
"ต้องการยืนยันผลการพิจารณาใช่หรือไม่?"
);
"ยืนยันผลการพิจารณา",
"ต้องการยืนยันผลการพิจารณาใช่หรือไม่?"
);
}
}, 100);
}
function nextStep() {
@ -379,6 +434,7 @@ onMounted(() => {
<div v-if="store.currentStep == 8" class="row col-12">
<div class="col-xs-12 col-sm-10 row">
<q-file
ref="fileEvaluation81Ref"
v-model="fileEvaluation81"
class="col-12"
outlined
@ -387,6 +443,11 @@ onMounted(() => {
lazy-rules
label="อัปโหลดไฟล์"
accept=".pdf"
:rules="
downloadFile1 === ''
? [(val) => !!val || 'กรุณาเลือกไฟล์']
: []
"
>
<template v-slot:prepend>
<q-icon name="attach_file" />
@ -463,6 +524,7 @@ onMounted(() => {
<div v-if="store.currentStep == 8" class="row col-12">
<div class="col-xs-12 col-sm-10 row">
<q-file
ref="fileEvaluation82Ref"
v-model="fileEvaluation82"
class="col-12"
outlined
@ -471,6 +533,11 @@ onMounted(() => {
lazy-rules
label="อัปโหลดไฟล์"
accept=".pdf"
:rules="
downloadFile2 === ''
? [(val) => !!val || 'กรุณาเลือกไฟล์']
: []
"
>
<template v-slot:prepend>
<q-icon name="attach_file" />
@ -547,6 +614,7 @@ onMounted(() => {
<div v-if="store.currentStep == 8" class="row col-12">
<div class="col-xs-12 col-sm-10 row">
<q-file
ref="fileEvaluation83Ref"
v-model="fileEvaluation83"
class="col-12"
outlined
@ -555,6 +623,11 @@ onMounted(() => {
lazy-rules
label="อัปโหลดไฟล์"
accept=".pdf"
:rules="
downloadFile3 === ''
? [(val) => !!val || 'กรุณาเลือกไฟล์']
: []
"
>
<template v-slot:prepend>
<q-icon name="attach_file" />
@ -631,6 +704,7 @@ onMounted(() => {
<div v-if="store.currentStep == 8" class="row col-12">
<div class="col-xs-12 col-sm-10 row">
<q-file
ref="fileEvaluation84Ref"
v-model="fileEvaluation84"
class="col-12"
outlined
@ -639,6 +713,11 @@ onMounted(() => {
lazy-rules
label="อัปโหลดไฟล์"
accept=".pdf"
:rules="
downloadFile4 === ''
? [(val) => !!val || 'กรุณาเลือกไฟล์']
: []
"
>
<template v-slot:prepend>
<q-icon name="attach_file" />
@ -715,6 +794,7 @@ onMounted(() => {
<div v-if="store.currentStep == 8" class="row col-12">
<div class="col-xs-12 col-sm-10 row">
<q-file
ref="fileEvaluation85Ref"
v-model="fileEvaluation85"
class="col-12"
outlined
@ -723,6 +803,11 @@ onMounted(() => {
lazy-rules
label="อัปโหลดไฟล์"
accept=".pdf"
:rules="
downloadFile5 === ''
? [(val) => !!val || 'กรุณาเลือกไฟล์']
: []
"
>
<template v-slot:prepend>
<q-icon name="attach_file" />
@ -799,6 +884,7 @@ onMounted(() => {
<div v-if="store.currentStep == 8" class="row col-12">
<div class="col-xs-12 col-sm-10 row">
<q-file
ref="fileEvaluation86Ref"
v-model="fileEvaluation86"
class="col-12"
outlined
@ -807,6 +893,11 @@ onMounted(() => {
lazy-rules
label="อัปโหลดไฟล์"
accept=".pdf"
:rules="
downloadFile6 === ''
? [(val) => !!val || 'กรุณาเลือกไฟล์']
: []
"
>
<template v-slot:prepend>
<q-icon name="attach_file" />
@ -876,7 +967,7 @@ onMounted(() => {
unelevated
label="ยืนยันผลการพิจารณา"
color="public"
@click="openConfirmEvalution"
@click="confirmApprove"
/>
</div>
</div>