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

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

@ -52,8 +52,6 @@ function onClickPopupHistory() {
}
async function onCilckNextStep() {
console.log(store.step);
const functionCreateDoc: (() => Promise<void>) | null =
store.step === 1
? await saveStep1
@ -94,6 +92,13 @@ async function onCilckNextStep() {
}
async function validateForm() {
console.log(downloadFileRef.value);
store.checkFileupload = !store.checkFileupload;
console.log(store.checkFileupload);
const emptyValues = downloadFileRef.value.filter((e: any) => e === "");
const hasError = [];
for (const key in formCommandRef) {
if (Object.prototype.hasOwnProperty.call(formCommandRef, key)) {
@ -105,13 +110,21 @@ async function validateForm() {
}
}
if (hasError.every((result) => result === true)) {
store.step === 2 ? saveStep2() : saveStep6();
if (emptyValues.length > 0) {
console.log("There are empty values in the array.");
} else {
store.step === 2 ? saveStep2() : saveStep6();
}
// store.step === 2 && emptyValues.length > 0 ? saveStep2() : saveStep6();
}
}
const pdfSrc = ref<any>();
async function updateFilePDF(url: any) {
const urlDownloadFile = ref<string>("");
async function updateFilePDF(url: any, urlDownload: string) {
pdfSrc.value = url;
urlDownloadFile.value = urlDownload;
}
/** function เช็คการยื่นข้อประเมิน*/
@ -123,7 +136,6 @@ async function fetchCheckStatus() {
const data = res.data.result;
const id =
route.params.type === "expert" ? data.expertId : data.specialExpertId;
router.push(`/evaluate/detail/${route.params.type}/${id}`);
})
.catch((err) => {
@ -324,13 +336,13 @@ const formCommandRef: FormCommandRef = {
fileEvaluation5: fileEvaluation5Ref,
fileEvaluation6: fileEvaluation6Ref,
};
const downloadFileRef = ref<any>();
function updateformCommand(val: any, ref: any) {
formCommand.commanderFullname = val.commanderFullname;
formCommand.commanderPosition = val.commanderPosition;
formCommand.commanderAboveFullname = val.commanderAboveFullname;
formCommand.commanderAbovePosition = val.commanderAbovePosition;
commanderFullnameRef.value = ref.commanderFullnameRef;
commanderPositionRef.value = ref.commanderPositionRef;
commanderAboveFullnameRef.value = ref.commanderAboveFullnameRef;
@ -341,7 +353,9 @@ function updateformCommand(val: any, ref: any) {
fileEvaluation4Ref.value = ref.fileEvaluation4Ref;
fileEvaluation5Ref.value = ref.fileEvaluation5Ref;
fileEvaluation6Ref.value = ref.fileEvaluation6Ref;
downloadFileRef.value = ref.downloadFile;
}
async function saveStep2() {
dialogConfirm(
$q,
@ -572,10 +586,12 @@ onMounted(async () => {
<ViewStep3
v-if="store.step === 3 && pdfSrc"
:pdfSrc="pdfSrc"
:urlDownloadFile="urlDownloadFile"
/>
<ViewStep7
v-if="store.step === 7 && pdfSrc"
:pdfSrc="pdfSrc"
:urlDownloadFile="urlDownloadFile"
/>
</div>