Compare commits

...

2 Commits

  1. 25
      web/client/src/sections/fillion/components/patrolTable.js

25
web/client/src/sections/fillion/components/patrolTable.js

@ -211,15 +211,21 @@ const DetailList = (props) => {
const PatrolNameList = (props) => {
const [users, setUsers] = useState([]);
const { onChange, record, userList, loading } = props;
const { onChange, record, userList, loading, activeTabKey1 } = props;
const [selectRoad, setSelectRoad] = useState();
useEffect(() => {
if (userList && userList instanceof Array && userList.length) {
setSelectRoad(userList[0].id)
// onChange(userList[0]);
}
}, [userList])
if (userList && userList instanceof Array && userList.length) {
setSelectRoad(userList[0].id)
// onChange(userList[0]);
}
if(activeTabKey1 == 'tab2'){
setSelectRoad(null)
}
}, [userList, activeTabKey1])
const columns = [
{
@ -271,7 +277,11 @@ const PatrolNameList = (props) => {
onClick: () => {
if (record) {
// console.log('record:', record)
setSelectRoad(record.id);
let id = record.id
if(selectRoad == record.id){
id = null
}
setSelectRoad(id);
onChange(record);
}
},
@ -376,6 +386,7 @@ const PatrolTable = (props) => {
<PatrolNameList
onChange={(record) => handleChangeRecord(record)}
record={record}
activeTabKey1={activeTabKey1}
userList={userList}
loading={userLoading} />
</Card>

Loading…
Cancel
Save