| 
					
				 | 
			
			
				@@ -3,56 +3,46 @@ import Slot from '@/components/Header/slot' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import SvgIcon from '@/components/SvgIcon'
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { tenderStore } from '@/store/mobx'
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { ContractTree } from '@/types/contract'
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { useContractTree, useTableExpand } from '@/utils/common/customHooks'
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import consts from '@/utils/consts'
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { CaretDownOutlined } from '@ant-design/icons'
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import { Button, Dropdown, Menu, message, Table } from 'antd'
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { Button, Dropdown, Menu, Table } from 'antd'
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { ColumnsType } from 'antd/lib/table'
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import React, { useEffect, useState } 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) => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+interface TableState {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  loading: boolean
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  expandedIds: string[]
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+const List: React.FC<RouteComponentProps> = props => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   const { clear } = useAliveController()
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   useEffect(() => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // 清除所有的缓存页面
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     clear()
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     getTree()
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }, [])
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  const [ tree, setTree ] = useState({
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    bidsectionId: '',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    children: [],
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    childsTotal: 0,
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    contracts: 0,
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    contractsIncome: '',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    contractsIncomeProgress: '',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    contractsPaid: '',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    contractsPay: '',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    contractsPayProgress: '',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    contractsReturned: '',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    csrf: '',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    hasFolder: false,
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    id: '',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    isBid: false,
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    isEnd: false,
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    isfolder: 0,
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    name: '',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    parentId: '',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    projectId: ''
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  })
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  const [ tree, setTree ] = useContractTree()
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  const [ expandedRowKeys, setRowKeys ] = useTableExpand(tree)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  const [ tableState, setTableState ] = useState<TableState>({ loading: false, expandedIds: [] })
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   const getTree = async () => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    setTableState({ ...tableState, loading: true })
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const { data, code = -1 } = await apiContractList()
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if (code === consts.RET_CODE.SUCCESS) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       setTree(data)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      setTableState({ ...tableState, loading: false })
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   const linkHandler = (id: string, name: string) => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     tenderStore.saveTenderInfo({ bidsectionId: id, name })
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    // tenderStore.saveName(name)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     props.history.push('/console/quality/content/summary')
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  const columns:ColumnsType<ContractTree> = [
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  const columns: ColumnsType<ContractTree> = [
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       title: '名称',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       dataIndex: 'name',
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -60,11 +50,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>
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          <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>
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          )
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     },
 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -75,49 +75,56 @@ const List: React.FC<RouteComponentProps> = (props) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     },
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       title: '待整改',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      dataIndex: 'quality_rectification',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      key: 'quality_rectification'
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      dataIndex: 'qualityRectification',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      key: 'qualityRectification'
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     },
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       title: '整改中',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      dataIndex: 'quality_rectification_in',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      key: 'quality_rectification_in'
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      dataIndex: 'qualityRectificationIn',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      key: 'qualityRectificationIn'
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     },
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       title: '已整改',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      dataIndex: 'quality_rectification_finish',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      key: 'quality_rectification_finish'
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      dataIndex: 'qualityRectificationFinish',
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      key: 'qualityRectificationFinish'
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   ]
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   const handleMenuClick = ({ key }: any) => {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    message.info(`Click on item ${key}`)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (key === 'expanded') {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      setRowKeys(true)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } else {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      setRowKeys(false)
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   const menu = (
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <Menu onClick={handleMenuClick}>
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      <Menu.Item key="1">展开所有</Menu.Item>
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      <Menu.Item key="2">收起所有</Menu.Item>
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      <Menu.Item key="expanded">展开所有</Menu.Item>
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      <Menu.Item key="collapsed">收起所有</Menu.Item>
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </Menu>
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   )
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   return (
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    <div className="wrap-contaniner hide-menu">
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <div className="wrap-contaniner hide-menu pi-bg-white">
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       <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>
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          loading={tableState.loading}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           columns={columns}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           dataSource={tree.children}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           pagination={false}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           rowKey={record => record.id}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           indentSize={20}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          bordered
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        >
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        </Table>
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          expandable={{ expandedRowKeys, onExpand: setRowKeys }}
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          bordered></Table>
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       </div>
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </div>
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   )
 
			 |