Merge branch 'develop' of github.com:Frappet/bma-ehr-frontend into develop

This commit is contained in:
Warunee Tamkoo 2024-08-14 12:25:21 +07:00
commit a7e33a49d7
4 changed files with 50 additions and 41 deletions

View file

@ -37,8 +37,8 @@ function handleItemClick(itemNumber: number) {
* @param volume index item
*/
function getFile(volume: number) {
const fileText = numToThai(volume);
showLoader();
const fileText = numToThai(volume);
http
.get(config.API.evaluationFilebyId("เล่ม 1", id.value, fileText))
.then((res) => {
@ -46,10 +46,8 @@ function getFile(volume: number) {
const type = res.data.fileType;
getPDF(link, type);
})
.catch(() => {
// messageError($q, e);
})
.finally(() => {
.catch((e) => {
messageError($q, e);
hideLoader();
});
}
@ -76,7 +74,6 @@ function getPDF(url: string, type: string) {
const objectUrl = URL.createObjectURL(blob);
const pdfData = await usePDF(`${objectUrl}`);
showLoader();
setTimeout(() => {
store.log = 1;
store.pdfSrcStore = pdfData.pdf.value;
@ -84,8 +81,8 @@ function getPDF(url: string, type: string) {
hideLoader();
}, 1500);
})
.catch(async (e) => {
messageError($q, JSON.parse(await e.response.data.text()));
.catch(() => {
hideLoader();
})
.finally(() => {
store.log = 0;

View file

@ -265,9 +265,10 @@ async function upLoadFile(file: any) {
})
.catch((e) => {
messageError($q, e);
hideLoader();
})
.finally(() => {
hideLoader();
// hideLoader();
});
}
}
@ -282,12 +283,13 @@ function fileUpLoad(url: string) {
headers: { "Content-Type": fileEvaluationUpload.value?.type },
onUploadProgress: (e) => console.log(e),
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
.then(() => {
checkDoc10();
success($q, "อัปโหลดไฟล์สำเร็จ");
})
.catch((e) => {
messageError($q, e);
hideLoader();
});
}
@ -333,6 +335,7 @@ async function checkDoc10() {
)
.then((res: any) => {
download10Url.value = res.data.downloadUrl;
fetchProfile();
})
.catch(() => {
// messageError($q, e);
@ -340,12 +343,11 @@ async function checkDoc10() {
.finally(() => {
hideLoader();
});
fetchProfile();
}
/** function เรียกข้แมูลคุณสมบัติ*/
async function fetchProfile() {
showLoader();
// showLoader();
await http
.get(config.API.evaluateGetDetail(id.value))
.then((res) => {
@ -356,7 +358,7 @@ async function fetchProfile() {
messageError($q, err);
})
.finally(() => {
hideLoader();
// hideLoader();
});
}
@ -430,14 +432,14 @@ onMounted(async () => {
</div>
<!-- ประกาศผลการคดเลอกบคคล (เอกสารหมายเลข 10) -->
<div class="col-12" >
<div class="col-12">
<q-card bordered style="border: 1px solid #d6dee1">
<div
class="text-weight-medium row col-12 bg-grey-1 q-py-sm q-px-md items-center"
>
<div>ประกาศผลการคดเลอกบคคล (เอกสารหมายเลข 10)</div>
<q-space />
<div v-if="store.currentStep == 4 ">
<div v-if="store.currentStep == 4">
<q-btn
icon="download"
color="indigo"
@ -473,7 +475,12 @@ onMounted(async () => {
</div>
<div class="col-12" v-if="store.currentStep == 4"><q-separator /></div>
<div class="row">
<div class="col-12 q-pa-sm" v-if="store.currentStep == 4 && checkPermission($route)?.attrIsUpdate">
<div
class="col-12 q-pa-sm"
v-if="
store.currentStep == 4 && checkPermission($route)?.attrIsUpdate
"
>
<q-file
ref="fileEvaluationUploadRef"
v-model="fileEvaluationUpload"
@ -482,6 +489,7 @@ onMounted(async () => {
dense
hide-bottom-space
lazy-rules
label="อัปโหลดไฟล์"
accept=".pdf"
:rules="
download10Url === '' ? [(val) => !!val || 'กรุณาเลือกไฟล์'] : []
@ -508,7 +516,10 @@ onMounted(async () => {
</div>
<!-- ดตอผขอประเม -->
<div class="col-12" v-if="store.currentStep == 4 && checkPermission($route)?.attrIsUpdate">
<div
class="col-12"
v-if="store.currentStep == 4 && checkPermission($route)?.attrIsUpdate"
>
<div class="q-mt-xs q-gutter-md" align="right">
<q-btn label="ติดต่อผู้ขอประเมิน" color="info" @click="openPopUp" />
<q-btn

View file

@ -117,8 +117,6 @@ function upLoadFile(file: any) {
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
@ -134,14 +132,15 @@ function fileUpLoad(url: string) {
headers: { "Content-Type": fileEvaluation5.value?.type },
onUploadProgress: (e) => console.log(e),
})
.then(() => {
success($q, "อัปโหลดไฟล์สำเร็จ");
.then(async () => {
await checkDocResult();
await success($q, "อัปโหลดไฟล์สำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
checkDocResult();
hideLoader();
});
}
@ -197,7 +196,7 @@ async function getDate() {
const download10Url = ref<string>("");
/** function เช็คไฟล์อัปโหลด*/
async function checkDocResult() {
showLoader();
// showLoader();
await http
.get(
config.API.evaluationPatchData(
@ -213,7 +212,7 @@ async function checkDocResult() {
// messageError($q, e);
})
.finally(() => {
hideLoader();
// hideLoader();
});
}

View file

@ -113,20 +113,18 @@ function upLoadFile(name: string, file: any) {
},
},
})
.then((res) => {
.then(async (res) => {
const foundKey: any = Object.keys(res.data).find(
(key) =>
res.data[key]?.fileName !== undefined &&
res.data[key]?.fileName !== ""
);
const link = res.data[foundKey]?.uploadUrl;
fileUpLoad(link, file);
await fileUpLoad(link, file);
await downloadFileList(name);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
downloadFileList(name);
hideLoader();
});
}
@ -143,11 +141,14 @@ function fileUpLoad(url: string, file: any) {
headers: { "Content-Type": file?.type },
onUploadProgress: (e) => console.log(e),
})
.then(() => {
success($q, "อัปโหลดไฟล์สำเร็จ");
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
success($q, "อัปโหลดไฟล์สำเร็จ");
hideLoader();
});
}
@ -191,6 +192,7 @@ async function confirmApprove() {
dialogConfirm(
$q,
() => {
showLoader();
const data = {
metadata: {
additionalProp1: nameOfWork.value,
@ -198,7 +200,6 @@ async function confirmApprove() {
additionalProp3: position.value,
},
};
showLoader();
http
.patch(
config.API.evaluationPatchData(
@ -208,13 +209,14 @@ async function confirmApprove() {
),
data
)
.then(() => {})
.then(() => {
nextStep();
modalConfirm.value = false;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
nextStep();
modalConfirm.value = false;
hideLoader();
});
},
@ -294,7 +296,7 @@ const downloadFile6 = ref<string>("");
* @param fileName อไฟล
*/
async function downloadFileList(fileName: string) {
showLoader();
// showLoader();
await http
.get(config.API.evaluationFilebyId("เล่ม 2", id.value, fileName))
.then((res) => {
@ -314,10 +316,10 @@ async function downloadFileList(fileName: string) {
} else if (fileName === "แบบสรุปผลการประเมิน (เอกสารแบบ ง)") {
downloadFile6.value = res.data.downloadUrl;
}
})
.finally(() => {
hideLoader();
});
// .finally(() => {
// hideLoader();
// });
}
const author = ref<string>("");