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