This commit is contained in:
chenos 2021-01-26 17:12:31 +08:00
parent 25d9ae8fcc
commit 11f5050fd5

View File

@ -15,7 +15,7 @@ configResponsive({
middle: 800, middle: 800,
large: 1200, large: 1200,
}); });
function toGroups(fields: any[]) { function toGroups(fields: any[], { displayFields = [] }) {
const groups = []; const groups = [];
let group = { let group = {
title: undefined, title: undefined,
@ -23,6 +23,9 @@ function toGroups(fields: any[]) {
children: [], children: [],
}; };
fields.forEach(field => { fields.forEach(field => {
if (Array.isArray(displayFields) && displayFields.length && displayFields.indexOf(field.id) === -1) {
return null;
}
if (field.interface === 'description' && group.children.length) { if (field.interface === 'description' && group.children.length) {
groups.push(group); groups.push(group);
group = { group = {
@ -72,7 +75,7 @@ export function Details(props: any) {
} }
} }
const { displayFields = [] } = activeTab; const { displayFields = [] } = activeTab;
const groups = toGroups(fields); const groups = toGroups(fields, { displayFields });
console.log({groups}); console.log({groups});
return ( return (
<Card bordered={false}> <Card bordered={false}>