This commit is contained in:
扶桑花间 2025-08-27 20:37:31 +08:00
parent 3aff17bba9
commit 11032db958
3 changed files with 26 additions and 21 deletions

View File

@ -4,6 +4,7 @@ namespace app\model;
use app\BaseModel; use app\BaseModel;
use think\db\Query; use think\db\Query;
use think\model\concern\SoftDelete;
use think\model\relation\HasOne; use think\model\relation\HasOne;
/** /**
@ -11,6 +12,8 @@ use think\model\relation\HasOne;
*/ */
class SysFileRecord extends BaseModel class SysFileRecord extends BaseModel
{ {
use SoftDelete;
protected $name = "sys_file_record"; protected $name = "sys_file_record";
protected $pk = "id"; protected $pk = "id";

View File

@ -24,6 +24,8 @@ export interface FileRecord {
thumbnail?: string; thumbnail?: string;
/** 文件下载地址 */ /** 文件下载地址 */
downloadUrl?: string; downloadUrl?: string;
/** 文件预览地址 */
previewUrl?: string;
/** 上传人账号 */ /** 上传人账号 */
createUsername?: string; createUsername?: string;
/** 上传人名称 */ /** 上传人名称 */

View File

@ -10,8 +10,6 @@
:show-overflow-tooltip="true" :show-overflow-tooltip="true"
v-model:selections="selections" v-model:selections="selections"
:highlight-current-row="true" :highlight-current-row="true"
:export-config="{ fileName: '文件数据', datasource: exportSource }"
:print-config="{ datasource: exportSource }"
cache-key="systemFileTable" cache-key="systemFileTable"
> >
<template #toolbar> <template #toolbar>
@ -40,9 +38,10 @@
</el-button> </el-button>
</template> </template>
<template #path="{ row }"> <template #path="{ row }">
<el-tag style="margin-right: 5px">{{ row.disk }}</el-tag>
<el-link <el-link
type="primary" type="primary"
:href="row.url" :href="row.previewUrl"
target="_blank" target="_blank"
underline="never" underline="never"
> >
@ -82,8 +81,7 @@
import { import {
pageFiles, pageFiles,
removeFiles, removeFiles,
uploadFile, uploadFile
listFiles
} from '@/api/system/file'; } from '@/api/system/file';
import type { FileRecord, FileRecordParam } from '@/api/system/file/model'; import type { FileRecord, FileRecordParam } from '@/api/system/file/model';
@ -105,22 +103,29 @@
type: 'index', type: 'index',
columnKey: 'index', columnKey: 'index',
width: 50, width: 50,
align: 'center' /* , align: 'center'
fixed: 'left' */
},
{
prop: 'name',
label: '文件名称',
sortable: 'custom',
minWidth: 140
}, },
{ {
prop: 'path', prop: 'path',
label: '文件路径', label: '文件路径',
sortable: 'custom',
minWidth: 140, minWidth: 140,
slot: 'path' slot: 'path'
}, },
{
prop: 'name',
label: '文件名称',
minWidth: 140
},
{
prop: 'md5',
label: '文件md5',
width: 280
},
{
prop: 'contentType',
label: '文件Mime',
minWidth: 80
},
{ {
prop: 'length', prop: 'length',
label: '文件大小', label: '文件大小',
@ -140,11 +145,10 @@
} }
}, },
{ {
prop: 'createNickname', prop: 'createUser.nickname',
label: '上传人', label: '上传人',
width: 120, width: 120,
align: 'center', align: 'center'
sortable: 'custom'
}, },
{ {
prop: 'createTime', prop: 'createTime',
@ -234,8 +238,4 @@
return false; return false;
}; };
/** 导出和打印全部数据的数据源 */
const exportSource: DatasourceFunction = ({ where, orders }) => {
return listFiles({ ...where, ...orders });
};
</script> </script>