เพิ่ม api download แก้บัคต่างๆ ฟอร์มลา
This commit is contained in:
parent
fd4f6038b2
commit
4d9be43479
4 changed files with 44 additions and 5 deletions
|
|
@ -22,4 +22,5 @@ export default {
|
||||||
leaveUserId: (id: string) => `${leave}/user/${id}`,
|
leaveUserId: (id: string) => `${leave}/user/${id}`,
|
||||||
leaveProfile: () => `${leave}/user/profile`,
|
leaveProfile: () => `${leave}/user/profile`,
|
||||||
leaveCheck: () => `${leave}/user/check`,
|
leaveCheck: () => `${leave}/user/check`,
|
||||||
|
leaveReport: (id: string) => `${leave}/report/${id}`,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -301,8 +301,8 @@ function resetEndDate(type: string) {
|
||||||
borderless
|
borderless
|
||||||
:enableTimePicker="false"
|
:enableTimePicker="false"
|
||||||
week-start="0"
|
week-start="0"
|
||||||
:readonly="isReadOnly"
|
:readonly="!formDataSick.leaveStartDate"
|
||||||
@update:model-value="FetchCheck()"
|
@update:model-value="FetchCheck(), isReadOnly"
|
||||||
:min-date="formDataSick.leaveStartDate"
|
:min-date="formDataSick.leaveStartDate"
|
||||||
>
|
>
|
||||||
<template #year="{ year }">
|
<template #year="{ year }">
|
||||||
|
|
@ -319,7 +319,7 @@ function resetEndDate(type: string) {
|
||||||
for="leaveEndDateRef"
|
for="leaveEndDateRef"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
bg-color="white"
|
bg-color="white"
|
||||||
:readonly="isReadOnly"
|
:readonly="!formDataSick.leaveStartDate"
|
||||||
:class="inputEdit(isReadOnly)"
|
:class="inputEdit(isReadOnly)"
|
||||||
:model-value="formDataSick.leaveEndDate != null ? date2Thai(formDataSick.leaveEndDate) : null"
|
:model-value="formDataSick.leaveEndDate != null ? date2Thai(formDataSick.leaveEndDate) : null"
|
||||||
:label="`${'ลาถึงวันที่'}`"
|
:label="`${'ลาถึงวันที่'}`"
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import { useLeaveStore } from "@/modules/05_leave/store"
|
||||||
import http from "@/plugins/http"
|
import http from "@/plugins/http"
|
||||||
import config from "@/app.config"
|
import config from "@/app.config"
|
||||||
import { useRouter } from "vue-router"
|
import { useRouter } from "vue-router"
|
||||||
|
import genReport from "@/plugins/genreport"
|
||||||
|
|
||||||
/** Use */
|
/** Use */
|
||||||
const dataStore = useLeaveStore()
|
const dataStore = useLeaveStore()
|
||||||
|
|
@ -106,6 +107,24 @@ const onSubmit = async () => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//download function
|
||||||
|
async function onClickDownloadFile(id: string, fileName: string) {
|
||||||
|
// showLoader();
|
||||||
|
await http
|
||||||
|
.get(config.API.leaveReport(id))
|
||||||
|
.then(async res => {
|
||||||
|
console.log(res)
|
||||||
|
const data = res.data.result
|
||||||
|
await genReport(data, fileName)
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
messageError($q, err)
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
// hideLoader();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* check ว่าลาได้ไหม จาก api
|
* check ว่าลาได้ไหม จาก api
|
||||||
* @param formData
|
* @param formData
|
||||||
|
|
@ -350,7 +369,7 @@ async function saveFormData() {
|
||||||
<div class="col-12 col-sm-4 col-md-4 q-my-sm offset-sm-1 offset-md-2">
|
<div class="col-12 col-sm-4 col-md-4 q-my-sm offset-sm-1 offset-md-2">
|
||||||
<div class="column q-mx-xs">
|
<div class="column q-mx-xs">
|
||||||
<div class="q-pl-sm text-weight-bold text-dark text-center">ดาวน์โหลด</div>
|
<div class="q-pl-sm text-weight-bold text-dark text-center">ดาวน์โหลด</div>
|
||||||
<q-btn color="primary" icon="download" label="ดาวน์โหลดแบบฟอร์ม" />
|
<q-btn color="primary" icon="download" label="ดาวน์โหลดแบบฟอร์ม" @click="onClickDownloadFile(formDataWorkInternational.typeId, 'dataStore.typeId')" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-10 col-sm-5 col-md-4 q-my-sm">
|
<div class="col-10 col-sm-5 col-md-4 q-my-sm">
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import { useLeaveStore } from "@/modules/05_leave/store"
|
||||||
import http from "@/plugins/http"
|
import http from "@/plugins/http"
|
||||||
import config from "@/app.config"
|
import config from "@/app.config"
|
||||||
import { useRouter } from "vue-router"
|
import { useRouter } from "vue-router"
|
||||||
|
import genReport from "@/plugins/genreport"
|
||||||
|
|
||||||
/** Use */
|
/** Use */
|
||||||
const dataStore = useLeaveStore()
|
const dataStore = useLeaveStore()
|
||||||
|
|
@ -115,6 +116,24 @@ async function FetchCheck() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//download function
|
||||||
|
async function onClickDownloadFile(id: string, fileName: string) {
|
||||||
|
// showLoader();
|
||||||
|
await http
|
||||||
|
.get(config.API.leaveReport(id))
|
||||||
|
.then(async res => {
|
||||||
|
console.log(res)
|
||||||
|
const data = res.data.result
|
||||||
|
await genReport(data, fileName)
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
messageError($q, err)
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
// hideLoader();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ฟังชั่นบันทีกข้อมูลจาก formdata ส่งไปที่ Api
|
* ฟังชั่นบันทีกข้อมูลจาก formdata ส่งไปที่ Api
|
||||||
*/
|
*/
|
||||||
|
|
@ -294,7 +313,7 @@ async function saveFormData() {
|
||||||
<div class="col-12 col-sm-4 col-md-4 q-my-sm offset-sm-1 offset-md-2">
|
<div class="col-12 col-sm-4 col-md-4 q-my-sm offset-sm-1 offset-md-2">
|
||||||
<div class="column q-mx-xs">
|
<div class="column q-mx-xs">
|
||||||
<div class="q-pl-sm text-weight-bold text-dark text-center">ดาวน์โหลด</div>
|
<div class="q-pl-sm text-weight-bold text-dark text-center">ดาวน์โหลด</div>
|
||||||
<q-btn color="primary" icon="download" label="ดาวน์โหลดแบบฟอร์ม" />
|
<q-btn color="primary" icon="download" label="ดาวน์โหลดแบบฟอร์ม" @click="onClickDownloadFile(formDataRehabilitation.typeId, ' dataStore.typeId')" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-10 col-sm-5 col-md-4 q-my-sm">
|
<div class="col-10 col-sm-5 col-md-4 q-my-sm">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue