Browse Source

养护抽查优化

dev
wenlele 1 year ago
parent
commit
2968aee7d9
  1. 6
      api/app/lib/controllers/report/index.js
  2. 75
      web/client/src/sections/fillion/components/adjustment.js
  3. 2
      web/client/src/sections/fillion/containers/adjustLog.js
  4. 25
      web/client/src/sections/fillion/containers/maintenanceSpotCheck-new.js

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

@ -1074,10 +1074,10 @@ async function exportSpotRode (ctx) {
key: 'stopPlaceName', key: 'stopPlaceName',
title: '止点名称', title: '止点名称',
}, { }, {
key: '', key: 'chainageMileage',
title: '里程', title: '里程',
}, { }, {
key: '', key: 'maintenanceCount',
title: '养护次数(次)', title: '养护次数(次)',
},] },]
@ -1107,7 +1107,7 @@ async function exportSpotRode (ctx) {
sectionNo: road.sectionNo, sectionNo: road.sectionNo,
startingPlaceName: road.startingPlaceName, startingPlaceName: road.startingPlaceName,
stopPlaceName: road.stopPlaceName, stopPlaceName: road.stopPlaceName,
mileage: road.chainageMileage, chainageMileage: road.chainageMileage,
maintenanceCount: item.maintenanceCount, maintenanceCount: item.maintenanceCount,
} }
}) })

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

