updated report url

This commit is contained in:
Warunee Tamkoo 2025-02-12 10:54:00 +07:00
parent fddb014b4c
commit 4a11216b5f

View file

@ -154,7 +154,14 @@ async function onUpdateFilter() {
.then(async (res) => { .then(async (res) => {
const data = await res.data.result; const data = await res.data.result;
detailReport.value = data; detailReport.value = data;
await fetchDocumentTemplate(data); const type =
typeReport.value === "report4" ||
typeReport.value === "report5" ||
typeReport.value === "report6" ||
typeReport.value === "report7"
? "xlsx"
: "docx";
await fetchDocumentTemplate(data, type);
}) })
.catch(async (e) => { .catch(async (e) => {
messageError($q, JSON.parse(await e.response.data.text())); messageError($q, JSON.parse(await e.response.data.text()));
@ -169,9 +176,9 @@ async function onUpdateFilter() {
* function เรยกไฟล PDF * function เรยกไฟล PDF
* @param data อมลบญชนลา * @param data อมลบญชนลา
*/ */
async function fetchDocumentTemplate(data: any) { async function fetchDocumentTemplate(data: any, type: string = "docx") {
await axios await axios
.post(`${config.API.reportTemplate}/docx`, data, { .post(`${config.API.reportTemplate}/${type}`, data, {
headers: { headers: {
accept: "application/pdf", accept: "application/pdf",
"content-Type": "application/json", "content-Type": "application/json",