Browse Source

区域化党建地图

shibei_master
jiangyy 4 years ago
parent
commit
11d04a7738
  1. 15
      src/views/modules/visual/communityGovern/processAnalyze.vue
  2. 307
      src/views/modules/visual/communityParty/community.vue
  3. 516
      src/views/modules/visual/components/screen-map/index copy.vue
  4. 10
      src/views/modules/visual/components/screen-map/index.vue

15
src/views/modules/visual/communityGovern/processAnalyze.vue

@ -48,7 +48,7 @@
</div>
</div>
<div class="l_bottom">
<div class="bottom_label">党建单位分类统计</div>
<div class="bottom_label">近12月新增项目数</div>
<screen-echarts-frame class="echart-line"
@myChartMethod="lineInitOk"
ref="lineChart"></screen-echarts-frame>
@ -229,9 +229,16 @@ export default {
params,
(data, rspMsg) => {
this.agencyInfo = data
this.agencyInfo.latitude = 36.072227
this.agencyInfo.longitude = 120.389455
this.agencyInfo.level = 'street'
if (!data.latitude) {
this.agencyInfo.latitude = 36.072227
}
if (!data.longitude) {
this.agencyInfo.longitude = 120.389455
}
if (!data.level) {
this.agencyInfo.level = 'street'
}
},
(rspMsg, data) => {
this.$message.error(rspMsg)

307
src/views/modules/visual/communityParty/community.vue

@ -2,7 +2,8 @@
<div class="warning-box">
<cpt-card class="card-wr">
<div class="card-title">
<img class="title-icon" src="../../../../assets/img/shuju/title-tip.png" />
<img class="title-icon"
src="../../../../assets/img/shuju/title-tip.png" />
<div class="title-label">
区域化党建
</div>
@ -10,28 +11,28 @@
<div class="second-title">
<div class="second-title-label">党建单位分类统计</div>
<div class="second-select">
<el-select v-model="serviceMatter" clearable placeholder="请选择"
@change="handleSelectChange"
@clear="handleSelectChange">
<el-option
v-for="item in unitList"
:key="item.value"
:label="item.label"
:value="item.value">
<el-select v-model="serviceMatter"
clearable
placeholder="请选择"
@change="handleSelectChange"
@clear="handleSelectChange">
<el-option v-for="item in unitList"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</div>
<div class="second-select">
<el-date-picker
v-model="timeRange"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
prefix-icon="el-icon-caret-bottom"
value-format="yyyy-MM-dd HH:mm:ss"
@change="handleSelectChange"
@clear="handleSelectChange">
<el-date-picker v-model="timeRange"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
prefix-icon="el-icon-caret-bottom"
value-format="yyyy-MM-dd HH:mm:ss"
@change="handleSelectChange"
@clear="handleSelectChange">
</el-date-picker>
</div>
</div>
@ -48,22 +49,18 @@
</div>
<div class="box-right">
<div class="warning-box-bottom">
<screen-table
:headerList="headerList"
:tableData="tableData"
:visibleLoading="visibleLoading"
:operate="true"
></screen-table>
<screen-table :headerList="headerList"
:tableData="tableData"
:visibleLoading="visibleLoading"
:operate="true"></screen-table>
<div class="pagination">
<el-pagination
:current-page="pageNo"
:page-size="pageSize"
background
layout="prev, pager, next"
@size-change="pageSizeChangeHandleNew"
@current-change="pageCurrentChangeHandleNew"
:total="total"
>
<el-pagination :current-page="pageNo"
:page-size="pageSize"
background
layout="prev, pager, next"
@size-change="pageSizeChangeHandleNew"
@current-change="pageCurrentChangeHandleNew"
:total="total">
</el-pagination>
</div>
</div>
@ -75,16 +72,26 @@
<div class="box-wr">
<div class="box-left box-left-w400">
<div v-for="item in partyItem" :key="item.value" class="box-left-item">
<div v-for="item in partyItem"
:key="item.value"
class="box-left-item">
<div class="box-label">{{ item.name }}</div>
<div class="box-num" :style="'color:' + item.color">{{ item.value }}</div>
<div class="box-num"
:style="'color:' + item.color">{{ item.value }}</div>
</div>
</div>
<div class="box-right">
<div class="box-map">这是地图容器</div>
<div class="map-tips">
<div v-for="item in partyItem" :key="item.value" class="map-tips-item">
<div class="box-map">
<screen-map class="map"
ref="map"
@clickFeature="clickProject"
:showIconLayer="true"></screen-map>
</div>
<div class="map-tips">
<div v-for="item in partyItem"
:key="item.value"
class="map-tips-item">
<div class="map-tips-icon">
<img :src="item.icon" />
</div>
@ -95,10 +102,8 @@
</div>
</cpt-card>
<dialog-info
v-show="showedMoreInfo"
@close="showedMoreInfo = false"
/>
<dialog-info v-show="showedMoreInfo"
@close="showedMoreInfo = false" />
</div>
</template>
@ -108,17 +113,20 @@ import screenTable from "../components/screen-table/index";
import cptCard from "@/views/modules/visual/cpts/card";
import nextTick from "dai-js/tools/nextTick";
import dialogInfo from './dialogInfo.vue'
import screenMap from "@/views/modules/visual/components/screen-map";
export default {
name: "warning-box",
components: {
cptCard,
screenTable,
dialogInfo
dialogInfo,
screenMap
},
data() {
data () {
return {
showedMoreInfo: true,
showedMoreInfo: false,
tableLoading: false,
warningList: [],
headerList: [
@ -172,19 +180,64 @@ export default {
icon: require('../../../../assets/img/shuju/measure/qita.png')
}
],
//
isfirstInit: true,//
agencyInfo: {},//level
unitMapList: [],
unitMapList1: [
{
type: '党建楼宇',
name: '建联单位1',
latitude: 36.062227,
longitude: 120.389455,
},
{
type: '党建楼宇',
name: '建联单位2',
latitude: 36.082227,
longitude: 120.389455,
},
{
type: '机关直属部门',
name: '建联单位3',
latitude: 36.062227,
longitude: 120.379455,
},
{
type: '两新党建',
name: '建联单位4',
latitude: 36.082227,
longitude: 120.379455,
},
{
type: '辖区单位',
name: '建联单位5',
latitude: 36.092227,
longitude: 120.379455,
},
{
type: '其他',
name: '建联单位6',
latitude: 36.102227,
longitude: 120.379455,
}
],
};
},
async mounted() {
async mounted () {
const { user } = this.$store.state
this.agencyId = user.agencyId
await nextTick(100);
this.loadUnit()
this.getList();
await this.getWorkUserInfo()
await this.getMapUnitList()
},
methods: {
//
async getList() {
async getList () {
this.visibleLoading = true
const url = "/heart/icpartyactivity/search"
@ -195,7 +248,7 @@ export default {
pageNo: this.pageNo,
serviceMatter: this.serviceMatter,
startTime: this.timeRange.length > 0 && this.timeRange[0] || '',
endTime: this.timeRange.length > 0 && this.timeRange[1] || ''
endTime: this.timeRange.length > 0 && this.timeRange[1] || ''
}
const { data, code, msg } = await requestPost(url, params)
@ -226,15 +279,131 @@ export default {
}
},
handleSelectChange() {
//
getWorkUserInfo () {
const url = '/epmetuser/customerstaff/staffbasicinfo'
let params = {}
window.app.ajax.post(
url,
params,
(data, rspMsg) => {
this.agencyInfo = data
if (!data.latitude) {
this.agencyInfo.latitude = 36.072227
}
if (!data.longitude) {
this.agencyInfo.longitude = 120.389455
}
if (!data.level) {
this.agencyInfo.level = 'street'
}
},
(rspMsg, data) => {
this.$message.error(rspMsg)
}
)
},
// //
// async loadType () {
// const url = "/sys/dict/data/dictlist"
// let params = {
// dictType: 'party_unit_type'
// }
// const { data, code, msg } = await requestPost(url, params)
// if (code === 0) {
// this.typeList = data
// } else {
// this.$message.error(msg)
// }
// },
//
async getMapUnitList () {
// const url = "/heart/icpartyunit/distribution"
const url = "http://yapi.elinkservice.cn/mock/245/heart/icpartyunit/distribution"
let params = {
agencyId: this.agencyId
}
const { data, code, msg } = await requestPost(url, params)
if (code === 0) {
// this.unitMapList = data
this.unitMapList = this.unitMapList1
this.unitMapList.forEach(item => {
if (item.type === '党建楼宇') {
item.urlIndex = 0
} else if (item.type === '两新党建') {
item.urlIndex = 1
} else if (item.type === '辖区单位') {
item.urlIndex = 2
} else if (item.type === '机关直属部门') {
item.urlIndex = 3
} else if (item.type === '其他') {
item.urlIndex = 4
}
});
this.iconUrlArray = [
require('../../../../assets/img/shuju/measure/ly@2x.png'),//
require('../../../../assets/img/shuju/measure/jgzs@2x.png'),//
require('../../../../assets/img/shuju/measure/lxdj@2x.png'),//
require('../../../../assets/img/shuju/measure/xq@2x.png'),//
require('../../../../assets/img/shuju/measure/qita.png')//
]
//false
this.loadMap()
this.isfirstInit = false
} else {
this.$message.error(msg)
}
},
//
loadMap () {
if (this.isfirstInit) {
//mapInfo, polygonArray, polIconUrlArray, iconArrays, iconUrlArray
this.$refs.map.loadMap(this.agencyInfo, null, null, this.unitMapList, this.iconUrlArray, null)
} else {
this.$refs.map.refreshMap(null, this.unitMapList)
}
},
//
clickProject (feature) {
console.log('标注信息', feature.values_.properties)
},
handleSelectChange () {
this.getList();
},
pageSizeChangeHandleNew(val) {
pageSizeChangeHandleNew (val) {
this.pageNo = 1;
this.pageSize = val;
this.getList();
},
pageCurrentChangeHandleNew(val) {
pageCurrentChangeHandleNew (val) {
this.pageNo = val;
this.getList();
},
@ -277,7 +446,6 @@ export default {
color: #fff;
font-weight: 800;
}
}
.second-title {
display: flex;
@ -291,7 +459,7 @@ export default {
color: #fff;
}
.second-title-label::after {
content: '';
content: "";
position: absolute;
top: 50%;
left: 20px;
@ -299,7 +467,7 @@ export default {
height: 12px;
box-sizing: border-box;
margin-top: -6px;
background: #2865FA;
background: #2865fa;
border-radius: 50%;
}
.second-select {
@ -312,12 +480,12 @@ export default {
padding: 0 10px;
color: #fff;
line-height: 36px;
background: #06186D;
border: 1px solid #1A64CC;
background: #06186d;
border: 1px solid #1a64cc;
}
.el-icon-arrow-up:before {
content: "\e78f"
content: "\e78f";
}
// .el-select__caret:before {
// content: '\E790'
@ -326,11 +494,11 @@ export default {
::v-deep .el-date-editor {
width: 360px;
position: relative;
background: #06186D;
border: 1px solid #1A64CC;
background: #06186d;
border: 1px solid #1a64cc;
.el-range-input {
color: #fff;
background: #06186D;
background: #06186d;
}
.el-range-separator {
color: #fff;
@ -360,7 +528,7 @@ export default {
.box-left-item {
.box-label {
font-size: 16px;
color: rgba(255, 255, 255, .72);
color: rgba(255, 255, 255, 0.72);
}
.box-num {
font-size: 32px;
@ -373,7 +541,12 @@ export default {
flex: 1;
.box-map {
height: 400px;
border: 1px solid #2865FA;
// border: 1px solid #2865fa;
.map {
height: 100%;
width: 100%;
}
}
}
.box-left-w400 {
@ -400,7 +573,6 @@ export default {
}
}
.map-tips {
width: 100%;
display: flex;
@ -432,5 +604,4 @@ export default {
}
}
}
</style>

516
src/views/modules/visual/components/screen-map/index copy.vue

@ -1,516 +0,0 @@
<template>
<div style="position: relative">
<div class="div_map"
id="map"
ref="map">
<!-- <div id="map"
class="map"></div> -->
</div>
</div>
</template>
<script>
import 'ol/ol.css'
import { Map, View } from 'ol'
import TileLayer from 'ol/layer/Tile.js';
import XYZ from 'ol/source/XYZ.js';
import VectorLayer from 'ol/layer/Vector.js';
import VectorSource from 'ol/source/Vector.js';
import GeoJSON from 'ol/format/GeoJSON.js';
import Point from "ol/geom/Point.js";
import Feature from "ol/Feature.js";
import Overlay from 'ol/Overlay';
import { defaults as defaultInteractions, Select, DoubleClickZoom } from 'ol/interaction.js';
import { getCenter, boundingExtent } from 'ol/extent.js';
import { Circle as CircleStyle, Icon, Fill, Stroke, Style, Text } from 'ol/style.js';
import { mapGetters } from "vuex";
import { Loading } from 'element-ui'; //Loading
import { requestPost } from "@/js/dai/request";
let loading;//
let map;
let mapView;
let gaodeMapLayer;//
let polygonLayer;//
let iconLayer; // icon
let iconSource; // icon
let polygonSource;//
let select;//
//url
let iconUrlArray = [
'https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet/test/20211116/a219130b6bc74b0b80b5ddb0fce0892a.png',
'https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet/test/20211116/a775d15e62374350b80e5cdf1912a4eb.png',
'https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet/test/20211116/884efcf6d6b44224a7fda599dd1b14cb.png'
];
let textColorArray = [
'rgba(236, 69, 4, 0.66)',
'rgba(0, 146, 238, 0.75)',
'rgba(238, 151, 0, 0.8)'
];
let polygonColorArray = [
'rgba(210, 2, 2, 0.24)',
'rgba(43, 231, 253, 0.25)',
'rgba(183, 185, 0, 0.16)'
];
//
var createTextStyle = function (feature) {
return new Text({
textAlign: undefined,
font: "18px Arial",
//fontFamily: "Courier New, monospace",
// fontWeight: "bold",
text: feature.values_.name,
backgroundFill: new Fill({
// color: 'rgba(0, 146, 238, 0.75)'
color: textColorArray[feature.values_.index - 1]
}),
padding: [4, 10, 4, 10],
//text: "",
fill: new Fill({ color: "#ffffff" }),
// stroke: new Stroke({ color: "#ffffff", width: 3 }),
offsetY: -30,
offsetX: -50,
overflow: true,
});
};
//
var polygonStyleFunction = (function () {
return function (feature) {
return new Style({
fill: new Fill({
// color: [255, 255, 255, 0.3]
color: polygonColorArray[feature.values_.index - 1]
}),
stroke: new Stroke({
color: polygonColorArray[feature.values_.index - 1],
width: 3
}),
text: createTextStyle(feature)
});;
};
})()
const vueGis = {
name: 'HomeMap',
data () {
return {
centerPoint: [],//
zoom: 14,//14
minZoom: 1,//
orgData: {},//
orgId: '',
orgLevel: '',
subAgencyArray: [],//
iconCoordinators: [],
currentCoordinate: null,
overlay: null,
}
},
async mounted () {
//
await this.loadOrgData()
//
this.initMap()
//
this.addPolygonLayer()
//icontuceng
this.addIconLayer()
//
this.loadPolygon(this.subAgencyArray)
},
methods: {
//
async refreshMap (isRefreshView) {
//
await this.loadOrgData()
//
await this.loadPolygon(this.subAgencyArray)
//
if (isRefreshView) {
this.setMapLocation()
mapView.setCenter(this.centerPoint);
mapView.setZoom(this.zoom);
}
},
//
async loadOrgData () {
const url = "/gov/org/agency/maporg"
let params = {
orgId: this.orgId,
level: this.orgLevel
}
const { data, code, msg } = await requestPost(url, params)
if (code === 0) {
this.orgData = data
this.orgId = this.orgData.id
this.orgLevel = this.orgData.level
if (data.children && data.children.length > 0) {
this.subAgencyArray = data.children
} else {
this.subAgencyArray = []
}
} else {
this.$message.error(msg)
}
},
//
loadPolygon (subAgencyArray) {
polygonSource.clear()//
iconSource.clear()//
let featureData = []//
if (subAgencyArray && subAgencyArray.length > 0) {//
let oneData = {}
subAgencyArray.forEach(agencyItem => {
if (agencyItem.coordinates && agencyItem.coordinates !== '') {//
let urlNum = this.getRndBetween(1, 3)
oneData = {
type: 'Feature',
id: agencyItem.id,
properties: {
id: agencyItem.id,
level: agencyItem.level,
name: agencyItem.name,
index: urlNum//
},
geometry: {
type: 'Polygon',
coordinates: [],
},
}
let coorArray = agencyItem.coordinates.split(',')//
let itemArray = []//[lon,lat]
let polygonArray = []//[[lon,lat],[lon,lat],[lon,lat]]
coorArray.forEach((item, index) => {
itemArray.push(item)
if (index % 2 == 0) {//
} else {//
polygonArray.push(itemArray)
itemArray = []
}
});
oneData.geometry.coordinates.push(polygonArray)
featureData.push(oneData)
}
});
}
if (featureData && featureData.length > 0) {
var geojsonObject = {
'type': 'FeatureCollection',
'features': featureData
};
let feature = (new GeoJSON()).readFeatures(geojsonObject)
polygonSource.addFeatures(feature)
let iconFeatures = [];
feature.forEach(oneIcon => {
var extent = boundingExtent(oneIcon.getGeometry().getCoordinates()[0]); //[minx,miny,maxx,maxy]
// var center = getCenter(extent); //
//
let x = (parseFloat(extent[0]) + parseFloat(extent[2])) / 2
let y = (parseFloat(extent[1]) + parseFloat(extent[3])) / 2
let oneArray = [x, y]
this.iconCoordinators.push(oneArray)
// debugger
let oneCctv = new Feature({
geometry: new Point([x, y]),
id: oneIcon.id_,
properties: {
type: "icon",
id: oneIcon.id_
}
});
let iconStyle = new Style({
image: new Icon({
// anchor: [0.5, 0.5],
// imgSize: [32, 32],
scale: 0.5,
src: iconUrlArray[oneIcon.values_.index - 1]
})
});
oneCctv.setStyle(iconStyle);
iconFeatures.push(oneCctv);
});
iconSource.addFeatures(iconFeatures);
}
// this.addGif()
},
//
setMapLocation () {
this.centerPoint = []
if (this.orgData.longitude && this.orgData.latitude) {
this.centerPoint.push(this.orgData.longitude)
this.centerPoint.push(this.orgData.latitude)
}
this.setZoom(this.orgData.agencyLevel)
},
//
setZoom (agencyLevel) {
if (agencyLevel === 'district') {
this.zoom = 14
} else if (agencyLevel === 'street') {
this.zoom = 15
} else if (agencyLevel === 'community') {
this.zoom = 16
}
},
initMap () {
this.setMapLocation()
gaodeMapLayer = new TileLayer({
title: "地图",
source: new XYZ({
//url
url: 'http://wprd0{1-4}.is.autonavi.com/appmaptile?lang=zh_cn&size=1&style=7&x={x}&y={y}&z={z}',
wrapX: true//xfalse
}),
zIndex: 20
});
mapView = new View({
//
center: this.centerPoint,
// projection: 'EPSG:3857',
projection: 'EPSG:4326',
zoom: this.zoom,
minZoom: this.minZoom
})
//map
//
map = new Map({
layers: [gaodeMapLayer],
//
view: mapView,
target: 'map'
//map
})
map.on('singleclick', function (e) {
// console.log(e.coordinate)
// console.log(transform(e.coordinate, 'EPSG:3857', 'EPSG:4326'));
})
//
const dblClickInteraction = map
.getInteractions()
.getArray()
.find(interaction => {
return interaction instanceof DoubleClickZoom;
});
map.removeInteraction(dblClickInteraction);
},
//
addPolygonLayer () {
polygonSource = new VectorSource({
//features: (new GeoJSON()).readFeatures(geojsonObject)
});
polygonLayer = new VectorLayer({
source: polygonSource,
style: polygonStyleFunction,
zIndex: 50
});
//
var overlayStyle = (function () {
return function (feature) {
var styles = {};
styles['Polygon'] = [
new Style({
stroke: new Stroke({
color: '#ec9000',
width: 2
})
}),
new Style({
fill: new Fill({
color: 'rgba(0, 0, 255, 0.1)'
})
}),
new Style({
text: createTextStyle(feature)
})
];
styles['MultiPolygon'] = styles['Polygon'];
return styles[feature.getGeometry().getType()];
};
})();
select = new Select({
style: overlayStyle
});
map.addLayer(polygonLayer)
map.addInteraction(select);
},
addIconLayer () {
iconSource = new VectorSource({
//features: (new GeoJSON()).readFeatures(geojsonObject)
});
iconLayer = new VectorLayer({
source: iconSource,
zIndex: 70
});
map.addLayer(iconLayer);
},
//
getRndBetween (lowerLimit, upperLimit) {
return Math.floor(Math.random() * (upperLimit - lowerLimit + 1)) + lowerLimit;
},
//
startLoading () {
loading = Loading.service({
lock: true, //
text: '正在加载……', //
background: 'rgba(0,0,0,.7)' //
});
},
//
endLoading () {
//clearTimeout(timer);
if (loading) {
loading.close();
}
},
},
props: {
//
showPolygonLayer: {
type: Boolean,
default: false
},
//
showIconLayer: {
type: Boolean,
default: false
}
},
computed: {
mapHeight () {
return this.clientHeight - 120;
},
// zoom: {
// get () {
// //zoom
// if (this.clientHeight < 900) {
// return 2.3
// } else {
// return 2.8
// }
// },
// set (value) {
// }
// },
...mapGetters(["clientHeight"])
},
components: {},
}
export default vueGis;
</script>
<style
lang="scss"
src="@/assets/scss/modules/visual/basicInfoMain.scss"
scoped
></style>
<style lang="scss" >
.div_content {
.ol-viewport {
border-radius: 5px;
}
}
.ol-overlaycontainer-stopevent {
display: none;
}
.el-scrollbar__wrap {
overflow-x: hidden !important;
}
</style>

10
src/views/modules/visual/components/screen-map/index.vue

@ -342,10 +342,14 @@ const vueGis = {
//icon
createTextStyle (feature) {
if (this.iconTextStyle) {
let iconTextStyle = { ...this.iconTextStyle }
iconTextStyle.text = feature.values_.name
return new Text({ ...iconTextStyle })
} else {
return null
}
let iconTextStyle = { ...this.iconTextStyle }
iconTextStyle.text = feature.values_.name
return new Text({ ...iconTextStyle })
},

Loading…
Cancel
Save