fix: defaultTab
This commit is contained in:
parent
8ec40d32e2
commit
4ed21682ac
@ -1,5 +1,6 @@
|
|||||||
import { Model, ModelCtor, BELONGSTOMANY } from '@nocobase/database';
|
import { Model, ModelCtor, BELONGSTOMANY } from '@nocobase/database';
|
||||||
import { get, set, isString } from 'lodash';
|
import { get, set, isString } from 'lodash';
|
||||||
|
import { Op } from 'sequelize';
|
||||||
|
|
||||||
const transforms = {
|
const transforms = {
|
||||||
table: async (fields: Model[], context?: any) => {
|
table: async (fields: Model[], context?: any) => {
|
||||||
@ -294,10 +295,14 @@ export default async (ctx, next) => {
|
|||||||
}
|
}
|
||||||
const defaultTabs = await collection.getTabs({
|
const defaultTabs = await collection.getTabs({
|
||||||
where: {
|
where: {
|
||||||
default: true,
|
id : {[Op.in]: permissions.tabs},
|
||||||
},
|
},
|
||||||
|
order: [['sort', 'asc']],
|
||||||
});
|
});
|
||||||
view.setDataValue('defaultTabName', get(defaultTabs, [0, 'name']));
|
|
||||||
|
const defaultTab = defaultTabs.find(tab => tab.default) || get(defaultTabs, [0]);
|
||||||
|
|
||||||
|
view.setDataValue('defaultTabName', get(defaultTab, ['name']));
|
||||||
if (view.get('type') === 'table') {
|
if (view.get('type') === 'table') {
|
||||||
view.setDataValue('rowViewName', 'form');
|
view.setDataValue('rowViewName', 'form');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user