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>

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>

View file

@ -105,32 +105,37 @@ function openConfirmEvalution() {
}
function upLoadFile(name: string, file: any) {
showLoader();
http
.post(config.API.evaluationFileListbyId("เล่ม 2", id.value), {
fileList: {
fileName: name,
metadata: {
tag: "value",
if (file) {
showLoader();
http
.post(config.API.evaluationFileListbyId("เล่ม 2", id.value), {
fileList: {
fileName: name,
metadata: {
tag: "value",
author: author.value,
subject: subject.value,
assignedPosition: assignedPosition.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, file);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
downloadFileList(name);
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, file);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
downloadFileList(name);
hideLoader();
});
}
}
function fileUpLoad(url: string, file: any) {
@ -337,7 +342,6 @@ async function downloadFileList(fileName: string) {
await http
.get(config.API.evaluationFilebyId("เล่ม 2", id.value, fileName))
.then((res) => {
console.log(res.data);
if (
fileName ===
"แบบตรวจสอบความถูกต้องครบถ้วนของข้อมูลประกอบการประเมินผลงาน (เอกสารแบบ ค)"
@ -360,8 +364,32 @@ async function downloadFileList(fileName: string) {
});
}
const author = ref<string>("");
const subject = ref<string>("");
const assignedPosition = ref<string>("");
async function fetchDataSigner() {
showLoader();
await http
.get(config.API.evaluationSigner(id.value, 2))
.then((res) => {
const data = res.data.result;
author.value = data.authorDoc2;
subject.value = data.subjectDoc2;
assignedPosition.value = data.assignedPosition;
console.log(assignedPosition.value, data);
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
onMounted(() => {
fetchProfile();
fetchDataSigner();
downloadFileList(
"แบบตรวจสอบความถูกต้องครบถ้วนของข้อมูลประกอบการประเมินผลงาน (เอกสารแบบ ค)"
);