diff --git a/src/pages/list/list/index.tsx b/src/pages/list/list/index.tsx index d7c89fe..4dc6e8f 100644 --- a/src/pages/list/list/index.tsx +++ b/src/pages/list/list/index.tsx @@ -63,11 +63,13 @@ const TableList: React.FC = () => { setTabs(tabsData.data); if (dataId) { const result: any = await requestList({ current: 1, pageSize: 1 }, { id: dataId }); - setOptions(result.data); - } - setTabActiveKey(key); - if (actionRef.current) { - actionRef.current.reload(); + setCurrentRow(result.data[0]); + setShowDetail(true); + } else { + setTabActiveKey(key); + if (actionRef.current) { + actionRef.current.reload(); + } } }; diff --git a/src/pages/list/search/index.tsx b/src/pages/list/search/index.tsx index cfec6b3..1f63ddc 100644 --- a/src/pages/list/search/index.tsx +++ b/src/pages/list/search/index.tsx @@ -4,7 +4,7 @@ import type { FC } from 'react'; import { useState, useEffect } from 'react'; import { history } from 'umi'; import { list } from './service'; - +import styles from './style.less'; type SearchProps = { match: { url: string; @@ -58,6 +58,7 @@ const Search: FC = (props) => { return ( = (props) => { tabActiveKey={activeKey} onTabChange={handleTabChange} > - {props.children} +
{props.children}
); }; diff --git a/src/pages/list/search/projects/components/TagSelect/index.tsx b/src/pages/list/search/projects/components/TagSelect/index.tsx index b646570..5981e94 100644 --- a/src/pages/list/search/projects/components/TagSelect/index.tsx +++ b/src/pages/list/search/projects/components/TagSelect/index.tsx @@ -53,7 +53,6 @@ const TagSelect: FC & { Option: typeof TagSelectOption } = (prop const [expand, { toggle }] = useBoolean(); const [value, setValue] = useControllableValue<(string | number)[]>(props); - const isTagSelectOption = (node: TagSelectOptionElement) => node && node.type && diff --git a/src/pages/list/search/projects/index.tsx b/src/pages/list/search/projects/index.tsx index ac8a7da..14ef306 100644 --- a/src/pages/list/search/projects/index.tsx +++ b/src/pages/list/search/projects/index.tsx @@ -16,7 +16,20 @@ const { Paragraph } = Typography; const Projects: FC = () => { const path: string = location.pathname.replace('/antdpro-demo', ''); const [templateData, setTemplateData] = useState([]); + const [type, setType] = useState({}); const [lists, setLists] = useState([]); + const getData = async (params: any) => { + let data: any = []; + const result = await list( + 'data/1', + { + current: 1, + }, + params, + ); + data = result.data; + setLists(data); + }; const getTemplateData = async () => { const { data } = await list( 'field/1', @@ -28,27 +41,18 @@ const Projects: FC = () => { ); setTemplateData(data); setLists(data); + setType({ type: [data[0].value] }); }; useEffect(() => { getTemplateData(); }, [path]); - const getData = async (params: any) => { - let data: any = []; - if (params.category) { - params.type = params.category[0]; - delete params.category; + useEffect(() => { + if (type.type) { + type.type = type.type[0]; } - const result = await list( - 'data/1', - { - current: 1, - pageSize: 20, - }, - params, - ); - data = result.data; - setLists(data); - }; + getData(type); + }, [JSON.stringify(type)]); + const formItemLayout = { wrapperCol: { xs: { span: 24 }, @@ -61,12 +65,12 @@ const Projects: FC = () => {
{ - getData(_); + onValuesChange={(params) => { + setType(params); }} > - + {templateData.map((item: any) => ( {item.name} @@ -86,7 +90,7 @@ const Projects: FC = () => { - +