|
@@ -11,9 +11,10 @@ import { ColumnsType } from 'antd/lib/table'
|
|
|
import React, { useState, useEffect } from 'react'
|
|
|
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) => {
|
|
|
+import { apiContractList } from '@/utils/common/api'
|
|
|
+import { handleIntoBidsection } from '@/utils/util'
|
|
|
+const List: React.FC<RouteComponentProps> = props => {
|
|
|
const { clear } = useAliveController()
|
|
|
const [ loading, setLoading ] = useState<boolean>(false)
|
|
|
useEffect(() => {
|
|
@@ -24,7 +25,7 @@ const List: React.FC<RouteComponentProps> = (props) => {
|
|
|
|
|
|
const getTree = async () => {
|
|
|
setLoading(true)
|
|
|
- const { data, code = -1 } = await apiContractList()
|
|
|
+ const { data, code = -1 } = await apiContractList(consts.BIDSECTION_TYPE.CONTRACT)
|
|
|
if (code === consts.RET_CODE.SUCCESS) {
|
|
|
setTree(data)
|
|
|
setLoading(false)
|
|
@@ -34,12 +35,15 @@ const List: React.FC<RouteComponentProps> = (props) => {
|
|
|
const [ tree, setTree ] = useContractTree()
|
|
|
const [ expandedRowKeys, setRowKeys ] = useTableExpand(tree)
|
|
|
|
|
|
- const linkHandler = (id: string, name: string) => {
|
|
|
+ const handleLinkClick = (id: string, name: string) => {
|
|
|
tenderStore.saveTenderInfo({ bidsectionId: id, name })
|
|
|
- props.history.push('/console/contract/content/summary')
|
|
|
+ const hasPermission = handleIntoBidsection("contract")
|
|
|
+ if (hasPermission) {
|
|
|
+ props.history.push('/console/contract/content/summary')
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- const columns:ColumnsType<ContractTree> = [
|
|
|
+ const columns: ColumnsType<ContractTree> = [
|
|
|
{
|
|
|
title: '名称',
|
|
|
dataIndex: 'name',
|
|
@@ -47,12 +51,21 @@ const List: React.FC<RouteComponentProps> = (props) => {
|
|
|
width: '25%',
|
|
|
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 className="pi-vertical-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/contract/content/summary', state: { id: record.bidsectionId } }}>{text}</Link> */}
|
|
|
- <span className="pi-link-blue" onClick={() => linkHandler(record.bidsectionId, record.name)}>{text}</span>
|
|
|
- </div>
|
|
|
+ return (
|
|
|
+ <div>
|
|
|
+ <span className="expandIcon">{record.isEnd ? '└' : '├'}</span>
|
|
|
+ <span className="pi-link-blue" onClick={() => handleLinkClick(record.bidsectionId, record.name)}>
|
|
|
+ {text}
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -111,7 +124,10 @@ 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>
|
|
@@ -124,9 +140,7 @@ const List: React.FC<RouteComponentProps> = (props) => {
|
|
|
rowKey={record => record.id}
|
|
|
indentSize={20}
|
|
|
expandable={{ expandedRowKeys, onExpand: setRowKeys }}
|
|
|
- bordered
|
|
|
- >
|
|
|
- </Table>
|
|
|
+ bordered></Table>
|
|
|
</div>
|
|
|
</div>
|
|
|
)
|