Commit 6b741fc7 authored by 皮倩雯's avatar 皮倩雯

解决操作刷新页面问题

parent 8dfc4424
Pipeline #34152 skipped with stages
...@@ -51,6 +51,7 @@ const incident = () => { ...@@ -51,6 +51,7 @@ const incident = () => {
const [sortData,setSortData] = useState([]) const [sortData,setSortData] = useState([])
const [rember, setRember] = useState(0)
const [maxLength, setMaxLength] = useState(0); const [maxLength, setMaxLength] = useState(0);
const [pickItem, setPickItem] = useState(''); const [pickItem, setPickItem] = useState('');
...@@ -301,7 +302,7 @@ const incident = () => { ...@@ -301,7 +302,7 @@ const incident = () => {
let arrr = formateArrDataA(zz, 'businessType') let arrr = formateArrDataA(zz, 'businessType')
console.log(arrr) console.log(arrr)
setTableData(arrr) setTableData(arrr)
setPickItem(newArr[0]) setPickItem(newArr[rember])
console.log(newArr, 'newArr'); console.log(newArr, 'newArr');
setTreeData(newArr) setTreeData(newArr)
} }
...@@ -318,6 +319,9 @@ const incident = () => { ...@@ -318,6 +319,9 @@ const incident = () => {
} }
}) })
},[]) },[])
useEffect(()=>{
})
const formateArrDataA = (initialArr, name) => { const formateArrDataA = (initialArr, name) => {
console.log(initialArr) console.log(initialArr)
console.log(name) console.log(name)
...@@ -473,7 +477,7 @@ const incident = () => { ...@@ -473,7 +477,7 @@ const incident = () => {
return <div className={classnames({ return <div className={classnames({
[styles.listItem]: true, [styles.listItem]: true,
[styles.pickItem]: item === pickItem, [styles.pickItem]: item === pickItem,
})} onClick={e => setPickItem(item)} key={index}>{item}{tableData[item] ? tableData[item].length : ''}{item === pickItem ? <RightOutlined /> : ''} </div> })} onClick={e => {setPickItem(item);setRember(index)}} key={index}>{item}{tableData[item] ? tableData[item].length : ''}{item === pickItem ? <RightOutlined /> : ''} </div>
}) })
)} )}
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment