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

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-01-03 17:03:25 +07:00
parent 0b4a87e293
commit 9f247273c1
12 changed files with 334 additions and 89 deletions

View file

@ -1,5 +1,6 @@
<script setup lang="ts">
import { ref, reactive, onMounted } from "vue";
import { ref, reactive, watch, onMounted } from "vue";
import keycloak from "@/plugins/keycloak";
import { useRoute } from "vue-router";
import http from "@/plugins/http";
import config from "@/app.config";
@ -28,6 +29,11 @@ const pdfSrc = ref<any>();
const performance = ref<string>("");
const performanceOwner = ref<string>("");
const position = ref<string>("");
const performanceRef = ref<object | null>(null);
const performanceOwnerRef = ref<object | null>(null);
const positionRef = ref<object | null>(null);
const formCommand = reactive<FormCommand>({
commanderFullname: "",
@ -55,6 +61,7 @@ const updateInput = (value: any) => {
commanderAboveFullnameRef: commanderAboveFullnameRef.value,
commanderAbovePositionRef: commanderAbovePositionRef.value,
fileEvaluation1Ref: fileEvaluation1Ref.value,
downloadFile: [downloadUrl.value],
};
emit("update:form", value, ref);
};
@ -66,14 +73,14 @@ async function fetchPathUpload(
file: any
) {
const body = {
fileList: { fileName: type, metadata: {} },
// "1-",
// "2-",
// "3- ( .)",
// "4-",
// "5- ( 9)",
// "6- ( 11)",
fileList: {
fileName: type,
metadata: {
subject: performance.value,
author: performanceOwner.value,
position: position.value
},
},
};
if (id && file) {
showLoader();
@ -105,6 +112,7 @@ async function uploadfile(uploadUrl: string, file: any) {
},
})
.then(() => {
checkDoc();
success($q, "อัปโหลไฟล์สำเร็จ");
})
.catch((err) => {
@ -152,18 +160,15 @@ async function fetchCheckDate() {
}
onMounted(async () => {
const ref = {
commanderFullnameRef: commanderFullnameRef.value,
commanderPositionRef: commanderPositionRef.value,
commanderAboveFullnameRef: commanderAboveFullnameRef.value,
commanderAbovePositionRef: commanderAbovePositionRef.value,
fileEvaluation1Ref: fileEvaluation1Ref.value,
};
if (keycloak.tokenParsed != null) {
performanceOwner.value = keycloak.tokenParsed.name;
}
checkDoc();
if (store.currentStep > 2) {
fetcheSigner(evaluateId.value);
}
await fetchCheckDate();
emit("update:form", formCommand, ref);
// props.evaluateId && (await fetchPathUpload(" 2", props.evaluateId));
});
@ -172,7 +177,7 @@ function checkDoc() {
showLoader();
http
.get(
config.API.loadFileDocument("เล่ม 2", store.evaluateId, "1-เอกสารเล่ม 2")
config.API.loadFileDocument("เล่ม 2", evaluateId.value, "1-เอกสารเล่ม 2")
)
.then((res: any) => {
downloadUrl.value = res.data.downloadUrl;
@ -182,12 +187,29 @@ function checkDoc() {
// })
.finally(() => {
hideLoader();
const ref = {
commanderFullnameRef: commanderFullnameRef.value,
commanderPositionRef: commanderPositionRef.value,
commanderAboveFullnameRef: commanderAboveFullnameRef.value,
commanderAbovePositionRef: commanderAbovePositionRef.value,
fileEvaluation1Ref: fileEvaluation1Ref.value,
downloadFile: [downloadUrl.value],
};
emit("update:form", formCommand, ref);
});
}
onMounted(() => {
checkDoc();
});
watch(
() => store.checkFileupload,
() => {
downloadUrl.value === ""
? (fileEvaluation1.value = "")
: fileEvaluation1.value;
}
);
// onMounted(() => {});
</script>
<template>
@ -214,7 +236,7 @@ onMounted(() => {
</div> -->
<div class="row col-12 q-col-gutter-md q-pa-sm">
<q-input
:readonly="store.currentStep != 2"
:readonly="store.currentStep != 6"
ref="performanceRef"
dense
class="col-xs-12 col-sm-6"
@ -226,7 +248,7 @@ onMounted(() => {
lazy-rules
/>
<q-input
:readonly="store.currentStep != 2"
:readonly="store.currentStep != 6"
ref="performanceOwnerRef"
class="col-xs-12 col-sm-6"
dense
@ -237,6 +259,20 @@ onMounted(() => {
:rules="[(val) => !!val || `${'กรุณากรอกเจ้าของผลงาน'}`]"
lazy-rules
/>
<q-input
:readonly="store.currentStep != 6"
ref="positionRef"
class="col-xs-12 col-sm-6"
dense
outlined
v-model="position"
@update:model-value="updateInput(formCommand)"
label="ตำแหน่งที่ได้รับ"
:rules="[
(val) => !!val || `${'กรุณากรอกตำแหน่งที่ได้รับ'}`,
]"
lazy-rules
/>
</div>
</div>
</div>