2020-11-11 15:23:39 +08:00
|
|
|
|
import { TableOptions } from '@nocobase/database';
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: 'attachments',
|
|
|
|
|
title: '文件管理器',
|
2020-12-11 10:31:00 +08:00
|
|
|
|
internal: true,
|
2020-12-23 16:03:37 +08:00
|
|
|
|
developerMode: true,
|
2020-11-11 15:23:39 +08:00
|
|
|
|
fields: [
|
|
|
|
|
{
|
2020-12-23 12:46:13 +08:00
|
|
|
|
comment: '用户文件名(不含扩展名)',
|
|
|
|
|
type: 'string',
|
|
|
|
|
name: 'title',
|
2020-12-19 08:45:19 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
2020-12-23 12:46:13 +08:00
|
|
|
|
comment: '系统文件名(含扩展名)',
|
2020-12-19 08:45:19 +08:00
|
|
|
|
type: 'string',
|
2020-12-23 12:46:13 +08:00
|
|
|
|
name: 'filename'
|
2020-12-19 08:45:19 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
comment: '扩展名(含“.”)',
|
2020-11-11 15:23:39 +08:00
|
|
|
|
type: 'string',
|
2020-12-19 08:45:19 +08:00
|
|
|
|
name: 'extname',
|
2020-11-11 15:23:39 +08:00
|
|
|
|
},
|
2020-12-19 08:45:19 +08:00
|
|
|
|
{
|
|
|
|
|
comment: '文件体积(字节)',
|
|
|
|
|
type: 'integer',
|
|
|
|
|
name: 'size',
|
|
|
|
|
},
|
2020-12-23 12:46:13 +08:00
|
|
|
|
// TODO: 使用暂不明确,以后再考虑
|
|
|
|
|
// {
|
|
|
|
|
// comment: '文件类型(mimetype 前半段,通常用于预览)',
|
|
|
|
|
// type: 'string',
|
|
|
|
|
// name: 'type',
|
|
|
|
|
// },
|
2020-12-19 08:45:19 +08:00
|
|
|
|
{
|
|
|
|
|
type: 'string',
|
|
|
|
|
name: 'mimetype',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
comment: '存储引擎',
|
|
|
|
|
type: 'belongsTo',
|
|
|
|
|
name: 'storage',
|
|
|
|
|
},
|
|
|
|
|
{
|
2020-12-23 12:46:13 +08:00
|
|
|
|
comment: '相对路径(含“/”前缀)',
|
2020-12-19 08:45:19 +08:00
|
|
|
|
type: 'string',
|
|
|
|
|
name: 'path',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
comment: '其他文件信息(如图片的宽高)',
|
|
|
|
|
type: 'jsonb',
|
|
|
|
|
name: 'meta',
|
2020-12-23 12:46:13 +08:00
|
|
|
|
defaultValue: {}
|
2020-12-19 08:45:19 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
comment: '网络访问地址',
|
2020-12-23 12:46:13 +08:00
|
|
|
|
type: 'formula',
|
|
|
|
|
name: 'url',
|
|
|
|
|
formula: '{{ storage.baseUrl }}{{ path }}/{{ filename }}'
|
2020-12-19 08:45:19 +08:00
|
|
|
|
}
|
2020-11-11 15:23:39 +08:00
|
|
|
|
],
|
|
|
|
|
actions: [
|
|
|
|
|
{
|
|
|
|
|
type: 'list',
|
|
|
|
|
name: 'list',
|
|
|
|
|
title: '查看',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'create',
|
|
|
|
|
name: 'create',
|
|
|
|
|
title: '创建',
|
|
|
|
|
viewName: 'form',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'update',
|
|
|
|
|
name: 'update',
|
|
|
|
|
title: '编辑',
|
|
|
|
|
viewName: 'form',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'destroy',
|
|
|
|
|
name: 'destroy',
|
|
|
|
|
title: '删除',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
views: [
|
|
|
|
|
{
|
|
|
|
|
type: 'form',
|
|
|
|
|
name: 'form',
|
|
|
|
|
title: '表单',
|
|
|
|
|
template: 'DrawerForm',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'details',
|
|
|
|
|
name: 'details',
|
|
|
|
|
title: '详情',
|
|
|
|
|
template: 'Details',
|
|
|
|
|
actionNames: ['update'],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'simple',
|
|
|
|
|
name: 'simple',
|
|
|
|
|
title: '简易模式',
|
|
|
|
|
template: 'SimpleTable',
|
|
|
|
|
actionNames: ['create', 'destroy'],
|
|
|
|
|
detailsViewName: 'details',
|
|
|
|
|
updateViewName: 'form',
|
|
|
|
|
default: true,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'table',
|
|
|
|
|
name: 'table',
|
|
|
|
|
title: '列表',
|
|
|
|
|
template: 'Table',
|
|
|
|
|
actionNames: ['create', 'destroy'],
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
} as TableOptions;
|