| | |
| | | import StickyDataTable from "@/page/components/StickyDataTable"; |
| | | |
| | | const ViewTable = ({ title, resource, filter, onClick, selectedId, columns }) => { |
| | | // 只有在有 filter 时才调用 useListController,避免不必要的请求 |
| | | const shouldLoadData = !!filter; |
| | | |
| | | const listContext = useListController({ |
| | | resource: resource, |
| | | filter: filter, |
| | | filter: filter || {}, |
| | | perPage: 100, |
| | | sort: { field: 'id', order: 'ASC' }, |
| | | disableSyncWithLocation: true, |
| | | queryOptions: { |
| | | enabled: shouldLoadData, // 只有在 shouldLoadData 为 true 时才执行查询 |
| | | }, |
| | | }); |
| | | |
| | | if (!filter) { |
| | | if (!shouldLoadData) { |
| | | return ( |
| | | <Card sx={{ height: '100%', display: 'flex', flexDirection: 'column' }}> |
| | | <Box p={1} borderBottom={1} borderColor="divider"> |
| | |
| | | <ViewTable |
| | | title={translate('menu.subsystemFlowTemplate')} |
| | | resource="subsystemFlowTemplate" |
| | | filter={selectedNode ? { systemCode: selectedNode.systemCode } : null} |
| | | filter={selectedNode ? { flowCode: selectedNode.nodeCode } : null} |
| | | onClick={handleFlowClick} |
| | | selectedId={selectedFlow?.id} |
| | | columns={flowColumns} |