@ -27,6 +27,8 @@ const Adjustment = (props) => {
const [codeList, setCodeList] = useState([]); const [codeList, setCodeList] = useState([]);
const [indexList, setIndexList] = useState([]); const [indexList, setIndexList] = useState([]);
const [roadFind, setRoadFind] = useState({}); const [roadFind, setRoadFind] = useState({});
const [routeCodeDisabled, setRouteCodeDisabled] = useState(true);
const [sectionNoDisabled, setSectionNoDisabled] = useState(true);
@ -63,11 +65,6 @@ const Adjustment = (props) => {
const [form] = Form.useForm() const [form] = Form.useForm()
return ( return (
<Modal visible={true} <Modal visible={true}
onCancel={() => { onCancel={() => {
@ -97,24 +94,66 @@ const Adjustment = (props) => {
let name = [] let name = []
let code = [] let code = []
let index = [] let index = []
let data = road?.filter(d => (allValues?.routeName ? allValues?.routeName == d?.routeName : true)
&& (allValues?.routeCode ? allValues?.routeCode == d?.routeCode : true) &&
(allValues?.sectionNo ? allValues?.sectionNo == d?.sectionNo : true))
let data = [...road]
data?.forEach(v => { data?.forEach(v => {
if (v.routeName && !name.includes(v.routeName)) { if (v.routeName && !name.includes(v.routeName)) {
name.push(v.routeName) name.push(v.routeName)
} }
if (v.routeCode && !code.includes(v.routeCode)) { });
code.push(v.routeCode) for (let d in changedValues) {
if (d == 'routeName') {
form.setFieldsValue({
routeCode: "",
sectionNo: ""
})
data?.forEach(v => {
if (allValues?.routeName && allValues?.routeName == v.routeName && v.routeCode && !code.includes(v.routeCode)) {
code.push(v.routeCode)
}
});
setCodeList(code)
} }
if (v.sectionNo && !index.includes(v.sectionNo)) {
index.push(v.sectionNo) if (d == 'routeCode') {
form.setFieldsValue({
sectionNo: "",
})
data = road?.filter(s => allValues?.routeName == s?.routeName)
data?.forEach(v => {
if (allValues?.routeCode && allValues?.routeCode == v?.routeCode && v.sectionNo && !index.includes(v.sectionNo)) {
index.push(v.sectionNo)
}
if (!allValues?.routeCode && v.routeCode && !code.includes(v.routeCode)) {
code.push(v.routeCode)
}
});
if (!allValues?.routeCode) {
setCodeList(code)
}
setIndexList(index)
} }
}); }
setNameList(name) setNameList(name)
setCodeList(code)
setIndexList(index)
if (allValues?.routeName) {
setRouteCodeDisabled(false)
} else {
setRouteCodeDisabled(true)
}
if (allValues?.routeName && allValues?.routeCode) {
setSectionNoDisabled(false)
} else {
setSectionNoDisabled(true)
}
if (allValues?.routeName && allValues?.routeCode && allValues?.sectionNo) { if (allValues?.routeName && allValues?.routeCode && allValues?.sectionNo) {
form.setFieldsValue({ form.setFieldsValue({
@ -144,14 +183,14 @@ const Adjustment = (props) => {
name="routeCode" name="routeCode"
rules={[{ required: true, message: '请选择路线代码' }]} rules={[{ required: true, message: '请选择路线代码' }]}
> >
<Select style={{ marginBottom: 10 }} allowClear showSearch={true} placeholder="请选择路线代码" options={codeList?.map(v => ({ value: v, label: v })) || []} /> <Select style={{ marginBottom: 10 }} disabled={routeCodeDisabled} allowClear showSearch={true} placeholder="请选择路线代码" options={codeList?.map(v => ({ value: v, label: v })) || []} />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label="路段序号" label="路段序号"
name="sectionNo" name="sectionNo"
rules={[{ required: true, message: '请选择抽取比例' }]} rules={[{ required: true, message: '请选择路段序号' }]}
> >
<Select style={{}} allowClear showSearch={true} placeholder="请选择抽取比例" options={indexList?.map(v => ({ value: v, label: v })) || []} /> <Select style={{}} allowClear showSearch={true} disabled={sectionNoDisabled} placeholder="请选择路段序号" options={indexList?.map(v => ({ value: v, label: v })) || []} />
</Form.Item> </Form.Item>
<Form.Item label='起点地名' name='startingPlaceName'> <Form.Item label='起点地名' name='startingPlaceName'>

2
web/client/src/sections/fillion/containers/adjustLog.js

@ -141,7 +141,7 @@ const AdjustLog = (props) => {
footer={<Button onClick={() => { footer={<Button onClick={() => {
setVis(false) setVis(false)
form.resetFields() form.resetFields()
}} > 重置 </Button>} }} > 确定 </Button>}
onOk={() => { onOk={() => {
form.resetFields() form.resetFields()
setVis(false) setVis(false)

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

@ -115,7 +115,6 @@ const MaintenanceSpotCheck = (props) => {
return ( return (
<div> <div>
<div style={{ display: "flex", alignItems: 'center', justifyContent: 'space-between', marginBottom: 16 }}> <div style={{ display: "flex", alignItems: 'center', justifyContent: 'space-between', marginBottom: 16 }}>
<Button onClick={() => { <Button onClick={() => {
setVis(true) setVis(true)
@ -178,7 +177,7 @@ const MaintenanceSpotCheck = (props) => {
title: '操作', title: '操作',
key: 'action', key: 'action',
dataIndex: 'action', dataIndex: 'action',
render: (_, r) => <Button type="link" onClick={() => { render: (_, r, index) => <Button disabled={reportData[0]?.id == record?.id ? false : true} type="link" onClick={() => {
setEditData({ setEditData({
...r, alterId: r?.road?.level == '县' ? record?.countyRoadId ...r, alterId: r?.road?.level == '县' ? record?.countyRoadId
: r?.road?.level == '乡' ? record?.townshipRoadId : r?.road?.level == '乡' ? record?.townshipRoadId
@ -211,17 +210,17 @@ const MaintenanceSpotCheck = (props) => {
{ {
vis && <Modal visible={vis} onCancel={cancelHandler} title='养护抽查' onOk={() => { vis && <Modal visible={vis} onCancel={cancelHandler} title='养护抽查' onOk={() => {
dispatch(confirmRoadSpot({ previewId })).then(res => { form.validateFields().then((values) => {
if (res.success) { dispatch(confirmRoadSpot({ previewId })).then(res => {
setPage(1) if (res.success) {
setExpandedRowKeys([]) setPage(1)
queryData({ startTime: dateRange[0], endTime: dateRange[1] }) setExpandedRowKeys([])
form.resetFields() queryData({ startTime: dateRange[0], endTime: dateRange[1] })
setVis(false) form.resetFields()
} setVis(false)
}); }
});
})
}}> }}>
<Form form={form}> <Form form={form}>

Loading…
Cancel
Save