ui ส่งหนังสือเวียน (ยังไม่ได้ปรับ api จาก step3)
This commit is contained in:
parent
a86743308f
commit
28365eeed0
4 changed files with 774 additions and 2 deletions
|
|
@ -69,6 +69,7 @@
|
|||
dense
|
||||
icon-right="mdi-file-pdf"
|
||||
class="q-px-sm"
|
||||
@click="fileDownload('pdf')"
|
||||
/>
|
||||
<q-btn
|
||||
flat
|
||||
|
|
@ -77,6 +78,7 @@
|
|||
dense
|
||||
icon-right="mdi-file-word"
|
||||
class="q-px-sm"
|
||||
@click="fileDownload('docx')"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -126,6 +128,19 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12">
|
||||
<div class="row">
|
||||
<q-space />
|
||||
<q-btn
|
||||
color="public"
|
||||
dense
|
||||
class="q-px-sm"
|
||||
label="ส่งหนังสือเวียน"
|
||||
@click="openDeceased(profileId)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</q-card>
|
||||
|
|
@ -144,6 +159,7 @@ const route = useRoute();
|
|||
const mixin = useCounterMixin();
|
||||
const { showLoader, hideLoader, messageError, date2Thai } = mixin;
|
||||
|
||||
const fullName = ref<string>("");
|
||||
const profileId = ref<string>(route.params.id.toString());
|
||||
const detail = ref<any>([]);
|
||||
|
||||
|
|
@ -156,7 +172,9 @@ const fectdata = async () => {
|
|||
await http
|
||||
.get(config.API.detailDeceased(profileId.value))
|
||||
.then((res) => {
|
||||
detail.value = res.data.result;
|
||||
const data = res.data.result;
|
||||
detail.value = data;
|
||||
fullName.value = `${data.prefix}${data.firstName} ${data.lastName}`;
|
||||
console.log(detail.value);
|
||||
})
|
||||
.catch((e) => {
|
||||
|
|
@ -171,9 +189,41 @@ const redirectToRegistry = (id: string) => {
|
|||
console.log(id);
|
||||
router.push(`/registry/${id}`);
|
||||
};
|
||||
const openDeceased = (id:string) => {
|
||||
router.push(`/deceased/detail/${id}`);
|
||||
}
|
||||
const nextPage = (page: string) => {
|
||||
window.open(page, "_blank");
|
||||
};
|
||||
const downloadFile = (response: any, filename: string) => {
|
||||
const link = document.createElement("a");
|
||||
var fileName = filename;
|
||||
link.href = window.URL.createObjectURL(new Blob([response.data]));
|
||||
link.setAttribute("download", fileName);
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
};
|
||||
|
||||
const fileDownload = async (type: string) => {
|
||||
showLoader();
|
||||
await http
|
||||
.get(config.API.DeceasedReport(type, profileId.value), {
|
||||
responseType: "blob",
|
||||
})
|
||||
.then((res) => {
|
||||
downloadFile(
|
||||
res,
|
||||
`รายละเอียดบันทึกเวียนแจ้งการถึงแก่กรรม-${fullName}.${type}`
|
||||
);
|
||||
})
|
||||
.catch((e) => {
|
||||
messageError($q, e);
|
||||
})
|
||||
.finally(() => {
|
||||
hideLoader();
|
||||
});
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scope>
|
||||
.q-img {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue