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

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

@ -27,6 +27,8 @@ const Adjustment = (props) => {
const [codeList, setCodeList] = useState([]);
const [indexList, setIndexList] = 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()
return (
<Modal visible={true}
onCancel={() => {
@ -97,24 +94,66 @@ const Adjustment = (props) => {
let name = []
let code = []
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 => {
if (v.routeName && !name.includes(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)
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) {
form.setFieldsValue({
@ -144,14 +183,14 @@ const Adjustment = (props) => {
name="routeCode"
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
label="路段序号"
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 label='起点地名' name='startingPlaceName'>

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

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

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

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

Loading…
Cancel
Save