Browse Source

热力图

shibei_master
jiangyy 4 years ago
parent
commit
5b87767941
  1. 55
      src/assets/scss/modules/visual/distributionAnalyze.scss
  2. 58
      src/assets/scss/modules/visual/processAnalyze.scss
  3. 204
      src/views/modules/visual/communityGovern/distributionAnalyze.vue
  4. 29
      src/views/modules/visual/communityGovern/processAnalyze.vue
  5. 22
      src/views/modules/visual/communityGovern/processPieOption.js
  6. 32
      src/views/modules/visual/components/screen-map/index.vue

55
src/assets/scss/modules/visual/distributionAnalyze.scss

@ -119,7 +119,7 @@
height: calc(100vh - 230px);
.g-l {
width: 50%;
width: 40%;
height: calc(100vh - 290px);
.echart-line {
@ -138,7 +138,56 @@
}
.g-r {
width: 50%;
height: calc(100vh - 290px);
width: 60%;
height: calc(100vh - 250px);
.r-map {
position: relative;
height: calc(100vh - 250px - 50px);
width: 100%;
.map {
height: 100%;
width: 100%;
}
}
.r-legend {
display: flex;
justify-content: center;
margin-top: 24px;
align-items: center;
.legend_item {
margin-left: 40px;
display: flex;
align-items: center;
> span {
margin-left: 11px;
font-size: 16px;
font-family: PingFang SC;
font-weight: 400;
color: #d2e7ff;
}
.color {
width: 20px;
height: 10px;
border-radius: 4px;
}
.color0 {
background: #dd2719;
}
.color1 {
background: #edbe00;
}
.color2 {
background: #00e5ed;
}
}
}
}
}

58
src/assets/scss/modules/visual/processAnalyze.scss

