From 2968aee7d969143500539e00bbda17305654e1df Mon Sep 17 00:00:00 2001 From: wenlele Date: Wed, 13 Dec 2023 15:42:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=BB=E6=8A=A4=E6=8A=BD=E6=9F=A5=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/report/index.js | 6 +- .../sections/fillion/components/adjustment.js | 75 ++++++++++++++----- .../sections/fillion/containers/adjustLog.js | 2 +- .../containers/maintenanceSpotCheck-new.js | 25 +++---- 4 files changed, 73 insertions(+), 35 deletions(-) diff --git a/api/app/lib/controllers/report/index.js b/api/app/lib/controllers/report/index.js index 3d44b7d3..bdf26de6 100644 --- a/api/app/lib/controllers/report/index.js +++ b/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, } }) diff --git a/web/client/src/sections/fillion/components/adjustment.js b/web/client/src/sections/fillion/components/adjustment.js index 8f7051ee..bd557ca1 100644 --- a/web/client/src/sections/fillion/components/adjustment.js +++ b/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 ( { @@ -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: '请选择路线代码' }]} > - ({ value: v, label: v })) || []} /> - ({ value: v, label: v })) || []} /> diff --git a/web/client/src/sections/fillion/containers/adjustLog.js b/web/client/src/sections/fillion/containers/adjustLog.js index f7cf8af3..359aa016 100644 --- a/web/client/src/sections/fillion/containers/adjustLog.js +++ b/web/client/src/sections/fillion/containers/adjustLog.js @@ -141,7 +141,7 @@ const AdjustLog = (props) => { footer={} + }} > 确定 } onOk={() => { form.resetFields() setVis(false) diff --git a/web/client/src/sections/fillion/containers/maintenanceSpotCheck-new.js b/web/client/src/sections/fillion/containers/maintenanceSpotCheck-new.js index 5888d1d1..d6e7759e 100644 --- a/web/client/src/sections/fillion/containers/maintenanceSpotCheck-new.js +++ b/web/client/src/sections/fillion/containers/maintenanceSpotCheck-new.js @@ -115,7 +115,6 @@ const MaintenanceSpotCheck = (props) => { return (
-