181 lines
4.7 KiB
Vue
181 lines
4.7 KiB
Vue
|
|
<script setup lang="ts">
|
||
|
|
import { ref } from "vue";
|
||
|
|
|
||
|
|
const splitterModel = ref(14);
|
||
|
|
const numOfPages = ref<number>(0);
|
||
|
|
const page = ref<number>(1);
|
||
|
|
const pdfSrc = ref<any>();
|
||
|
|
|
||
|
|
/** ไปหน้าต่อไปของรายงาน */
|
||
|
|
function nextPage() {
|
||
|
|
if (page.value < numOfPages.value) {
|
||
|
|
page.value++;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/** กลับหน้าก่อนหน้าของรายงาน */
|
||
|
|
function backPage() {
|
||
|
|
if (page.value !== 1) {
|
||
|
|
page.value--;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<template>
|
||
|
|
<q-splitter
|
||
|
|
v-model="splitterModel"
|
||
|
|
horizontal
|
||
|
|
style="
|
||
|
|
height: 50vh;
|
||
|
|
border: 1px solid rgb(210, 210, 210);
|
||
|
|
border-radius: 5px;
|
||
|
|
"
|
||
|
|
before-class="overflow-hidden disable"
|
||
|
|
separator-class="bg-white disabled"
|
||
|
|
>
|
||
|
|
<template v-slot:before>
|
||
|
|
<div class="q-px-sm">
|
||
|
|
<div class="row items-start items-center">
|
||
|
|
<div class="col">
|
||
|
|
<q-btn
|
||
|
|
padding="xs"
|
||
|
|
icon="mdi-chevron-left"
|
||
|
|
color="grey-2"
|
||
|
|
text-color="grey-5"
|
||
|
|
size="md"
|
||
|
|
class="my-auto"
|
||
|
|
@click="backPage"
|
||
|
|
:disable="page == 1"
|
||
|
|
/>
|
||
|
|
</div>
|
||
|
|
<div class="col-12 col-md-auto">
|
||
|
|
<div class="q-pa-md flex">
|
||
|
|
หน้าที่ {{ page }} จาก {{ numOfPages }}
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<div class="col text-right">
|
||
|
|
<q-btn
|
||
|
|
padding="xs"
|
||
|
|
icon="mdi-chevron-right"
|
||
|
|
color="grey-2"
|
||
|
|
text-color="grey-5"
|
||
|
|
size="md"
|
||
|
|
@click="nextPage"
|
||
|
|
:disable="page === numOfPages"
|
||
|
|
/>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</template>
|
||
|
|
<template v-slot:after>
|
||
|
|
<div class="q-pa-md">
|
||
|
|
<VuePDF ref="vuePDFRef" :pdf="pdfSrc" :page="page" fit-parent />
|
||
|
|
</div>
|
||
|
|
</template>
|
||
|
|
<template v-slot:default>
|
||
|
|
<div class="q-pa-md">
|
||
|
|
<div class="row items-start items-center">
|
||
|
|
<div class="col">
|
||
|
|
<q-btn
|
||
|
|
padding="xs"
|
||
|
|
icon="mdi-chevron-left"
|
||
|
|
color="grey-2"
|
||
|
|
text-color="grey-5"
|
||
|
|
size="md"
|
||
|
|
class="my-auto"
|
||
|
|
@click="backPage"
|
||
|
|
:disable="page == 1"
|
||
|
|
/>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<div class="col-12 col-md-auto">
|
||
|
|
<div class="q-pa-md flex">
|
||
|
|
หน้าที่ {{ page }} จาก {{ numOfPages }}
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<div class="col text-right">
|
||
|
|
<q-btn
|
||
|
|
padding="xs"
|
||
|
|
icon="mdi-chevron-right"
|
||
|
|
color="grey-2"
|
||
|
|
text-color="grey-5"
|
||
|
|
size="md"
|
||
|
|
@click="nextPage"
|
||
|
|
:disable="page === numOfPages"
|
||
|
|
/>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</template>
|
||
|
|
</q-splitter>
|
||
|
|
<!-- <q-card class="bg-white">
|
||
|
|
<div class="q-pa-md">
|
||
|
|
<div class="row items-start items-center">
|
||
|
|
<div class="col">
|
||
|
|
<q-btn
|
||
|
|
padding="xs"
|
||
|
|
icon="mdi-chevron-left"
|
||
|
|
color="grey-2"
|
||
|
|
text-color="grey-5"
|
||
|
|
size="md"
|
||
|
|
class="my-auto"
|
||
|
|
@click="backPage"
|
||
|
|
:disable="page == 1"
|
||
|
|
/>
|
||
|
|
</div>
|
||
|
|
<div class="col-12 col-md-auto">
|
||
|
|
<div class="q-pa-md flex">
|
||
|
|
หน้าที่ {{ page }} จาก {{ numOfPages }}
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<div class="col text-right">
|
||
|
|
<q-btn
|
||
|
|
padding="xs"
|
||
|
|
icon="mdi-chevron-right"
|
||
|
|
color="grey-2"
|
||
|
|
text-color="grey-5"
|
||
|
|
size="md"
|
||
|
|
@click="nextPage"
|
||
|
|
:disable="page === numOfPages"
|
||
|
|
/>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<div class="row items- items-center">
|
||
|
|
<VuePDF ref="vuePDFRef" :pdf="pdfSrc" :page="page" fit-parent />
|
||
|
|
</div>
|
||
|
|
<div class="row items- items-end">
|
||
|
|
<div class="col">
|
||
|
|
<q-btn
|
||
|
|
padding="xs"
|
||
|
|
icon="mdi-chevron-left"
|
||
|
|
color="grey-2"
|
||
|
|
text-color="grey-5"
|
||
|
|
size="md"
|
||
|
|
class="my-auto"
|
||
|
|
@click="backPage"
|
||
|
|
:disable="page == 1"
|
||
|
|
/>
|
||
|
|
</div>
|
||
|
|
<div class="col-12 col-md-auto">
|
||
|
|
<div class="q-pa-md flex">
|
||
|
|
หน้าที่ {{ page }} จาก {{ numOfPages }}
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<div class="col text-right">
|
||
|
|
<q-btn
|
||
|
|
padding="xs"
|
||
|
|
icon="mdi-chevron-right"
|
||
|
|
color="grey-2"
|
||
|
|
text-color="grey-5"
|
||
|
|
size="md"
|
||
|
|
@click="nextPage"
|
||
|
|
:disable="page === numOfPages"
|
||
|
|
/>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</q-card> -->
|
||
|
|
</template>
|
||
|
|
|
||
|
|
<style scoped></style>
|