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

@ -220,32 +220,36 @@ function getStep() {
});
}
function upLoadFile() {
showLoader();
http
.post(config.API.evaluationFileListbyId("เล่ม 1", id.value), {
fileList: {
fileName: "10-ประกาศผลการคัดเลือกบุคคล (เอกสารหมายเลข 10)",
metadata: {
tag: "value",
function upLoadFile(file: any) {
if (file) {
showLoader();
http
.post(config.API.evaluationFileListbyId("เล่ม 1", id.value), {
fileList: {
fileName: "10-ประกาศผลการคัดเลือกบุคคล (เอกสารหมายเลข 10)",
metadata: {
tag: "value",
subject: subject.value,
author: author.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) {
@ -328,8 +332,29 @@ async function fetchProfile() {
});
}
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(() => {
checkDoc10();
fetchDataSigner();
});
</script>
@ -443,7 +468,7 @@ onMounted(() => {
dense
color="primary"
icon="mdi-upload "
@click="upLoadFile"
@click="upLoadFile(fileEvaluationUpload)"
><q-tooltip>ปโหลดไฟล</q-tooltip></q-btn
>
</div>