|
@@ -13,17 +13,20 @@ import { useAliveController } from 'react-activation'
|
|
|
import { RouteComponentProps, withRouter } from 'react-router-dom'
|
|
|
import { apiContractList } from './api'
|
|
|
import styles from './index.module.scss'
|
|
|
-const List: React.FC<RouteComponentProps> = (props) => {
|
|
|
+const List: React.FC<RouteComponentProps> = props => {
|
|
|
const { clear } = useAliveController()
|
|
|
+ const [ loading, setLoading ] = useState<boolean>(false)
|
|
|
useEffect(() => {
|
|
|
// 清除所有的缓存页面
|
|
|
clear()
|
|
|
getTree()
|
|
|
}, [])
|
|
|
const getTree = async () => {
|
|
|
+ setLoading(true)
|
|
|
const { data, code = -1 } = await apiContractList()
|
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
|
setTree(data)
|
|
|
+ setLoading(false)
|
|
|
}
|
|
|
}
|
|
|
const [ tree, setTree ] = useContractTree()
|
|
@@ -33,7 +36,7 @@ const List: React.FC<RouteComponentProps> = (props) => {
|
|
|
tenderStore.saveTenderInfo({ bidsectionId: id, name })
|
|
|
props.history.push('/console/safe/content/summary')
|
|
|
}
|
|
|
- const columns:ColumnsType<ContractTree> = [
|
|
|
+ const columns: ColumnsType<ContractTree> = [
|
|
|
{
|
|
|
title: '名称',
|
|
|
dataIndex: 'name',
|
|
@@ -41,12 +44,21 @@ const List: React.FC<RouteComponentProps> = (props) => {
|
|
|
width: '40%',
|
|
|
render: (text: string, record: ContractTree) => {
|
|
|
if (record.isfolder) {
|
|
|
- return <div style={{ verticalAlign: "baseline" }}><SvgIcon type={record.hasFolder ? "xxh-folder-open" : "xxh-folder"} /><span className="pi-mg-left-2">{text}</span></div>
|
|
|
+ return (
|
|
|
+ <div style={{ verticalAlign: 'baseline' }}>
|
|
|
+ <SvgIcon type={record.hasFolder ? 'xxh-folder-open' : 'xxh-folder'} />
|
|
|
+ <span className="pi-mg-left-2">{text}</span>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
} else {
|
|
|
- return <div><span style={{ color: '#6c757d', marginRight: '.5rem' }}>{record.isEnd ? '└' : '├'}</span>
|
|
|
- {/* <Link to={{ pathname: '/console/safe/content/summary', search: `?bid=${record.id}` }}>{text}</Link> */}
|
|
|
- <span className="pi-link-blue" onClick={() => linkHandler(record.bidsectionId, record.name)}>{text}</span>
|
|
|
- </div>
|
|
|
+ return (
|
|
|
+ <div>
|
|
|
+ <span style={{ color: '#6c757d', marginRight: '.5rem' }}>{record.isEnd ? '└' : '├'}</span>
|
|
|
+ <span className="pi-link-blue" onClick={() => linkHandler(record.bidsectionId, record.name)}>
|
|
|
+ {text}
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -90,21 +102,23 @@ const List: React.FC<RouteComponentProps> = (props) => {
|
|
|
<Header>
|
|
|
<Slot>
|
|
|
<Dropdown overlay={menu}>
|
|
|
- <Button type="text" size="small" className={styles.textBtn}>展开/收起<CaretDownOutlined /></Button>
|
|
|
+ <Button type="text" size="small" className={styles.textBtn}>
|
|
|
+ 展开/收起
|
|
|
+ <CaretDownOutlined />
|
|
|
+ </Button>
|
|
|
</Dropdown>
|
|
|
</Slot>
|
|
|
</Header>
|
|
|
<div className={styles.tableContent}>
|
|
|
<Table<ContractTree>
|
|
|
columns={columns}
|
|
|
+ loading={loading}
|
|
|
dataSource={tree.children}
|
|
|
pagination={false}
|
|
|
rowKey={record => record.id}
|
|
|
indentSize={20}
|
|
|
expandable={{ expandedRowKeys, onExpand: setRowKeys }}
|
|
|
- bordered
|
|
|
- >
|
|
|
- </Table>
|
|
|
+ bordered></Table>
|
|
|
</div>
|
|
|
</div>
|
|
|
)
|