diff --git a/packages/app/src/api/collections/authors.ts b/packages/app/src/api/collections/authors.ts new file mode 100644 index 0000000000..a254861020 --- /dev/null +++ b/packages/app/src/api/collections/authors.ts @@ -0,0 +1,90 @@ +import { TableOptions } from '@nocobase/database'; + +export default { + title: '作者', + showInDataMenu: true, + name: 'authors', + // createdBy: true, + // updatedBy: true, + fields: [ + { + interface: 'string', + title: '姓名', + name: 'name', + component: { + showInTable: true, + showInDetail: true, + showInForm: true, + }, + }, + { + interface: 'radio', + title: '性别', + dataSource: [ + {value: 'male', label: '男性'}, + {value: 'female', label: '女性'}, + ], + component: { + showInTable: true, + showInDetail: true, + showInForm: true, + }, + }, + { + interface: 'number', + title: '年龄', + component: { + showInTable: true, + showInDetail: true, + showInForm: true, + }, + }, + { + interface: 'linkTo', + title: '书籍', + target: 'books', + labelField: 'name', + component: { + showInTable: true, + showInDetail: true, + showInForm: true, + }, + }, + { + interface: 'createdBy', + title: '创建人', + component: { + showInTable: true, + showInDetail: true, + // showInForm: true, + }, + }, + { + interface: 'updatedBy', + title: '更新人', + component: { + showInTable: true, + showInDetail: true, + // showInForm: true, + }, + }, + { + interface: 'createdAt', + title: '创建日期', + component: { + showInTable: true, + showInDetail: true, + // showInForm: true, + }, + }, + { + interface: 'updatedAt', + title: '更新日期', + component: { + showInTable: true, + showInDetail: true, + // showInForm: true, + }, + } + ], +}; diff --git a/packages/app/src/api/collections/books.ts b/packages/app/src/api/collections/books.ts new file mode 100644 index 0000000000..6f786146c7 --- /dev/null +++ b/packages/app/src/api/collections/books.ts @@ -0,0 +1,68 @@ +import { TableOptions } from '@nocobase/database'; + +export default { + title: '书籍', + showInDataMenu: true, + name: 'books', + // createdBy: true, + // updatedBy: true, + fields: [ + { + interface: 'string', + title: '书籍名称', + name: 'name', + component: { + showInTable: true, + showInDetail: true, + showInForm: true, + }, + }, + { + interface: 'linkTo', + title: '作者', + target: 'authors', + labelField: 'name', + component: { + showInTable: true, + showInDetail: true, + showInForm: true, + }, + }, + { + interface: 'createdBy', + title: '创建人', + component: { + showInTable: true, + showInDetail: true, + // showInForm: true, + }, + }, + { + interface: 'updatedBy', + title: '更新人', + component: { + showInTable: true, + showInDetail: true, + // showInForm: true, + }, + }, + { + interface: 'createdAt', + title: '创建日期', + component: { + showInTable: true, + showInDetail: true, + // showInForm: true, + }, + }, + { + interface: 'updatedAt', + title: '更新日期', + component: { + showInTable: true, + showInDetail: true, + // showInForm: true, + }, + } + ], +}; diff --git a/packages/app/src/api/migrate.ts b/packages/app/src/api/migrate.ts index 85fb1f798d..0a6be4e3b6 100644 --- a/packages/app/src/api/migrate.ts +++ b/packages/app/src/api/migrate.ts @@ -196,5 +196,7 @@ api.registerPlugin('plugin-file-manager', [path.resolve(__dirname, '../../../plu default: true }); await database.getModel('collections').import(require('./collections/example').default); + await database.getModel('collections').import(require('./collections/authors').default); + await database.getModel('collections').import(require('./collections/books').default); await database.close(); })(); diff --git a/packages/plugin-collections/src/collections/tabs.ts b/packages/plugin-collections/src/collections/tabs.ts index 29dbd23e90..510a5f0ad6 100644 --- a/packages/plugin-collections/src/collections/tabs.ts +++ b/packages/plugin-collections/src/collections/tabs.ts @@ -178,7 +178,7 @@ export default { interface: 'boolean', type: 'boolean', name: 'default', - title: '默认标签页', + title: '作为默认标签页', defaultValue: false, component: { type: 'checkbox', diff --git a/packages/plugin-collections/src/collections/views.ts b/packages/plugin-collections/src/collections/views.ts index 4d42c901c3..2eef9d3c8d 100644 --- a/packages/plugin-collections/src/collections/views.ts +++ b/packages/plugin-collections/src/collections/views.ts @@ -141,7 +141,7 @@ export default { interface: 'boolean', type: 'boolean', name: 'default', - title: '默认视图', + title: '作为默认试图', defaultValue: false, component: { type: 'checkbox',