diff --git a/packages/plugin-pages/src/actions/getView.ts b/packages/plugin-pages/src/actions/getView.ts index 238ce4d1a6..7a70fb8d24 100644 --- a/packages/plugin-pages/src/actions/getView.ts +++ b/packages/plugin-pages/src/actions/getView.ts @@ -69,7 +69,7 @@ const transforms = { prop.type = 'string' } if (field.get('component.tooltip')) { - prop.description = `{{html('${encodeURIComponent(field.get('component.tooltip'))}')}}`; + // prop.description = `{{html('${encodeURIComponent(field.get('component.tooltip'))}')}}`; } if (field.get('name') === 'dataSource') { @@ -190,6 +190,11 @@ const transforms = { export default async (ctx, next) => { const { resourceName, resourceKey, values = {} } = ctx.action.params; const [View, Collection, Field, Action] = ctx.db.getModels(['views', 'collections', 'fields', 'actions']) as ModelCtor[]; + const collection = await Collection.findOne({ + where: { + name: resourceName, + }, + }); let view = await View.findOne(View.parseApiJson({ filter: { collection_name: resourceName, @@ -201,7 +206,10 @@ export default async (ctx, next) => { })); let throughName; const { resourceKey: resourceKey2, associatedName, resourceFieldName, associatedKey } = values; - const permissions = await ctx.ac.can(resourceName).permissions(); + // TODO: 暂时不处理 developerMode 和 internal 的情况 + const permissions = (ctx.ac.isRoot() || collection.developerMode || collection.internal) + ? await ctx.ac.getRootPermissions() + : await ctx.ac.can(resourceName).permissions(); ctx.listFields = []; ctx.createFields = []; ctx.updateFields = []; @@ -239,11 +247,7 @@ export default async (ctx, next) => { // 如果不存在 view,新建一个 view = new View({type: resourceKey, template: 'FilterForm'}); } - const collection = await Collection.findOne({ - where: { - name: resourceName, - }, - }); + // const where: any = { // developerMode: ctx.state.developerMode, // }