2020-11-11 15:23:39 +08:00
|
|
|
import { TableOptions } from '@nocobase/database';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'tabs',
|
|
|
|
title: '标签配置',
|
2020-12-11 10:31:00 +08:00
|
|
|
internal: true,
|
2020-12-01 20:11:39 +08:00
|
|
|
sortable: true,
|
|
|
|
model: 'TabModel',
|
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-12 16:36:02 +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-13 00:09:25 +08:00
|
|
|
required: true,
|
2020-12-01 20:11:39 +08:00
|
|
|
dataSource: [
|
|
|
|
{ label: '详情数据', value: 'details' },
|
2020-12-20 12:52:15 +08:00
|
|
|
{ label: '相关数据', value: 'association' },
|
2020-12-08 14:33:28 +08:00
|
|
|
{ label: '模块组合', value: 'module', disabled: true },
|
2020-12-01 20:11:39 +08:00
|
|
|
],
|
|
|
|
component: {
|
|
|
|
type: 'radio',
|
|
|
|
showInTable: true,
|
|
|
|
showInDetail: true,
|
|
|
|
showInForm: true,
|
2020-12-12 16:36:02 +08:00
|
|
|
"x-linkages": [
|
2020-12-25 16:15:58 +08:00
|
|
|
// {
|
|
|
|
// "type": "value:visible",
|
|
|
|
// "target": "association",
|
|
|
|
// "condition": "{{ $self.value === 'association' }}"
|
|
|
|
// },
|
2020-12-12 16:36:02 +08:00
|
|
|
{
|
2020-12-25 16:15:58 +08:00
|
|
|
type: "value:visible",
|
|
|
|
target: "associationField",
|
|
|
|
condition: "{{ $self.value === 'association' }}"
|
|
|
|
},
|
|
|
|
// {
|
|
|
|
// type: "value:schema",
|
|
|
|
// target: "association",
|
|
|
|
// condition: "{{ $self.value === 'association' }}",
|
|
|
|
// schema: {
|
|
|
|
// "x-component-props": {
|
|
|
|
// "associatedKey": "{{ $form.values && $form.values.associatedKey }}"
|
|
|
|
// },
|
|
|
|
// },
|
|
|
|
// },
|
|
|
|
{
|
|
|
|
type: "value:schema",
|
|
|
|
target: "associationField",
|
|
|
|
condition: "{{ $self.value === 'association' }}",
|
|
|
|
schema: {
|
|
|
|
"x-component-props": {
|
|
|
|
associatedKey: "{{ $form.values && $form.values.associatedKey }}"
|
|
|
|
},
|
|
|
|
},
|
2020-12-12 16:36:02 +08:00
|
|
|
},
|
|
|
|
],
|
2020-12-01 20:11:39 +08:00
|
|
|
},
|
|
|
|
},
|
2020-12-25 16:15:58 +08:00
|
|
|
// {
|
|
|
|
// interface: 'string',
|
|
|
|
// type: 'string',
|
|
|
|
// name: 'association',
|
|
|
|
// title: '相关数据',
|
|
|
|
// component: {
|
|
|
|
// type: 'remoteSelect',
|
|
|
|
// showInDetail: true,
|
|
|
|
// showInForm: true,
|
|
|
|
// 'x-component-props': {
|
|
|
|
// resourceName: 'collections.fields',
|
|
|
|
// labelField: 'title',
|
|
|
|
// valueField: 'name',
|
|
|
|
// filter: {
|
|
|
|
// interface: 'linkTo',
|
|
|
|
// },
|
|
|
|
// },
|
|
|
|
// },
|
|
|
|
// },
|
2020-12-01 20:11:39 +08:00
|
|
|
{
|
2020-12-25 16:15:58 +08:00
|
|
|
interface: 'linkTo',
|
|
|
|
type: 'belongsTo',
|
|
|
|
name: 'associationField',
|
|
|
|
target: 'fields',
|
2020-12-01 20:11:39 +08:00
|
|
|
title: '相关数据表',
|
2020-12-25 16:15:58 +08:00
|
|
|
labelField: 'title',
|
|
|
|
// valueField: 'name',
|
|
|
|
component: {
|
|
|
|
type: 'remoteSelect',
|
|
|
|
showInDetail: true,
|
|
|
|
showInForm: true,
|
|
|
|
'x-component-props': {
|
|
|
|
resourceName: 'collections.fields',
|
|
|
|
labelField: 'title',
|
|
|
|
// valueField: 'name',
|
|
|
|
objectValue: true,
|
|
|
|
filter: {
|
|
|
|
interface: 'linkTo',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"x-linkages": [
|
|
|
|
{
|
|
|
|
type: "value:visible",
|
|
|
|
target: "viewName",
|
|
|
|
condition: "{{ !!$self.value }}"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: "value:schema",
|
|
|
|
target: "viewName",
|
|
|
|
condition: "{{ !!$self.value }}",
|
|
|
|
schema: {
|
|
|
|
"x-component-props": {
|
|
|
|
associatedKey: "{{ $self.value.target }}"
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
interface: 'string',
|
|
|
|
type: 'string',
|
|
|
|
name: 'viewName',
|
|
|
|
title: '视图',
|
|
|
|
labelField: 'title',
|
|
|
|
// valueField: 'name',
|
2020-12-01 20:11:39 +08:00
|
|
|
component: {
|
2020-12-25 16:15:58 +08:00
|
|
|
type: 'remoteSelect',
|
2020-12-01 20:11:39 +08:00
|
|
|
showInDetail: true,
|
|
|
|
showInForm: true,
|
2020-12-25 16:15:58 +08:00
|
|
|
'x-component-props': {
|
|
|
|
resourceName: 'collections.views',
|
|
|
|
labelField: 'title',
|
|
|
|
valueField: 'name',
|
|
|
|
},
|
2020-12-01 20:11:39 +08:00
|
|
|
},
|
2020-11-11 15:23:39 +08:00
|
|
|
},
|
|
|
|
{
|
2020-12-01 20:11:39 +08:00
|
|
|
interface: 'boolean',
|
2020-12-28 23:13:17 +08:00
|
|
|
type: 'radio',
|
2020-11-11 15:23:39 +08:00
|
|
|
name: 'default',
|
2020-12-27 21:53:44 +08:00
|
|
|
title: '作为默认标签页',
|
2020-11-11 15:23:39 +08:00
|
|
|
defaultValue: false,
|
2020-12-28 23:13:17 +08:00
|
|
|
scope: ['collection'],
|
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: 'enabled',
|
2020-12-12 16:36:02 +08:00
|
|
|
title: '启用',
|
|
|
|
defaultValue: true,
|
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-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',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
interface: 'json',
|
|
|
|
type: 'json',
|
|
|
|
name: 'options',
|
|
|
|
title: '配置信息',
|
|
|
|
defaultValue: {},
|
|
|
|
component: {
|
|
|
|
type: 'hidden',
|
|
|
|
},
|
2020-11-11 15:23:39 +08:00
|
|
|
},
|
|
|
|
],
|
|
|
|
actions: [
|
|
|
|
{
|
|
|
|
type: 'list',
|
|
|
|
name: 'list',
|
|
|
|
title: '查看',
|
|
|
|
},
|
2020-12-30 00:00:39 +08:00
|
|
|
{
|
|
|
|
type: 'destroy',
|
|
|
|
name: 'destroy',
|
|
|
|
title: '删除',
|
|
|
|
},
|
2020-11-11 15:23:39 +08:00
|
|
|
{
|
|
|
|
type: 'create',
|
|
|
|
name: 'create',
|
2020-12-23 19:55:25 +08:00
|
|
|
title: '新增',
|
2020-11-11 15:23:39 +08:00
|
|
|
viewName: 'form',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
type: 'update',
|
|
|
|
name: 'update',
|
|
|
|
title: '编辑',
|
|
|
|
viewName: 'form',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
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,
|
2020-12-30 00:00:39 +08:00
|
|
|
actionNames: ['destroy', 'create'],
|
2020-11-11 15:23:39 +08:00
|
|
|
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;
|