2020-11-11 15:23:39 +08:00
|
|
|
|
import { TableOptions } from '@nocobase/database';
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: 'collections',
|
|
|
|
|
title: '数据表配置',
|
2020-12-11 10:31:00 +08:00
|
|
|
|
internal: true,
|
2020-12-01 20:11:39 +08:00
|
|
|
|
sortable: true,
|
|
|
|
|
draggable: true,
|
|
|
|
|
model: 'CollectionModel',
|
2020-12-07 08:53:18 +08:00
|
|
|
|
developerMode: true,
|
2020-11-11 15:23:39 +08:00
|
|
|
|
fields: [
|
2020-11-19 21:12:15 +08:00
|
|
|
|
{
|
2020-12-01 20:11:39 +08:00
|
|
|
|
interface: 'sort',
|
2020-11-19 21:12:15 +08:00
|
|
|
|
type: 'integer',
|
|
|
|
|
name: 'sort',
|
|
|
|
|
title: '排序',
|
|
|
|
|
component: {
|
|
|
|
|
type: 'sort',
|
|
|
|
|
className: 'drag-visible',
|
|
|
|
|
width: 60,
|
2020-12-01 20:11:39 +08:00
|
|
|
|
showInTable: true,
|
2020-11-19 21:12:15 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
2020-11-11 15:23:39 +08:00
|
|
|
|
{
|
2020-12-01 20:11:39 +08:00
|
|
|
|
interface: 'string',
|
2020-11-11 15:23:39 +08:00
|
|
|
|
type: 'string',
|
|
|
|
|
name: 'title',
|
2020-12-01 20:11:39 +08:00
|
|
|
|
title: '数据表名称',
|
2020-11-11 15:23:39 +08:00
|
|
|
|
required: true,
|
|
|
|
|
component: {
|
|
|
|
|
type: 'string',
|
2020-11-19 21:12:15 +08:00
|
|
|
|
className: 'drag-visible',
|
2020-12-01 20:11:39 +08:00
|
|
|
|
showInTable: true,
|
|
|
|
|
showInForm: true,
|
|
|
|
|
showInDetail: true,
|
2020-11-11 15:23:39 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
2020-12-01 20:11:39 +08:00
|
|
|
|
interface: 'string',
|
2020-11-11 15:23:39 +08:00
|
|
|
|
type: 'string',
|
|
|
|
|
name: 'name',
|
2020-12-08 14:33:28 +08:00
|
|
|
|
createOnly: true,
|
2020-11-11 15:23:39 +08:00
|
|
|
|
title: '标识',
|
|
|
|
|
unique: true,
|
|
|
|
|
required: true,
|
|
|
|
|
component: {
|
|
|
|
|
type: 'string',
|
2020-12-01 20:11:39 +08:00
|
|
|
|
showInTable: true,
|
|
|
|
|
showInForm: true,
|
|
|
|
|
showInDetail: true,
|
2020-11-11 15:23:39 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
2020-12-01 20:11:39 +08:00
|
|
|
|
interface: 'string',
|
|
|
|
|
type: 'virtual',
|
2020-12-01 23:38:10 +08:00
|
|
|
|
name: 'icon',
|
2020-12-01 20:11:39 +08:00
|
|
|
|
title: '图标',
|
|
|
|
|
component: {
|
|
|
|
|
type: 'string',
|
|
|
|
|
showInTable: true,
|
|
|
|
|
showInForm: true,
|
|
|
|
|
showInDetail: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
interface: 'radio',
|
|
|
|
|
type: 'virtual',
|
2020-12-01 23:38:10 +08:00
|
|
|
|
name: 'defaultView',
|
2020-12-01 20:11:39 +08:00
|
|
|
|
title: '默认视图',
|
|
|
|
|
defaultValue: 'table',
|
|
|
|
|
dataSource: [
|
|
|
|
|
{label: '表格', value: 'table'},
|
|
|
|
|
{label: '看板', value: 'kanban', disabled: true},
|
|
|
|
|
{label: '日历', value: 'calendar', disabled: true},
|
|
|
|
|
],
|
|
|
|
|
component: {
|
|
|
|
|
type: 'radio',
|
|
|
|
|
showInTable: true,
|
|
|
|
|
showInForm: true,
|
|
|
|
|
showInDetail: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
interface: 'radio',
|
|
|
|
|
type: 'virtual',
|
2020-12-01 23:38:10 +08:00
|
|
|
|
name: 'mode',
|
2020-12-01 20:11:39 +08:00
|
|
|
|
title: '表格模式',
|
|
|
|
|
defaultValue: 'default',
|
|
|
|
|
dataSource: [
|
|
|
|
|
{label: '常规模式', value: 'default'},
|
|
|
|
|
{label: '简易模式', value: 'simple'},
|
|
|
|
|
],
|
|
|
|
|
component: {
|
|
|
|
|
type: 'radio',
|
|
|
|
|
tooltip: `
|
|
|
|
|
<p>常规模式:点击数据进入详情页进行各项查看和操作;<br/>简易模式:点击数据直接打开编辑表单</p>
|
|
|
|
|
`,
|
|
|
|
|
showInForm: true,
|
|
|
|
|
showInDetail: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
interface: 'radio',
|
|
|
|
|
type: 'virtual',
|
2020-12-01 23:38:10 +08:00
|
|
|
|
name: 'defaultPerPage',
|
2020-12-01 20:11:39 +08:00
|
|
|
|
title: '每页显示几行数据',
|
|
|
|
|
defaultValue: 50,
|
|
|
|
|
dataSource: [
|
|
|
|
|
{label: '20', value: 20},
|
|
|
|
|
{label: '50', value: 50},
|
|
|
|
|
{label: '100', value: 100},
|
|
|
|
|
],
|
|
|
|
|
component: {
|
|
|
|
|
type: 'radio',
|
|
|
|
|
showInForm: true,
|
|
|
|
|
showInDetail: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
interface: 'boolean',
|
|
|
|
|
type: 'virtual',
|
2020-12-01 23:38:10 +08:00
|
|
|
|
name: 'draggable',
|
2020-12-01 20:11:39 +08:00
|
|
|
|
title: '支持拖拽数据排序',
|
|
|
|
|
showInForm: true,
|
|
|
|
|
showInDetail: true,
|
|
|
|
|
component: {
|
|
|
|
|
type: 'checkbox',
|
|
|
|
|
showInForm: true,
|
|
|
|
|
showInDetail: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
interface: 'boolean',
|
|
|
|
|
type: 'boolean',
|
|
|
|
|
name: 'showInDataMenu',
|
|
|
|
|
title: '显示在“数据”菜单里',
|
2020-11-11 15:23:39 +08:00
|
|
|
|
component: {
|
2020-12-01 20:11:39 +08:00
|
|
|
|
type: 'checkbox',
|
|
|
|
|
showInTable: true,
|
|
|
|
|
showInForm: true,
|
|
|
|
|
showInDetail: true,
|
2020-11-11 15:23:39 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
2020-12-07 08:53:18 +08:00
|
|
|
|
{
|
|
|
|
|
interface: 'boolean',
|
|
|
|
|
type: 'boolean',
|
|
|
|
|
name: 'developerMode',
|
|
|
|
|
title: '开发者模式',
|
|
|
|
|
defaultValue: false,
|
|
|
|
|
component: {
|
|
|
|
|
type: 'boolean',
|
|
|
|
|
},
|
|
|
|
|
},
|
2020-11-11 15:23:39 +08:00
|
|
|
|
{
|
2020-12-01 20:11:39 +08:00
|
|
|
|
interface: 'json',
|
2020-11-11 15:23:39 +08:00
|
|
|
|
type: 'json',
|
|
|
|
|
name: 'options',
|
2020-12-01 20:11:39 +08:00
|
|
|
|
title: '配置信息',
|
|
|
|
|
defaultValue: {},
|
|
|
|
|
component: {
|
|
|
|
|
type: 'hidden',
|
|
|
|
|
},
|
2020-11-11 15:23:39 +08:00
|
|
|
|
},
|
2020-12-11 10:31:00 +08:00
|
|
|
|
{
|
|
|
|
|
interface: 'boolean',
|
|
|
|
|
type: 'boolean',
|
|
|
|
|
name: 'internal',
|
|
|
|
|
title: '系统内置',
|
|
|
|
|
defaultValue: false,
|
|
|
|
|
developerMode: true,
|
|
|
|
|
component: {
|
|
|
|
|
type: 'boolean',
|
|
|
|
|
},
|
|
|
|
|
},
|
2020-11-11 15:23:39 +08:00
|
|
|
|
{
|
2020-12-01 20:11:39 +08:00
|
|
|
|
interface: 'linkTo',
|
2020-11-11 15:23:39 +08:00
|
|
|
|
type: 'hasMany',
|
|
|
|
|
name: 'fields',
|
2020-12-01 20:11:39 +08:00
|
|
|
|
title: '字段',
|
2020-11-11 15:23:39 +08:00
|
|
|
|
sourceKey: 'name',
|
2020-12-01 20:11:39 +08:00
|
|
|
|
draggable: true,
|
2020-11-19 21:12:15 +08:00
|
|
|
|
actions: {
|
|
|
|
|
list: {
|
|
|
|
|
sort: 'sort',
|
|
|
|
|
},
|
|
|
|
|
},
|
2020-12-01 20:11:39 +08:00
|
|
|
|
component: {
|
|
|
|
|
type: 'drawerSelect',
|
|
|
|
|
},
|
2020-11-11 15:23:39 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
2020-12-01 20:11:39 +08:00
|
|
|
|
interface: 'linkTo',
|
2020-11-11 15:23:39 +08:00
|
|
|
|
type: 'hasMany',
|
|
|
|
|
name: 'actions',
|
2020-12-01 20:11:39 +08:00
|
|
|
|
title: '动作',
|
2020-11-11 15:23:39 +08:00
|
|
|
|
sourceKey: 'name',
|
2020-12-01 20:11:39 +08:00
|
|
|
|
draggable: true,
|
2020-11-19 21:12:15 +08:00
|
|
|
|
actions: {
|
|
|
|
|
list: {
|
|
|
|
|
sort: 'sort',
|
|
|
|
|
},
|
|
|
|
|
},
|
2020-12-01 20:11:39 +08:00
|
|
|
|
component: {
|
|
|
|
|
type: 'drawerSelect',
|
|
|
|
|
},
|
2020-11-11 15:23:39 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
2020-12-01 20:11:39 +08:00
|
|
|
|
interface: 'linkTo',
|
2020-11-11 15:23:39 +08:00
|
|
|
|
type: 'hasMany',
|
|
|
|
|
name: 'tabs',
|
2020-12-01 20:11:39 +08:00
|
|
|
|
title: '标签页',
|
2020-11-11 15:23:39 +08:00
|
|
|
|
sourceKey: 'name',
|
2020-12-01 20:11:39 +08:00
|
|
|
|
draggable: true,
|
2020-11-19 21:12:15 +08:00
|
|
|
|
actions: {
|
|
|
|
|
list: {
|
|
|
|
|
sort: 'sort',
|
|
|
|
|
},
|
|
|
|
|
},
|
2020-12-01 20:11:39 +08:00
|
|
|
|
component: {
|
|
|
|
|
type: 'drawerSelect',
|
|
|
|
|
},
|
2020-11-11 15:23:39 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
2020-12-01 20:11:39 +08:00
|
|
|
|
interface: 'linkTo',
|
2020-11-11 15:23:39 +08:00
|
|
|
|
type: 'hasMany',
|
|
|
|
|
name: 'views',
|
2020-12-01 20:11:39 +08:00
|
|
|
|
title: '视图',
|
2020-11-11 15:23:39 +08:00
|
|
|
|
sourceKey: 'name',
|
2020-12-01 20:11:39 +08:00
|
|
|
|
draggable: true,
|
2020-11-19 21:12:15 +08:00
|
|
|
|
actions: {
|
|
|
|
|
list: {
|
|
|
|
|
sort: 'sort',
|
|
|
|
|
},
|
|
|
|
|
},
|
2020-12-01 20:11:39 +08:00
|
|
|
|
component: {
|
|
|
|
|
type: 'drawerSelect',
|
|
|
|
|
},
|
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',
|
2020-12-07 08:53:18 +08:00
|
|
|
|
developerMode: true,
|
2020-11-11 15:23:39 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'details',
|
|
|
|
|
name: 'details',
|
|
|
|
|
title: '详情',
|
|
|
|
|
template: 'Details',
|
|
|
|
|
actionNames: ['update'],
|
2020-12-07 08:53:18 +08:00
|
|
|
|
developerMode: true,
|
2020-11-11 15:23:39 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
2020-11-13 22:01:14 +08:00
|
|
|
|
type: 'table',
|
2020-11-11 15:23:39 +08:00
|
|
|
|
name: 'simple',
|
|
|
|
|
title: '简易模式',
|
|
|
|
|
template: 'SimpleTable',
|
|
|
|
|
actionNames: ['create', 'destroy'],
|
|
|
|
|
detailsViewName: 'details',
|
|
|
|
|
updateViewName: 'form',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'table',
|
|
|
|
|
name: 'table',
|
|
|
|
|
title: '列表',
|
|
|
|
|
template: 'Table',
|
|
|
|
|
actionNames: ['create', 'destroy'],
|
|
|
|
|
default: true,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
tabs: [
|
|
|
|
|
{
|
|
|
|
|
type: 'details',
|
|
|
|
|
name: 'details',
|
|
|
|
|
title: '详情',
|
|
|
|
|
viewName: 'details',
|
|
|
|
|
default: true,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'association',
|
|
|
|
|
name: 'fields',
|
|
|
|
|
title: '字段',
|
|
|
|
|
association: 'fields',
|
|
|
|
|
viewName: 'simple',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'association',
|
|
|
|
|
name: 'views',
|
|
|
|
|
title: '视图',
|
|
|
|
|
association: 'views',
|
|
|
|
|
viewName: 'simple',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'association',
|
|
|
|
|
name: 'actions',
|
|
|
|
|
title: '动作',
|
|
|
|
|
association: 'actions',
|
|
|
|
|
viewName: 'simple',
|
2020-12-07 08:53:18 +08:00
|
|
|
|
developerMode: true,
|
2020-11-11 15:23:39 +08:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
type: 'association',
|
|
|
|
|
name: 'tabs',
|
|
|
|
|
title: '标签页',
|
|
|
|
|
association: 'tabs',
|
|
|
|
|
viewName: 'simple',
|
|
|
|
|
},
|
2020-12-07 08:53:18 +08:00
|
|
|
|
// {
|
|
|
|
|
// type: 'association',
|
|
|
|
|
// name: 'roles',
|
|
|
|
|
// title: '权限',
|
|
|
|
|
// association: 'roles',
|
|
|
|
|
// viewName: 'simple2',
|
|
|
|
|
// },
|
2020-11-11 15:23:39 +08:00
|
|
|
|
],
|
|
|
|
|
} as TableOptions;
|