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 <ViewFactory
{...props} {...props}
viewName={viewName} viewName={viewName}
isAssociationView={true}
{...params} {...params}
/> />
</div> </div>

View File

@ -49,6 +49,7 @@ export default function ViewFactory(props: ViewProps) {
viewName, viewName,
mode, mode,
reference, reference,
isAssociationView = false,
} = props; } = props;
console.log('propspropspropspropspropspropsprops', props); console.log('propspropspropspropspropspropsprops', props);
const { data = {}, loading } = useRequest(() => { const { data = {}, loading } = useRequest(() => {
@ -67,7 +68,10 @@ export default function ViewFactory(props: ViewProps) {
if (loading) { if (loading) {
return <Spin/>; return <Spin/>;
} }
const { template } = data; let { template } = data;
if (isAssociationView && template === 'Table') {
template = 'SimpleTable';
}
const Template = getViewTemplate(template); const Template = getViewTemplate(template);
return Template && <Template {...props} ref={reference} schema={data}/>; 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'])); view.setDataValue('defaultTabName', get(defaultTabs, [0, 'name']));
} }
if (view.get('template') === 'SimpleTable') { if (view.get('type') === 'table') {
view.setDataValue('rowViewName', 'form'); view.setDataValue('rowViewName', 'form');
} }
if (view.get('updateViewName')) { if (view.get('updateViewName')) {