巴林闲侠 1 year ago
parent
commit
16642e8347
  1. 3
      web/client/src/sections/fillion/components/gis/patrolGis.js
  2. 26
      web/client/src/sections/fillion/components/patrolTable.js

3
web/client/src/sections/fillion/components/gis/patrolGis.js

@ -49,6 +49,7 @@ function PatrolGis(props) {
}, [userId, dateRange]) }, [userId, dateRange])
useEffect(() => { useEffect(() => {
console.log('userId', userId)
if (reportList && mapObj) { if (reportList && mapObj) {
mapObj.clearMap(); mapObj.clearMap();
renderMarkers(); renderMarkers();
@ -142,7 +143,7 @@ function PatrolGis(props) {
}); });
} }
} }
// , display: userId ? 'block' : 'none'
return ( return (
<div style={{ width: '100%', backgroundColor: '#101824', height: '100%', minHeight: 700, position: 'relative' }}> <div style={{ width: '100%', backgroundColor: '#101824', height: '100%', minHeight: 700, position: 'relative' }}>
<div id='amapId' style={{ width: '100%', height: '100%', background: "#101824", minHeight: 700 }} /> <div id='amapId' style={{ width: '100%', height: '100%', background: "#101824", minHeight: 700 }} />

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

@ -960,7 +960,7 @@ const PatrolNameList = (props) => {
const PatrolTable = (props) => { const PatrolTable = (props) => {
const { allDepUsers, clientHeight, user, userList, reportList, dispatch, reportListLoading, reportDetail, reportDetailLoading, userLoading, exports, pathname, anspectionNotificationPhoneList } = props; const { allDepUsers, clientHeight, user, userList, reportList, dispatch, reportListLoading, reportDetail, reportDetailLoading, userLoading, exports, pathname, anspectionNotificationPhoneList } = props;
const [record, setRecord] = useState(1); const [record, setRecord] = useState(1);
// const [recordCopy, setRecordCopy] = useState(); const [recordCopy, setRecordCopy] = useState();
const [dateRange, setDateRange] = useState(); const [dateRange, setDateRange] = useState();
const [selectProjectType, setSelectProjectType] = useState(''); const [selectProjectType, setSelectProjectType] = useState('');
const [detailVisible, setDetailVisible] = useState(false) const [detailVisible, setDetailVisible] = useState(false)
@ -1016,9 +1016,11 @@ const PatrolTable = (props) => {
useEffect(() => { useEffect(() => {
if (activeTabKey1 && activeTabKey1 == 'tab2') { if (activeTabKey1 && activeTabKey1 == 'tab2') {
setRecord(null); setRecordCopy(null)
} else if (activeTabKey1 && activeTabKey1 == 'tab1') { } else if (activeTabKey1 && activeTabKey1 == 'tab1') {
// setRecord(userList[0]); // setRecord(userList[0]);
queryData()
} }
}, [activeTabKey1]) }, [activeTabKey1])
const handelRefresh = () => { const handelRefresh = () => {
@ -1054,19 +1056,21 @@ const PatrolTable = (props) => {
</Card> </Card>
</div> </div>
], ],
tab2: <PatrolGis userId={(record || {}).id} dispatch={dispatch} reportList={reportList} /> tab2: <PatrolGis userId={recordCopy} dispatch={dispatch} reportList={reportList} />
}; };
const onTab1Change = (key) => { const onTab1Change = (key) => {
setActiveTabKey1(key); setActiveTabKey1(key);
}; };
// const handleChangeRecord = (newRecord) => { const handleChangeRecord = (newRecord) => {
// let target = null; console.log('userId', newRecord)
// if (!record || (newRecord && newRecord.id != record.id)) { let target = null;
// target = newRecord; if (!recordCopy || (newRecord != recordCopy)) {
// } target = newRecord;
// setRecord(target); }
// } console.log('userId', target)
setRecordCopy(target)
}
const handleExport = () => { const handleExport = () => {
if (reportList && reportList instanceof Array && reportList.length) { if (reportList && reportList instanceof Array && reportList.length) {
@ -1130,7 +1134,7 @@ const PatrolTable = (props) => {
<PatrolNameList <PatrolNameList
clientHeight={clientHeight} user={user} clientHeight={clientHeight} user={user}
dispatch={dispatch} dispatch={dispatch}
onChange={(record) => setRecord(record)} onChange={(record, recordCopy) => { setRecord(record); handleChangeRecord(record) }}
record={record} record={record}
activeTabKey1={activeTabKey1} activeTabKey1={activeTabKey1}
userList={userList} userList={userList}

Loading…
Cancel
Save