auth-web/src/views/system/files/utils/columns.ts

39 lines
1.7 KiB
TypeScript
Raw Normal View History

import { $t } from '@/plugins/i18n';
import { reactive } from 'vue';
// 表格列
export const columns: TableColumnList = [
2025-04-24 13:43:37 +08:00
{ type: 'selection', align: 'left' },
2025-04-29 18:18:07 +08:00
{ type: 'index', index: (index: number) => index + 1, label: $t('index'), width: 60 },
2025-04-24 13:43:37 +08:00
// 文件的名称
2025-04-29 18:18:07 +08:00
{ label: $t('files_filename'), prop: 'filename', width: 280 },
2025-04-24 13:43:37 +08:00
// 文件在服务器上的存储路径
2025-04-29 23:21:40 +08:00
{ label: $t('files_filepath'), prop: 'filepath' },
2025-04-24 13:43:37 +08:00
// 文件的MIME类型
2025-05-12 20:40:42 +08:00
{ label: $t('files_fileType'), prop: 'contentType', width: 180 },
{ label: '缩略图类型', prop: 'thContentType', width: 180 },
2025-04-24 13:43:37 +08:00
// 下载数量
2025-04-29 18:18:07 +08:00
{ label: $t('files_downloadCount'), prop: 'downloadCount', width: 115 },
{ label: $t('table.updateTime'), prop: 'updateTime', sortable: true, width: 160 },
{ label: $t('table.createTime'), prop: 'createTime', sortable: true, width: 160 },
{ label: $t('table.createUser'), prop: 'createUser', slot: 'createUser', width: 130 },
{ label: $t('table.updateUser'), prop: 'updateUser', slot: 'updateUser', width: 130 },
{ label: $t('table.operation'), fixed: 'right', width: 210, slot: 'operation' },
];
// 添加规则
2024-10-14 14:12:43 +08:00
export const addRules = reactive({
2025-04-24 13:43:37 +08:00
// 文件在服务器上的存储路径
filepath: [{ required: true, message: `${$t('input')}${$t('files_filepath')}`, trigger: 'blur' }],
// 文件列表
files: [{ required: true, message: `${$t('files')}`, trigger: 'blur' }],
2024-10-14 14:12:43 +08:00
});
// 上传规则
export const uploadRules = reactive({
2025-04-24 13:43:37 +08:00
// 文件的名称
filename: [{ required: true, message: `${$t('input')}${$t('files_filename')}`, trigger: 'blur' }],
// 文件的MIME类型
fileType: [{ required: true, message: `${$t('input')}${$t('files_fileType')}`, trigger: 'blur' }],
});