fix รายละเอียดการลาออกข

This commit is contained in:
DESKTOP-1R2VSQH\Lenovo ThinkPad E490 2024-10-24 17:52:42 +07:00
parent bc967ee238
commit 23d30d532c

View file

@ -94,8 +94,6 @@ const reasonReign = ref<string>("");
const dateBreak = ref<Date | null>(null);
const isCheckData = computed(() => {
console.log(workflowRef.value?.permission.isOperate);
if (
organizationPositionOld.value !== "" &&
positionTypeOld.value !== "" &&
@ -183,7 +181,6 @@ function diffDate() {
/** นำข้อมูลมาจาก API*/
async function fetchData(id: string) {
showLoader();
await http
.get(config.API.resingByid(id))
.then(async (res) => {
@ -219,8 +216,6 @@ async function fetchData(id: string) {
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
@ -241,14 +236,6 @@ function onSubmit() {
} else {
rejectpopUp();
}
// if (myFormConfirm.value !== null) {
// myFormConfirm.value.validate().then(async (check) => {
// if (check) {
// }
// });
// }
}
//pop up
@ -411,13 +398,13 @@ async function fileDownload(type: string, fileName: string) {
.then(async (res) => {
const data = res.data.result;
await genReport(data, `${fileName}`, type);
hideLoader();
})
.catch(async (e) => {
messageError($q, JSON.parse(await e.response.data.text()));
hideLoader();
})
.finally(() => {});
.finally(() => {
hideLoader();
});
}
function updatemodalPersonal(modal: boolean) {
@ -428,13 +415,11 @@ async function fetchFile() {
showLoader();
await http
.get(config.API.file("พ้นจากราชการ", "หลักฐานลาออก", id.value))
.then((res) => {
fileList.value = res.data;
.then(async (res) => {
fileList.value = await res.data;
})
.catch((e) => {
messageError($q, e);
})
.finally(() => {
hideLoader();
});
}
@ -456,7 +441,7 @@ function uploadFiles() {
res.data[key]?.fileName !== undefined &&
res.data[key]?.fileName !== ""
);
foundKey && uploadFileURL(res.data[foundKey]?.uploadUrl);
foundKey && (await uploadFileURL(res.data[foundKey]?.uploadUrl));
})
.catch((err) => {
messageError($q, err);
@ -476,9 +461,9 @@ async function uploadFileURL(uploadUrl: string) {
"Content-Type": file.value.type,
},
})
.then(() => {
.then(async () => {
await fetchFile();
success($q, "อัปโหลดไฟล์สำเร็จ");
fetchFile();
})
.catch((e) => {
messageError($q, e);
@ -489,14 +474,14 @@ async function uploadFileURL(uploadUrl: string) {
});
}
function downloadFiles(fileName: string) {
async function downloadFiles(fileName: string) {
showLoader();
http
await http
.get(
config.API.fileByFile("พ้นจากราชการ", "หลักฐานลาออก", id.value, fileName)
)
.then((res) => {
const data = res.data.downloadUrl;
.then(async (res) => {
const data = await res.data.downloadUrl;
window.open(data, "_blank");
})
.catch((e) => {
@ -524,9 +509,9 @@ function removeFile(fileName: string) {
)
)
.then(() => {
success($q, `ลบไฟล์สำเร็จ`);
setTimeout(() => {
fetchFile();
setTimeout(async () => {
await fetchFile();
success($q, `ลบไฟล์สำเร็จ`);
hideLoader();
}, 1000);
})
@ -539,8 +524,11 @@ function removeFile(fileName: string) {
/** Hook */
onMounted(async () => {
fetchData(id.value);
fetchFile();
showLoader();
await Promise.all([fetchData(id.value), fetchFile()]).finally(() => {
hideLoader();
});
// const user = await tokenParsed();
// if (user) {
// const commander = await user.role.includes("commander");