|
|
@ -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(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> |
|
|
|