@ -77,6 +77,7 @@
width: 100px;
}
.g-pie {
position: relative;
}
}
.l_bottom {
@ -209,6 +210,10 @@
background-color: #082586;
}
}
.r-status:hover {
cursor: pointer;
}
}
.r-legend {
@ -231,9 +236,6 @@
color: #d2e7ff;
}
}
.r-legend:hover {
cursor: pointer;
}
}
.echart-wr {
@ -242,10 +244,52 @@
text-align: center;
position: relative;
width: 500px;
height: 100%;
// height: 100%;
box-sizing: border-box;
.echart-org {
width: 100%;
height: 90%;
}
.g-pie {
position: relative;
.pie-legend {
margin-left: 30px;
margin-top: -40px;
display: flex;
justify-content: center;
.legend_item {
.item_name {
margin-left: 5px;
font-size: 10px;
font-family: PingFang SC;
font-weight: 500;
color: #eff0f1;
}
> img {
margin-top: -10px;
width: 80px;
height: 10px;
}
.item_num {
.item_count {
font-size: 17px;
font-family: PingFang SC;
font-weight: 500;
color: #ffffff;
}
.item_percent {
margin-left: 12px;
font-size: 8px;
font-family: PingFang SC;
font-weight: 300;
color: #ffffff;
line-height: 18px;
}
}
}
.item_last {
margin-left: 50px;
}
}
}

204
src/views/modules/visual/communityGovern/distributionAnalyze.vue

@ -41,10 +41,23 @@
ref="lineChart"></screen-echarts-frame>
</div>
<div class="g-r">111
<!-- <screen-echarts-frame class="echart-wr"
@myChartMethod="lineInitOk"
ref="lineChart"></screen-echarts-frame> -->
<div class="g-r">
<div class="r-map">
<screen-map class="map"
ref="map"
:showPolygonLayer="true"></screen-map>
<div class="r-legend">
<div class="legend_item"
v-for="(item,index) in legendArray"
:key="index">
<div :class="['color','color'+index]"></div>
<span>{{item.name}}</span>
</div>
</div>
</div>
</div>
</div>
@ -57,7 +70,7 @@ import { requestPost } from "@/js/dai/request";
import cptCard from "@/views/modules/visual/cpts/card";
import cptTb from "@/views/modules/visual/cpts/tb";
import screenEchartsFrame from "@/views/modules/visual/components/screen-echarts-frame";
import screenMap from "@/views/modules/visual/components/screen-map";
import { lineOption } from './distributionLineOption.js'
import * as echarts from 'echarts'
@ -144,11 +157,31 @@ export default {
}
],
timeRange: [],
orgId: '',
isfirstInit: true,
mapList: [
{
orgId: '3115fc83f1db431008a73c553eef1eb5',
count: 169
},
{
orgId: '7e57419e6afcdc910d08124c0a1b4eb9',
count: 149
},
{
orgId: 'e56ac695b01d9eed8723bde718071df5',
count: 219
}
],
agencyInfo: {},
subAgencyArray: [],
colorArray: ['#DD2719', '#EDBE00', '#00E5ED'],
colorFillArray: ['rgba(221, 39, 25, 0.24)', 'rgba(237, 190, 0, 0.25)', 'rgba(0, 229, 237, 0.16)'],
legendArray: [],
under: null,
above: null
};
},
@ -161,6 +194,7 @@ export default {
this.userId = this.uid;
this.initData()
await this.getAgencylist()//
await this.loadOrgData()
this.getApiData();
},
@ -204,7 +238,7 @@ export default {
async getApiData () {
await this.getLine()
// await this.getTable();
await this.loadMapData();
},
async getAgencylist () {
@ -236,9 +270,148 @@ export default {
this.getApiData()
},
//
async loadOrgData () {
const url = "/gov/org/agency/maporg"
// const url = "http://yapi.elinkservice.cn/mock/245/gov/org/agency/maporg"
let params = {
orgId: this.orgId,
level: 'agency'
}
const { data, code, msg } = await requestPost(url, params)
if (code === 0) {
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'
}
this.subAgencyArray = []
if (data.children && data.children.length > 0) {
this.subAgencyArray = data.children
} else {
this.subAgencyArray = []
}
} else {
this.$message.error(msg)
}
},
async loadMapData () {
this.$refs.lineChart.clear()
const _that = this
// this.$refs.lineChart.showLoading()
// const url ="/gov/project/project/projectdistributionanalysisright";
const url = "http://yapi.elinkservice.cn/mock/245/gov/project/project/projectdistributionanalysisright";
let params = {
orgId: this.orgId,
startDate: this.timeRange.length > 0 && this.timeRange[0] || '',
endDate: this.timeRange.length > 0 && this.timeRange[1] || ''
};
const { data, code, msg } = await requestPost(url, params);
if (code === 0) {
this.legendArray = []
if (data.above) {
this.under = data.under
this.legendArray.push(
{
color: this.colorArray[0],
name: data.under + '以下'
}
)
}
if (data.above) {
this.above = data.above
this.legendArray.push(
{
color: this.colorArray[1],
name: data.under + '-' + data.above
}
)
this.legendArray.push(
{
color: this.colorArray[2],
name: data.above + '以上'
}
)
}
if (data.list && data.list.length > 0) {
// this.mapList = data.list
} else {
this.mapList = []
}
this.mapList.forEach(item => {
// debugger
for (let i = 0; i < this.subAgencyArray.length; i++) {
let agencyItem = this.subAgencyArray[i]
if (item.orgId === agencyItem.id) {
item.longitude = agencyItem.longitude
item.latitude = agencyItem.latitude
item.coordinates = agencyItem.coordinates
if (this.under) {
if (item.count < this.under || item.count === this.under) {
item.color = this.colorArray[0]
item.fillColor = this.colorFillArray[0]
}
if (this.above) {
if (item.count > this.under && item.count < this.above) {
item.color = this.colorArray[1]
item.fillColor = this.colorFillArray[1]
} else {
item.color = this.colorArray[2]
item.fillColor = this.colorFillArray[2]
}
}
}
break
}
}
});
console.log(this.mapList)
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, this.mapList, null, null, null, null,)
} else {
this.$refs.map.refreshMap(this.mapList, null)
}
},
lineInitOk (dom) {
console.log('line准备好了', dom)
this.lineInitState = true
@ -291,10 +464,9 @@ export default {
this.$message.error(msg);
}
},
//
//线
loadCategoryData () {
this.xaxis = []
@ -345,15 +517,14 @@ export default {
});
console.log(this.series)
},
handleChangeAgency (value) {
this.agencyName = this.$refs["myCascader"].getCheckedNodes()[0].label
this.orgId = this.agencyIdArray.length > 0 ? this.agencyIdArray[this.agencyIdArray.length - 1] : ''
this.getApiData()
console.log(this.agencyIdArray)
},
@ -369,12 +540,15 @@ export default {
},
},
computed: {},
computed: {
},
components: {
cptCard,
cptTb,
screenEchartsFrame,
screenMap
},
watch: {

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

@ -45,6 +45,20 @@
<screen-echarts-frame class="echart-wr"
@myChartMethod="pieInitOk"
ref="pieChart"></screen-echarts-frame>
<div class="pie-legend">
<div :class="['legend_item',{'item_last':index===legendArray.length-1}]"
v-for="(item,index) in legendArray"
:key="index">
<div class="item_name">{{item.name}}</div>
<img :src="item.url" />
<div class="item_num">
<span class="item_count">{{item.count}}</span>
<span class="item_percent">{{item.percent}}</span>
</div>
</div>
</div>
</div>
</div>
<div class="l_bottom">
@ -126,6 +140,21 @@ export default {
],
legendArray: [
{
name: '未结案',
count: 120,
percent: '25.0%',
url: require('../../../../assets/img/shuju/measure/huang@2x.png')
},
{
name: '已结案',
count: 351,
percent: '50.0%',
url: require('../../../../assets/img/shuju/measure/lv@2x.png')
}
],
dateId: '',
agencyId: '',
status: 'pending',//: pendingclosed

22
src/views/modules/visual/communityGovern/processPieOption.js

@ -23,18 +23,18 @@ const center= ['50%', '200px']
tooltip: {
show: false
},
legend: {
top: 350,
bottom: 0,
itemWidth: 20,
itemHeight: 10,
textStyle: {
color: '#D2E7FF',
fontSize: 16,
lineHeight: 20,
},
// legend: {
// top: 350,
// bottom: 0,
// itemWidth: 20,
// itemHeight: 10,
// textStyle: {
// color: '#D2E7FF',
// fontSize: 16,
// lineHeight: 20,
// },
},
// },
series: [
// 外侧圆环
{

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

@ -66,14 +66,14 @@ var polygonStyleFunction = (function () {
return new Style({
fill: new Fill({
// color: [255, 255, 255, 0.3]
color: polygonColorArray[feature.values_.index - 1]
color: feature.values_.fillColor
}),
stroke: new Stroke({
color: polygonColorArray[feature.values_.index - 1],
width: 3
color: feature.values_.color,
width: 2
}),
text: createTextStyle(feature)
// text: createTextStyle(feature)
});;
};
})()
@ -142,7 +142,7 @@ const vueGis = {
},
methods: {
//
//:icon
loadMap (mapInfo, polygonArray, polIconUrlArray, iconArrays, iconUrlArray, iconTextStyle) {
this.mapInfo = mapInfo
this.polygonArray = polygonArray
@ -203,26 +203,22 @@ const vueGis = {
//
loadPolygon () {
polygonSource.clear()//
let featureData = []//
if (polygonArray && polygonArray.length > 0) {//
if (this.polygonArray && this.polygonArray.length > 0) {//
let oneData = {}
polygonArray.forEach(polygonItem => {
this.polygonArray.forEach(polygonItem => {
if (polygonItem.coordinates && polygonItem.coordinates !== '') {//
let urlNum = this.getRndBetween(1, 3)
oneData = {
type: 'Feature',
id: polygonItem.id,
properties: {
id: polygonItem.id,
level: polygonItem.level,
name: polygonItem.name,
index: urlNum//
},
properties: { ...polygonItem },
geometry: {
type: 'Polygon',
coordinates: [],
@ -231,19 +227,19 @@ const vueGis = {
let coorArray = polygonItem.coordinates.split(',')//
let itemArray = []//[lon,lat]
let polygonArray = []//[[lon,lat],[lon,lat],[lon,lat]]
let tempPolygonArray = []//[[lon,lat],[lon,lat],[lon,lat]]
coorArray.forEach((item, index) => {
itemArray.push(item)
if (index % 2 == 0) {//
} else {//
polygonArray.push(itemArray)
tempPolygonArray.push(itemArray)
itemArray = []
}
});
oneData.geometry.coordinates.push(polygonArray)
oneData.geometry.coordinates.push(tempPolygonArray)
featureData.push(oneData)
}
});

Loading…
Cancel
Save