From 372aee6c9dd0e8310df0d73297b444e64a5615fa Mon Sep 17 00:00:00 2001 From: wenlele Date: Thu, 28 Dec 2023 13:56:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=BD=E6=9F=A5=E6=9D=91=E4=B8=8D=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=E6=9D=91=E5=90=8D=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/report/index.js | 5 ++++- .../containers/maintenanceSpotCheck-new.js | 20 +------------------ 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/api/app/lib/controllers/report/index.js b/api/app/lib/controllers/report/index.js index c0446dd0..bc35f341 100644 --- a/api/app/lib/controllers/report/index.js +++ b/api/app/lib/controllers/report/index.js @@ -581,7 +581,7 @@ async function roadSpotPrepare (ctx) { }) if (lastVillage) { - let villageNnmter = 0 + let villageNnmter = 0 lastVillage.forEach(d => { if (villageNnmter < (100 - (countyPercentage == 75 ? 20 : 10))) { lastVillageRoadRoadIds = lastVillageRoadRoadIds.concat(d.villageRoadId) || [] @@ -1044,6 +1044,9 @@ async function roadSpotDetail (ctx) { ...(keyword ? { routeName: { $ilike: `%${keyword}%` } } : {}), del: false, }, + include: [{ + model: models.Village, + }] }, { model: models.RoadSpotCheckPreview, attributes: ['id'], diff --git a/web/client/src/sections/fillion/containers/maintenanceSpotCheck-new.js b/web/client/src/sections/fillion/containers/maintenanceSpotCheck-new.js index ff4e7ad9..49420d6a 100644 --- a/web/client/src/sections/fillion/containers/maintenanceSpotCheck-new.js +++ b/web/client/src/sections/fillion/containers/maintenanceSpotCheck-new.js @@ -52,25 +52,7 @@ const MaintenanceSpotCheck = (props) => { { title: "银三角管委会", value: "360121471000" }, { title: "幽兰镇", value: "360121104000" }, ] - const [village, setVillage] = useState() - useEffect(() => { - const fetchData = async () => { - try { - const res = await dispatch(getVillageList({})) - let data = res.payload.data - // console.log(data) - data.map(s => { - setVillage(s) - }) - } catch (error) { - console.error(error) - } - } - - fetchData() - }, [dispatch]) - // console.log(village) const columns = [ { title: '抽查日期', @@ -238,7 +220,7 @@ const MaintenanceSpotCheck = (props) => { } } }, - { title: '所属行政村', key: 'villageId', dataIndex: 'villageId', render: (_, r) => r.road?.villageId === village.id ? village.name : '--' }, + { title: '所属行政村', key: 'villageId', dataIndex: 'villageId', render: (_, r) => r.road?.village?.name || '--' }, { 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 || '--' },