fix: defaultTab
This commit is contained in:
parent
8ec40d32e2
commit
4ed21682ac
@ -1,5 +1,6 @@
|
||||
import { Model, ModelCtor, BELONGSTOMANY } from '@nocobase/database';
|
||||
import { get, set, isString } from 'lodash';
|
||||
import { Op } from 'sequelize';
|
||||
|
||||
const transforms = {
|
||||
table: async (fields: Model[], context?: any) => {
|
||||
@ -294,10 +295,14 @@ export default async (ctx, next) => {
|
||||
}
|
||||
const defaultTabs = await collection.getTabs({
|
||||
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') {
|
||||
view.setDataValue('rowViewName', 'form');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user