|
|
@ -15,6 +15,7 @@ const MaintenanceSpotCheck = (props) => { |
|
|
|
const [vis, setVis] = useState(false)//模态框的显示与隐藏变量
|
|
|
|
const [count, setCount] = useState(0) |
|
|
|
const [page, setPage] = useState(1) |
|
|
|
const [innerPage, setInnerPage] = useState(1) |
|
|
|
const [depName, setDepName] = useState('') |
|
|
|
const [total, setTotal] = useState(0) |
|
|
|
const [previewId, setPreviewId] = useState(0) |
|
|
@ -26,6 +27,7 @@ const MaintenanceSpotCheck = (props) => { |
|
|
|
const [expandedRowKeys, setExpandedRowKeys] = useState([]); |
|
|
|
const [isAdjustment, setIsAdjustment] = useState(false); |
|
|
|
const [editData, setEditData] = useState({}); |
|
|
|
const [keyword, setKeyword] = useState(""); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -71,6 +73,7 @@ const MaintenanceSpotCheck = (props) => { |
|
|
|
dispatch(roadSpotList(data)).then(res => { |
|
|
|
if (res.success) { |
|
|
|
setReportData(res?.payload.data) |
|
|
|
setKeyword("") |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
@ -78,6 +81,7 @@ const MaintenanceSpotCheck = (props) => { |
|
|
|
const detailData = (data = {}) => { |
|
|
|
dispatch(roadSpotDetail(data)).then(res => { |
|
|
|
if (res.success) { |
|
|
|
setInnerPage(1) |
|
|
|
setDetailList(res?.payload.data) |
|
|
|
} |
|
|
|
}) |
|
|
@ -120,6 +124,7 @@ const MaintenanceSpotCheck = (props) => { |
|
|
|
setVis(true) |
|
|
|
}} type='primary' style={{ marginLeft: 10 }}> 新增 </Button> |
|
|
|
<div> |
|
|
|
|
|
|
|
<RangePicker value={dateRange[0] ? [moment(dateRange[0]), moment(dateRange[1])] : []} onChange={(date, dateString) => { |
|
|
|
setDateRange(dateString) |
|
|
|
}} style={{ marginRight: 20 }} /> |
|
|
@ -143,6 +148,7 @@ const MaintenanceSpotCheck = (props) => { |
|
|
|
expandedRowKeys: expandedRowKeys, // 控制哪些行展开,这里需要通过 state 管理
|
|
|
|
// defaultExpandedRowKeys: ['0'],
|
|
|
|
onExpand: (expanded, record) => { |
|
|
|
setKeyword("") |
|
|
|
if (expanded) { |
|
|
|
setExpandedRowKeys([record?.id]) |
|
|
|
detailData({ previewId: record?.id }) |
|
|
@ -152,44 +158,62 @@ const MaintenanceSpotCheck = (props) => { |
|
|
|
} |
|
|
|
}, |
|
|
|
expandedRowRender: (record) => ( |
|
|
|
< Table |
|
|
|
pagination={{ |
|
|
|
pageSize: 10, |
|
|
|
defaultPageSize: 10, |
|
|
|
showSizeChanger: false, |
|
|
|
}} |
|
|
|
loading={detailLoading} |
|
|
|
style={{ margin: 0 }} |
|
|
|
dataSource={detailList} |
|
|
|
columns={ |
|
|
|
[ |
|
|
|
{ |
|
|
|
title: '道路类型', key: 'level', dataIndex: 'level', render: (_, r) => r?.road?.level ? (r?.road?.level + '道') : '--' |
|
|
|
}, |
|
|
|
{ title: '道路名称', key: 'routeName', dataIndex: 'routeName', render: (_, r) => r.road?.routeName || '--' }, |
|
|
|
{ title: '道路代码', key: 'routeCode', dataIndex: 'routeCode', render: (_, r) => r.road?.routeCode || '--' }, |
|
|
|
{ title: '路段序号', key: 'sectionNo', dataIndex: 'sectionNo', render: (_, r) => r.road?.sectionNo || '--' }, |
|
|
|
{ title: '起点地名', key: 'startingPlaceName', dataIndex: 'startingPlaceName', render: (_, r) => r.road?.startingPlaceName || '--' }, |
|
|
|
{ title: '止点地名', key: 'stopPlaceName', dataIndex: 'stopPlaceName', render: (_, r) => r.road?.stopPlaceName || '--' }, |
|
|
|
{ title: '里程', key: 'chainageMileage', dataIndex: 'chainageMileage', render: (_, r) => r.road?.chainageMileage || '--' }, |
|
|
|
{ title: '养护次数(次)', key: 'maintenanceCount', dataIndex: 'maintenanceCount' }, |
|
|
|
{ |
|
|
|
title: '操作', |
|
|
|
key: 'action', |
|
|
|
dataIndex: 'action', |
|
|
|
render: (_, r, index) => <Button disabled={reportData[0]?.id == record?.id ? false : true} type="link" onClick={() => { |
|
|
|
setEditData({ |
|
|
|
...r, alterId: r?.road?.level == '县' ? record?.countyRoadId |
|
|
|
: r?.road?.level == '乡' ? record?.townshipRoadId |
|
|
|
: r?.road?.level == '村' ? record?.villageId : [], |
|
|
|
previewId: record?.id |
|
|
|
}) |
|
|
|
setIsAdjustment(true) |
|
|
|
}}> 调整 </Button > |
|
|
|
}, |
|
|
|
]} |
|
|
|
|
|
|
|
/> |
|
|
|
<> |
|
|
|
<div style={{ textAlign: 'end' }}> |
|
|
|
<Input style={{ width: 160, marginRight: 16 }} onPressEnter={() => { |
|
|
|
detailData({ previewId: record?.id, keyword: keyword }) |
|
|
|
}} value={keyword} placeholder='道路名称关键字' onChange={(e) => { |
|
|
|
setKeyword(e.target.value) |
|
|
|
}} /> |
|
|
|
<Button style={{ marginRight: 20 }} onClick={() => { |
|
|
|
detailData({ previewId: record?.id, keyword: keyword }) |
|
|
|
}} > 查询 </Button> |
|
|
|
</div> |
|
|
|
< Table |
|
|
|
pagination={{ |
|
|
|
total: detailList?.length || 0, |
|
|
|
pageSize: 10, |
|
|
|
current: innerPage || 1, |
|
|
|
defaultPageSize: 10, |
|
|
|
showSizeChanger: false, |
|
|
|
onChange: (page, pageSize) => { |
|
|
|
setInnerPage(page) |
|
|
|
} |
|
|
|
}} |
|
|
|
loading={detailLoading} |
|
|
|
style={{ margin: 0 }} |
|
|
|
dataSource={detailList} |
|
|
|
columns={ |
|
|
|
[ |
|
|
|
{ |
|
|
|
title: '道路类型', key: 'level', dataIndex: 'level', render: (_, r) => r?.road?.level ? (r?.road?.level + '道') : '--' |
|
|
|
}, |
|
|
|
{ title: '道路名称', key: 'routeName', dataIndex: 'routeName', render: (_, r) => r.road?.routeName || '--' }, |
|
|
|
{ title: '道路代码', key: 'routeCode', dataIndex: 'routeCode', render: (_, r) => r.road?.routeCode || '--' }, |
|
|
|
{ title: '路段序号', key: 'sectionNo', dataIndex: 'sectionNo', render: (_, r) => r.road?.sectionNo || '--' }, |
|
|
|
{ title: '起点地名', key: 'startingPlaceName', dataIndex: 'startingPlaceName', render: (_, r) => r.road?.startingPlaceName || '--' }, |
|
|
|
{ title: '止点地名', key: 'stopPlaceName', dataIndex: 'stopPlaceName', render: (_, r) => r.road?.stopPlaceName || '--' }, |
|
|
|
{ title: '里程', key: 'chainageMileage', dataIndex: 'chainageMileage', render: (_, r) => r.road?.chainageMileage || '--' }, |
|
|
|
{ title: '养护次数(次)', key: 'maintenanceCount', dataIndex: 'maintenanceCount' }, |
|
|
|
{ |
|
|
|
title: '操作', |
|
|
|
key: 'action', |
|
|
|
dataIndex: 'action', |
|
|
|
render: (_, r, index) => <Button disabled={reportData[0]?.id == record?.id ? false : true} type="link" onClick={() => { |
|
|
|
setEditData({ |
|
|
|
...r, alterId: r?.road?.level == '县' ? record?.countyRoadId |
|
|
|
: r?.road?.level == '乡' ? record?.townshipRoadId |
|
|
|
: r?.road?.level == '村' ? record?.villageId : [], |
|
|
|
previewId: record?.id |
|
|
|
}) |
|
|
|
setIsAdjustment(true) |
|
|
|
}}> 调整 </Button > |
|
|
|
}, |
|
|
|
]} |
|
|
|
|
|
|
|
/> |
|
|
|
</> |
|
|
|
|
|
|
|
), |
|
|
|
}} |
|
|
|
pagination={{ |
|
|
|