ww664853070 2 years ago
parent
commit
751f5bb858
  1. 25
      weapp/src/packages/patrol/index.jsx
  2. BIN
      web/client/assets/images/gis/pointer.png
  3. 6
      web/client/src/sections/quanju/containers/example.js
  4. 30
      web/client/src/sections/quanju/containers/footer/leadership/centerleft/hudong.js
  5. 2
      web/client/src/sections/quanju/containers/footer/leadership/left/left-center.js
  6. 77
      web/client/src/sections/quanju/containers/public/olMap.js

25
weapp/src/packages/patrol/index.jsx

@ -255,7 +255,7 @@ const Index = () => {
]) ])
}, [reportType]) }, [reportType])
function report() { function report () {
if (!canReport) { return } if (!canReport) { return }
if ( if (
(isPatrol && (!projectType || !road)) (isPatrol && (!projectType || !road))
@ -332,7 +332,7 @@ const Index = () => {
}) })
} }
function deleteReport() { function deleteReport () {
Taro.showModal({ Taro.showModal({
title: '提示', title: '提示',
content: '确定删除吗?', content: '确定删除吗?',
@ -359,7 +359,7 @@ const Index = () => {
}) })
} }
function handleInput({ detail: { value } }, type) { function handleInput ({ detail: { value } }, type) {
switch (type) { switch (type) {
case 'roadSectionStart': case 'roadSectionStart':
setRoadSectionStart(value) setRoadSectionStart(value)
@ -394,15 +394,15 @@ const Index = () => {
} }
} }
function handleTypeChange(e) { function handleTypeChange (e) {
setReportType(e.detail.value) setReportType(e.detail.value)
} }
function handleImgChange(files, operationType, index, type) { function handleImgChange (files, operationType, index, type) {
if (operationType === 'remove') { if (operationType === 'remove') {
setImg(false) setImg(false)
} }
function setImg(isAdd, url) { function setImg (isAdd, url) {
switch (type) { switch (type) {
case 'scenePic': case 'scenePic':
let nextImg = sceneImg let nextImg = sceneImg
@ -502,12 +502,12 @@ const Index = () => {
} }
} }
function handleImgClick(index, file) { function handleImgClick (index, file) {
Taro.previewImage({ Taro.previewImage({
urls: [file.url] // http urls: [file.url] // http
}) })
} }
function handleImgClicks(index, file) { function handleImgClicks (index, file) {
Taro.previewImage({ Taro.previewImage({
urls: [file] // http urls: [file] // http
}) })
@ -529,7 +529,7 @@ const Index = () => {
} }
} }
}, [road]) }, [road])
function handleOk() { function handleOk () {
if (!canReport) { return } if (!canReport) { return }
let str = handleCenter.trim() let str = handleCenter.trim()
if (!str) { if (!str) {
@ -574,14 +574,14 @@ const Index = () => {
} }
}) })
} }
function addVideo() { function addVideo () {
wx.chooseMedia({ wx.chooseMedia({
count: 1, count: 1,
mediaType: ['video'], mediaType: ['video'],
sourceType: ['album', 'camera'], sourceType: ['album', 'camera'],
maxDuration: 15, maxDuration: 15,
camera: 'back', camera: 'back',
success(res) { success (res) {
const tempFilePaths = res.tempFiles[0].tempFilePath const tempFilePaths = res.tempFiles[0].tempFilePath
let token = getState('token') || Taro.getStorageSync('token') let token = getState('token') || Taro.getStorageSync('token')
if (res.tempFiles[0].duration < 15) { if (res.tempFiles[0].duration < 15) {
@ -947,7 +947,8 @@ const Index = () => {
<AtButton type='primary' className='sub-btn' onClick={report}>上报</AtButton> <AtButton type='primary' className='sub-btn' onClick={report}>上报</AtButton>
} }
{ {
handleType == '已处理' || wait == 'wait' || handle == 'handle' ? <view> // handleType == '' ||
wait == 'wait' || handle == 'handle' ? <view>
<view className='patrol-img'><text style={{ color: 'red' }}>*</text>处理内容</view> <view className='patrol-img'><text style={{ color: 'red' }}>*</text>处理内容</view>
<AtTextarea <AtTextarea
title='处理内容:' title='处理内容:'

BIN
web/client/assets/images/gis/pointer.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

6
web/client/src/sections/quanju/containers/example.js

@ -24,7 +24,7 @@ const Example = (props) => {
console.log(tab); console.log(tab);
if (tab === 'conserve') { if (tab === 'conserve') {
dispatch(getReportList({ dispatch(getReportList({
reportType: 'patrol', reportType: 'conserve',
isTop: true isTop: true
})).then(res => { })).then(res => {
console.log(res); console.log(res);
@ -32,6 +32,8 @@ const Example = (props) => {
setPatrolList(res.payload.data || []) setPatrolList(res.payload.data || [])
} }
}) })
}
if (tab === 'build') {
dispatch(getReportList({ dispatch(getReportList({
reportType: 'road', reportType: 'road',
isTop: true isTop: true
@ -56,7 +58,7 @@ const Example = (props) => {
</div> </div>
<div style={{ position: 'absolute', width: "100%", height: "90%" }}> <div style={{ position: 'absolute', width: "100%", height: "90%" }}>
{/* <Gis tabKey={tabKey} /> */} {/* <Gis tabKey={tabKey} /> */}
<OlMap patrolList={patrolList} roadProjectList={roadProjectList} /> <OlMap patrolList={patrolList} roadProjectList={roadProjectList} tab={tabKey} />
<Footer tabKey={tabKey} dispatch={dispatch} /> <Footer tabKey={tabKey} dispatch={dispatch} />
</div> </div>
</div> </div>

30
web/client/src/sections/quanju/containers/footer/leadership/centerleft/hudong.js

@ -2,7 +2,7 @@ import { values } from 'lodash';
import React, { Component } from 'react'; import React, { Component } from 'react';
import './conter.less'; import './conter.less';
class ReactCarousel extends Component { class ReactCarousel extends Component {
chunk(arr, size) { chunk (arr, size) {
var arr1 = new Array(); var arr1 = new Array();
for (var i = 0; i < Math.ceil(arr.length / size); i++) { for (var i = 0; i < Math.ceil(arr.length / size); i++) {
arr1[i] = new Array(); arr1[i] = new Array();
@ -45,7 +45,7 @@ class ReactCarousel extends Component {
// arr1: "" // arr1: ""
dizhi: localStorage.getItem("qndmn") dizhi: localStorage.getItem("qndmn")
} }
// console.log(this.state.imgs); console.log(this.props.shuzu);
this.state.imgs = this.props.shuzu.filter((item) => { this.state.imgs = this.props.shuzu.filter((item) => {
return item.imgs !== "" return item.imgs !== ""
}) })
@ -53,7 +53,7 @@ class ReactCarousel extends Component {
} }
render() { render () {
return ( return (
<div className="ReactCarousel" style={{ width: "100%", height: "100%" }}> <div className="ReactCarousel" style={{ width: "100%", height: "100%" }}>
<div className="contain" <div className="contain"
@ -61,15 +61,27 @@ class ReactCarousel extends Component {
onMouseLeave={() => { this.start() }} //鼠标退出自动播放 onMouseLeave={() => { this.start() }} //鼠标退出自动播放
> >
<ul className="ul"> <ul className="ul" style={{ paddingInlineStart: 0 }}>
{ {
this.state.imgs.map((value, index) => { this.state.imgs.map((value, index) => {
return ( return (
<li style={{ position: "relative", width: "100%", height: "100%", top: "-5%", fontSize: "12px" }} className={index === this.state.showIndex ? 'show' : ''} <li style={{
// position: "relative",
width: "100%", height: "100%",
// top: "-5%",
fontSize: "12px"
}} className={index === this.state.showIndex ? 'show' : ''}
key={index} key={index}
> >
<div style={{ width: "100%", height: "80%", position: "absolute", top: "10%", right: "5%" }}> <div style={{
<img src={this.state.dizhi + "/" + value.imgs} style={{ width: "100%", height: "100%", marginLeft: "3%", marginRight: "3%" }} /> width: "100%", height: "80%",
// position: "absolute", top: "10%", right: "5%"
}}>
<img src={this.state.dizhi + "/" + value.imgs} style={{
// width: "100%", height: "100%",
width: 140, height: 140,
marginLeft: "3%", marginRight: "3%"
}} />
</div> </div>
</li> </li>
@ -101,11 +113,11 @@ class ReactCarousel extends Component {
</div > </div >
) )
} }
componentDidMount() { //一开始自动播放 componentDidMount () { //一开始自动播放
this.start(); this.start();
} }
componentWillUnmount() { //销毁前清除定时器 componentWillUnmount () { //销毁前清除定时器
this.stop(); this.stop();
} }
stop = () => { //暂停 stop = () => { //暂停

2
web/client/src/sections/quanju/containers/footer/leadership/left/left-center.js

@ -36,7 +36,7 @@ const Leftcenter = ({ videoCenterList }) => {
setNum(num + 1); setNum(num + 1);
// setTu(list[num].img); // setTu(list[num].img);
} }
}, 2000 * 10); }, 1000 * 60 * 5);
return () => clearInterval(timer); return () => clearInterval(timer);
}, [num]); }, [num]);

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

@ -6,14 +6,20 @@ import moment from 'moment';
import { OlMapRequest } from '$utils' import { OlMapRequest } from '$utils'
const OlMap = (props) => { const OlMap = (props) => {
const { dispatch, actions, user, olMapArcgisHost, olMapGeoDataHost, patrolList, roadProjectList } = props const { dispatch, actions, user, olMapArcgisHost, olMapGeoDataHost, patrolList, roadProjectList, tab } = props
const [olMapOpenData, setOlMapOpenData] = useState([]) const [olMapOpenData, setOlMapOpenData] = useState([])
const [olMap, setOlMap] = useState() const [olMap, setOlMap] = useState()
const [pointItem, setPointItem] = useState({}) const [pointItem, setPointItem] = useState({})
useEffect(() => { useEffect(() => {
setOlMapOpenData([])
}, []) setPointItem({})
if (olMap) {
olMap.closeOverlay('clickOpen')
olMap.closeOverlay('pointClickOpen')
olMap.removeGeometryLayer('geometry0')
}
}, [tab])
useEffect(() => { useEffect(() => {
if (olMapGeoDataHost) { if (olMapGeoDataHost) {
@ -148,7 +154,11 @@ const OlMap = (props) => {
}, [olMapGeoDataHost]) }, [olMapGeoDataHost])
useEffect(() => { useEffect(() => {
if (patrolList.length && olMap) { if (patrolList.length && olMap && tab == 'conserve') {
roadProjectList.forEach((d, index) => {
olMap.removeGeometryLayer('geometry_road_' + index)
})
patrolList.forEach((d, index) => { patrolList.forEach((d, index) => {
console.log(d, index); console.log(d, index);
olMap.addGeometryLayer({ olMap.addGeometryLayer({
@ -164,7 +174,7 @@ const OlMap = (props) => {
setPointItem(d) setPointItem(d)
olMap.addOverlay('pointClickOpen', { olMap.addOverlay('pointClickOpen', {
id: 'pointClickOpen', id: 'pointClickOpen',
offset: [0, 25], // 偏移 offset: [0, 4], // 偏移
position: [d.longitude, d.latitude], // 坐标 position: [d.longitude, d.latitude], // 坐标
autoPan: true, autoPan: true,
autoPanMargin: 100, autoPanMargin: 100,
@ -178,9 +188,8 @@ const OlMap = (props) => {
], ],
style: { style: {
icon: { icon: {
src: '/assets/images/worker.png', src: '/assets/images/gis/pointer.png',
// anchor: [0.5, 1], scale: 1, // 图标引用
scale: 0.08, // 图标引用
}, },
// stroke: { width: 1, color: '#ffff00' }, // stroke: { width: 1, color: '#ffff00' },
// circle: { // circle: {
@ -191,9 +200,8 @@ const OlMap = (props) => {
}, },
selectStyle: { selectStyle: {
icon: { icon: {
src: '/assets/images/worker.png', src: '/assets/images/gis/pointer.png',
// anchor: [0.5, 1], scale: 1, // 图标引用
scale: 0.08, // 图标引用
}, },
// circle: { // circle: {
// radius: 16, // 直径 // radius: 16, // 直径
@ -206,10 +214,14 @@ const OlMap = (props) => {
}); });
}); });
} }
}, [patrolList, olMap]) }, [patrolList, olMap, tab])
useEffect(() => { useEffect(() => {
if (roadProjectList.length && olMap) { if (roadProjectList.length && olMap && tab == 'build') {
patrolList.forEach((d, index) => {
olMap.removeGeometryLayer('geometry_patrol_' + index)
})
roadProjectList.forEach((d, index) => { roadProjectList.forEach((d, index) => {
olMap.addGeometryLayer({ olMap.addGeometryLayer({
features: [ features: [
@ -224,7 +236,7 @@ const OlMap = (props) => {
setPointItem(d) setPointItem(d)
olMap.addOverlay('pointClickOpen', { olMap.addOverlay('pointClickOpen', {
id: 'pointClickOpen', id: 'pointClickOpen',
offset: [0, 25], // 偏移 offset: [0, 4], // 偏移
position: [d.longitude, d.latitude], // 坐标 position: [d.longitude, d.latitude], // 坐标
// position: [115.944220000000, 28.545380000000], // position: [115.944220000000, 28.545380000000],
autoPan: true, autoPan: true,
@ -240,21 +252,21 @@ const OlMap = (props) => {
], ],
style: { style: {
icon: { icon: {
src: '/assets/images/worker.png', src: '/assets/images/gis/pointer.png',
scale: 0.08, // 图标引用 scale: 1, // 图标引用
}, },
}, },
selectStyle: { selectStyle: {
icon: { icon: {
src: '/assets/images/worker.png', src: '/assets/images/gis/pointer.png',
scale: 0.08, // 图标引用 scale: 1, // 图标引用
}, },
}, },
layerName: 'geometry_road_' + index layerName: 'geometry_road_' + index
}); });
}); });
} }
}, [roadProjectList, olMap]) }, [roadProjectList, olMap, tab])
const isRoadProject = pointItem.report_type == 'road' const isRoadProject = pointItem.report_type == 'road'
return ( return (
@ -301,16 +313,23 @@ const OlMap = (props) => {
<div style={{ width: "50%", height: "100%", }}> <div style={{ width: "50%", height: "100%", }}>
{ {
pointItem.id ? pointItem.id ?
<Hua shuzu={[{ <Hua key={pointItem.id} shuzu={
"imgs": pointItem.conserve_after_pic ? isRoadProject ?
pointItem.conserve_after_pic[0] : "" [{
}, { "imgs": pointItem.scene_pic && pointItem.scene_pic.length ?
"imgs": pointItem.conserve_before_pic ? pointItem.scene_pic[0] : ""
pointItem.conserve_before_pic[0] : "" }] :
}, { [{
"imgs": pointItem.conserve_underway_pic ? "imgs": pointItem.conserve_after_pic ?
pointItem.conserve_underway_pic[0] : "" pointItem.conserve_after_pic[0] : ""
}]} /> }, {
"imgs": pointItem.conserve_before_pic ?
pointItem.conserve_before_pic[0] : ""
}, {
"imgs": pointItem.conserve_underway_pic ?
pointItem.conserve_underway_pic[0] : ""
}]}
/>
: '' : ''
} }
</div> </div>

Loading…
Cancel
Save