refactor: list view icon, date, file type
This commit is contained in:
parent
6379bece40
commit
0666a60741
1 changed files with 18 additions and 7 deletions
|
|
@ -3,9 +3,12 @@ import { computed, ref } from 'vue'
|
||||||
import { storeToRefs } from 'pinia'
|
import { storeToRefs } from 'pinia'
|
||||||
import type { QTableProps } from 'quasar'
|
import type { QTableProps } from 'quasar'
|
||||||
import { useTreeDataStore } from '@/stores/tree-data'
|
import { useTreeDataStore } from '@/stores/tree-data'
|
||||||
|
import { useFileInfoStore } from '@/stores/file-info-data'
|
||||||
import FromEdit from '@/components/FromEdit.vue'
|
import FromEdit from '@/components/FromEdit.vue'
|
||||||
|
import FileIcon from '@/components/FileIcon.vue'
|
||||||
|
|
||||||
const { deleteFolder } = useTreeDataStore()
|
const { deleteFolder } = useTreeDataStore()
|
||||||
|
const { getFormatDate, getSize, getType } = useFileInfoStore()
|
||||||
const { listDataFile, listDataFolder, currentDept } = storeToRefs(
|
const { listDataFile, listDataFolder, currentDept } = storeToRefs(
|
||||||
useTreeDataStore()
|
useTreeDataStore()
|
||||||
)
|
)
|
||||||
|
|
@ -58,7 +61,7 @@ const columnsFolder: QTableProps['columns'] = [
|
||||||
sortable: true,
|
sortable: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'createdBy',
|
name: 'createdAt',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
label: 'วันที่สร้าง',
|
label: 'วันที่สร้าง',
|
||||||
field: 'createdAt',
|
field: 'createdAt',
|
||||||
|
|
@ -76,7 +79,7 @@ const columnsFolder: QTableProps['columns'] = [
|
||||||
|
|
||||||
const columnsFile: QTableProps['columns'] = [
|
const columnsFile: QTableProps['columns'] = [
|
||||||
{
|
{
|
||||||
name: 'fileName',
|
name: 'name',
|
||||||
required: true,
|
required: true,
|
||||||
label: 'ชื่อไฟล์',
|
label: 'ชื่อไฟล์',
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
|
@ -163,7 +166,13 @@ const columnsFile: QTableProps['columns'] = [
|
||||||
{{ nameRow.row.name }}
|
{{ nameRow.row.name }}
|
||||||
</q-td>
|
</q-td>
|
||||||
</template>
|
</template>
|
||||||
|
<template v-slot:body-cell-createdAt="createdAtRow">
|
||||||
|
<q-td>
|
||||||
|
<div class="justify-center">
|
||||||
|
{{ getFormatDate(createdAtRow.row.createdAt) }}
|
||||||
|
</div>
|
||||||
|
</q-td>
|
||||||
|
</template>
|
||||||
<template v-slot:body-cell-actions="actionsRow">
|
<template v-slot:body-cell-actions="actionsRow">
|
||||||
<q-td class="justify-center">
|
<q-td class="justify-center">
|
||||||
<div>
|
<div>
|
||||||
|
|
@ -241,14 +250,16 @@ const columnsFile: QTableProps['columns'] = [
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
<q-icon :name="currentIcon" size="2em" color="primary" />
|
<file-icon size="list" :fileMimeType="nameRow.row.fileType" />
|
||||||
{{ nameRow.row.name }}
|
{{ nameRow.row.fileName }}
|
||||||
</q-td>
|
</q-td>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-slot:body-cell-fileType="fileTypeRow">
|
<template v-slot:body-cell-fileType="fileTypeRow">
|
||||||
<q-td>
|
<q-td>
|
||||||
{{ fileTypeRow.row.fileType }}
|
<div class="justify-center">
|
||||||
|
{{ getType(fileTypeRow.row.fileType) }}
|
||||||
|
</div>
|
||||||
</q-td>
|
</q-td>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -261,7 +272,7 @@ const columnsFile: QTableProps['columns'] = [
|
||||||
self="center right"
|
self="center right"
|
||||||
:offset="[5, 1]"
|
:offset="[5, 1]"
|
||||||
>
|
>
|
||||||
{{ actionsRow.row.fileSize }}
|
{{ getSize(actionsRow.row.fileSize) }}
|
||||||
</q-tooltip>
|
</q-tooltip>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="props.mode === 'admin'">
|
<div v-if="props.mode === 'admin'">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue