Browse Source

养护抽查 道路名称搜索

dev
wenlele 1 year ago
parent
commit
095d224d62
  1. 1914
      api/app/lib/controllers/report/index.js
  2. 5
      web/client/src/sections/fillion/components/adjustment.js
  3. 100
      web/client/src/sections/fillion/containers/maintenanceSpotCheck-new.js

1914
api/app/lib/controllers/report/index.js

File diff suppressed because it is too large

5
web/client/src/sections/fillion/components/adjustment.js

@ -156,9 +156,10 @@ const Adjustment = (props) => {
if (allValues?.routeName && allValues?.routeCode && allValues?.sectionNo) {
let find = road?.find(s => allValues?.routeName == s.routeName && allValues?.routeCode == s.routeCode && allValues?.sectionNo == s.sectionNo)
form.setFieldsValue({
'startingPlaceName': data[0]?.startingPlaceName,
'stopPlaceName': data[0]?.stopPlaceName
'startingPlaceName': find?.startingPlaceName,
'stopPlaceName': find?.stopPlaceName
})
} else {
form.setFieldsValue({

100
web/client/src/sections/fillion/containers/maintenanceSpotCheck-new.js

@ -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={{

Loading…
Cancel
Save