fig: export report recruit
This commit is contained in:
parent
27d3e30b82
commit
7077d67d7e
2 changed files with 140 additions and 35 deletions
|
|
@ -229,31 +229,9 @@ async function fetchData(actionType?: string) {
|
|||
async function clickPassExam(id: string) {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.exportPassExamList(id))
|
||||
.then(async (res) => {
|
||||
const data = res.data.result;
|
||||
data.reportName = `CandidateList`;
|
||||
await genReport(data, "รายชื่อผู้สอบแข่งขันได้", "pdf");
|
||||
})
|
||||
.catch(async (e) => {
|
||||
messageError($q, JSON.parse(await e.response.data.text()));
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* ดาวน์โหลดรายชื่อผู้มีสิทธิ์สอบ
|
||||
* @param id รอบสอบเเข่งขัน
|
||||
*/
|
||||
async function clickCandidateList(id: string) {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.exportCandidateListNew(id), {
|
||||
.get(config.API.exportPassExamList(id), {
|
||||
headers: {
|
||||
accept:
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
accept: "application/pdf",
|
||||
"content-Type": "application/json",
|
||||
},
|
||||
|
||||
|
|
@ -271,7 +249,64 @@ async function clickCandidateList(id: string) {
|
|||
// สร้างลิงก์เพื่อดาวน์โหลดไฟล์
|
||||
const link = document.createElement("a");
|
||||
link.href = url;
|
||||
link.download = `CandidateList.xlsx`; // กำหนดชื่อไฟล์ที่จะดาวน์โหลด
|
||||
link.download = `รายชื่อผู้สอบแข่งขันได้.pdf`; // กำหนดชื่อไฟล์ที่จะดาวน์โหลด
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
|
||||
// ลบ URL ที่สร้างขึ้นหลังจากใช้งาน
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
})
|
||||
.catch(async (e) => {
|
||||
messageError($q, JSON.parse(await e.response.data.text()));
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
|
||||
// await http
|
||||
// .get(config.API.exportPassExamList(id))
|
||||
// .then(async (res) => {
|
||||
// const data = res.data.result;
|
||||
// data.reportName = `CandidateList`;
|
||||
// await genReport(data, "รายชื่อผู้สอบแข่งขันได้", "pdf");
|
||||
// })
|
||||
// .catch(async (e) => {
|
||||
// messageError($q, JSON.parse(await e.response.data.text()));
|
||||
// })
|
||||
// .finally(() => {
|
||||
// hideLoader();
|
||||
// });
|
||||
}
|
||||
|
||||
/**
|
||||
* ดาวน์โหลดรายชื่อผู้มีสิทธิ์สอบ
|
||||
* @param id รอบสอบเเข่งขัน
|
||||
*/
|
||||
async function clickCandidateList(id: string) {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.exportCandidateListNew(id), {
|
||||
headers: {
|
||||
accept: "application/pdf",
|
||||
"content-Type": "application/json",
|
||||
},
|
||||
|
||||
responseType: "blob",
|
||||
})
|
||||
.then(async (res) => {
|
||||
const data = res.data;
|
||||
if (data) {
|
||||
// สร้าง Blob จาก array buffer
|
||||
const blob = new Blob([data]);
|
||||
|
||||
// สร้าง URL สำหรับไฟล์ Blob
|
||||
const url = URL.createObjectURL(blob);
|
||||
|
||||
// สร้างลิงก์เพื่อดาวน์โหลดไฟล์
|
||||
const link = document.createElement("a");
|
||||
link.href = url;
|
||||
link.download = `รายชื่อผู้มีสิทธิ์สอบแข่งขัน.pdf`; // กำหนดชื่อไฟล์ที่จะดาวน์โหลด
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
|
||||
|
|
|
|||
|
|
@ -187,15 +187,50 @@ const visibleColumnsHistory = ref<String[]>([
|
|||
/** ดาวน์โหลดรายชื่อผู้สอบคัดเลือกคนพิการได้ */
|
||||
async function clickPassExam(id: string) {
|
||||
showLoader();
|
||||
// await http
|
||||
// .get(config.API.exportDisablePassExamList(id))
|
||||
// .then(async (res) => {
|
||||
// const data = res.data.result;
|
||||
// data.reportName = `CandidateList`;
|
||||
// await genReport(data, "รายชื่อผู้สอบแข่งขันได้", "pdf");
|
||||
// })
|
||||
// .catch(async (e) => {
|
||||
// messageError($q, e);
|
||||
// })
|
||||
// .finally(() => {
|
||||
// hideLoader();
|
||||
// });
|
||||
await http
|
||||
.get(config.API.exportDisablePassExamList(id))
|
||||
.get(config.API.exportDisablePassExamList(id), {
|
||||
headers: {
|
||||
accept: "application/pdf",
|
||||
"content-Type": "application/json",
|
||||
},
|
||||
|
||||
responseType: "blob",
|
||||
})
|
||||
.then(async (res) => {
|
||||
const data = res.data.result;
|
||||
data.reportName = `CandidateList`;
|
||||
await genReport(data, "รายชื่อผู้สอบแข่งขันได้", "pdf");
|
||||
const data = res.data;
|
||||
if (data) {
|
||||
// สร้าง Blob จาก array buffer
|
||||
const blob = new Blob([data]);
|
||||
|
||||
// สร้าง URL สำหรับไฟล์ Blob
|
||||
const url = URL.createObjectURL(blob);
|
||||
|
||||
// สร้างลิงก์เพื่อดาวน์โหลดไฟล์
|
||||
const link = document.createElement("a");
|
||||
link.href = url;
|
||||
link.download = `รายชื่อผู้สอบคัดเลือกคนพิการได้.pdf`; // กำหนดชื่อไฟล์ที่จะดาวน์โหลด
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
|
||||
// ลบ URL ที่สร้างขึ้นหลังจากใช้งาน
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
})
|
||||
.catch(async (e) => {
|
||||
messageError($q, e);
|
||||
messageError($q, JSON.parse(await e.response.data.text()));
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
|
|
@ -205,15 +240,50 @@ async function clickPassExam(id: string) {
|
|||
/** ดาวน์โหลดรายชื่อผู้มีสิทธิ์สอบ */
|
||||
async function clickCandidateList(id: string) {
|
||||
showLoader();
|
||||
// await http
|
||||
// .get(config.API.exportDisableCandidateList(id))
|
||||
// .then(async (res) => {
|
||||
// const data = res.data.result;
|
||||
// data.reportName = `CandidateList`;
|
||||
// await genReport(data, "รายชื่อผู้มีสิทธิ์สอบ", "pdf");
|
||||
// })
|
||||
// .catch(async (e) => {
|
||||
// messageError($q, e);
|
||||
// })
|
||||
// .finally(() => {
|
||||
// hideLoader();
|
||||
// });
|
||||
await http
|
||||
.get(config.API.exportDisableCandidateList(id))
|
||||
.get(config.API.exportDisablePassExamList(id), {
|
||||
headers: {
|
||||
accept: "application/pdf",
|
||||
"content-Type": "application/json",
|
||||
},
|
||||
|
||||
responseType: "blob",
|
||||
})
|
||||
.then(async (res) => {
|
||||
const data = res.data.result;
|
||||
data.reportName = `CandidateList`;
|
||||
await genReport(data, "รายชื่อผู้มีสิทธิ์สอบ", "pdf");
|
||||
const data = res.data;
|
||||
if (data) {
|
||||
// สร้าง Blob จาก array buffer
|
||||
const blob = new Blob([data]);
|
||||
|
||||
// สร้าง URL สำหรับไฟล์ Blob
|
||||
const url = URL.createObjectURL(blob);
|
||||
|
||||
// สร้างลิงก์เพื่อดาวน์โหลดไฟล์
|
||||
const link = document.createElement("a");
|
||||
link.href = url;
|
||||
link.download = `รายชื่อผู้มีสิทธิ์สอบคัดเลือกคนพิการ.pdf`; // กำหนดชื่อไฟล์ที่จะดาวน์โหลด
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
|
||||
// ลบ URL ที่สร้างขึ้นหลังจากใช้งาน
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
})
|
||||
.catch(async (e) => {
|
||||
messageError($q, e);
|
||||
messageError($q, JSON.parse(await e.response.data.text()));
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue