upload file ประเมืน

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-01-05 10:08:00 +07:00
parent 8bef90ab4b
commit 8968086017
4 changed files with 165 additions and 91 deletions

View file

@ -107,32 +107,36 @@ function save() {
}
}
function upLoadFile() {
showLoader();
http
.post(config.API.evaluationFileListbyId("เล่ม 1", id.value), {
fileList: {
fileName: "บันทึกแจ้งผลการประกาศคัดเลือก",
metadata: {
tag: "value",
function upLoadFile(file: any) {
if (file) {
showLoader();
http
.post(config.API.evaluationFileListbyId("เล่ม 1", id.value), {
fileList: {
fileName: "บันทึกแจ้งผลการประกาศคัดเลือก",
metadata: {
tag: "value",
author: author.value,
subject: subject.value,
},
},
},
})
.then((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);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
})
.then((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);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
}
function fileUpLoad(url: string) {
@ -275,9 +279,30 @@ function checkDocResult() {
});
}
onMounted(() => {
getDate();
checkDocResult();
const author = ref<string>("");
const subject = ref<string>("");
function fetchDataSigner() {
showLoader();
http
.get(config.API.evaluationSigner(id.value, 1))
.then((res) => {
const data = res.data.result;
author.value = data.author;
subject.value = data.subject;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
onMounted(async () => {
await getDate();
await checkDocResult();
await fetchDataSigner();
});
</script>
@ -392,7 +417,7 @@ onMounted(() => {
dense
color="primary"
icon="mdi-upload"
@click="upLoadFile"
@click="upLoadFile(fileEvaluation5)"
><q-tooltip>ปโหลดไฟล</q-tooltip></q-btn
>
</div>