แก้เช็คและ loading สรรหา
This commit is contained in:
parent
d9f5661ac3
commit
8a87f084c9
6 changed files with 98 additions and 92 deletions
|
|
@ -465,16 +465,19 @@ async function addData() {
|
|||
.then(async (res) => {
|
||||
const data = res.data.result;
|
||||
id.value = data;
|
||||
await uploadImgData();
|
||||
await uploadDocData();
|
||||
await uploadBarCodes();
|
||||
await uploadQrCodes();
|
||||
const uploadImg = await uploadImgData();
|
||||
const uploadDoc = await uploadDocData();
|
||||
const uploadBarCode = await uploadBarCodes();
|
||||
const uploadQrCode = await uploadQrCodes();
|
||||
hideLoader();
|
||||
|
||||
success($q, "บันทึกรอบคัดเลือกสำเร็จ");
|
||||
setTimeout(async () => {
|
||||
if (uploadImg && uploadDoc && uploadBarCode && uploadQrCode) {
|
||||
success($q, "บันทึกรอบคัดเลือกสำเร็จ");
|
||||
await clickBack();
|
||||
}, 1200);
|
||||
}
|
||||
// setTimeout(async () => {
|
||||
// await clickBack();
|
||||
// }, 1200);
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
|
|
@ -492,16 +495,21 @@ async function editData(id: string) {
|
|||
await http
|
||||
.put(config.API.periodExamId(id), sendData())
|
||||
.then(async () => {
|
||||
await uploadImgData();
|
||||
await uploadDocData();
|
||||
await uploadBarCodes();
|
||||
await uploadQrCodes();
|
||||
const uploadImg = await uploadImgData();
|
||||
const uploadDoc = await uploadDocData();
|
||||
const uploadBarCode = await uploadBarCodes();
|
||||
const uploadQrCode = await uploadQrCodes();
|
||||
hideLoader();
|
||||
|
||||
success($q, "แก้ไขรอบคัดเลือกสำเร็จ");
|
||||
setTimeout(async () => {
|
||||
console.log(uploadImg, uploadDoc, uploadBarCode, uploadQrCode);
|
||||
|
||||
if (uploadImg && uploadDoc && uploadBarCode && uploadQrCode) {
|
||||
success($q, "แก้ไขรอบคัดเลือกสำเร็จ");
|
||||
await clickBack();
|
||||
}, 1200);
|
||||
}
|
||||
// setTimeout(async () => {
|
||||
// await clickBack();
|
||||
// }, 1200);
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
|
|
@ -537,59 +545,60 @@ async function fileRemoveDoc(files: any) {
|
|||
|
||||
/** อัปโหลดไฟล์เอกสาร */
|
||||
async function uploadDocData() {
|
||||
const formData = new FormData();
|
||||
if (fileDocDataUpload.value.length > 0) {
|
||||
const formData = new FormData();
|
||||
fileDocDataUpload.value.forEach((file: any) => {
|
||||
formData.append("", file);
|
||||
});
|
||||
showLoader();
|
||||
await http
|
||||
.put(config.API.periodExamDoc(id.value), formData)
|
||||
.then((res) => {})
|
||||
.catch((e) => {})
|
||||
.finally(async () => {
|
||||
hideLoader();
|
||||
.then(() => {
|
||||
return true;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** อัปโหลดไฟล์เอกสาร */
|
||||
async function uploadBarCodes() {
|
||||
const formData = new FormData();
|
||||
if (barCodes.value !== null) {
|
||||
const formData = new FormData();
|
||||
formData.append("", barCodes.value);
|
||||
|
||||
showLoader();
|
||||
|
||||
await http
|
||||
.put(config.API.periodExambarcode(id.value), formData)
|
||||
.then((res) => {
|
||||
console.log(1);
|
||||
.then(() => {
|
||||
return true;
|
||||
})
|
||||
.catch((e) => {})
|
||||
.finally(async () => {
|
||||
hideLoader();
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** อัปโหลดไฟล์เอกสาร */
|
||||
async function uploadQrCodes() {
|
||||
const formData = new FormData();
|
||||
if (qrCodes.value !== null) {
|
||||
const formData = new FormData();
|
||||
formData.append("", qrCodes.value);
|
||||
|
||||
showLoader();
|
||||
await http
|
||||
.put(config.API.periodExamqrcode(id.value), formData)
|
||||
.then((res) => {
|
||||
console.log(2);
|
||||
.then(() => {
|
||||
return true;
|
||||
})
|
||||
.catch((e) => {})
|
||||
.finally(async () => {
|
||||
hideLoader();
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -624,15 +633,17 @@ async function uploadImgData() {
|
|||
fileImgDataUpload.value.forEach((file: any) => {
|
||||
formData.append("", file);
|
||||
});
|
||||
showLoader();
|
||||
await http
|
||||
.put(config.API.periodExamImg(id.value), formData)
|
||||
.then((res) => {})
|
||||
.catch((e) => {})
|
||||
.finally(async () => {
|
||||
hideLoader();
|
||||
.then(() => {
|
||||
return true;
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue