updated report url
This commit is contained in:
parent
fddb014b4c
commit
4a11216b5f
1 changed files with 10 additions and 3 deletions
|
|
@ -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",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue