Browse Source

故障处理

dev
LUCAS 2 years ago
parent
commit
691fefd1f6
  1. 17
      web/client/src/sections/fillion/components/patrolTable.js

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

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

Loading…
Cancel
Save