刘翔宇-旅管家 4 years ago
parent e800848904
commit 7bc6f5aec7

@ -4,3 +4,5 @@ ENV = 'development'
# base api
VUE_APP_BASE_API = ''
VUE_APP_DOMAIN=http://patrol.115.langye.net/
#VUE_APP_DOMAIN=http://192.168.60.100:9001/

@ -0,0 +1,9 @@
import request from '@/utils/request'
export function indexChart(data) {
return request({
url: '/api/admin/other/statistic',
method: 'get',
params:data
})
}

@ -10,7 +10,8 @@
<app-main />
</el-scrollbar>
</div>
</div>
</div>
</template>
<script>

@ -40,11 +40,6 @@ export const constantRoutes = [{
path: '/404',
component: () => import('@/views/404'),
hidden: true
},
{
path: '/rain/inspection/maps',
component: () => import('@/views/rain/inspection/maps'),
hidden: true
},
{
path: '/',

@ -0,0 +1,149 @@
<template>
<div :class="className" :style="{height:height,width:width}" />
</template>
<script>
import echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme
import resize from './mixins/resize'
const animationDuration = 6000
export default {
mixins: [resize],
props: {
className: {
type: String,
default: 'chart'
},
width: {
type: String,
default: '100%'
},
height: {
type: String,
default: '500px'
},
chartData: {
type: Object
}
},
data() {
return {
chart: null
}
},
mounted() {
this.$nextTick(() => {
this.initChart()
})
},
watch: {
chartData: {
deep: true,
handler(val) {
this.setOptions(val)
}
}
},
beforeDestroy() {
if (!this.chart) {
return
}
this.chart.dispose()
this.chart = null
},
methods: {
initChart() {
this.chart = echarts.init(this.$el, 'macarons');
this.$nextTick(() => {
this.setOptions(this.chartData);
})
},
setOptions(chartdata) {
console.log(chartdata.xArr)
this.chart.setOption({
dataZoom: [
//x
{
startValue: 0,
endValue: 6, //
type: 'slider',
show: true,
xAxisIndex: [0],
handleSize: 0, // 2
height: 8, //
left: 50, //
right: 40, //
bottom: 31, //
handleColor: '#EFEFEF', //h
handleStyle: {
borderColor: '#409EFF',
borderWidth: '1',
shadowBlur: 2,
background: '#EFEFEF',
shadowColor: '#EFEFEF'
},
fillerColor: new echarts.graphic.LinearGradient(1, 0, 0, 0, [{
// 410
//01
offset: 0,
color: '#409EFF'
},
{
offset: 1,
color: '#409EFF'
}
]),
backgroundColor: '#EFEFEF', //
showDataShadow: false, // auto
showDetail: false, // true
handleIcon: 'M-292,322.2c-3.2,0-6.4-0.6-9.3-1.9c-2.9-1.2-5.4-2.9-7.6-5.1s-3.9-4.8-5.1-7.6c-1.3-3-1.9-6.1-1.9-9.3c0-3.2,0.6-6.4,1.9-9.3c1.2-2.9,2.9-5.4,5.1-7.6s4.8-3.9,7.6-5.1c3-1.3,6.1-1.9,9.3-1.9c3.2,0,6.4,0.6,9.3,1.9c2.9,1.2,5.4,2.9,7.6,5.1s3.9,4.8,5.1,7.6c1.3,3,1.9,6.1,1.9,9.3c0,3.2-0.6,6.4-1.9,9.3c-1.2,2.9-2.9,5.4-5.1,7.6s-4.8,3.9-7.6,5.1C-285.6,321.5-288.8,322.2-292,322.2z',
filterMode: 'filter'
}
//
// {
// type: 'inside',
// show: true,
// xAxisIndex: [0],
// start: 0, //1
// end: 50,
// },
],
grid: {
top: 10,
left: '2%',
right: '2%',
bottom: '3%',
containLabel: true
},
xAxis: [{
type: 'category',
data: chartdata.xArr,
axisTick: {
alignWithLabel: true
}
}],
yAxis: [{
type: 'value',
minInterval: 1,
axisTick: {
show: false
}
}],
series: [{
name: '数据',
type: 'bar',
stack: 'vistors',
barWidth: '60%',
data: chartdata.yArr,
animationDuration,
barMaxWidth: 20, //
}]
})
}
}
}
</script>

@ -0,0 +1,144 @@
<template>
<div :class="className" :style="{height:height,width:width}" />
</template>
<script>
import echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme
import resize from './mixins/resize'
const animationDuration = 6000
export default {
mixins: [resize],
props: {
className: {
type: String,
default: 'chart'
},
width: {
type: String,
default: '100%'
},
height: {
type: String,
default: '400px'
},
chartData: {
type: Object
}
},
data() {
return {
chart: null
}
},
mounted() {
this.$nextTick(() => {
this.initChart()
})
},
watch: {
chartData: {
deep: true,
handler(val) {
this.setOptions(val)
}
}
},
beforeDestroy() {
if (!this.chart) {
return
}
this.chart.dispose()
this.chart = null
},
methods: {
initChart() {
this.chart = echarts.init(this.$el, 'macarons');
this.setOptions(this.chartData);
},
setOptions(chartdata) {
console.log(chartdata.xArr)
this.chart.setOption({
dataZoom: [
//x
// {
// startValue: 0,
// endValue: 6, //
// type: 'slider',
// show: true,
// xAxisIndex: [0],
// // handleSize: 0, // 2
// height: 8, //
// left: 50, //
// right: 40, //
// bottom: 26, //
// handleColor: '#EFEFEF', //h
// handleStyle: {
// borderColor: '#409EFF',
// borderWidth: '1',
// shadowBlur: 2,
// background: '#EFEFEF',
// shadowColor: '#EFEFEF'
// },
// fillerColor: new echarts.graphic.LinearGradient(1, 0, 0, 0, [{
// // 410
// //01
// offset: 0,
// color: '#409EFF'
// },
// {
// offset: 1,
// color: '#409EFF'
// }
// ]),
// backgroundColor: '#EFEFEF', //
// showDataShadow: false, // auto
// showDetail: false, // true
// handleIcon: 'M-292,322.2c-3.2,0-6.4-0.6-9.3-1.9c-2.9-1.2-5.4-2.9-7.6-5.1s-3.9-4.8-5.1-7.6c-1.3-3-1.9-6.1-1.9-9.3c0-3.2,0.6-6.4,1.9-9.3c1.2-2.9,2.9-5.4,5.1-7.6s4.8-3.9,7.6-5.1c3-1.3,6.1-1.9,9.3-1.9c3.2,0,6.4,0.6,9.3,1.9c2.9,1.2,5.4,2.9,7.6,5.1s3.9,4.8,5.1,7.6c1.3,3,1.9,6.1,1.9,9.3c0,3.2-0.6,6.4-1.9,9.3c-1.2,2.9-2.9,5.4-5.1,7.6s-4.8,3.9-7.6,5.1C-285.6,321.5-288.8,322.2-292,322.2z',
// filterMode: 'filter'
// }
//
// {
// type: 'inside',
// show: true,
// xAxisIndex: [0],
// start: 0, //1
// end: 50,
// },
],
legendArr:[],
legend: {
orient: 'horizontal',
bottom: '3%',
data:chartdata.legendArr
},
tooltip: {
trigger: 'axis'
},
backgroundColor:"#fff",
grid: {
top: '3%',
left: '2%',
right: '2%',
bottom: '12%',
containLabel: true
},
xAxis: [{
type: 'category',
axisLabel: {rotate: chartdata.rotate},
data: chartdata.xArr,
}],
yAxis: [{
type: 'value',
minInterval: 1,
}],
series: chartdata.series
})
}
}
}
</script>

@ -0,0 +1,163 @@
<template>
<div :class="className" :style="{height:height,width:width}" />
</template>
<script>
import echarts from 'echarts'
require('echarts/theme/macarons') // echarts theme
import resize from './mixins/resize'
const animationDuration = 6000
export default {
mixins: [resize],
props: {
className: {
type: String,
default: 'chart'
},
width: {
type: String,
default: '100%'
},
height: {
type: String,
default: '300px'
},
chartData: {
type: Object
}
},
data() {
return {
chart: null
}
},
mounted() {
this.$nextTick(() => {
this.initChart()
})
},
watch: {
chartData: {
deep: true,
handler(val) {
this.setOptions(val)
}
}
},
beforeDestroy() {
if (!this.chart) {
return
}
this.chart.dispose()
this.chart = null
},
methods: {
initChart() {
this.chart = echarts.init(this.$el, 'macarons');
this.setOptions(this.chartData);
},
setOptions(chartdata) {
console.log(chartdata.xArr)
this.chart.setOption({
dataZoom: [
//x
// {
// startValue: 0,
// endValue: 6, //
// type: 'slider',
// show: true,
// xAxisIndex: [0],
// // handleSize: 0, // 2
// height: 8, //
// left: 50, //
// right: 40, //
// bottom: 26, //
// handleColor: '#EFEFEF', //h
// handleStyle: {
// borderColor: '#409EFF',
// borderWidth: '1',
// shadowBlur: 2,
// background: '#EFEFEF',
// shadowColor: '#EFEFEF'
// },
// fillerColor: new echarts.graphic.LinearGradient(1, 0, 0, 0, [{
// // 410
// //01
// offset: 0,
// color: '#409EFF'
// },
// {
// offset: 1,
// color: '#409EFF'
// }
// ]),
// backgroundColor: '#EFEFEF', //
// showDataShadow: false, // auto
// showDetail: false, // true
// handleIcon: 'M-292,322.2c-3.2,0-6.4-0.6-9.3-1.9c-2.9-1.2-5.4-2.9-7.6-5.1s-3.9-4.8-5.1-7.6c-1.3-3-1.9-6.1-1.9-9.3c0-3.2,0.6-6.4,1.9-9.3c1.2-2.9,2.9-5.4,5.1-7.6s4.8-3.9,7.6-5.1c3-1.3,6.1-1.9,9.3-1.9c3.2,0,6.4,0.6,9.3,1.9c2.9,1.2,5.4,2.9,7.6,5.1s3.9,4.8,5.1,7.6c1.3,3,1.9,6.1,1.9,9.3c0,3.2-0.6,6.4-1.9,9.3c-1.2,2.9-2.9,5.4-5.1,7.6s-4.8,3.9-7.6,5.1C-285.6,321.5-288.8,322.2-292,322.2z',
// filterMode: 'filter'
// }
//
// {
// type: 'inside',
// show: true,
// xAxisIndex: [0],
// start: 0, //1
// end: 50,
// },
],
legend: {
orient: 'horizontal',
bottom: '4%',
},
tooltip: {
trigger: 'item',
formatter: "{a} <br/>{b} : {c} ({d}%)"
},
grid: {
top: 0,
left: '2%',
right: '2%',
bottom: '3%',
containLabel: false
},
xAxis: [{
type: 'category',
data: chartdata.xArr,
axisLine: {
show: false //线
},
axisTick: {
show: false //
},
}],
yAxis: [{
type: 'value',
minInterval: 1,
axisLine: {
show: false //线
},
axisTick: {
show: false //
},
}],
radiusArr:[],
series: [{
name: '数据',
type: 'pie',
stack: 'vistors',
barWidth: '60%',
radius: chartdata.radiusArr,
center: ['50%', '45%'],
data: chartdata.yArr,
animationDuration
}]
})
}
}
}
</script>

@ -0,0 +1,55 @@
import { debounce } from '@/utils'
export default {
data() {
return {
$_sidebarElm: null,
$_resizeHandler: null
}
},
mounted() {
this.$_resizeHandler = debounce(() => {
if (this.chart) {
this.chart.resize()
}
}, 100)
this.$_initResizeEvent()
this.$_initSidebarResizeEvent()
},
beforeDestroy() {
this.$_destroyResizeEvent()
this.$_destroySidebarResizeEvent()
},
// to fixed bug when cached by keep-alive
// https://github.com/PanJiaChen/vue-element-admin/issues/2116
activated() {
this.$_initResizeEvent()
this.$_initSidebarResizeEvent()
},
deactivated() {
this.$_destroyResizeEvent()
this.$_destroySidebarResizeEvent()
},
methods: {
// use $_ for mixins properties
// https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential
$_initResizeEvent() {
window.addEventListener('resize', this.$_resizeHandler)
},
$_destroyResizeEvent() {
window.removeEventListener('resize', this.$_resizeHandler)
},
$_sidebarResizeHandler(e) {
if (e.propertyName === 'width') {
this.$_resizeHandler()
}
},
$_initSidebarResizeEvent() {
this.$_sidebarElm = document.getElementsByClassName('sidebar-container')[0]
this.$_sidebarElm && this.$_sidebarElm.addEventListener('transitionend', this.$_sidebarResizeHandler)
},
$_destroySidebarResizeEvent() {
this.$_sidebarElm && this.$_sidebarElm.removeEventListener('transitionend', this.$_sidebarResizeHandler)
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -1,393 +1,8 @@
<template>
<dialogShow :title="title" :is-show.sync="isShow" :width="width" style="height:500px">
<template v-slot:content style="height:500px">
<div class="wrapper">
<div class="chooseMap">
<div>
<el-radio-group v-model="showMap" @change="changeMap">
<el-radio v-for="item in mapRadioList" :label="item.id">{{item.title}}</el-radio>
</el-radio-group>
</div>
<div>
<el-checkbox-group v-model="checkList" @change="changeCheck">
<el-checkbox v-for="item in mapCheckList" :label="item.id">{{item.title}}</el-checkbox>
</el-checkbox-group>
</div>
</div>
<div class="map" id="olMap"></div>
<!-- 弹框 -->
<div ref="popup" class="popup" v-show="shopPopup">
<div class="info">
<div class="address">地址{{nowAddress}}</div>
<div class="showinfo" @click='showInfo(nowId)'>查看详情</div>
</div>
</div>
<!-- 查看详情 -->
<showRainEquipmentInfo ref="showRainEquipmentInfo"></showRainEquipmentInfo>
<showRainSiteInfo ref="showRainSiteInfo"></showRainSiteInfo>
</div>
</template>
</dialogShow>
</template>
<script>
import "ol/ol.css";
import {Tile as TileLayer,Vector as VectorLayer } from "ol/layer";
import XYZ from "ol/source/XYZ";
import {TileArcGISRest} from "ol/source"
import tilegrid from "ol/tilegrid/TileGrid"
import { defaults as defaultControls } from "ol/control";
import {get as getprojection} from "ol/proj"
import {Projection,addProjection} from "ol/proj"
import Map from "ol/Map.js";
import View from "ol/View.js";
//
import { Vector as VectorSource } from "ol/source";
import * as olProj from "ol/proj";
import {Feature, Overlay} from "ol"
import { Point } from "ol/geom";
import { Style, Fill, Stroke, Circle as sCircle } from "ol/style";
import proj4 from 'proj4'
import {CONFIGS,MAPCONFIGS} from '@/views/rain/inspection/components/config'
import showRainEquipmentInfo from '@/views/rain/inspection/components/showRainEquipmentInfo'
import showRainSiteInfo from '@/views/rain/inspection/components/showRainSiteInfo'
import dialogShow from '@/components/dialogShow'
export default {
components: {
showRainEquipmentInfo,
showRainSiteInfo,
CONFIGS,
MAPCONFIGS,
dialogShow
},
data() {
return {
title: "巡查点位",
width: "100%",
isShow: true,
map: null,
shopPopup:false,
nowAddress:"",
nowId:"",
showMap:"M2",
mapRadioList:[
{
id:"M2",
title:"天地图"
},{
id:"S1",
title:"水利图"
},{
id:"H1",
title:"河道图"
}
],
checkList:['M1','L1'],
mapCheckList:[
{
id:"M1",
title:"高清影像",
checked:true
},{
id:"L1",
title:"路网",
checked:true
}
],
configs :CONFIGS,
mapConfigs:MAPCONFIGS,
projection:"EPSG:4490",
featuresArr:[],
pointArr:[
[120.63212, 31.26249, 'suzhouas',51],
[120.63212, 30.26249, 'suzhouwown2',50],
[120.55590234876, 31.320813249765, 'suzhouwown2',49],
]
};
},
created() {
},
mounted() {
//
},
methods: {
showMap(){
this.$nextTick(function () {
this.initMap();
})
},
initMap() {
proj4.defs("EPSG:4490", '+proj=longlat +ellps=GRS80 +no_defs')
this.projection = new Projection({
code: this.mapConfigs.Map_Code,
units: this.mapConfigs.Map_units,
axisOrientation: this.mapConfigs.Map_axisOrientation,
global: this.mapConfigs.Map_global,
});
addProjection(this.projection);
let map = new Map({
target: "olMap",
view: new View({
center: this.mapConfigs.MAP_center, //
zoom: this.mapConfigs.Map_Zooms[0], //
maxZoom:this.mapConfigs.Map_Zooms[1],
minZoom:this.mapConfigs.Map_Zooms[2],
projection: this.projection,
}),
layers:[],
// interactions: defaultControls({
// doubleClickZoom: false,
// }),
});
this.map = map;
//
let url = "http://t0.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}";
url = `${url}&T=vec_c&tk=82526d64e8504a0341f775c087863825`;
let tdtLayer = new TileLayer({
title: "天地图",
id: "M2",
type: "overlay",
visible: true,
layerType: "TD地图",
opacity: 1,
source: new XYZ({
crossOrigin:'anonymous',
url: url,
projection:"EPSG:4326"
})
});
this.map.addLayer(tdtLayer);
this.ShowLayers()
this.setMarker()
this.addOverlay()
this.singleclick()
// this.map.layer2.setVisible(false)
},
//
ShowLayers() {
for (var i = 0; i < this.configs.length; i++) {
var result = this.configs[i];
if (result.layerType == "GIS地图") {
let projection = getprojection(result.projection);
let origin = [-400.0, 399.9999999999998];
let resolutions = [0.0027465820824835565,0.0013732910412417782,6.866455206208891E-4,3.4332276031044456E-4,1.7166138015522228E-4,8.583069007761114E-5,4.291534503880557E-5,2.1457672519402785E-5,1.0728836259701392E-5];
let fullExtent = [118.63622216442072, 30.12564516975147, 122.81217622965288, 32.74305227616479];
let tileGrid = new tilegrid({
tileSize: 256,
origin: origin,
extent: fullExtent,
resolutions: resolutions
});
let layer = new TileLayer({
title: result.title,
id: result.id,
type: result.type,
visible: result.visible,
layerType: result.layerType,
opacity: result.opacity,
source: new XYZ({
tileGrid: tileGrid,
url: result.url,
projection: projection
})
})
this.map.addLayer(layer);
}else {
let layer = new TileLayer({
title: result.title,
id: result.id,
type: result.type,
visible: result.visible,
layerType: result.layerType,
opacity: result.opacity,
source: new TileArcGISRest({
url: result.url,
projection: result.projection
}),
});
this.map.addLayer(layer);
}
}
},
//
setMarker() {
//
let flagLayer = new VectorLayer({
id:"pointer",
source: new VectorSource()
});
//
this.map.addLayer(flagLayer);
// feature
for (let i = 0; i < this.pointArr.length; i++) {
// featurefeature
let feature = new Feature({
geometry: new Point([this.pointArr[i][0], this.pointArr[i][1]])
});
//
feature.set('address',this.pointArr[i][2])
// ID
feature.setId(this.pointArr[i][3])
feature.setStyle(
new Style({
image: new sCircle({
fill: new Fill({
color: '#38ef7d',
}),
radius: 6,
}),
})
);
this.featuresArr.push(feature);
} // for
flagLayer.getSource().addFeatures(this.featuresArr);
},
addOverlay() {
// Overlay
let elPopup = this.$refs.popup;
this.popup = new Overlay({
element: elPopup,
positioning: "bottom-center",
stopEvent: false,
offset: [0, -20],
});
this.map.addOverlay(this.popup);
},
singleclick() {
//
this.map.on("singleclick", (e) => {
//
let feature = this.map.forEachFeatureAtPixel(
e.pixel,
(feature) => feature
);
if (feature) {
this.shopPopup = true;
//
let coordinates = feature.getGeometry().getCoordinates();
this.nowAddress = feature.get('address');
this.nowId = feature.getId()
this.popup.setPosition(coordinates);
} else {
this.shopPopup = false;
}
});
},
showInfo(id){
this.$refs.showRainEquipmentInfo.isShow = true
this.$refs.showRainEquipmentInfo.getEquipmentInfo(id)
this.$refs.showRainEquipmentInfo.infoId = id
this.$refs.showRainEquipmentInfo.formType = 'showform'
},
changeMap(val){
for(var m of this.mapRadioList){
if(val==m.id){
this.checkLayers(val,true)
}else{
this.checkLayers(m.id,false)
}
}
},
changeCheck(val){
if(val.length==0){
for(var m of this.mapCheckList){
this.checkLayers(m.id,false)
}
}else if(val.length==this.mapCheckList.length){
console.log(val)
for(var m of this.mapCheckList){
this.checkLayers(m.id,true)
}
}else{
for(var m of this.mapCheckList){
if(m.id==val[0]){
this.checkLayers(m.id,true)
}else{
this.checkLayers(m.id,false)
}
}
}
},
//
checkLayers(id, bool) {
var layers = this.map.getLayers().getArray();
for (let i = 0; i < layers.length; i++) {
if (layers[i].get("id") == id) {
if (bool) {
layers[i].setVisible(true);
}else{
layers[i].setVisible(false);
}
}
}
}
},
};
<script>
</script>
<style lang="scss" scoped>
.chooseMap{
position: absolute;
margin: 15px 20px;
// width: 350px;
background-color: #fff;
border-radius: 4px;
border: 0.8px solid hsla(0,0%,60%,.2);
z-index:99;
top: 0;
right: 0;
line-height: 40px;
// text-align: center;
padding:0 40px 0 20px;
}
.map {
width: 100vw;
height: 100vh;
}
.popup {
width: 200px;
background-color: white;
padding: 18px;
border-radius: 10px;
box-shadow: 0 0 15px rgb(177, 177, 177);
.info {
font-size: 14px;
text-align: left;
ul {
padding-left: 0;
}
.showinfo{
color:red;
cursor: pointer;
}
}
}
</style>
<style>
</style>

@ -250,15 +250,15 @@
field: "area_name",
title: "巡查片区",
type: "string",
width:180,
width:120,
align: "center"
},
{
field: "road_name",
title: "巡查道路",
type: "road_name",
width:180,
align: "center"
width:680,
align: "left"
},
{
field: "day",

@ -0,0 +1,8 @@
<template>
</template>
<script>
</script>
<style>
</style>
Loading…
Cancel
Save