fix: file-icon
This commit is contained in:
parent
9e889ccaa1
commit
c69d1f6702
2 changed files with 31 additions and 42 deletions
|
|
@ -127,43 +127,34 @@ export const useFileInfoStore = defineStore('info', () => {
|
|||
}
|
||||
|
||||
function getType(mimeType: any): string {
|
||||
if (mimeType === undefined) {
|
||||
return 'unknow type'
|
||||
} else {
|
||||
if (mimeFileMapping.hasOwnProperty(mimeType)) {
|
||||
return mimeFileMapping[mimeType].type
|
||||
} else {
|
||||
return 'unknow type'
|
||||
}
|
||||
}
|
||||
return mimeType && mimeFileMapping.hasOwnProperty(mimeType)
|
||||
? mimeFileMapping[mimeType].type
|
||||
: 'unknown type'
|
||||
}
|
||||
|
||||
function getFormatDate(dateTime: any): string {
|
||||
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
|
||||
return 'unknown date'
|
||||
}
|
||||
const date = new Date(dateTime)
|
||||
return date.toLocaleDateString('th-TH', {
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: 'numeric',
|
||||
})
|
||||
}
|
||||
|
||||
function getSize(size: any): string {
|
||||
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]
|
||||
}
|
||||
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]
|
||||
}
|
||||
|
||||
async function getFileInfo(data: EhrFile) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue