fix: add sort field to the users table

* [Fixed]
1、初始化数据表时,没有配置sort
2、增加sort接口类型

* [Fixed]
1、重新提交PR

* [Fixed]
1、重新提交PR

* [Fixed]
1、重新提交PR

* [Fixed]
1、重新提交PR

* [Fixed]
1、重新提交PR
This commit is contained in:
semmywong 2021-10-30 10:55:43 +08:00 committed by GitHub
parent d68196ab20
commit 14f492f414
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 7 deletions

View File

@ -374,7 +374,7 @@ export const fieldsToFilterColumns = (fields: any[], options: any = {}) => {
return;
}
const fieldOption = interfaces.get(field.interface);
if (!fieldOption.operations) {
if (!fieldOption?.operations) {
return;
}
properties[`column${index}`] = {
@ -493,7 +493,7 @@ Calendar.Filter.DesignableBar = () => {
{fields
.filter((collectionField) => {
const option = interfaces.get(collectionField.interface);
return option.operations?.length;
return option?.operations?.length;
})
.map((collectionField) => (
<SwitchMenuItem

View File

@ -1409,7 +1409,7 @@ const fieldsToFilterColumns = (fields: any[], options: any = {}) => {
return;
}
const fieldOption = interfaces.get(field.interface);
if (!fieldOption.operations) {
if (!fieldOption?.operations) {
return;
}
properties[`column${index}`] = {
@ -1436,7 +1436,7 @@ const fieldsToSortColumns = (fields: any[]) => {
fields.forEach((field) => {
const fieldOption = interfaces.get(field.interface);
if (!fieldOption.sortable) {
if (!fieldOption?.sortable) {
return;
}
dataSource.push({
@ -1546,7 +1546,7 @@ Table.Filter.DesignableBar = () => {
{fields
.filter((collectionField) => {
const option = interfaces.get(collectionField.interface);
return option.operations?.length;
return option?.operations?.length;
})
.map((collectionField) => (
<SwitchMenuItem

View File

@ -32,9 +32,11 @@ export default {
}
const config = table.getOptions();
const collection = await Collection.create(config);
// 把当前系统排序字段排除掉不写入fields表
const fields = config.fields?.filter((field) => field.type !== 'sort');
await collection.updateAssociations({
generalFields: config.fields.filter((field) => field.state !== 0),
systemFields: config.fields.filter((field) => field.state === 0),
generalFields: fields.filter((field) => field.state !== 0),
systemFields: fields.filter((field) => field.state === 0),
});
// await collection.migrate();
}

View File

@ -3,6 +3,7 @@ import { TableOptions } from '@nocobase/database';
export default {
name: 'users',
title: '用户',
sortable: 'sort',
// developerMode: true,
// internal: true,
createdBy: false,