|
@ -1,6 +1,6 @@ |
|
|
import { connect } from 'react-redux'; |
|
|
import { connect } from 'react-redux'; |
|
|
import './protable.less' |
|
|
import './protable.less' |
|
|
import { Card, Button, Popconfirm, Badge, Col, Row, DatePicker, Input, Modal, Spin, Image, message, Popover } from 'antd'; |
|
|
import { Card, Button, Popconfirm, Badge, Col, Row, DatePicker, Input, Modal, Spin, Image, message, Popover, Select } from 'antd'; |
|
|
import ProTable from '@ant-design/pro-table'; |
|
|
import ProTable from '@ant-design/pro-table'; |
|
|
import { getReportList, getReportDetail, handleReport } from '../actions/patrol'; |
|
|
import { getReportList, getReportDetail, handleReport } from '../actions/patrol'; |
|
|
import React, { useEffect, useState } from 'react'; |
|
|
import React, { useEffect, useState } from 'react'; |
|
@ -19,6 +19,7 @@ const DetailForm = (props) => { |
|
|
const keyList = [ |
|
|
const keyList = [ |
|
|
// { key: '编号', name: 'id' },
|
|
|
// { key: '编号', name: 'id' },
|
|
|
{ key: '工程类型', name: 'projectType', skip: !isPatrol }, |
|
|
{ key: '工程类型', name: 'projectType', skip: !isPatrol }, |
|
|
|
|
|
{ key: '反馈类型', name: 'projectType', skip: !isAnomaly }, |
|
|
{ key: '工程名称', name: 'projectName', skip: !isRoad }, |
|
|
{ key: '工程名称', name: 'projectName', skip: !isRoad }, |
|
|
{ key: '所在路段', name: 'road', skip: isRoad }, |
|
|
{ key: '所在路段', name: 'road', skip: isRoad }, |
|
|
{ key: '具体位置', name: 'address' }, |
|
|
{ key: '具体位置', name: 'address' }, |
|
@ -128,9 +129,9 @@ const DetailList = (props) => { |
|
|
return moment(record.time).format("YYYYMMDD") * 10000 + counter; |
|
|
return moment(record.time).format("YYYYMMDD") * 10000 + counter; |
|
|
} |
|
|
} |
|
|
} : '', |
|
|
} : '', |
|
|
isPatrol ? |
|
|
isPatrol || isAnomaly ? |
|
|
{ |
|
|
{ |
|
|
title: '工程类型', |
|
|
title: isPatrol ? '工程类型' : '反馈类型', |
|
|
key: 'projectType', |
|
|
key: 'projectType', |
|
|
dataIndex: 'projectType', |
|
|
dataIndex: 'projectType', |
|
|
align: 'center', |
|
|
align: 'center', |
|
@ -140,6 +141,9 @@ const DetailList = (props) => { |
|
|
case 'bridge': return '桥梁'; |
|
|
case 'bridge': return '桥梁'; |
|
|
case 'culvert': return '涵洞'; |
|
|
case 'culvert': return '涵洞'; |
|
|
case 'other': return '其他'; |
|
|
case 'other': return '其他'; |
|
|
|
|
|
case 'conserve': return '养护'; |
|
|
|
|
|
case 'patrol': return '巡查'; |
|
|
|
|
|
case 'construction': return '在建'; |
|
|
default: return text; |
|
|
default: return text; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -268,9 +272,8 @@ const PatrolNameList = (props) => { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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]);
|
|
|
} |
|
|
} |
|
|
if (activeTabKey1 == 'tab2') { |
|
|
if (activeTabKey1 == 'tab2') { |
|
@ -333,7 +336,7 @@ const PatrolNameList = (props) => { |
|
|
id = null |
|
|
id = null |
|
|
} |
|
|
} |
|
|
setSelectRoad(id); |
|
|
setSelectRoad(id); |
|
|
onChange(record); |
|
|
onChange(id ? record : null); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
}; |
|
|
}; |
|
@ -349,6 +352,7 @@ const PatrolTable = (props) => { |
|
|
const { userList, reportList, dispatch, reportListLoading, reportDetail, reportDetailLoading, userLoading, exports, pathname } = props; |
|
|
const { userList, reportList, dispatch, reportListLoading, reportDetail, reportDetailLoading, userLoading, exports, pathname } = props; |
|
|
const [record, setRecord] = useState(); |
|
|
const [record, setRecord] = useState(); |
|
|
const [dateRange, setDateRange] = useState(); |
|
|
const [dateRange, setDateRange] = useState(); |
|
|
|
|
|
const [selectProjectType, setSelectProjectType] = useState(''); |
|
|
const [detailVisible, setDetailVisible] = useState(false) |
|
|
const [detailVisible, setDetailVisible] = useState(false) |
|
|
const [activeTabKey1, setActiveTabKey1] = useState('tab1'); |
|
|
const [activeTabKey1, setActiveTabKey1] = useState('tab1'); |
|
|
|
|
|
|
|
@ -360,19 +364,21 @@ const PatrolTable = (props) => { |
|
|
const reportType = isRoad ? 'road' : isAnomaly ? 'anomaly' : 'patrol'; |
|
|
const reportType = isRoad ? 'road' : isAnomaly ? 'anomaly' : 'patrol'; |
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
|
if (userList && userList instanceof Array) { |
|
|
queryData(); |
|
|
setRecord(userList[0]); |
|
|
}, []) |
|
|
} |
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
// if (userList && userList instanceof Array) {
|
|
|
|
|
|
// setRecord(userList[0]);
|
|
|
|
|
|
// }
|
|
|
}, [userList]) |
|
|
}, [userList]) |
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
|
if (record) { |
|
|
|
|
|
queryData(); |
|
|
queryData(); |
|
|
} |
|
|
}, [record, dateRange, selectProjectType]) |
|
|
}, [record, dateRange]) |
|
|
|
|
|
|
|
|
|
|
|
const queryData = () => { |
|
|
const queryData = () => { |
|
|
let query = { userId: record.id, reportType: reportType, asc: true } |
|
|
let query = { userId: record?.id, reportType: reportType, projectType: selectProjectType, asc: true } |
|
|
if ((dateRange && dateRange instanceof Array && dateRange[0] != '')) { |
|
|
if ((dateRange && dateRange instanceof Array && dateRange[0] != '')) { |
|
|
query.startTime = moment(dateRange[0]).startOf('day').format('YYYY-MM-DD HH:mm:ss') |
|
|
query.startTime = moment(dateRange[0]).startOf('day').format('YYYY-MM-DD HH:mm:ss') |
|
|
query.endTime = moment(dateRange[1]).endOf('day').format('YYYY-MM-DD HH:mm:ss') |
|
|
query.endTime = moment(dateRange[1]).endOf('day').format('YYYY-MM-DD HH:mm:ss') |
|
@ -384,7 +390,7 @@ const PatrolTable = (props) => { |
|
|
if (activeTabKey1 && activeTabKey1 == 'tab2') { |
|
|
if (activeTabKey1 && activeTabKey1 == 'tab2') { |
|
|
setRecord(null); |
|
|
setRecord(null); |
|
|
} else if (activeTabKey1 && activeTabKey1 == 'tab1') { |
|
|
} else if (activeTabKey1 && activeTabKey1 == 'tab1') { |
|
|
setRecord(userList[0]); |
|
|
// setRecord(userList[0]);
|
|
|
} |
|
|
} |
|
|
}, [activeTabKey1]) |
|
|
}, [activeTabKey1]) |
|
|
|
|
|
|
|
@ -428,7 +434,7 @@ const PatrolTable = (props) => { |
|
|
|
|
|
|
|
|
const handleChangeRecord = (newRecord) => { |
|
|
const handleChangeRecord = (newRecord) => { |
|
|
let target = null; |
|
|
let target = null; |
|
|
if (!record || newRecord.id != record.id) { |
|
|
if (!record || (newRecord && newRecord.id != record.id)) { |
|
|
target = newRecord; |
|
|
target = newRecord; |
|
|
} |
|
|
} |
|
|
setRecord(target); |
|
|
setRecord(target); |
|
@ -463,6 +469,25 @@ const PatrolTable = (props) => { |
|
|
activeTabKey1 == 'tab1' ? |
|
|
activeTabKey1 == 'tab1' ? |
|
|
<div style={{ marginBottom: 20 }}> |
|
|
<div style={{ marginBottom: 20 }}> |
|
|
<RangePicker onChange={(date, dateString) => { setDateRange(dateString) }} /> |
|
|
<RangePicker onChange={(date, dateString) => { setDateRange(dateString) }} /> |
|
|
|
|
|
{ |
|
|
|
|
|
isAnomaly ? |
|
|
|
|
|
<Select |
|
|
|
|
|
style={{ |
|
|
|
|
|
width: 120, |
|
|
|
|
|
marginLeft: 20 |
|
|
|
|
|
}} |
|
|
|
|
|
options={[ |
|
|
|
|
|
{ label: '养护', value: 'conserve' }, |
|
|
|
|
|
{ label: '巡查', value: 'patrol' }, |
|
|
|
|
|
{ label: '在建', value: 'construction' }, |
|
|
|
|
|
]} |
|
|
|
|
|
placeholder="反馈类型" |
|
|
|
|
|
onChange={(value) => { |
|
|
|
|
|
setSelectProjectType(value) |
|
|
|
|
|
}} |
|
|
|
|
|
/> |
|
|
|
|
|
: '' |
|
|
|
|
|
} |
|
|
<Button style={{ marginLeft: 20 }}>查询</Button> |
|
|
<Button style={{ marginLeft: 20 }}>查询</Button> |
|
|
{/* <Button style={{ marginLeft: 20 }} onClick={handleExport} >导出</Button> */} |
|
|
{/* <Button style={{ marginLeft: 20 }} onClick={handleExport} >导出</Button> */} |
|
|
</div> : '' |
|
|
</div> : '' |
|
|