2020-11-11 15:23:39 +08:00
|
|
|
import { TableOptions } from '@nocobase/database';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'views',
|
|
|
|
title: '视图配置',
|
2020-12-11 10:31:00 +08:00
|
|
|
internal: true,
|
2020-12-01 20:11:39 +08:00
|
|
|
sortable: true,
|
|
|
|
model: 'ViewModel',
|
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-12-13 00:09:25 +08:00
|
|
|
type: 'sort',
|
2020-11-19 21:12:15 +08:00
|
|
|
name: 'sort',
|
2020-12-13 00:09:25 +08:00
|
|
|
scope: ['collection'],
|
2020-11-19 21:12:15 +08:00
|
|
|
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',
|
2020-12-01 20:11:39 +08:00
|
|
|
name: 'title',
|
|
|
|
title: '视图名称',
|
2020-12-20 12:52:15 +08:00
|
|
|
required: true,
|
2020-11-19 21:12:15 +08:00
|
|
|
component: {
|
|
|
|
type: 'string',
|
|
|
|
className: 'drag-visible',
|
2020-12-01 20:11:39 +08:00
|
|
|
showInTable: true,
|
|
|
|
showInDetail: true,
|
|
|
|
showInForm: 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: 'name',
|
|
|
|
title: '标识',
|
2020-12-01 20:11:39 +08:00
|
|
|
component: {
|
|
|
|
type: 'string',
|
|
|
|
showInTable: true,
|
|
|
|
showInDetail: true,
|
|
|
|
showInForm: true,
|
|
|
|
},
|
2020-11-11 15:23:39 +08:00
|
|
|
},
|
|
|
|
{
|
2020-12-01 20:11:39 +08:00
|
|
|
interface: 'radio',
|
2020-11-11 15:23:39 +08:00
|
|
|
type: 'string',
|
2020-12-01 20:11:39 +08:00
|
|
|
name: 'type',
|
|
|
|
title: '视图类型',
|
2020-12-20 12:52:15 +08:00
|
|
|
required: true,
|
2020-12-01 20:11:39 +08:00
|
|
|
dataSource: [
|
|
|
|
{ label: '表格', value: 'table' },
|
2020-12-20 12:52:15 +08:00
|
|
|
// { label: '表单', value: 'form' },
|
2020-12-01 20:11:39 +08:00
|
|
|
{ label: '看板', value: 'kanban', disabled: true },
|
|
|
|
{ label: '日历', value: 'calendar', disabled: true },
|
|
|
|
{ label: '地图', value: 'map', disabled: true },
|
|
|
|
],
|
|
|
|
component: {
|
|
|
|
type: 'radio',
|
|
|
|
showInTable: true,
|
|
|
|
showInDetail: true,
|
|
|
|
showInForm: true,
|
2020-12-20 12:52:15 +08:00
|
|
|
default: 'table',
|
2020-12-13 00:09:25 +08:00
|
|
|
"x-linkages": [
|
|
|
|
{
|
|
|
|
"type": "value:visible",
|
|
|
|
"target": "filter",
|
|
|
|
"condition": "{{ $self.value !== 'form' }}"
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
interface: 'json',
|
|
|
|
type: 'json',
|
|
|
|
name: 'filter',
|
|
|
|
title: '筛选数据',
|
|
|
|
developerMode: false,
|
|
|
|
mode: 'replace',
|
2020-12-20 12:52:15 +08:00
|
|
|
defaultValue: {},
|
2020-12-13 00:09:25 +08:00
|
|
|
component: {
|
|
|
|
type: 'filter',
|
|
|
|
showInForm: true,
|
2020-12-01 20:11:39 +08:00
|
|
|
},
|
2020-11-11 15:23:39 +08:00
|
|
|
},
|
|
|
|
{
|
2020-12-09 20:46:57 +08:00
|
|
|
interface: 'select',
|
2020-11-11 15:23:39 +08:00
|
|
|
type: 'string',
|
|
|
|
name: 'template',
|
|
|
|
title: '模板',
|
2020-12-20 12:52:15 +08:00
|
|
|
required: true,
|
2020-12-09 20:46:57 +08:00
|
|
|
dataSource: [
|
2020-12-20 12:52:15 +08:00
|
|
|
// { label: '表单', value: 'DrawerForm' },
|
2020-12-09 20:46:57 +08:00
|
|
|
{ label: '常规表格', value: 'Table' },
|
|
|
|
{ label: '简易表格', value: 'SimpleTable' },
|
|
|
|
],
|
2020-12-01 20:11:39 +08:00
|
|
|
component: {
|
|
|
|
type: 'string',
|
2020-12-20 12:52:15 +08:00
|
|
|
default: 'Table',
|
2020-12-01 20:11:39 +08:00
|
|
|
showInTable: true,
|
|
|
|
showInDetail: true,
|
|
|
|
showInForm: true,
|
|
|
|
},
|
2020-11-11 15:23:39 +08:00
|
|
|
},
|
2020-12-09 20:46:57 +08:00
|
|
|
{
|
|
|
|
interface: 'radio',
|
|
|
|
type: 'virtual',
|
|
|
|
name: 'defaultPerPage',
|
|
|
|
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',
|
|
|
|
name: 'draggable',
|
|
|
|
title: '支持拖拽数据排序',
|
|
|
|
showInForm: true,
|
|
|
|
showInDetail: true,
|
|
|
|
component: {
|
|
|
|
type: 'checkbox',
|
|
|
|
showInForm: true,
|
|
|
|
showInDetail: true,
|
|
|
|
},
|
|
|
|
},
|
2020-11-11 15:23:39 +08:00
|
|
|
{
|
2020-12-01 20:11:39 +08:00
|
|
|
interface: 'boolean',
|
2020-11-11 15:23:39 +08:00
|
|
|
type: 'boolean',
|
|
|
|
name: 'default',
|
|
|
|
title: '默认视图',
|
|
|
|
defaultValue: false,
|
2020-12-01 20:11:39 +08:00
|
|
|
component: {
|
|
|
|
type: 'checkbox',
|
|
|
|
showInTable: true,
|
|
|
|
showInDetail: true,
|
|
|
|
showInForm: true,
|
|
|
|
},
|
2020-11-11 15:23:39 +08:00
|
|
|
},
|
|
|
|
{
|
2020-12-01 20:11:39 +08:00
|
|
|
interface: 'boolean',
|
|
|
|
type: 'boolean',
|
|
|
|
name: 'showInDataMenu',
|
|
|
|
title: '作为数据表子菜单',
|
|
|
|
defaultValue: false,
|
|
|
|
component: {
|
|
|
|
type: 'checkbox',
|
|
|
|
showInTable: true,
|
|
|
|
showInDetail: true,
|
|
|
|
showInForm: 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: 'linkTo',
|
2020-11-11 15:23:39 +08:00
|
|
|
type: 'belongsTo',
|
|
|
|
name: 'collection',
|
2020-12-01 20:11:39 +08:00
|
|
|
title: '所属数据表',
|
2020-11-11 15:23:39 +08:00
|
|
|
target: 'collections',
|
|
|
|
targetKey: 'name',
|
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: 'json',
|
|
|
|
type: 'json',
|
|
|
|
name: 'options',
|
|
|
|
title: '配置信息',
|
|
|
|
defaultValue: {},
|
|
|
|
component: {
|
|
|
|
type: 'hidden',
|
|
|
|
},
|
2020-11-11 15:23:39 +08:00
|
|
|
},
|
2020-12-01 20:11:39 +08:00
|
|
|
// 以下暂不考虑
|
|
|
|
// {
|
|
|
|
// type: 'belongsToMany',
|
|
|
|
// name: 'fields',
|
|
|
|
// component: {
|
|
|
|
// type: 'drawerSelect',
|
|
|
|
// },
|
|
|
|
// },
|
|
|
|
// {
|
|
|
|
// type: 'belongsToMany',
|
|
|
|
// name: 'actions',
|
|
|
|
// 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',
|
|
|
|
default: true,
|
|
|
|
actionNames: ['create', 'destroy'],
|
|
|
|
detailsViewName: 'details',
|
|
|
|
updateViewName: 'form',
|
2020-11-21 23:49:59 +08:00
|
|
|
paginated: false,
|
2020-12-13 00:09:25 +08:00
|
|
|
draggable: true,
|
2020-11-11 15:23:39 +08:00
|
|
|
},
|
|
|
|
],
|
|
|
|
} as TableOptions;
|