巴林闲侠 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])
useEffect(() => {
console.log('userId', userId)
if (reportList && mapObj) {
mapObj.clearMap();
renderMarkers();
@ -142,7 +143,7 @@ function PatrolGis(props) {
});
}
}
// , display: userId ? 'block' : 'none'
return (
<div style={{ width: '100%', backgroundColor: '#101824', height: '100%', minHeight: 700, position: 'relative' }}>
<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 { allDepUsers, clientHeight, user, userList, reportList, dispatch, reportListLoading, reportDetail, reportDetailLoading, userLoading, exports, pathname, anspectionNotificationPhoneList } = props;
const [record, setRecord] = useState(1);
// const [recordCopy, setRecordCopy] = useState();
const [recordCopy, setRecordCopy] = useState();
const [dateRange, setDateRange] = useState();
const [selectProjectType, setSelectProjectType] = useState('');
const [detailVisible, setDetailVisible] = useState(false)
@ -1016,9 +1016,11 @@ const PatrolTable = (props) => {
useEffect(() => {
if (activeTabKey1 && activeTabKey1 == 'tab2') {
setRecord(null);
setRecordCopy(null)
} else if (activeTabKey1 && activeTabKey1 == 'tab1') {
// setRecord(userList[0]);
queryData()
}
}, [activeTabKey1])
const handelRefresh = () => {
@ -1054,19 +1056,21 @@ const PatrolTable = (props) => {
</Card>
</div>
],
tab2: <PatrolGis userId={(record || {}).id} dispatch={dispatch} reportList={reportList} />
tab2: <PatrolGis userId={recordCopy} dispatch={dispatch} reportList={reportList} />
};
const onTab1Change = (key) => {
setActiveTabKey1(key);
};
// const handleChangeRecord = (newRecord) => {
// let target = null;
// if (!record || (newRecord && newRecord.id != record.id)) {
// target = newRecord;
// }
// setRecord(target);
// }
const handleChangeRecord = (newRecord) => {
console.log('userId', newRecord)
let target = null;
if (!recordCopy || (newRecord != recordCopy)) {
target = newRecord;
}
console.log('userId', target)
setRecordCopy(target)
}
const handleExport = () => {
if (reportList && reportList instanceof Array && reportList.length) {
@ -1130,7 +1134,7 @@ const PatrolTable = (props) => {
<PatrolNameList
clientHeight={clientHeight} user={user}
dispatch={dispatch}
onChange={(record) => setRecord(record)}
onChange={(record, recordCopy) => { setRecord(record); handleChangeRecord(record) }}
record={record}
activeTabKey1={activeTabKey1}
userList={userList}

Loading…
Cancel
Save