fix: use simple table for the association tab view

This commit is contained in:
chenos 2020-12-28 11:11:49 +08:00
parent cf47b9f282
commit 94c386e7aa
3 changed files with 7 additions and 2 deletions

View File

@ -29,6 +29,7 @@ export function CollectionTabPane(props) {
<ViewFactory
{...props}
viewName={viewName}
isAssociationView={true}
{...params}
/>
</div>

View File

@ -49,6 +49,7 @@ export default function ViewFactory(props: ViewProps) {
viewName,
mode,
reference,
isAssociationView = false,
} = props;
console.log('propspropspropspropspropspropsprops', props);
const { data = {}, loading } = useRequest(() => {
@ -67,7 +68,10 @@ export default function ViewFactory(props: ViewProps) {
if (loading) {
return <Spin/>;
}
const { template } = data;
let { template } = data;
if (isAssociationView && template === 'Table') {
template = 'SimpleTable';
}
const Template = getViewTemplate(template);
return Template && <Template {...props} ref={reference} schema={data}/>;
}

View File

@ -185,7 +185,7 @@ export default async (ctx, next) => {
view.setDataValue('defaultTabName', get(defaultTabs, [0, 'name']));
}
if (view.get('template') === 'SimpleTable') {
if (view.get('type') === 'table') {
view.setDataValue('rowViewName', 'form');
}
if (view.get('updateViewName')) {