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

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

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