hrms-edm/Services/client/src/modules/01_user/components/FileDownload.vue

144 lines
4.4 KiB
Vue
Raw Normal View History

<script setup lang="ts">
import { ref } from 'vue'
import { storeToRefs } from 'pinia'
import { useFileInfoStore } from '@/stores/file-info-data'
import FileIcon from '@/components/FileIcon.vue'
const { isPreview, fileInfo } = storeToRefs(useFileInfoStore())
const { getType, getFormatDate, getSize } = useFileInfoStore()
</script>
<template>
<div class="bg-white rounded-borders shadow-5 relative">
<div class="bg-white q-pa-md">
<div class="row items-center justify-between">
<span class="text-h6">
<q-btn
flat
dense
class="q-mr-sm q-px-sm"
@click="() => (isPreview = false)"
>
<q-icon
class="pointer"
name="arrow_back"
size="1em"
color="primary"
/>
</q-btn>
{{ fileInfo?.title }}</span
>
</div>
<div class="row">
<div class="q-pa-sm">
<div class="col">
<div class="box border-radius-inherit">
<q-card flat>
<q-card-section class="column justify-center relative q-px-xl">
<file-icon
size="preview"
:fileMimeType="fileInfo?.fileType"
/>
<span class="text-center q-pt-md text-h6">{{
fileInfo?.title
}}</span>
</q-card-section>
</q-card>
</div>
</div>
<div class="column q-py-md">
<q-btn
color="primary"
label="ดาวน์โหลด"
icon="mdi-download"
class="q-py-sm"
/>
</div>
</div>
<div class="col q-px-lg q-gutter-md">
<div class="row">
<div class="col-2">
<span>อไฟล</span>
</div>
<div class="col-grow">
<span class="text-grey">{{ fileInfo?.fileName }}</span>
</div>
</div>
<q-separator />
<div class="row">
<div class="col-2">
<span>อเรอง</span>
</div>
<div class="col-grow">
<span class="text-grey">{{ fileInfo?.title }}</span>
</div>
</div>
<q-separator />
<div class="row">
<div class="col-2">
<span>รายละเอยด</span>
</div>
<div class="col-grow">
<span class="text-grey">{{ fileInfo?.description }}</span>
</div>
</div>
<q-separator />
<div class="row">
<div class="col-2">
<span>กล/หมวดหม</span>
</div>
<div class="col-grow" v-for="category in fileInfo?.category" :key="category">
<span class="text-grey">{{ category }}</span>
</div>
</div>
<q-separator />
<div class="row">
<div class="col-2">
<span>คำสำค</span>
</div>
<div class="col-grow" v-for="keyword in fileInfo?.keyword" :key="keyword">
<span class="text-grey">{{ keyword }}</span>
</div>
</div>
<q-separator />
<div class="row">
<div class="col-2">
<span>ขนาดไฟล</span>
</div>
<div class="col-grow">
<span class="text-grey">{{ getSize(fileInfo?.fileSize) }}</span>
</div>
</div>
<q-separator />
<div class="row">
<div class="col-2">
<span>ประเภทไฟล</span>
</div>
<div class="col-grow">
<span class="text-grey">{{ getType(fileInfo?.fileType) }}</span>
</div>
</div>
<q-separator />
<div class="row">
<div class="col-2">
<span>นทปโหลด</span>
</div>
<div class="col-grow">
<span class="text-grey">{{ getFormatDate(fileInfo?.createdAt) }}</span>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<style lang="scss" scoped>
.box {
border: 2px solid #f1f2f4;
border-radius: 8px;
}
</style>