diff --git a/Services/client/src/components/FileIcon.vue b/Services/client/src/components/FileIcon.vue
new file mode 100644
index 0000000..bf31845
--- /dev/null
+++ b/Services/client/src/components/FileIcon.vue
@@ -0,0 +1,35 @@
+
+
+
+
+
diff --git a/Services/client/src/components/FileItem.vue b/Services/client/src/components/FileItem.vue
index ffe8b71..127290a 100644
--- a/Services/client/src/components/FileItem.vue
+++ b/Services/client/src/components/FileItem.vue
@@ -4,7 +4,10 @@ import { storeToRefs } from 'pinia'
import FileItemAction from '@/components/FileItemAction.vue'
import { useTreeDataStore } from '@/stores/tree-data'
+import { useFileInfoStore } from '@/stores/file-info-data'
+const { isPreview } = storeToRefs(useFileInfoStore())
+const { getFileInfo } = useFileInfoStore()
const DEPT_NAME = ['ตู้เอกสาร', 'ลิ้นชัก', 'แฟ้ม', 'แฟ้มย่อย']
const { currentFolder, currentFile, currentDept } = storeToRefs(
@@ -113,9 +116,21 @@ const props = withDefaults(
-
+
-
+ {
+ getFileInfo(currentFile[index])
+ isPreview = true
+ }
+ "
+ >
import { storeToRefs } from 'pinia'
import { useSearchDataStore } from '@/stores/searched-data'
+import { useFileInfoStore } from '@/stores/file-info-data'
const { foundFile } = storeToRefs(useSearchDataStore())
+const { isPreview } = storeToRefs(useFileInfoStore())
+const { getFileInfo } = useFileInfoStore()
-
+
-
+ {
+ getFileInfo(foundFile[index])
+ isPreview = true
+ }
+ "
+ >
{{ value.title }}
diff --git a/Services/client/src/components/PageLayout.vue b/Services/client/src/components/PageLayout.vue
index 074aa46..9d9828f 100644
--- a/Services/client/src/components/PageLayout.vue
+++ b/Services/client/src/components/PageLayout.vue
@@ -3,13 +3,16 @@ import { onMounted, ref } from 'vue'
import { storeToRefs } from 'pinia'
import { useTreeDataStore } from '@/stores/tree-data'
import { useSearchDataStore } from '@/stores/searched-data'
+import { useFileInfoStore } from '@/stores/file-info-data'
import FileItem from '@/components/FileItem.vue'
import TreeExplorer from '@/components/TreeExplorer.vue'
import SearchBar from '@/modules/01_user/components/SearchBar.vue'
import FileSearched from '@/components/FileSearched.vue'
+import FileDownload from '@/modules/01_user/components/FileDownload.vue'
const DEPT_NAME = ['ตู้เอกสาร', 'ลิ้นชัก', 'แฟ้ม', 'แฟ้มย่อย', 'ไฟล์']
+const { isPreview } = storeToRefs(useFileInfoStore())
const { isSearch } = storeToRefs(useSearchDataStore())
const { data, currentDept } = storeToRefs(useTreeDataStore())
const { getCabinet, gotoParent } = useTreeDataStore()
@@ -62,8 +65,8 @@ onMounted(getCabinet)
-
-
+
+
@@ -72,12 +75,13 @@ onMounted(getCabinet)
flat
dense
class="q-mr-sm q-px-sm"
- v-if="currentDept > 0"
+ v-if="currentDept > 0 && isSearch === false"
@click="() => gotoParent()"
>
-
{{ DEPT_NAME[currentDept] }}
+
{{ DEPT_NAME[currentDept] }}
+
ผลการค้นหา
+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 } = useFileInfoStore()
+const fileIconComp = ref>()
+
+
+
+
+
+
+
+ (isPreview = false)"
+ >
+
+
+ {{ fileInfo?.title }}
+
+
+
+
+
+
+
+
+
+
+
+ {{
+ fileInfo?.title
+ }}
+
+
+
+
+
+
+
+
+
+
+
+
+ ชื่อไฟล์
+
+
+ {{ fileInfo?.fileName }}
+
+
+
+
+
+ ชื่อเรื่อง
+
+
+ {{ fileInfo?.title }}
+
+
+
+
+
+ รายละเอียด
+
+
+ {{ fileInfo?.description }}
+
+
+
+
+
+ กลุ่ม/หมวดหมู่
+
+
+ {{ fileInfo?.category }}
+
+
+
+
+
+ คำสำคัญ
+
+
+ {{ fileInfo?.keyword }}
+
+
+
+
+
+ ขนาดไฟล์
+
+
+ {{ fileInfo?.fileSize }}
+
+
+
+
+
+ ประเภทไฟล์
+
+
+ {{ getType(fileInfo?.fileType) }}
+
+
+
+
+
+ วันที่อัปโหลด
+
+
+ {{ fileInfo?.createdAt }}
+
+
+
+
+
+
+
+
+
diff --git a/Services/client/src/modules/01_user/components/SearchBar.vue b/Services/client/src/modules/01_user/components/SearchBar.vue
index 40e663b..807fa6d 100644
--- a/Services/client/src/modules/01_user/components/SearchBar.vue
+++ b/Services/client/src/modules/01_user/components/SearchBar.vue
@@ -148,7 +148,7 @@ async function searchSubmit() {
color="primary"
label="ค้นหา"
icon="mdi-magnify"
- @click="() => searchSubmit()"
+ @click="searchSubmit"
/>
diff --git a/Services/client/src/stores/file-info-data.ts b/Services/client/src/stores/file-info-data.ts
new file mode 100644
index 0000000..414daf7
--- /dev/null
+++ b/Services/client/src/stores/file-info-data.ts
@@ -0,0 +1,161 @@
+import { ref } from 'vue'
+import { defineStore } from 'pinia'
+
+import type { EhrFile } from '@/stores/tree-data'
+
+export interface MimeMap {
+ [key: string]: { icon: string; color: string; type: string }
+}
+
+export const useFileInfoStore = defineStore('info', () => {
+ const fileInfo = ref
()
+ const isPreview = ref(false)
+ const mimeFileMapping: MimeMap = {
+ 'application/msword': {
+ icon: 'mdi-file-word-outline',
+ color: 'blue-11',
+ type: '.doc',
+ },
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': {
+ icon: 'mdi-file-word-outline',
+ color: 'blue-11',
+ type: '.docx',
+ },
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.template': {
+ icon: 'mdi-file-word-outline',
+ color: 'blue-11',
+ type: '.dotx',
+ },
+ 'application/vnd.ms-word.document.macroEnabled.12': {
+ icon: 'mdi-file-word-outline',
+ color: 'blue-11',
+ type: '.docm',
+ },
+ 'application/vnd.ms-word.template.macroEnabled.12': {
+ icon: 'mdi-file-word-outline',
+ color: 'blue-11',
+ type: '.dotm',
+ },
+
+ 'application/vnd.ms-excel': {
+ icon: 'mdi-file-excel-outline',
+ color: 'green-12',
+ type: '.xls',
+ },
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': {
+ icon: 'mdi-file-excel-outline',
+ color: 'green-12',
+ type: '.xlsx',
+ },
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.template': {
+ icon: 'mdi-file-excel-outline',
+ color: 'green-12',
+ type: '.xltx',
+ },
+ 'application/vnd.ms-excel.sheet.macroEnabled.12': {
+ icon: 'mdi-file-excel-outline',
+ color: 'green-12',
+ type: '.xlsm',
+ },
+ 'application/vnd.ms-excel.template.macroEnabled.12': {
+ icon: 'mdi-file-excel-outline',
+ color: 'green-12',
+ type: '.xltm',
+ },
+ 'application/vnd.ms-excel.addin.macroEnabled.12': {
+ icon: 'mdi-file-excel-outline',
+ color: 'green-12',
+ type: '.xlam',
+ },
+ 'application/vnd.ms-excel.sheet.binary.macroEnabled.12': {
+ icon: 'mdi-file-excel-outline',
+ color: 'green-12',
+ type: '.xlsb',
+ },
+
+ 'application/vnd.ms-powerpoint': {
+ icon: 'mdi-file-powerpoint-outline',
+ color: 'orange-12',
+ type: '.ppt',
+ },
+ 'application/vnd.openxmlformats-officedocument.presentationml.presentation':
+ {
+ icon: 'mdi-file-powerpoint-outline',
+ color: 'orange-12',
+ type: '.pptx',
+ },
+ 'application/vnd.openxmlformats-officedocument.presentationml.template': {
+ icon: 'mdi-file-powerpoint-outline',
+ color: 'orange-12',
+ type: '.potx',
+ },
+ 'application/vnd.openxmlformats-officedocument.presentationml.slideshow': {
+ icon: 'mdi-file-powerpoint-outline',
+ color: 'orange-12',
+ type: '.ppsx',
+ },
+ 'application/vnd.ms-powerpoint.addin.macroEnabled.12': {
+ icon: 'mdi-file-powerpoint-outline',
+ color: 'orange-12',
+ type: '.ppam',
+ },
+ 'application/vnd.ms-powerpoint.presentation.macroEnabled.12': {
+ icon: 'mdi-file-powerpoint-outline',
+ color: 'orange-12',
+ type: '.pptm',
+ },
+ 'application/vnd.ms-powerpoint.template.macroEnabled.12': {
+ icon: 'mdi-file-powerpoint-outline',
+ color: 'orange-12',
+ type: '.potm',
+ },
+ 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12': {
+ icon: 'mdi-file-powerpoint-outline',
+ color: 'orange-12',
+ type: '.ppsm',
+ },
+
+ 'application/pdf': {
+ icon: 'mdi-file-document-outline',
+ color: 'red-12',
+ type: '.pdf',
+ },
+
+ 'text/plain': {
+ icon: 'mdi-file-document-outline',
+ color: 'blue-11',
+ type: '.txt',
+ },
+
+ 'image/x-png': {
+ icon: 'mdi-file-image-outline',
+ color: 'blue-11',
+ type: '.png',
+ },
+ 'image/x-citrix-jpeg': {
+ icon: 'mdi-file-image-outline',
+ color: 'blue-11',
+ type: '.jpg, jpeg',
+ },
+ }
+
+ function getType(mimeType: any) {
+ if (mimeFileMapping.hasOwnProperty(mimeType)) {
+ return mimeFileMapping[mimeType].type
+ } else {
+ return 'unknow type'
+ }
+ }
+
+ async function getFileInfo(data: EhrFile) {
+ fileInfo.value = data
+ }
+
+ return {
+ mimeFileMapping,
+ isPreview,
+ fileInfo,
+ getFileInfo,
+ getType,
+ }
+})