Browse Source

养护抽查 道路名称搜索

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

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

@ -851,15 +851,19 @@ async function roadSpotList (ctx) {
async function roadSpotDetail (ctx) {
try {
const { models } = ctx.fs.dc;
const { previewId } = ctx.query
const { previewId, keyword } = ctx.query
const listRes = await models.RoadSpotCheck.findAll({
where: {
prepareId: previewId
prepareId: previewId,
},
include: [{
model: models.Road,
// required: false,
where: {
...(keyword ? { routeName: { $ilike: `%${keyword}%` } } : {})
},
}]
})

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({

24
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,11 +158,27 @@ const MaintenanceSpotCheck = (props) => {
}
},
expandedRowRender: (record) => (
<>
<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 }}
@ -190,6 +212,8 @@ const MaintenanceSpotCheck = (props) => {
]}
/>
</>
),
}}
pagination={{

Loading…
Cancel
Save