diff --git a/packages/client/src/components/admin-layout/Permissions/index.tsx b/packages/client/src/components/admin-layout/Permissions/index.tsx
index 8c9c2ea8b..2b3740ea0 100644
--- a/packages/client/src/components/admin-layout/Permissions/index.tsx
+++ b/packages/client/src/components/admin-layout/Permissions/index.tsx
@@ -92,14 +92,13 @@ const useActionPermissionResource = ({ onSuccess }) => {
console.log('actionPermissions', data);
onSuccess({
actionPermissions: data.map((permission) => {
- const item: any = {}
- Object.keys(permission).forEach(key => {
+ const item: any = {};
+ Object.keys(permission).forEach((key) => {
if (isValid(permission[key])) {
item[key] = permission[key];
}
});
- item.fields =
- permission?.fields.map((field) => field.key) || [];
+ item.fields = permission?.fields.map((field) => field.key) || [];
return item;
}),
});
@@ -162,63 +161,6 @@ const collectionSchema: ISchema = {
collectionName: 'collections',
},
properties: {
- [uid()]: {
- type: 'void',
- title: '操作',
- 'x-component': 'Table.Operation',
- 'x-component-props': {
- className: 'nb-table-operation',
- },
- properties: {
- [uid()]: {
- type: 'void',
- 'x-component': 'Action',
- 'x-component-props': {
- icon: 'EllipsisOutlined',
- },
- properties: {
- [uid()]: {
- type: 'void',
- 'x-component': 'Action.Dropdown',
- 'x-component-props': {},
- properties: {
- [uid()]: {
- type: 'void',
- title: '配置',
- 'x-component': 'Menu.Action',
- 'x-component-props': {
- style: {
- minWidth: 150,
- },
- },
- 'x-action-type': 'view',
- properties: {
- [uid()]: {
- type: 'void',
- title: '数据表操作权限',
- 'x-component': 'Action.Drawer',
- 'x-decorator': 'Form',
- 'x-decorator-props': {
- useResource: useActionPermissionResource,
- },
- 'x-component-props': {
- useOkAction: useActionPermissionSubmit,
- },
- properties: {
- actionPermissions: {
- type: 'array',
- 'x-component': 'ActionPermissionField',
- },
- },
- },
- },
- },
- },
- },
- },
- },
- },
- },
column1: {
type: 'void',
title: '数据表名称',
@@ -243,6 +185,54 @@ const collectionSchema: ISchema = {
},
},
},
+ column3: {
+ type: 'void',
+ title: '操作',
+ 'x-component': 'Table.Column',
+ 'x-component-props': {
+ width: 60,
+ },
+ properties: {
+ [uid()]: {
+ type: 'void',
+ 'x-component': 'Action.Group',
+ 'x-component-props': {
+ type: 'link',
+ },
+ properties: {
+ [uid()]: {
+ type: 'void',
+ title: '配置',
+ 'x-component': 'Action',
+ 'x-component-props': {
+ type: 'link',
+ },
+ 'x-action-type': 'view',
+ properties: {
+ [uid()]: {
+ type: 'void',
+ title: '数据表操作权限',
+ 'x-component': 'Action.Drawer',
+ 'x-decorator': 'Form',
+ 'x-decorator-props': {
+ useResource: useActionPermissionResource,
+ },
+ 'x-component-props': {
+ useOkAction: useActionPermissionSubmit,
+ },
+ properties: {
+ actionPermissions: {
+ type: 'array',
+ 'x-component': 'ActionPermissionField',
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ },
},
};
@@ -342,121 +332,6 @@ const schema: ISchema = {
},
},
},
- [uid()]: {
- type: 'void',
- title: '操作',
- 'x-component': 'Table.Operation',
- 'x-component-props': {
- className: 'nb-table-operation',
- },
- properties: {
- [uid()]: {
- type: 'void',
- 'x-component': 'Action',
- 'x-component-props': {
- icon: 'EllipsisOutlined',
- },
- properties: {
- [uid()]: {
- type: 'void',
- 'x-component': 'Action.Dropdown',
- 'x-component-props': {},
- properties: {
- [uid()]: {
- type: 'void',
- title: '配置',
- 'x-component': 'Menu.Action',
- 'x-component-props': {
- style: {
- minWidth: 150,
- },
- },
- 'x-action-type': 'view',
- properties: {
- [uid()]: {
- type: 'void',
- title: '权限配置',
- 'x-decorator': 'RoleProvider',
- 'x-component': 'Action.Drawer',
- 'x-component-props': {
- bodyStyle: {
- background: '#f0f2f5',
- paddingTop: 0,
- },
- },
- properties: {
- [uid()]: {
- type: 'void',
- 'x-component': 'Tabs',
- properties: {
- [uid()]: {
- type: 'void',
- title: '数据表操作权限',
- 'x-component': 'Tabs.TabPane',
- 'x-component-props': {},
- properties: {
- collectionSchema,
- },
- },
- [uid()]: {
- type: 'void',
- title: '菜单访问权限',
- 'x-component': 'Tabs.TabPane',
- 'x-component-props': {},
- properties: {
- menuSchema,
- },
- },
- },
- },
- },
- },
- },
- },
- [uid()]: {
- type: 'void',
- title: '编辑',
- 'x-component': 'Menu.Action',
- 'x-action-type': 'update',
- properties: {
- [uid()]: {
- type: 'void',
- title: '编辑数据',
- 'x-decorator': 'Form',
- 'x-decorator-props': {
- useResource: useDetailsResource,
- },
- 'x-component': 'Action.Drawer',
- 'x-component-props': {
- useOkAction: '{{ Table.useTableUpdateAction }}',
- },
- properties: {
- title: {
- type: 'string',
- title: '权限名称',
- 'x-component': 'Input',
- 'x-decorator': 'FormilyFormItem',
- },
- },
- },
- },
- },
- [uid()]: {
- type: 'void',
- title: '删除',
- 'x-component': 'Menu.Action',
- 'x-designable-bar': 'Table.Action.DesignableBar',
- 'x-action-type': 'destroy',
- 'x-component-props': {
- useAction: '{{ Table.useTableDestroyAction }}',
- },
- },
- },
- },
- },
- },
- },
- },
column1: {
type: 'void',
title: '权限名称',
@@ -481,6 +356,116 @@ const schema: ISchema = {
},
},
},
+ [uid()]: {
+ type: 'void',
+ title: '操作',
+ 'x-component': 'Table.Column',
+ 'x-component-props': {
+ width: 160,
+ },
+ properties: {
+ [uid()]: {
+ type: 'void',
+ 'x-component': 'Action.Group',
+ 'x-component-props': {
+ type: 'link',
+ },
+ properties: {
+ [uid()]: {
+ type: 'void',
+ title: '配置',
+ 'x-component': 'Action',
+ 'x-component-props': {
+ type: 'link',
+ },
+ 'x-action-type': 'view',
+ properties: {
+ [uid()]: {
+ type: 'void',
+ title: '权限配置',
+ 'x-decorator': 'RoleProvider',
+ 'x-component': 'Action.Drawer',
+ 'x-component-props': {
+ bodyStyle: {
+ background: '#f0f2f5',
+ paddingTop: 0,
+ },
+ },
+ properties: {
+ [uid()]: {
+ type: 'void',
+ 'x-component': 'Tabs',
+ properties: {
+ [uid()]: {
+ type: 'void',
+ title: '数据表操作权限',
+ 'x-component': 'Tabs.TabPane',
+ 'x-component-props': {},
+ properties: {
+ collectionSchema,
+ },
+ },
+ [uid()]: {
+ type: 'void',
+ title: '菜单访问权限',
+ 'x-component': 'Tabs.TabPane',
+ 'x-component-props': {},
+ properties: {
+ menuSchema,
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ [uid()]: {
+ type: 'void',
+ title: '编辑',
+ 'x-component': 'Action',
+ 'x-component-props': {
+ type: 'link',
+ },
+ 'x-action-type': 'update',
+ properties: {
+ [uid()]: {
+ type: 'void',
+ title: '编辑数据',
+ 'x-decorator': 'Form',
+ 'x-decorator-props': {
+ useResource: useDetailsResource,
+ },
+ 'x-component': 'Action.Drawer',
+ 'x-component-props': {
+ useOkAction: '{{ Table.useTableUpdateAction }}',
+ },
+ properties: {
+ title: {
+ type: 'string',
+ title: '权限名称',
+ 'x-component': 'Input',
+ 'x-decorator': 'FormilyFormItem',
+ },
+ },
+ },
+ },
+ },
+ [uid()]: {
+ type: 'void',
+ title: '删除',
+ 'x-component': 'Action',
+ 'x-designable-bar': 'Table.Action.DesignableBar',
+ 'x-action-type': 'destroy',
+ 'x-component-props': {
+ type: 'link',
+ useAction: '{{ Table.useTableDestroyAction }}',
+ },
+ },
+ },
+ },
+ },
+ },
},
},
},
diff --git a/packages/client/src/schemas/add-new/index.tsx b/packages/client/src/schemas/add-new/index.tsx
index e6f7b85bd..dad87cac8 100644
--- a/packages/client/src/schemas/add-new/index.tsx
+++ b/packages/client/src/schemas/add-new/index.tsx
@@ -196,7 +196,7 @@ function generateCardItemSchema(component) {
type: 'void',
title: '新增数据',
'x-decorator': 'Form',
- 'x-component': 'Action.Modal',
+ 'x-component': 'Action.Drawer',
'x-component-props': {
useOkAction: '{{ Table.useTableCreateAction }}',
},
@@ -217,79 +217,56 @@ function generateCardItemSchema(component) {
[uid()]: {
type: 'void',
title: '操作',
- 'x-component': 'Table.Operation',
- 'x-component-props': {
- className: 'nb-table-operation',
- },
+ 'x-component': 'Table.Column',
+ 'x-component-props': {},
'x-designable-bar': 'Table.Operation.DesignableBar',
properties: {
[uid()]: {
type: 'void',
- 'x-component': 'Action',
+ 'x-component': 'Action.Group',
'x-component-props': {
- icon: 'EllipsisOutlined',
+ type: 'link',
},
properties: {
[uid()]: {
type: 'void',
- 'x-component': 'Action.Dropdown',
- 'x-component-props': {},
+ name: 'action1',
+ title: '查看',
+ 'x-component': 'Action',
+ 'x-component-props': {
+ type: 'link',
+ },
+ 'x-designable-bar': 'Table.Action.DesignableBar',
+ 'x-action-type': 'view',
properties: {
- // [uid()]: {
- // type: 'void',
- // title: '操作 1',
- // 'x-component': 'Menu.Action',
- // 'x-component-props': {
- // style: {
- // minWidth: 150,
- // },
- // disabled: true,
- // },
- // },
[uid()]: {
type: 'void',
- name: 'action1',
- title: '查看',
- 'x-component': 'Menu.Action',
+ title: '查看数据',
+ 'x-component': 'Action.Drawer',
'x-component-props': {
- style: {
- minWidth: 150,
+ bodyStyle: {
+ background: '#f0f2f5',
+ // paddingTop: 0,
},
},
- 'x-designable-bar': 'Table.Action.DesignableBar',
- 'x-action-type': 'view',
properties: {
[uid()]: {
type: 'void',
- title: '查看',
- 'x-component': 'Action.Modal',
- 'x-component-props': {
- bodyStyle: {
- background: '#f0f2f5',
- // paddingTop: 0,
- },
- },
+ 'x-component': 'Tabs',
+ 'x-designable-bar': 'Tabs.DesignableBar',
properties: {
[uid()]: {
type: 'void',
- 'x-component': 'Tabs',
- 'x-designable-bar': 'Tabs.DesignableBar',
+ title: '详情',
+ 'x-designable-bar': 'Tabs.TabPane.DesignableBar',
+ 'x-component': 'Tabs.TabPane',
+ 'x-component-props': {},
properties: {
[uid()]: {
type: 'void',
- title: '详情',
- 'x-designable-bar':
- 'Tabs.TabPane.DesignableBar',
- 'x-component': 'Tabs.TabPane',
- 'x-component-props': {},
- properties: {
- [uid()]: {
- type: 'void',
- 'x-component': 'Grid',
- 'x-component-props': {
- addNewComponent: 'AddNew.PaneItem',
- },
- },
+ 'x-component': 'Grid',
+ 'x-component-props': {
+ addNewComponent: 'AddNew.PaneItem',
},
},
},
@@ -298,47 +275,51 @@ function generateCardItemSchema(component) {
},
},
},
+ },
+ },
+ [uid()]: {
+ type: 'void',
+ title: '编辑',
+ 'x-component': 'Action',
+ 'x-component-props': {
+ type: 'link',
+ },
+ 'x-designable-bar': 'Table.Action.DesignableBar',
+ 'x-action-type': 'update',
+ properties: {
[uid()]: {
type: 'void',
- title: '编辑',
- 'x-component': 'Menu.Action',
- 'x-designable-bar': 'Table.Action.DesignableBar',
- 'x-action-type': 'update',
+ title: '编辑数据',
+ 'x-decorator': 'Form',
+ 'x-decorator-props': {
+ useResource: '{{ Table.useResource }}',
+ useValues: '{{ Table.useTableRowRecord }}',
+ },
+ 'x-component': 'Action.Drawer',
+ 'x-component-props': {
+ useOkAction: '{{ Table.useTableUpdateAction }}',
+ },
properties: {
[uid()]: {
type: 'void',
- title: '编辑数据',
- 'x-decorator': 'Form',
- 'x-decorator-props': {
- useResource: '{{ Table.useResource }}',
- useValues: '{{ Table.useTableRowRecord }}',
- },
- 'x-component': 'Action.Modal',
+ 'x-component': 'Grid',
'x-component-props': {
- useOkAction: '{{ Table.useTableUpdateAction }}',
- },
- properties: {
- [uid()]: {
- type: 'void',
- 'x-component': 'Grid',
- 'x-component-props': {
- addNewComponent: 'AddNew.FormItem',
- },
- },
+ addNewComponent: 'AddNew.FormItem',
},
},
},
},
- [uid()]: {
- type: 'void',
- title: '删除',
- 'x-component': 'Menu.Action',
- 'x-designable-bar': 'Table.Action.DesignableBar',
- 'x-action-type': 'destroy',
- 'x-component-props': {
- useAction: '{{ Table.useTableDestroyAction }}',
- },
- },
+ },
+ },
+ [uid()]: {
+ type: 'void',
+ title: '删除',
+ 'x-component': 'Action',
+ 'x-designable-bar': 'Table.Action.DesignableBar',
+ 'x-action-type': 'destroy',
+ 'x-component-props': {
+ type: 'link',
+ useAction: '{{ Table.useTableDestroyAction }}',
},
},
},
@@ -471,179 +452,6 @@ function generateCardItemSchema(component) {
},
},
},
- [uid()]: {
- type: 'void',
- title: '操作',
- 'x-component': 'Table.Operation',
- 'x-component-props': {
- className: 'nb-table-operation',
- },
- properties: {
- [uid()]: {
- type: 'void',
- 'x-component': 'Action',
- 'x-component-props': {
- icon: 'EllipsisOutlined',
- },
- properties: {
- [uid()]: {
- type: 'void',
- 'x-component': 'Action.Dropdown',
- 'x-component-props': {},
- properties: {
- [uid()]: {
- type: 'void',
- name: 'action1',
- title: '查看',
- 'x-component': 'Menu.Action',
- 'x-component-props': {
- style: {
- minWidth: 150,
- },
- },
- 'x-action-type': 'view',
- properties: {
- [uid()]: {
- type: 'void',
- title: '查看数据',
- 'x-read-pretty': true,
- 'x-decorator': 'Form',
- 'x-decorator-props': {
- useResource:
- '{{ Table.useActionLogDetailsResource }}',
- },
- 'x-component': 'Action.Drawer',
- 'x-component-props': {
- // bodyStyle: {
- // background: '#f0f2f5',
- // // paddingTop: 0,
- // },
- },
- properties: {
- created_at: {
- type: 'string',
- title: '操作时间',
- 'x-decorator': 'FormItem',
- 'x-component': 'DatePicker',
- 'x-read-pretty': true,
- 'x-component-props': {
- format: 'YYYY-MM-DD HH:mm:ss',
- },
- },
- 'user.nickname': {
- type: 'string',
- title: '操作用户',
- 'x-decorator': 'FormItem',
- 'x-component': 'Input',
- 'x-read-pretty': true,
- },
- 'collection.title': {
- type: 'string',
- title: '所属数据表',
- 'x-decorator': 'FormItem',
- 'x-component': 'Input',
- 'x-read-pretty': true,
- },
- type: {
- type: 'string',
- title: '操作类型',
- 'x-decorator': 'FormItem',
- 'x-component': 'Select',
- 'x-read-pretty': true,
- enum: [
- {
- label: '新增',
- value: 'create',
- color: 'green',
- },
- {
- label: '更新',
- value: 'update',
- color: 'blue',
- },
- {
- label: '删除',
- value: 'destroy',
- color: 'red',
- },
- ],
- },
- changes: {
- type: 'array',
- title: '数据变动',
- 'x-decorator': 'FormItem',
- 'x-component': 'ArrayTable',
- 'x-component-props': {
- pagination: false,
- // scroll: { x: '100%' },
- },
- // 'x-reactions': ['{{ filterActionLogs }}'],
- items: {
- type: 'object',
- properties: {
- column0: {
- type: 'void',
- 'x-component': 'ArrayTable.Column',
- 'x-component-props': {
- width: 80,
- align: 'center',
- },
- properties: {
- index: {
- type: 'void',
- 'x-component': 'ArrayTable.Index',
- },
- },
- },
- column1: {
- type: 'void',
- 'x-component': 'ArrayTable.Column',
- 'x-component-props': { title: '字段名称' },
- properties: {
- field: {
- type: 'string',
- 'x-decorator': 'FormilyFormItem',
- 'x-component': 'ActionLogs.Field',
- },
- },
- },
- column3: {
- type: 'void',
- 'x-component': 'ArrayTable.Column',
- 'x-component-props': { title: '操作前' },
- properties: {
- before: {
- type: 'string',
- 'x-decorator': 'FormilyFormItem',
- 'x-component': 'ActionLogs.FieldValue',
- },
- },
- },
- column4: {
- type: 'void',
- 'x-component': 'ArrayTable.Column',
- 'x-component-props': { title: '操作后' },
- properties: {
- after: {
- type: 'string',
- 'x-decorator': 'FormilyFormItem',
- 'x-component': 'ActionLogs.FieldValue',
- },
- },
- },
- },
- },
- },
- },
- },
- },
- },
- },
- },
- },
- },
- },
- },
column1: {
type: 'void',
title: '操作时间',
@@ -700,6 +508,165 @@ function generateCardItemSchema(component) {
},
},
},
+ [uid()]: {
+ type: 'void',
+ title: '操作',
+ 'x-component': 'Table.Column',
+ 'x-component-props': {
+ width: 60,
+ align: 'center',
+ },
+ properties: {
+ [uid()]: {
+ type: 'void',
+ name: 'action1',
+ title: '查看',
+ 'x-component': 'Action',
+ 'x-component-props': {
+ type: 'link',
+ style: {
+ padding: '0',
+ height: 'auto',
+ },
+ },
+ 'x-action-type': 'view',
+ properties: {
+ [uid()]: {
+ type: 'void',
+ title: '查看数据',
+ 'x-read-pretty': true,
+ 'x-decorator': 'Form',
+ 'x-decorator-props': {
+ useResource: '{{ Table.useActionLogDetailsResource }}',
+ },
+ 'x-component': 'Action.Drawer',
+ 'x-component-props': {
+ // bodyStyle: {
+ // background: '#f0f2f5',
+ // // paddingTop: 0,
+ // },
+ },
+ properties: {
+ created_at: {
+ type: 'string',
+ title: '操作时间',
+ 'x-decorator': 'FormItem',
+ 'x-component': 'DatePicker',
+ 'x-read-pretty': true,
+ 'x-component-props': {
+ format: 'YYYY-MM-DD HH:mm:ss',
+ },
+ },
+ 'user.nickname': {
+ type: 'string',
+ title: '操作用户',
+ 'x-decorator': 'FormItem',
+ 'x-component': 'Input',
+ 'x-read-pretty': true,
+ },
+ 'collection.title': {
+ type: 'string',
+ title: '所属数据表',
+ 'x-decorator': 'FormItem',
+ 'x-component': 'Input',
+ 'x-read-pretty': true,
+ },
+ type: {
+ type: 'string',
+ title: '操作类型',
+ 'x-decorator': 'FormItem',
+ 'x-component': 'Select',
+ 'x-read-pretty': true,
+ enum: [
+ {
+ label: '新增',
+ value: 'create',
+ color: 'green',
+ },
+ {
+ label: '更新',
+ value: 'update',
+ color: 'blue',
+ },
+ {
+ label: '删除',
+ value: 'destroy',
+ color: 'red',
+ },
+ ],
+ },
+ changes: {
+ type: 'array',
+ title: '数据变动',
+ 'x-decorator': 'FormItem',
+ 'x-component': 'ArrayTable',
+ 'x-component-props': {
+ pagination: false,
+ // scroll: { x: '100%' },
+ },
+ // 'x-reactions': ['{{ filterActionLogs }}'],
+ items: {
+ type: 'object',
+ properties: {
+ column0: {
+ type: 'void',
+ 'x-component': 'ArrayTable.Column',
+ 'x-component-props': {
+ width: 80,
+ align: 'center',
+ },
+ properties: {
+ index: {
+ type: 'void',
+ 'x-component': 'ArrayTable.Index',
+ },
+ },
+ },
+ column1: {
+ type: 'void',
+ 'x-component': 'ArrayTable.Column',
+ 'x-component-props': { title: '字段名称' },
+ properties: {
+ field: {
+ type: 'string',
+ 'x-decorator': 'FormilyFormItem',
+ 'x-component': 'ActionLogs.Field',
+ },
+ },
+ },
+ column3: {
+ type: 'void',
+ 'x-component': 'ArrayTable.Column',
+ 'x-component-props': { title: '操作前' },
+ properties: {
+ before: {
+ type: 'string',
+ 'x-decorator': 'FormilyFormItem',
+ 'x-component': 'ActionLogs.FieldValue',
+ },
+ },
+ },
+ column4: {
+ type: 'void',
+ 'x-component': 'ArrayTable.Column',
+ 'x-component-props': { title: '操作后' },
+ properties: {
+ after: {
+ type: 'string',
+ 'x-decorator': 'FormilyFormItem',
+ 'x-component': 'ActionLogs.FieldValue',
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ },
+ },
},
},
};
@@ -935,7 +902,11 @@ AddNew.CardItem = observer((props: any) => {
{ghost ? (