fix: view collection source field (#2483)

This commit is contained in:
katherinehhh 2023-08-18 16:45:40 +08:00 committed by GitHub
parent b91a923fe0
commit 576ff8e52b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 28 deletions

View File

@ -90,9 +90,11 @@ const PreviewCom = (props) => {
} }
}); });
field.value = fieldsData; field.value = fieldsData;
setDataSource(fieldsData); setTimeout(() => {
form.setValuesIn('sources', data.data?.sources); setDataSource(fieldsData);
setSourceCollections(data.data?.sources); form.setValuesIn('sources', data.data?.sources);
setSourceCollections(data.data?.sources);
});
} }
}).catch; }).catch;
} }

View File

@ -71,35 +71,37 @@ export const PreviewTable = (props) => {
}); });
}; };
return ( return (
<Spin spinning={loading}> <Spin spinning={loading} key="preview">
<div <div
style={{ style={{
marginBottom: 22, marginBottom: 22,
}} }}
> >
{previewColumns?.length > 0 && [ <div
<div className="ant-formily-item-label"
className="ant-formily-item-label" style={{ marginTop: 24, display: 'flex', padding: '0 0 8px' }}
style={{ marginTop: 24, display: 'flex', padding: '0 0 8px' }} key={viewName}
key={viewName} >
> <div className="ant-formily-item-label-content">
<div className="ant-formily-item-label-content"> <span>
<span> <label>{t('Preview')}</label>
<label>{t('Preview')}</label> </span>
</span> </div>
</div> <span className="ant-formily-item-colon">:</span>
<span className="ant-formily-item-colon">:</span> </div>
</div>, {previewColumns?.length > 0 && (
<Table <>
size={'middle'} <Table
pagination={false} size={'middle'}
bordered pagination={false}
columns={previewColumns} bordered
dataSource={previewData} columns={previewColumns}
scroll={{ x: 1000, y: 300 }} dataSource={previewData}
key={viewName} scroll={{ x: 1000, y: 300 }}
/>, key={viewName}
]} />
</>
)}
</div> </div>
</Spin> </Spin>
); );

View File

@ -132,10 +132,13 @@ export const view: ICollectionTemplate = {
schema: { schema: {
'x-component-props': '{{$form.values}}', //任意层次属性都支持表达式 'x-component-props': '{{$form.values}}', //任意层次属性都支持表达式
}, },
state: {
visible: `{{$deps[1]?.length > 0}}`,
},
}, },
}, },
}, },
...getConfigurableProperties('category'), ...getConfigurableProperties('category'),
}, },
}; };