dengyinhuan 1 year ago
parent
commit
625c260879
  1. 1
      api/app/lib/controllers/data/vehicle.js
  2. 2
      api/app/lib/models/report.js
  3. 4
      scripts/1.3.0/schema/6.update_report.sql
  4. 9
      scripts/1.3.1/schema/4.update_report.sql
  5. 10
      web/client/src/sections/fillion/components/bridgeTable.js
  6. 7
      web/client/src/sections/fillion/components/highwaysTable.js
  7. 23
      web/client/src/sections/fillion/components/transportationTable.js
  8. 4
      web/client/src/sections/quanju/containers/footer/leadership/centerleft/daolu.js
  9. 14
      web/client/src/sections/quanju/containers/footer/leadership/centerleft/top.js
  10. 81
      web/client/src/sections/quanju/containers/footer/operation/right.js
  11. 132
      web/client/src/sections/quanju/containers/public/olMap.js

1
api/app/lib/controllers/data/vehicle.js

@ -26,7 +26,6 @@ async function get(ctx) {
} }
} }
const vehicleRes = await models.Statistic.findAll(findOption) const vehicleRes = await models.Statistic.findAll(findOption)
console.log('vehicleRes', vehicleRes)
ctx.status = 200; ctx.status = 200;
ctx.body = { ctx.body = {
vehicleRes: vehicleRes.filter(item => item.dataValues.name === '标志牌' || item.dataValues.name === '养护责任牌') vehicleRes: vehicleRes.filter(item => item.dataValues.name === '标志牌' || item.dataValues.name === '养护责任牌')

2
api/app/lib/models/report.js

@ -163,7 +163,7 @@ module.exports = dc => {
handleState: { handleState: {
type: DataTypes.STRING, type: DataTypes.STRING,
allowNull: true, allowNull: true,
defaultValue: null, defaultValue: '已处理',
comment: null, comment: null,
primaryKey: false, primaryKey: false,
field: "handle_state", field: "handle_state",

4
scripts/1.3.0/schema/6.update_report.sql

@ -1,4 +0,0 @@
alter table report
add handle_opinions varchar(1024);
comment on column report.handle_opinions is '处理意见';

9
scripts/1.3.1/schema/4.update_report.sql

@ -1,6 +1,13 @@
ALTER TABLE "public"."report" ALTER TABLE "public"."report"
ADD COLUMN "handle_advice" varchar(1024); ADD COLUMN "handle_advice" varchar(1024)
add handle_opinions varchar(1024);
COMMENT ON COLUMN "public"."report"."handle_state" IS '待处理 / 已指派 / 已处理 / 不处理'; COMMENT ON COLUMN "public"."report"."handle_state" IS '待处理 / 已指派 / 已处理 / 不处理';
COMMENT ON COLUMN "public"."report"."handle_advice" IS '管理员处理意见'; COMMENT ON COLUMN "public"."report"."handle_advice" IS '管理员处理意见';
comment on column report.handle_opinions is '处理意见';

10
web/client/src/sections/fillion/components/bridgeTable.js

@ -39,6 +39,12 @@ const BrideTable = (props) => {
setDelet(res) setDelet(res)
}) })
} }
useEffect(async () => {
const res = await dispatch(getBridge())
setSmallBridge(res.payload.data?.filter(item => item.bridgeClassification === '小桥'))
setMiddleBridge(res.payload.data?.filter(item => item.bridgeClassification === '中桥'))
setBigBridge(res.payload.data?.filter(item => item.bridgeClassification === '大桥'))
}, [])
const deldatas = (id) => { // 工程 const deldatas = (id) => { // 工程
const query = { const query = {
projectId: id projectId: id
@ -1813,9 +1819,7 @@ const BrideTable = (props) => {
setRowSelected([]); setRowSelected([]);
const res = await dispatch(getBridge(query)); const res = await dispatch(getBridge(query));
// console.log(res) // console.log(res)
setSmallBridge(res.payload.data?.filter(item => item.bridgeClassification === '小桥'))
setMiddleBridge(res.payload.data?.filter(item => item.bridgeClassification === '中桥'))
setBigBridge(res.payload.data?.filter(item => item.bridgeClassification === '大桥'))
setCounts(res.payload.data) setCounts(res.payload.data)
return { return {
...res, ...res,

7
web/client/src/sections/fillion/components/highwaysTable.js

@ -91,15 +91,14 @@ const TransporTationTable = (props) => {
width: 160, width: 160,
fixed: 'right', fixed: 'right',
render: (dom, record) => { render: (dom, record) => {
console.log('record', record.id === null) return <div>{record.id !== null ? (<Button type="link"
return <div><Button type="link"
onClick={() => { onClick={() => {
hightModal('edit', record) hightModal('edit', record)
setTypecard('compile') setTypecard('compile')
setRecortd(record) setRecortd(record)
}} }}
disabled={editAble && record.id === null} disabled={editAble}
>编辑</Button></div> >编辑</Button>) : null}</div>
} }
}, },

23
web/client/src/sections/fillion/components/transportationTable.js

@ -76,6 +76,20 @@ const TransporTationTable = (props) => {
setDelet(res) setDelet(res)
}) })
} }
useEffect(async () => {
console.log('whichofits', whichofits)
let query = {}
if (whichofits === '县') {
query.level = '县'
} else if (whichofits === '乡') {
query.level = '乡'
} else if (whichofits === '村') {
query.level = '村'
}
const res = await dispatch(getRoadway(query))
const uniqueArray = [...new Set(res.payload.data?.map(item => item.routeName))];
setRoadData(uniqueArray)
}, [whichofits])
const columns = { const columns = {
tab1: [ tab1: [
{ {
@ -3823,8 +3837,7 @@ const TransporTationTable = (props) => {
} }
setRowSelected([]); setRowSelected([]);
const res = await dispatch(getRoadway(query)); const res = await dispatch(getRoadway(query));
const uniqueArray = [...new Set(res.payload.data?.map(item => item.routeName))];
setRoadData(uniqueArray)
setCounts(departmentInfo ? res.payload.data.filter((item) => { setCounts(departmentInfo ? res.payload.data.filter((item) => {
return item.townshipCode === departmentInfo.areaCode return item.townshipCode === departmentInfo.areaCode
}) : res.payload.data) }) : res.payload.data)
@ -3840,8 +3853,6 @@ const TransporTationTable = (props) => {
} }
setRowSelected([]); setRowSelected([]);
const res = await dispatch(getRoadway(query)); const res = await dispatch(getRoadway(query));
const uniqueArray = [...new Set(res.payload.data?.map(item => item.routeName))];
setRoadData(uniqueArray)
setCounts(departmentInfo ? res.payload.data.filter((item) => { setCounts(departmentInfo ? res.payload.data.filter((item) => {
return item.townshipCode === departmentInfo.areaCode return item.townshipCode === departmentInfo.areaCode
}) : res.payload.data) }) : res.payload.data)
@ -3856,8 +3867,6 @@ const TransporTationTable = (props) => {
} }
setRowSelected([]); setRowSelected([]);
const res = await dispatch(getRoadway(query)) const res = await dispatch(getRoadway(query))
const uniqueArray = [...new Set(res.payload.data?.map(item => item.routeName))];
setRoadData(uniqueArray)
setCounts(departmentInfo ? res.payload.data.filter((item) => { setCounts(departmentInfo ? res.payload.data.filter((item) => {
return item.townshipCode === departmentInfo.areaCode return item.townshipCode === departmentInfo.areaCode
}) : res.payload.data) }) : res.payload.data)
@ -3883,7 +3892,7 @@ const TransporTationTable = (props) => {
search={{ search={{
defaultCollapsed: false, defaultCollapsed: false,
optionRender: (searchConfig, formProps, dom) => [ optionRender: (searchConfig, formProps, dom) => [
<span style={{ marginRight: 20 }}>{`共有${whichofits}道:${roadData.length || 0}`}</span>, <span >{`共有${whichofits}道:${roadData.length || 0}`}</span>,
...dom.reverse(), ...dom.reverse(),
<Popconfirm title="确认导出?" onConfirm={() => { props.exports(rowSelected, grade, differentiate) }} <Popconfirm title="确认导出?" onConfirm={() => { props.exports(rowSelected, grade, differentiate) }}
disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'ROADMANAGE')[0].isshow === "true" ? true : ''} disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'ROADMANAGE')[0].isshow === "true" ? true : ''}

4
web/client/src/sections/quanju/containers/footer/leadership/centerleft/daolu.js

@ -38,6 +38,7 @@ const Right = (props) => {
// const // const
}) })
}, []) }, [])
const roadMile = 2481.2
const renderBody = () => { const renderBody = () => {
return ( return (
@ -117,8 +118,7 @@ const Right = (props) => {
</div> </div>
<div style={{ width: "96%", position: "relative", left: "2%" }}> <div style={{ width: "96%", position: "relative", left: "2%" }}>
{/* <Spin spinning={!roads} tip="Loading" > */} {/* <Spin spinning={!roads} tip="Loading" > */}
<p style={{ width: "50%", position: "absolute", color: "rgba(216,240,255,0.8)", fontSize: "18px" }}>乡村道道路<span style={{ marginLeft: "4%", fontFamily: "YouSheBiaoTiHei", fontSize: "24px", color: "#F5FCFF" }}></span>2481.2<span style={{ marginLeft: "4%" }}></span></p> <p style={{ width: "50%", position: "absolute", color: "rgba(216,240,255,0.8)", fontSize: "18px" }}>乡村道道路<span style={{ marginLeft: "4%", fontFamily: "YouSheBiaoTiHei", fontSize: "24px", color: "#F5FCFF" }}>{roadMile}</span><span style={{ marginLeft: "4%" }}></span></p>
{/* <p style={{ width: "50%", position: "absolute", color: "rgba(216,240,255,0.8)", fontSize: "18px" }}>乡村道道路<span style={{ marginLeft: "4%", fontFamily: "YouSheBiaoTiHei", fontSize: "24px", color: "#F5FCFF" }}>{isNaN((roads?.["乡"] + roads?.["村"]).toFixed(3)) ? "" : (roads?.["乡"] + roads?.["村"]).toFixed(3)}</span><span style={{ marginLeft: "4%" }}>公里</span></p> */} {/* <p style={{ width: "50%", position: "absolute", color: "rgba(216,240,255,0.8)", fontSize: "18px" }}>乡村道道路<span style={{ marginLeft: "4%", fontFamily: "YouSheBiaoTiHei", fontSize: "24px", color: "#F5FCFF" }}>{isNaN((roads?.["乡"] + roads?.["村"]).toFixed(3)) ? "" : (roads?.["乡"] + roads?.["村"]).toFixed(3)}</span><span style={{ marginLeft: "4%" }}>公里</span></p> */}
<p style={{ position: "absolute", right: "0", color: "rgba(216,240,255,0.8)", top: "10px" }}>占比<span>{((2481.2 / 2689) * 100).toFixed(2)}</span><span>%</span></p> <p style={{ position: "absolute", right: "0", color: "rgba(216,240,255,0.8)", top: "10px" }}>占比<span>{((2481.2 / 2689) * 100).toFixed(2)}</span><span>%</span></p>

14
web/client/src/sections/quanju/containers/footer/leadership/centerleft/top.js

@ -28,7 +28,7 @@ const Leftcenter = (props) => {
{/* <div className={tabKey == "build" ? "tabKey-map" : "notabKey"} style={{ backgroundImage: "url(/assets/images/quanju/zuobeijing.png)", backgroundSize: "100% 100%" }} onClick={() => { {/* <div className={tabKey == "build" ? "tabKey-map" : "notabKey"} style={{ backgroundImage: "url(/assets/images/quanju/zuobeijing.png)", backgroundSize: "100% 100%" }} onClick={() => {
onClick("build") onClick("build")
}}><a>建设</a></div> */} }}><a>建设</a></div> */}
<div style={{ width: "30%", height: "10vh", backgroundColor: "", position: "relative", left: "2%", top: "100%" }} onClick={() => { <div style={{ width: "35%", height: "10vh", backgroundColor: "", position: "relative", left: "10%", top: "100%" }} onClick={() => {
onClick("daolu") onClick("daolu")
}} > }} >
{ {
@ -37,14 +37,14 @@ const Leftcenter = (props) => {
<div style={{ width: "50%", height: "100%", position: "absolute", left: "17%", top: "23%" }}> <div style={{ width: "50%", height: "100%", position: "absolute", left: "17%", top: "23%" }}>
<img src='/assets/images/leadership/lu.png' style={{ width: "50%" }} /> <img src='/assets/images/leadership/lu.png' style={{ width: "50%" }} />
</div> </div>
<div style={{ width: "50%", height: "100%", position: "absolute", left: "50%", top: "11%" }}> <div style={{ width: "60%", height: "100%", position: "absolute", left: "50%", top: "11%" }}>
<p style={{ fontFamily: "YouSheBiaoTiHei", color: "#ffffff", fontSize: "2.5vh", marginTop: "-2%" }}>2689</p>
<p style={{ fontSize: "2vh", color: "#D8F0FF", fontFamily: "PingFangSC-Regular, PingFang SC", marginTop: "3%" }}>道路统计<span style={{ marginLeft: "10px", color: "rgba(216,240,255,0.8000)" }}>公里</span></p> <p style={{ fontSize: "2vh", color: "#D8F0FF", fontFamily: "PingFangSC-Regular, PingFang SC", marginTop: "3%" }}>道路统计<span style={{ marginLeft: "10px", color: "rgba(216,240,255,0.8000)" }}>公里</span></p>
{/* <p style={{ fontFamily: "YouSheBiaoTiHei", color: "#ffffff", fontSize: "2.5vh", marginTop: "-2%" }}>{isNaN((list?.["县"] + list?.["乡"] + list?.["村"]).toFixed(3)) ? "" : (list?.["县"] + list?.["乡"] + list?.["村"]).toFixed(3)}</p> */} {/* <p style={{ fontFamily: "YouSheBiaoTiHei", color: "#ffffff", fontSize: "2.5vh", marginTop: "-2%" }}>{isNaN((list?.["县"] + list?.["乡"] + list?.["村"]).toFixed(3)) ? "" : (list?.["县"] + list?.["乡"] + list?.["村"]).toFixed(3)}</p> */}
<p style={{ fontFamily: "YouSheBiaoTiHei", color: "#ffffff", fontSize: "2.5vh", marginTop: "-2%" }}>2689</p>
</div> </div>
</div> </div>
<div style={{ width: "30%", height: "10vh", backgroundColor: "", position: "relative", left: "35%", top: "-105%" }} onClick={() => { {/* <div style={{ width: "30%", height: "10vh", backgroundColor: "", position: "relative", left: "35%", top: "-105%" }} onClick={() => {
onClick("handong") onClick("handong")
}} > }} >
{ {
@ -57,8 +57,8 @@ const Leftcenter = (props) => {
<p style={{ fontSize: "2vh", color: "#D8F0FF", fontFamily: "PingFangSC-Regular, PingFang SC", marginTop: "3%" }}>涵洞统计<span style={{ fontSize: "14px", marginLeft: "10px", color: "rgba(216,240,255,0.8000)" }}></span></p> <p style={{ fontSize: "2vh", color: "#D8F0FF", fontFamily: "PingFangSC-Regular, PingFang SC", marginTop: "3%" }}>涵洞统计<span style={{ fontSize: "14px", marginLeft: "10px", color: "rgba(216,240,255,0.8000)" }}></span></p>
<p style={{ fontFamily: "YouSheBiaoTiHei", color: "#24FFEE", fontSize: "2.5vh" }}>{isNaN((culvert?.["县"] + culvert?.["乡"] + culvert?.["村"]).toFixed(0)) ? "" : (culvert?.["县"] + culvert?.["乡"] + culvert?.["村"]).toFixed(0)}</p> <p style={{ fontFamily: "YouSheBiaoTiHei", color: "#24FFEE", fontSize: "2.5vh" }}>{isNaN((culvert?.["县"] + culvert?.["乡"] + culvert?.["村"]).toFixed(0)) ? "" : (culvert?.["县"] + culvert?.["乡"] + culvert?.["村"]).toFixed(0)}</p>
</div> </div>
</div> </div> */}
<div style={{ width: "30%", height: "10vh", backgroundColor: "", position: "relative", left: "68%", top: "-315%" }} onClick={() => { <div style={{ width: "35%", height: "10vh", backgroundColor: "", position: "relative", left: "55%", top: "-100%" }} onClick={() => {
onClick("qiaoliang") onClick("qiaoliang")
}} > }} >
{ {
@ -68,8 +68,8 @@ const Leftcenter = (props) => {
<img src='/assets/images/leadership/qiao.png' style={{ width: "50%" }} /> <img src='/assets/images/leadership/qiao.png' style={{ width: "50%" }} />
</div> </div>
<div style={{ width: "50%", height: "100%", position: "absolute", left: "50%", top: "8%" }}> <div style={{ width: "50%", height: "100%", position: "absolute", left: "50%", top: "8%" }}>
<p style={{ fontSize: "2vh", color: "#D8F0FF", fontFamily: "PingFangSC-Regular, PingFang SC", marginTop: "3%" }}>桥梁统计<span style={{ fontSize: "14px", marginLeft: "10px", color: "rgba(216,240,255,0.8000)" }}></span></p>
<p style={{ fontFamily: "YouSheBiaoTiHei", color: "#00F1FF", fontSize: "2.5vh", marginTop: "-2%" }}>165</p> <p style={{ fontFamily: "YouSheBiaoTiHei", color: "#00F1FF", fontSize: "2.5vh", marginTop: "-2%" }}>165</p>
<p style={{ fontSize: "2vh", color: "#D8F0FF", fontFamily: "PingFangSC-Regular, PingFang SC", marginTop: "3%" }}>桥梁统计<span style={{ marginLeft: "10px", color: "rgba(216,240,255,0.8000)" }}></span></p>
{/* <p style={{ fontFamily: "YouSheBiaoTiHei", color: "#00F1FF", fontSize: "2.5vh", marginTop: "-2%" }}>{isNaN((bridge?.["小桥"] + bridge?.["中桥"] + bridge?.["大桥"])) ? "" : (bridge?.["小桥"] + bridge?.["中桥"] + bridge?.["大桥"])}</p> */} {/* <p style={{ fontFamily: "YouSheBiaoTiHei", color: "#00F1FF", fontSize: "2.5vh", marginTop: "-2%" }}>{isNaN((bridge?.["小桥"] + bridge?.["中桥"] + bridge?.["大桥"])) ? "" : (bridge?.["小桥"] + bridge?.["中桥"] + bridge?.["大桥"])}</p> */}
</div> </div>

81
web/client/src/sections/quanju/containers/footer/operation/right.js

@ -30,16 +30,55 @@ const Right = ({ busRunTime }) => {
const [queryStr, setQueryStr] = useState('') const [queryStr, setQueryStr] = useState('')
useEffect(() => { useEffect(() => {
setBusRunTimeList( let repeatCarNo = []
queryStr ? let nextBusRunList = queryStr ?
busRunTime.filter(b => { busRunTime.filter(b => {
return b?.busNoChar?.indexOf(queryStr) > -1 let queryMatch = b?.busNoChar?.indexOf(queryStr) > -1
if (repeatCarNo.some(c => c == b.busNoChar.trim())) {
return false
} else {
repeatCarNo.push(b.busNoChar.trim())
return queryMatch && true
}
}) })
: busRunTime : busRunTime.filter(b => {
) if (repeatCarNo.some(c => c == b.busNoChar.trim())) {
return false
} else {
repeatCarNo.push(b.busNoChar.trim())
return true
}
})
console.log(nextBusRunList);
setBusRunTimeList(nextBusRunList)
}, [queryStr, busRunTime]) }, [queryStr, busRunTime])
const style = { height: "97%", marginTop: "3%" } const style = { height: "97%", marginTop: "3%" }
const carouselContent = busRunTimeList.map((d, index) => {
return (
<div key={index} style={{ width: '100%', height: '40%' }}>
<div className='busInformation'>
<img src='/assets/images/quanju/theBus.png' style={{ width: '15%', display: 'block', float: 'left' }} />
<span>
<h3>车辆牌照</h3>
<h5>{d.busNoChar}</h5>
<h3>调度状态</h3>
<h4>{busWillRun.find(w => w.value == d.willRun)?.text || '--'}</h4>
</span>
<span>
<h3>发车时间</h3>
<h5>{d.lastDepTime}</h5>
</span>
<span style={{ position: 'relative', left: '21%' }}>
<h3>司机</h3>
<h5>{d.employeeName}</h5>
<h3>工号</h3>
<h4>{d.opNo}</h4>
</span>
</div>
</div>
)
})
return ( return (
<div style={{ position: 'absolute', right: 0, width: "23%", height: "100%", marginRight: "1%", }}> <div style={{ position: 'absolute', right: 0, width: "23%", height: "100%", marginRight: "1%", }}>
<Module style={style} customize={true} <Module style={style} customize={true}
@ -70,6 +109,8 @@ const Right = ({ busRunTime }) => {
/> />
</div> </div>
{
carouselContent.length > 3 ?
<Carousel <Carousel
autoplay autoplay
infinite infinite
@ -79,31 +120,7 @@ const Right = ({ busRunTime }) => {
slidesToShow={4} slidesToShow={4}
> >
{ {
busRunTimeList.map((d, index) => { carouselContent
return (
<div key={index} style={{ width: '100%', height: '40%' }}>
<div className='busInformation'>
<img src='/assets/images/quanju/theBus.png' style={{ width: '15%', display: 'block', float: 'left' }} />
<span>
<h3>车辆牌照</h3>
<h5>{d.busNoChar}</h5>
<h3>调度状态</h3>
<h4>{busWillRun.find(w => w.value == d.willRun)?.text || '--'}</h4>
</span>
<span>
<h3>发车时间</h3>
<h5>{d.lastDepTime}</h5>
</span>
<span style={{ position: 'relative', left: '21%' }}>
<h3>司机</h3>
<h5>{d.employeeName}</h5>
<h3>工号</h3>
<h4>{d.opNo}</h4>
</span>
</div>
</div>
)
})
} }
{/* { {/* {
dataLists.map((data, index) => ( dataLists.map((data, index) => (
@ -135,6 +152,10 @@ const Right = ({ busRunTime }) => {
)) ))
} */} } */}
</Carousel> </Carousel>
:
carouselContent
}
</div> </div>
</Module> </Module>
</div> </div>

132
web/client/src/sections/quanju/containers/public/olMap.js

@ -4,6 +4,7 @@ import request from 'superagent'
import Hua from '../footer/leadership/centerleft/hudong' import Hua from '../footer/leadership/centerleft/hudong'
import moment from 'moment'; import moment from 'moment';
import { OlMapRequest } from '$utils' import { OlMapRequest } from '$utils'
import { useRef } from 'react';
export const busWillRun = [ export const busWillRun = [
{ text: '非运营', value: '0' }, { text: '非运营', value: '0' },
@ -17,16 +18,25 @@ export const busWillRun = [
{ text: '检车', value: '8' }, { text: '检车', value: '8' },
] ]
const codeMap = {
x: 'gpsxd',
y: 'gpsyd',
c: 'gpscd',
}
const OlMap = (props) => { const OlMap = (props) => {
const { dispatch, actions, user, olMapArcgisHost, olMapGeoDataHost, patrolList, roadProjectList, tab, busRunTime, busLine } = props const { dispatch, actions, user, olMapArcgisHost, olMapGeoDataHost, patrolList, roadProjectList, tab, busRunTime, busLine, projectList } = props
const [olMapOpenData, setOlMapOpenData] = useState([]) const [olMapOpenData, setOlMapOpenData] = useState([])
const [olMap, setOlMap] = useState() const [olMap, setOlMap] = useState()
const [curClickCoordinate, setCurClickCoordinate] = useState([])
const [pointItem, setPointItem] = useState({}) const [pointItem, setPointItem] = useState({})
// //
const [busRunData, setBusRunData] = useState([]) const [busRunData, setBusRunData] = useState([])
//
const curTab = useRef(tab)
useEffect(() => { useEffect(() => {
curTab.current = tab
setOlMapOpenData([]) setOlMapOpenData([])
setPointItem({}) setPointItem({})
if (olMap) { if (olMap) {
@ -79,6 +89,10 @@ const OlMap = (props) => {
olMapTool.closeOverlay('pointClickOpen') olMapTool.closeOverlay('pointClickOpen')
olMapTool.removeGeometryLayer('geometry0') olMapTool.removeGeometryLayer('geometry0')
setCurClickCoordinate(p.coordinate)
if (curTab.current == 'build') {
return
}
// 请求路线坐标 // 请求路线坐标
request.post(`${olMapGeoDataHost || 'http://36.2.6.32:8811'}/geoserver-pg/rest/bufferSearch`) request.post(`${olMapGeoDataHost || 'http://36.2.6.32:8811'}/geoserver-pg/rest/bufferSearch`)
.type('form') .type('form')
@ -201,11 +215,6 @@ const OlMap = (props) => {
}) })
// 请求路线坐标 // 请求路线坐标
if (d.code_road) { if (d.code_road) {
let codeMap = {
x: 'gpsxd',
y: 'gpsyd',
c: 'gpscd',
}
let roadCodeStart = d.code_road[0] let roadCodeStart = d.code_road[0]
let layerName = codeMap[roadCodeStart.toLowerCase()] let layerName = codeMap[roadCodeStart.toLowerCase()]
if (layerName) { if (layerName) {
@ -425,6 +434,11 @@ const OlMap = (props) => {
useEffect(() => { useEffect(() => {
if (busLine && olMap && tab == 'operation') { if (busLine && olMap && tab == 'operation') {
if (busLine.length) {
olMap.closeOverlay('clickOpen')
busRunData.forEach((d, index) => {
olMap.removeGeometryLayer('geometry_bus_' + index)
})
olMap.addGeometryLayer({ olMap.addGeometryLayer({
features: [ features: [
{ {
@ -444,15 +458,11 @@ const OlMap = (props) => {
selectStyle: { stroke: { width: 8, color: '#9933FF' } }, selectStyle: { stroke: { width: 8, color: '#9933FF' } },
layerName: 'geometry_bus_line' layerName: 'geometry_bus_line'
}); });
if (busLine.length) {
olMap.closeOverlay('clickOpen')
olMap.setCenter([ olMap.setCenter([
(busLine[0].pointLng + busLine[busLine.length - 1].pointLng) / 2, (busLine[0].pointLng + busLine[busLine.length - 1].pointLng) / 2,
(busLine[0].pointLat + busLine[busLine.length - 1].pointLat) / 2 (busLine[0].pointLat + busLine[busLine.length - 1].pointLat) / 2
]) ])
busRunData.forEach((d, index) => {
olMap.removeGeometryLayer('geometry_bus_' + index)
})
} else { } else {
drawBusRunPoint() drawBusRunPoint()
} }
@ -461,6 +471,103 @@ const OlMap = (props) => {
} }
}, [busLine, olMap, tab]) }, [busLine, olMap, tab])
useEffect(async () => {
if (olMap) {
if (tab == 'build') {
const roadRes = await Promise.all(projectList.map((d, index) => {
let roadCodeStart = d.roadCodeStart ? d.roadCodeStart[0] : 'N'
let layerName = codeMap[roadCodeStart.toLowerCase()]
if (layerName) {
return request.post(`${olMapGeoDataHost || 'http://36.2.6.32:8811'}/geoserver-pg/rest/search`)
.type('form')
.send({
params: `{"layerName":"${layerName}","filter":"(roadcode = '${d.roadCodeStart}')","spatialFilter":"","isReturnGeometry":"true","orderByFields":"roadcode, roadstart asc","spatialRel":"INTERSECTS","pageNum":1,"pageSize":99}`
})
} else {
return new Promise(resolve => setTimeout(() => resolve(), 0));
}
}))
let renderIndex = 0
for (let res of roadRes) {
if (res) {
if (res.status == 200 && res.body && res.body.code == 1) {
const data = res.body.data
const { datalist } = data
if (datalist?.list?.length) {
let dataIndex = 0
for (let d of datalist.list) {
const corData = projectList[renderIndex]
olMap.addGeometryJMLayer({
features: [
{
geometry: d.shape,
geometryType: 'LineString',
// geometryType: 'Point',
attributes: {
callbackParams: {},
callback: (p, x) => {
let extent = p?.selected[0]?.values_?.geometry?.flatCoordinates
let coordinate = []
if (extent && extent.length) {
let coordinateIndex = Math.ceil((extent.length - 1) / 2)
if (coordinateIndex % 2) {
coordinateIndex -= 1
}
coordinate = [extent[coordinateIndex], extent[coordinate + 1]]
}
if (coordinate.length) {
setOlMapOpenData([{
n: '项目名称',
v: corData.entryName
}, {
n: '项目规模(公里)',
v: corData.projectMileage
}, {
n: '项目投资(万元)',
v: corData.investment
}, {
n: '业主单位',
v: corData.buildUnit,
}, {
n: '施工单位',
v: corData.constructionUnit
}, {
n: '开工日期',
v: corData.startTime ? moment(corData.startTime).format('YYYY-MM-DD') : ''
},])
olMap.addOverlay('clickOpen', {
id: 'clickOpen',
offset: [0, 4], // 偏移
position: coordinate, // 坐标
// position: [115.944220000000, 28.545380000000],
autoPan: true,
autoPanMargin: 100,
positioning: 'top-right'
})
}
}
},
},
],
style: { stroke: { width: 5, color: '#9933FF' } },
selectStyle: { stroke: { width: 8, color: '#9933FF' } },
layerName: 'geometry_build_road_' + renderIndex
});
}
}
}
}
renderIndex++
}
} else {
projectList.forEach((d, index) => {
olMap.removeGeometryLayer('geometry_build_road_' + index)
})
}
}
}, [projectList, olMap, tab])
const isRoadProject = pointItem.report_type == 'road' const isRoadProject = pointItem.report_type == 'road'
// const isBusPoint = pointItem.busNoChar // const isBusPoint = pointItem.busNoChar
return ( return (
@ -624,7 +731,7 @@ const OlMap = (props) => {
} }
function mapStateToProps (state) { function mapStateToProps (state) {
const { auth, global, busRunTime, busLine } = state; const { auth, global, busRunTime, busLine, projectList } = state;
return { return {
user: auth.user, user: auth.user,
actions: global.actions, actions: global.actions,
@ -632,6 +739,7 @@ function mapStateToProps (state) {
olMapGeoDataHost: global.olMapGeoDataHost, olMapGeoDataHost: global.olMapGeoDataHost,
busRunTime: busRunTime.data || [], busRunTime: busRunTime.data || [],
busLine: busLine.data || [], busLine: busLine.data || [],
projectList: projectList.data || []
}; };
} }

Loading…
Cancel
Save