diff --git a/Services/client/src/components/FileItem.vue b/Services/client/src/components/FileItem.vue index 445e92b..87eb06e 100644 --- a/Services/client/src/components/FileItem.vue +++ b/Services/client/src/components/FileItem.vue @@ -20,16 +20,10 @@ const { getFolder, createFolder, editFolder, uploadFile } = useTreeDataStore() const drawer = ref(false) const drawerFile = ref(false) const drawerStatus = ref<'edit' | 'create'>('create') -const input = ref('') const inputFile = ref() const fileTitle = ref('') const fileDesc = ref('') const fileCategory = ref('') -const optionsCategory = [ - { label: 'ศิลปะ', value: 'art' }, - { label: 'ภาพวาด', value: 'drawing' }, - { label: 'ภาษาไทย', value: 'thai' }, -] const fileKeyword = ref('') const editPathname = ref('') @@ -181,7 +175,7 @@ async function handleSubmit() { > กลุ่ม/หมวดหมู่ - -import { ref } from 'vue' import { storeToRefs } from 'pinia' import { useFileInfoStore } from '@/stores/file-info-data' @@ -89,8 +88,13 @@ const { getType, getFormatDate, getSize } = useFileInfoStore()
กลุ่ม/หมวดหมู่
-
- {{ category }} +
+ {{ category }}
@@ -98,8 +102,13 @@ const { getType, getFormatDate, getSize } = useFileInfoStore()
คำสำคัญ
-
- {{ keyword }} +
+ {{ keyword }}
@@ -126,7 +135,9 @@ const { getType, getFormatDate, getSize } = useFileInfoStore() วันที่อัปโหลด
- {{ getFormatDate(fileInfo?.createdAt) }} + {{ + getFormatDate(fileInfo?.createdAt) + }}
diff --git a/Services/client/src/stores/file-info-data.ts b/Services/client/src/stores/file-info-data.ts index 92860ae..16d5bce 100644 --- a/Services/client/src/stores/file-info-data.ts +++ b/Services/client/src/stores/file-info-data.ts @@ -139,23 +139,31 @@ export const useFileInfoStore = defineStore('info', () => { } function getFormatDate(dateTime: any): string { - const date = new Date(dateTime) - const result = date.toLocaleDateString('th-TH', { - year: 'numeric', - month: 'long', - day: 'numeric', - }) - return result + if (dateTime === undefined) { + return 'unknow date' + } else { + const date = new Date(dateTime) + const result = date.toLocaleDateString('th-TH', { + year: 'numeric', + month: 'long', + day: 'numeric', + }) + return result + } } function getSize(size: any): string { - const units = ['B', 'KB', 'MB', 'GB', 'TB'] - let i = 0 - while (size >= 1024 && i < units.length - 1) { - size /= 1024 - i++ + if (size === undefined) { + return 'unknow size' + } else { + const units = ['B', 'KB', 'MB', 'GB', 'TB'] + let i = 0 + while (size >= 1024 && i < units.length - 1) { + size /= 1024 + i++ + } + return size.toFixed(2) + ' ' + units[i] } - return size.toFixed(2) + ' ' + units[i] } async function getFileInfo(data: EhrFile) {