|
After Width: | Height: | Size: 6.3 KiB |
|
After Width: | Height: | Size: 540 B |
|
After Width: | Height: | Size: 6.5 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 51 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
@ -0,0 +1,144 @@ |
|||||
|
@import '../../c/config'; |
||||
|
@import '../../c/function'; |
||||
|
@import './c/common'; |
||||
|
|
||||
|
.title { |
||||
|
padding: 10px; |
||||
|
font-size: 22px; |
||||
|
font-family: PingFang SC; |
||||
|
font-weight: 800; |
||||
|
color: #ffffff; |
||||
|
|
||||
|
position: relative; |
||||
|
|
||||
|
.card-title { |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
|
||||
|
img { |
||||
|
display: block; |
||||
|
margin-right: 5px; |
||||
|
} |
||||
|
span { |
||||
|
display: block; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.second-title { |
||||
|
display: block; |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
margin-top: 20px; |
||||
|
.second-title-label { |
||||
|
position: relative; |
||||
|
padding-left: 40px; |
||||
|
font-size: 16px; |
||||
|
font-weight: 500; |
||||
|
color: #fff; |
||||
|
} |
||||
|
.second-title-label::after { |
||||
|
content: ''; |
||||
|
position: absolute; |
||||
|
top: 50%; |
||||
|
left: 20px; |
||||
|
width: 12px; |
||||
|
height: 12px; |
||||
|
box-sizing: border-box; |
||||
|
margin-top: -6px; |
||||
|
background: #2865fa; |
||||
|
border-radius: 50%; |
||||
|
} |
||||
|
.second-select { |
||||
|
margin: 0 10px 0 40px; |
||||
|
::v-deep .el-input { |
||||
|
width: 180px; |
||||
|
height: 36px; |
||||
|
.el-input__inner { |
||||
|
height: 100%; |
||||
|
padding: 0 10px; |
||||
|
color: #fff; |
||||
|
line-height: 36px; |
||||
|
background: #06186d; |
||||
|
border: 1px solid #1a64cc; |
||||
|
} |
||||
|
|
||||
|
.el-icon-arrow-up:before { |
||||
|
content: '\e78f'; |
||||
|
} |
||||
|
// .el-select__caret:before { |
||||
|
// content: '\E790' |
||||
|
// } |
||||
|
} |
||||
|
::v-deep .el-date-editor { |
||||
|
width: 360px; |
||||
|
position: relative; |
||||
|
background: #06186d; |
||||
|
border: 1px solid #1a64cc; |
||||
|
.el-range-input { |
||||
|
color: #fff; |
||||
|
background: #06186d; |
||||
|
} |
||||
|
.el-range-separator { |
||||
|
color: #fff; |
||||
|
} |
||||
|
.el-range__icon { |
||||
|
position: absolute; |
||||
|
right: 5px; |
||||
|
// float: right; |
||||
|
} |
||||
|
.el-input__prefix { |
||||
|
left: unset; |
||||
|
right: 5px; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
.second-select:last-child { |
||||
|
margin-left: 0; |
||||
|
} |
||||
|
} |
||||
|
.cascader { |
||||
|
::v-deep .el-input { |
||||
|
width: 220px; |
||||
|
} |
||||
|
} |
||||
|
.status-select { |
||||
|
position: absolute; |
||||
|
top: 20px; |
||||
|
right: 10px; |
||||
|
} |
||||
|
.second-select:last-child { |
||||
|
margin-left: 0; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.g-cpt-resi { |
||||
|
display: flex; |
||||
|
flex-direction: row; |
||||
|
// flex-wrap: wrap; |
||||
|
// justify-content: center; |
||||
|
height: calc(100vh - 230px); |
||||
|
|
||||
|
.g-l { |
||||
|
width: 50%; |
||||
|
height: calc(100vh - 290px); |
||||
|
|
||||
|
.echart-line { |
||||
|
margin-left: 30px; |
||||
|
// margin-top: 100px; |
||||
|
text-align: center; |
||||
|
position: relative; |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
box-sizing: border-box; |
||||
|
.echart-org { |
||||
|
width: 100%; |
||||
|
height: 90%; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.g-r { |
||||
|
width: 50%; |
||||
|
height: calc(100vh - 290px); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,135 @@ |
|||||
|
@import '../../c/config'; |
||||
|
@import '../../c/function'; |
||||
|
@import './c/common'; |
||||
|
|
||||
|
.title { |
||||
|
padding: 10px; |
||||
|
font-size: 22px; |
||||
|
font-family: PingFang SC; |
||||
|
font-weight: 800; |
||||
|
color: #ffffff; |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
position: relative; |
||||
|
|
||||
|
img { |
||||
|
display: block; |
||||
|
margin-right: 5px; |
||||
|
} |
||||
|
span { |
||||
|
display: block; |
||||
|
} |
||||
|
|
||||
|
.second-select { |
||||
|
margin: 0 10px 0 40px; |
||||
|
|
||||
|
::v-deep .el-input { |
||||
|
width: 140px; |
||||
|
height: 36px; |
||||
|
.el-input__inner { |
||||
|
height: 100%; |
||||
|
padding: 0 10px; |
||||
|
color: #fff; |
||||
|
line-height: 36px; |
||||
|
background: #06186d; |
||||
|
border: 1px solid #1a64cc; |
||||
|
} |
||||
|
.el-icon-arrow-up:before { |
||||
|
content: '\e78f'; |
||||
|
} |
||||
|
} |
||||
|
::v-deep .el-date-editor { |
||||
|
.el-input__prefix { |
||||
|
left: unset; |
||||
|
right: 5px; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.cascader { |
||||
|
::v-deep .el-input { |
||||
|
width: 220px; |
||||
|
} |
||||
|
} |
||||
|
.status-select { |
||||
|
position: absolute; |
||||
|
top: 20px; |
||||
|
right: 10px; |
||||
|
} |
||||
|
.second-select:last-child { |
||||
|
margin-left: 0; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.g-cpt-resi { |
||||
|
display: flex; |
||||
|
flex-direction: row; |
||||
|
// flex-wrap: wrap; |
||||
|
// justify-content: center; |
||||
|
height: calc(100vh - 130px); |
||||
|
|
||||
|
.g-l { |
||||
|
flex-shrink: 0; |
||||
|
width: 600px; |
||||
|
height: calc(100vh - 190px); |
||||
|
} |
||||
|
|
||||
|
.g-r { |
||||
|
text-align: center; |
||||
|
margin: 40px 19px 20px; |
||||
|
width: calc(100vw - 60px - 600px); |
||||
|
height: calc(100vh - 140px - 20px); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.g-r { |
||||
|
.tb { |
||||
|
position: relative; |
||||
|
height: calc(100vh - 220px); |
||||
|
overflow-y: auto; |
||||
|
@include scrollBar; |
||||
|
|
||||
|
.m-pagination { |
||||
|
position: absolute; |
||||
|
box-sizing: border-box; |
||||
|
right: 0; |
||||
|
bottom: 0; |
||||
|
|
||||
|
width: 100%; |
||||
|
height: 40px; |
||||
|
display: flex; |
||||
|
justify-content: flex-end; |
||||
|
|
||||
|
/deep/ .el-pagination.is-background .el-pager li:not(.disabled).active { |
||||
|
background: #0266d1; |
||||
|
color: #000d3f; |
||||
|
} |
||||
|
|
||||
|
/deep/ .el-pagination .el-pager li { |
||||
|
background: #002e74; |
||||
|
} |
||||
|
|
||||
|
/deep/ .el-pagination .btn-prev { |
||||
|
background: #002e74; |
||||
|
} |
||||
|
|
||||
|
/deep/ .el-pagination .btn-next { |
||||
|
background: #002e74; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.echart-wr { |
||||
|
margin-left: 30px; |
||||
|
// margin-top: 100px; |
||||
|
text-align: center; |
||||
|
position: relative; |
||||
|
width: 500px; |
||||
|
height: 100%; |
||||
|
box-sizing: border-box; |
||||
|
.echart-org { |
||||
|
width: 100%; |
||||
|
height: 90%; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,399 @@ |
|||||
|
<template> |
||||
|
<cpt-card> |
||||
|
<div class="title"> |
||||
|
<div class="card-title"> |
||||
|
<img src="@/assets/img/shuju/title-tip.png" /> |
||||
|
<span>项目分布分析</span> |
||||
|
</div> |
||||
|
<div class="second-title"> |
||||
|
<div class="second-title-label">不同事件类别在不同时间段的变化和分布</div> |
||||
|
<div class="second-select cascader"> |
||||
|
|
||||
|
<el-cascader class="customer_cascader" |
||||
|
ref="myCascader" |
||||
|
v-model="agencyIdArray" |
||||
|
:key="iscascaderShow" |
||||
|
:options="casOptions" |
||||
|
:props="optionProps" |
||||
|
@change="handleChangeAgency" |
||||
|
clearable></el-cascader> |
||||
|
</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" |
||||
|
@change="handleSelectChange"> |
||||
|
</el-date-picker> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
<div class="g-cpt-resi"> |
||||
|
<div class="g-l"> |
||||
|
<screen-echarts-frame class="echart-line" |
||||
|
@myChartMethod="lineInitOk" |
||||
|
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> |
||||
|
</div> |
||||
|
</cpt-card> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { Loading } from "element-ui"; //引入Loading服务 |
||||
|
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 { lineOption } from './distributionLineOption.js' |
||||
|
import * as echarts from 'echarts' |
||||
|
|
||||
|
|
||||
|
export default { |
||||
|
name: "HomeMap", |
||||
|
data () { |
||||
|
return { |
||||
|
showNoData: false, |
||||
|
timer: null, |
||||
|
|
||||
|
casOptions: [], |
||||
|
agencyIdArray: [], |
||||
|
customerList: [], |
||||
|
iscascaderShow: 0, |
||||
|
|
||||
|
optionProps: { |
||||
|
multiple: false, |
||||
|
value: 'agencyId', |
||||
|
label: 'agencyName', |
||||
|
children: 'subAgencyList', |
||||
|
checkStrictly: true |
||||
|
}, |
||||
|
|
||||
|
lineChart: '', |
||||
|
lineOption: {}, |
||||
|
lineInitState: false, |
||||
|
lineColorArray: [], |
||||
|
xaxis: [], |
||||
|
series: [], |
||||
|
legend: [], |
||||
|
lineData: [820, 932, 901, 934, 1290, 1330, 1320], |
||||
|
lineList: [ |
||||
|
{ |
||||
|
time: '4:00', |
||||
|
categoryList: [ |
||||
|
{ |
||||
|
categoryCode: '001', |
||||
|
count: 100, |
||||
|
color: '#1B51FF', |
||||
|
name: '分类1' |
||||
|
}, |
||||
|
{ |
||||
|
categoryCode: '002', |
||||
|
count: 200, |
||||
|
color: '#00E5ED', |
||||
|
name: '分类2' |
||||
|
} |
||||
|
] |
||||
|
}, |
||||
|
{ |
||||
|
time: '5:00', |
||||
|
categoryList: [ |
||||
|
{ |
||||
|
categoryCode: '001', |
||||
|
count: 20, |
||||
|
color: '#1B51FF', |
||||
|
name: '分类1' |
||||
|
}, |
||||
|
{ |
||||
|
categoryCode: '002', |
||||
|
count: 400, |
||||
|
color: '#00E5ED', |
||||
|
name: '分类2' |
||||
|
} |
||||
|
] |
||||
|
}, |
||||
|
{ |
||||
|
time: '6:00', |
||||
|
categoryList: [ |
||||
|
{ |
||||
|
categoryCode: '001', |
||||
|
count: 50, |
||||
|
color: '#1B51FF', |
||||
|
name: '分类1' |
||||
|
}, |
||||
|
{ |
||||
|
categoryCode: '002', |
||||
|
count: 10, |
||||
|
color: '#00E5ED', |
||||
|
name: '分类2' |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
], |
||||
|
|
||||
|
|
||||
|
timeRange: [], |
||||
|
orgId: '', |
||||
|
|
||||
|
|
||||
|
|
||||
|
}; |
||||
|
}, |
||||
|
// mixins: [animate] |
||||
|
beforeDestroy () { |
||||
|
this.timer && clearInterval(this.timer) |
||||
|
}, |
||||
|
|
||||
|
async mounted () { |
||||
|
this.userId = this.uid; |
||||
|
this.initData() |
||||
|
await this.getAgencylist()//获取组织级别 |
||||
|
this.getApiData(); |
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
initData () { |
||||
|
let yesterday = new Date((new Date).getTime() - 24 * 60 * 60 * 1000) |
||||
|
|
||||
|
let year = yesterday.getFullYear() |
||||
|
let month = yesterday.getMonth() + 1 //月 |
||||
|
let day = yesterday.getDate() //日 |
||||
|
|
||||
|
var days = new Date(year, month, 0); |
||||
|
days = days.getDate(); //获取当前月的天数 |
||||
|
var year2 = year; |
||||
|
var month2 = parseInt(month) - 1; |
||||
|
if (month2 == 0) { |
||||
|
year2 = parseInt(year2) - 1; |
||||
|
month2 = 12; |
||||
|
} |
||||
|
var day2 = day; |
||||
|
var days2 = new Date(year2, month2, 0); |
||||
|
days2 = days2.getDate(); |
||||
|
if (day2 > days2) { |
||||
|
day2 = days2; |
||||
|
} |
||||
|
if (month2 < 10) { |
||||
|
month2 = '0' + month2; |
||||
|
} |
||||
|
var t2 = year2 + '-' + month2 + '-' + day2; |
||||
|
var t1 = year + '-' + month + '-' + day; |
||||
|
// let t3 = formate(t2, style); |
||||
|
|
||||
|
this.timeRange = [t2, t1] |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
handleSelectChange () { |
||||
|
this.getApiData(); |
||||
|
}, |
||||
|
|
||||
|
async getApiData () { |
||||
|
|
||||
|
await this.getLine() |
||||
|
// await this.getTable(); |
||||
|
}, |
||||
|
|
||||
|
async getAgencylist () { |
||||
|
const url = '/gov/org/customeragency/agencylist' |
||||
|
// const url = 'http://yapi.elinkservice.cn/mock/102/gov/org/agency/agencylist' |
||||
|
|
||||
|
const params = { |
||||
|
// customerId: '613cc61a6b8ce4c70d21bd413dac72cc' |
||||
|
customerId: '0c41b272ee9ee95ac6f184ad548a30eb' |
||||
|
} |
||||
|
const { data, code, msg } = await requestPost(url, params) |
||||
|
if (code === 0) { |
||||
|
++this.iscascaderShow |
||||
|
this.casOptions = [] |
||||
|
this.agencyIdArray.length = [] |
||||
|
|
||||
|
if (data) { |
||||
|
this.casOptions.push(data) |
||||
|
} |
||||
|
|
||||
|
} else { |
||||
|
this.$message.error(msg) |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
handleChangeDate (value) { |
||||
|
|
||||
|
this.dateId = value |
||||
|
this.getApiData() |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
lineInitOk (dom) { |
||||
|
console.log('line准备好了', dom) |
||||
|
|
||||
|
this.lineInitState = true |
||||
|
|
||||
|
}, |
||||
|
getLine () { |
||||
|
if (this.lineInitState) { |
||||
|
this.getLineChart() |
||||
|
} else { |
||||
|
setTimeout(() => { |
||||
|
this.getLine() |
||||
|
}, 500) |
||||
|
} |
||||
|
}, |
||||
|
// 获取折线图 |
||||
|
async getLineChart () { |
||||
|
this.$refs.lineChart.clear() |
||||
|
|
||||
|
const _that = this |
||||
|
// this.$refs.lineChart.showLoading() |
||||
|
// const url ="/gov/project/project/projectdistributionanalysisleft"; |
||||
|
const url = "http://yapi.elinkservice.cn/mock/245/gov/project/project/projectdistributionanalysisleft"; |
||||
|
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) { |
||||
|
// 获取pieChart配置 |
||||
|
this.lineOption = lineOption() |
||||
|
|
||||
|
if (data && data.length > 0) { |
||||
|
|
||||
|
this.loadCategoryData() |
||||
|
|
||||
|
} else { |
||||
|
|
||||
|
} |
||||
|
this.$refs.lineChart.setOption(this.lineOption, true) |
||||
|
this.$refs.lineChart.setOption({ |
||||
|
xAxis: { data: this.xaxis }, |
||||
|
legend: { data: this.legend }, |
||||
|
series: this.series |
||||
|
}, true) |
||||
|
|
||||
|
|
||||
|
} else { |
||||
|
this.$message.error(msg); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
}, |
||||
|
|
||||
|
//解析 |
||||
|
loadCategoryData () { |
||||
|
|
||||
|
this.xaxis = [] |
||||
|
this.series = [] |
||||
|
this.legend = [] |
||||
|
let num = this.lineList[0].categoryList.length |
||||
|
|
||||
|
let dataArray = new Array(num) |
||||
|
//遍历每个分类 |
||||
|
this.lineList[0].categoryList.forEach((categoryItem, index) => { |
||||
|
this.legend.push(categoryItem.name) |
||||
|
dataArray[index] = [] |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
//遍历每个时间 |
||||
|
this.lineList.forEach(item => { |
||||
|
this.xaxis.push(item.time) |
||||
|
|
||||
|
//遍历每个分类 |
||||
|
item.categoryList.forEach((categoryItem, index) => { |
||||
|
dataArray[index].push(categoryItem.count) |
||||
|
}); |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
//遍历第一组的分类 |
||||
|
this.lineList[0].categoryList.forEach((categoryItem, index) => { |
||||
|
|
||||
|
let object = { |
||||
|
name: categoryItem.name, |
||||
|
type: 'line', |
||||
|
barWidth: 15, |
||||
|
areaStyle: {}, |
||||
|
itemStyle: { |
||||
|
color: new echarts.graphic.LinearGradient( |
||||
|
0, 1, 0, 0, |
||||
|
[ |
||||
|
{ offset: 0, color: 'rgba(121, 55, 255, 0)' }, |
||||
|
{ offset: 1, color: categoryItem.color } |
||||
|
] |
||||
|
) |
||||
|
}, |
||||
|
data: dataArray[index] |
||||
|
} |
||||
|
|
||||
|
this.series.push(object) |
||||
|
|
||||
|
|
||||
|
}); |
||||
|
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) |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
toUserInfo (uid) { |
||||
|
this.$router.push({ path: `/main-shuju/visual-basicinfo-people/${uid}` }); |
||||
|
}, |
||||
|
}, |
||||
|
props: { |
||||
|
uid: { |
||||
|
type: String, |
||||
|
default: "", |
||||
|
// default: "8ada68cb6f1e4b9a8333348a39ef3aee", |
||||
|
}, |
||||
|
}, |
||||
|
|
||||
|
computed: {}, |
||||
|
|
||||
|
components: { |
||||
|
cptCard, |
||||
|
cptTb, |
||||
|
screenEchartsFrame, |
||||
|
}, |
||||
|
|
||||
|
watch: { |
||||
|
uid (id) { |
||||
|
this.userId = id; |
||||
|
}, |
||||
|
userId () { |
||||
|
this.getApiData(); |
||||
|
window.scrollTo(0, 0); |
||||
|
}, |
||||
|
}, |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style |
||||
|
lang="scss" |
||||
|
src="@/assets/scss/modules/visual/distributionAnalyze.scss" |
||||
|
scoped |
||||
|
></style> |
||||
|
|
||||
|
<style lang=scss scoped> |
||||
|
</style> |
||||
@ -0,0 +1,89 @@ |
|||||
|
import * as echarts from 'echarts' |
||||
|
export function lineOption () { |
||||
|
|
||||
|
return { |
||||
|
legend: { |
||||
|
textStyle: { |
||||
|
color: '#D2E7FF', |
||||
|
fontSize: 16, |
||||
|
|
||||
|
}, |
||||
|
itemWidth: 20, |
||||
|
itemHeight: 10, |
||||
|
// top: 350,
|
||||
|
bottom: 0, |
||||
|
data: [] |
||||
|
}, |
||||
|
xAxis: { |
||||
|
type: 'category', |
||||
|
// boundaryGap: false,
|
||||
|
axisLabel: { |
||||
|
color: '#8ec7dc', |
||||
|
fontSize: 16 |
||||
|
}, |
||||
|
axisTick: { |
||||
|
show: false |
||||
|
}, |
||||
|
axisLine: { |
||||
|
lineStyle: { |
||||
|
color: '#0c4b59' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
yAxis: { |
||||
|
nameTextStyle: { |
||||
|
color: '#8ec7dc', |
||||
|
fontSize: 18 |
||||
|
}, |
||||
|
splitNumber: 4, |
||||
|
minInterval: 1, |
||||
|
show: true, |
||||
|
type: 'value', |
||||
|
axisLabel: { |
||||
|
color: '#8ec7dc', |
||||
|
fontSize: 18 |
||||
|
}, |
||||
|
axisTick: { |
||||
|
show: false |
||||
|
}, |
||||
|
splitLine: { |
||||
|
lineStyle: { |
||||
|
color: ['#145968'], |
||||
|
type: 'dotted' |
||||
|
} |
||||
|
}, |
||||
|
axisLine: { |
||||
|
show: true, |
||||
|
symbol: ['none', 'arrow'], |
||||
|
symbolOffset: [0, 15], |
||||
|
lineStyle: { |
||||
|
color: '#0c4b59' |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
series: [ |
||||
|
// {
|
||||
|
// name: '项目数',
|
||||
|
// type: 'line',
|
||||
|
// barWidth: 15,
|
||||
|
// areaStyle: {},
|
||||
|
// itemStyle: {
|
||||
|
// color: new echarts.graphic.LinearGradient(
|
||||
|
// 0, 1, 0, 0,
|
||||
|
// [
|
||||
|
// { offset: 0, color: 'rgba(121, 55, 255, 0)' },
|
||||
|
// { offset: 1, color: '#6339FF' }
|
||||
|
// ]
|
||||
|
// )
|
||||
|
// },
|
||||
|
// data: [120, 132, 101, 134, 90, 230, 210]
|
||||
|
// },
|
||||
|
// {
|
||||
|
// data: [820, 932, 901, 934, 1290, 1330, 1320],
|
||||
|
// type: 'line',
|
||||
|
// areaStyle: {}
|
||||
|
// }
|
||||
|
] |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,179 @@ |
|||||
|
|
||||
|
export function pieOption (_charts) { |
||||
|
const center= ['50%', '250px'] |
||||
|
return { |
||||
|
title: { |
||||
|
text: '0', |
||||
|
top: 220, |
||||
|
left: 'center', |
||||
|
textStyle: { |
||||
|
width: '100%', |
||||
|
fontSize: 32, |
||||
|
color: '#FFFFFF', |
||||
|
fontWeight: 400 |
||||
|
}, |
||||
|
itemGap: 5, |
||||
|
subtext: '总数', |
||||
|
subtextStyle: { |
||||
|
fontSize: 20, |
||||
|
color: '#fff', |
||||
|
fontWeight: 400 |
||||
|
} |
||||
|
}, |
||||
|
tooltip: { |
||||
|
show: false |
||||
|
}, |
||||
|
legend: { |
||||
|
top: 500, |
||||
|
bottom: 0, |
||||
|
itemWidth: 20, |
||||
|
itemHeight: 10, |
||||
|
textStyle: { |
||||
|
color: '#D2E7FF', |
||||
|
fontSize: 16, |
||||
|
lineHeight: 20, |
||||
|
}, |
||||
|
|
||||
|
}, |
||||
|
series: [ |
||||
|
// 外侧圆环
|
||||
|
{ |
||||
|
type: 'pie', |
||||
|
// 起始刻度的角度,默认为 90 度,即圆心的正上方。0 度为圆心的正右方。
|
||||
|
startAngle: 0, |
||||
|
hoverAnimation: false, |
||||
|
// tooltip: {
|
||||
|
// },
|
||||
|
center: center, |
||||
|
radius: ['55%', '55.3%'], |
||||
|
label: { |
||||
|
show: false |
||||
|
}, |
||||
|
labelLine: { |
||||
|
show: false |
||||
|
}, |
||||
|
data: [{ |
||||
|
value: 360, |
||||
|
itemStyle: { |
||||
|
color: 'rgba(40, 101, 250, 0)', |
||||
|
width:0, |
||||
|
borderColor: 'rgba(40, 101, 250, 0.5)', |
||||
|
borderWidth: 1, |
||||
|
borderType: 'dotted' |
||||
|
} |
||||
|
} |
||||
|
] |
||||
|
}, |
||||
|
|
||||
|
// 突出的
|
||||
|
{ |
||||
|
hoverAnimation: false, |
||||
|
// name: 'Access From',
|
||||
|
type: 'pie', |
||||
|
center: center, |
||||
|
radius: ['40%', '60%'], |
||||
|
avoidLabelOverlap: false, |
||||
|
// top: top + '%',
|
||||
|
// height: '80%',
|
||||
|
selectedMode: 'single', |
||||
|
left: 'center', |
||||
|
width: 400, |
||||
|
label: { |
||||
|
// show: false,
|
||||
|
position: 'outside', |
||||
|
alignTo: 'edge', |
||||
|
// formatter: '{a|{c}}\n\n{name|{b}}',
|
||||
|
formatter: '{a|{c}}\n{r|}\n{name|{b}}', |
||||
|
minMargin: 5, |
||||
|
edgeDistance: 1, |
||||
|
lineHeight: 15, |
||||
|
color: '#fff', |
||||
|
fontSize: 12, |
||||
|
// distanceToLabelLine: -60,
|
||||
|
rich: { |
||||
|
name: { |
||||
|
padding: [0, 6, 0, 6] |
||||
|
}, |
||||
|
a: { |
||||
|
fontSize: 30, |
||||
|
color: '#fff', |
||||
|
padding: [0, 6, 6, 6] |
||||
|
}, |
||||
|
r: { |
||||
|
backgroundColor: 'auto', |
||||
|
borderRadius: 6, |
||||
|
width: 6, |
||||
|
height: 6, |
||||
|
// padding: [3, 3, 0, -12]
|
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
labelLine: { |
||||
|
show: false, |
||||
|
smooth: 0.2, |
||||
|
length: 30, |
||||
|
length2: 0, |
||||
|
maxSurfaceAngle: 80 |
||||
|
}, |
||||
|
labelLayout: function (params) { |
||||
|
|
||||
|
const isLeft = params.labelRect.x < _charts.getWidth() / 2; |
||||
|
const points = params.labelLinePoints; |
||||
|
// Update the end point.
|
||||
|
if (points) { |
||||
|
points[2][0] = isLeft |
||||
|
? params.labelRect.x |
||||
|
: params.labelRect.x + params.labelRect.width; |
||||
|
} |
||||
|
|
||||
|
return { |
||||
|
labelLinePoints: points |
||||
|
}; |
||||
|
}, |
||||
|
itemStyle: { |
||||
|
// color:function(params) {
|
||||
|
// //自定义颜色
|
||||
|
// var colorList = [
|
||||
|
// '#00FFFF', '#00FF00', '#FFFF00', '#FF8C00', '#FF0000', '#FE8463',
|
||||
|
// ];
|
||||
|
// return colorList[params.dataIndex]
|
||||
|
// }
|
||||
|
}, |
||||
|
data: [], |
||||
|
|
||||
|
}, |
||||
|
// 中间圆环
|
||||
|
{ |
||||
|
type: 'pie', |
||||
|
// 起始刻度的角度,默认为 90 度,即圆心的正上方。0 度为圆心的正右方。
|
||||
|
startAngle: 0, |
||||
|
hoverAnimation: false, |
||||
|
center: center, |
||||
|
// tooltip: {
|
||||
|
// },
|
||||
|
radius: ['0%', '25%'], |
||||
|
label: { |
||||
|
|
||||
|
show: false |
||||
|
|
||||
|
}, |
||||
|
labelLine: { |
||||
|
|
||||
|
show: false |
||||
|
|
||||
|
}, |
||||
|
data: [{ |
||||
|
value: 360, |
||||
|
itemStyle: { |
||||
|
normal: { |
||||
|
color: 'rgba(8, 37, 134, 1)', |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
] |
||||
|
}, |
||||
|
] |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,189 @@ |
|||||
|
<template> |
||||
|
<div class="m-pop"> |
||||
|
<div class="wrap"> |
||||
|
<cpt-card> |
||||
|
<div class="title"> |
||||
|
<img src="@/assets/img/shuju/title-tip.png" /> |
||||
|
<span>需求详情</span> |
||||
|
</div> |
||||
|
|
||||
|
<div class="btn-close" @click="handleClose"> |
||||
|
<img src="@/assets/img/shuju/people/close.png" /> |
||||
|
</div> |
||||
|
<div class="list-title">需求内容</div> |
||||
|
<div class="list-wr"> |
||||
|
<div class="list"> |
||||
|
|
||||
|
<div class="item-desc"> |
||||
|
<!-- <span class="item-field">所属网格:</span> --> |
||||
|
<span>市北区同德花园小区物业管理服务,公司的同志每天对该小区 公共部位,喷洒消毒液进行消毒。为杀灭新型冠状病毒,近几 天以来,市北区</span> |
||||
|
</div> |
||||
|
<div class="item"> |
||||
|
<span class="item-field">所属网格:</span> |
||||
|
<span>哈哈哈</span> |
||||
|
</div> |
||||
|
<div class="item"> |
||||
|
<span class="item-field">需求类型:</span> |
||||
|
<span>的是法撒旦法</span> |
||||
|
</div> |
||||
|
<div class="item"> |
||||
|
<span class="item-field">需求状态:</span> |
||||
|
<span>第三方士大夫</span> |
||||
|
</div> |
||||
|
<div class="item"> |
||||
|
<span class="item-field">上报类型:</span> |
||||
|
<span>撒打发斯蒂芬</span> |
||||
|
</div> |
||||
|
<div class="item"> |
||||
|
<span class="item-field">上 报 人:</span> |
||||
|
<span>撒打发斯蒂芬</span> |
||||
|
</div> |
||||
|
<div class="item"> |
||||
|
<span class="item-field">上报人联系方式:</span> |
||||
|
<span>撒打发斯蒂芬</span> |
||||
|
</div> |
||||
|
<div class="item"> |
||||
|
<span class="item-field">上报时间:</span> |
||||
|
<span>2021-09-17 12:52</span> |
||||
|
</div> |
||||
|
<div class="item"> |
||||
|
<span class="item-field">服务时间:</span> |
||||
|
<span>2021-09-17 12:52</span> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="list"> |
||||
|
<div class="item"> |
||||
|
<span class="item-field">服务方:</span> |
||||
|
<span>哈哈哈</span> |
||||
|
</div> |
||||
|
<div class="item"> |
||||
|
<span class="item-field">实际服务时间:</span> |
||||
|
<span>2021-09-17 12:52 至 <br/> |
||||
|
2021-09-17 17:52</span> |
||||
|
</div> |
||||
|
<div class="item"> |
||||
|
<span class="item-field">完成情况:</span> |
||||
|
<span>第三方士大夫</span> |
||||
|
</div> |
||||
|
<div class="item"> |
||||
|
<span class="item-field">评价:</span> |
||||
|
<span> |
||||
|
<el-rate value="4" disabled></el-rate> |
||||
|
</span> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="tabs"> |
||||
|
<div |
||||
|
class="tab-btn" |
||||
|
> |
||||
|
<img src="@/assets/img/shuju/people/arrow-double-left.png" /> |
||||
|
</div> |
||||
|
<div |
||||
|
class="tab z-on" |
||||
|
> |
||||
|
研判分析 |
||||
|
</div> |
||||
|
<div |
||||
|
class="tab-btn" |
||||
|
> |
||||
|
<img src="@/assets/img/shuju/people/arrow-double-right.png" /> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<analyse /> |
||||
|
|
||||
|
</cpt-card> |
||||
|
</div> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import cptCard from "@/views/modules/visual/cpts/card"; |
||||
|
import analyse from '../cpts/analyse.vue' |
||||
|
import { requestPost } from "@/js/dai/request"; |
||||
|
|
||||
|
export default { |
||||
|
name: "dialogInfo", |
||||
|
props: { |
||||
|
userId: { |
||||
|
type: String, |
||||
|
default: "", |
||||
|
}, |
||||
|
gridName: { |
||||
|
type: String, |
||||
|
default: "", |
||||
|
}, |
||||
|
}, |
||||
|
|
||||
|
components: { |
||||
|
cptCard, |
||||
|
analyse |
||||
|
}, |
||||
|
|
||||
|
data() { |
||||
|
return { |
||||
|
fieldList: [], |
||||
|
groupList: [], |
||||
|
groupIndex: 0, |
||||
|
startGroupIndex: 0, |
||||
|
info: {}, |
||||
|
allInfo: {}, |
||||
|
|
||||
|
xiaoquList: [], |
||||
|
louList: [], |
||||
|
danyuanList: [], |
||||
|
homeList: [], |
||||
|
}; |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
mounted() { |
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
handleClose() { |
||||
|
this.$emit("close"); |
||||
|
}, |
||||
|
} |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss" src="@/assets/scss/modules/visual/people.scss" scoped></style> |
||||
|
<style lang="scss" scoped> |
||||
|
.m-pop { |
||||
|
.wrap { |
||||
|
.list { |
||||
|
display: block; |
||||
|
width: 50%; |
||||
|
.item { |
||||
|
display: flex; |
||||
|
width: 100%; |
||||
|
box-sizing: border-box; |
||||
|
margin-top: 0; |
||||
|
margin-bottom: 15px; |
||||
|
font-size: 16px; |
||||
|
cursor: pointer; |
||||
|
} |
||||
|
.item-desc { |
||||
|
font-size: 16px; |
||||
|
margin-bottom: 10px; |
||||
|
line-height: 24px; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
.list-title { |
||||
|
width: 100%; |
||||
|
box-sizing: border-box; |
||||
|
padding: 20px 0 10px 62px; |
||||
|
font-size: 20px; |
||||
|
cursor: pointer; |
||||
|
} |
||||
|
} |
||||
|
.list-wr { |
||||
|
display: flex; |
||||
|
padding: 0 32px; |
||||
|
|
||||
|
} |
||||
|
</style> |
||||
@ -0,0 +1,176 @@ |
|||||
|
|
||||
|
export function pieOption (_charts) { |
||||
|
const center= ['50%', '50%'] |
||||
|
return { |
||||
|
title: { |
||||
|
text: '0', |
||||
|
top: 125, |
||||
|
left: 196, |
||||
|
textAlign: 'center', |
||||
|
textStyle: { |
||||
|
width: '100%', |
||||
|
fontSize: 32, |
||||
|
color: '#FFFFFF', |
||||
|
fontWeight: 400, |
||||
|
align: 'center' |
||||
|
}, |
||||
|
itemGap: 5, |
||||
|
subtext: '总数', |
||||
|
subtextStyle: { |
||||
|
fontSize: 16, |
||||
|
color: '#fff', |
||||
|
fontWeight: 400, |
||||
|
align: 'center' |
||||
|
} |
||||
|
}, |
||||
|
tooltip: { |
||||
|
show: false |
||||
|
}, |
||||
|
legend: { |
||||
|
top: 500, |
||||
|
bottom: 0, |
||||
|
itemWidth: 20, |
||||
|
itemHeight: 10, |
||||
|
textStyle: { |
||||
|
color: '#D2E7FF', |
||||
|
fontSize: 16, |
||||
|
lineHeight: 20, |
||||
|
}, |
||||
|
|
||||
|
}, |
||||
|
series: [ |
||||
|
// 外侧圆环
|
||||
|
{ |
||||
|
type: 'pie', |
||||
|
// 起始刻度的角度,默认为 90 度,即圆心的正上方。0 度为圆心的正右方。
|
||||
|
startAngle: 90, |
||||
|
hoverAnimation: false, |
||||
|
// tooltip: {
|
||||
|
// },
|
||||
|
center: center, |
||||
|
left: 'left', |
||||
|
radius: ['60%', '70%'], |
||||
|
width: 400, |
||||
|
label: { |
||||
|
show: false |
||||
|
}, |
||||
|
labelLine: { |
||||
|
show: false |
||||
|
}, |
||||
|
data: [{ |
||||
|
value: 480, |
||||
|
itemStyle: { |
||||
|
color: 'rgba(40, 101, 250, 0)', |
||||
|
width:0, |
||||
|
borderColor: 'rgba(40, 101, 250, 0.5)', |
||||
|
borderWidth: 1, |
||||
|
borderType: 'dotted' |
||||
|
} |
||||
|
} |
||||
|
] |
||||
|
}, |
||||
|
|
||||
|
// 突出的
|
||||
|
{ |
||||
|
hoverAnimation: false, |
||||
|
type: 'pie', |
||||
|
center: center, |
||||
|
radius: ['40%', '60%'], |
||||
|
avoidLabelOverlap: false, |
||||
|
selectedMode: 'single', |
||||
|
left: 'left', |
||||
|
width: 400, |
||||
|
startAngle: 90, |
||||
|
label: { |
||||
|
// show: false,
|
||||
|
position: 'outside', |
||||
|
alignTo: 'edge', |
||||
|
// formatter: '{a|{c}}\n\n{name|{b}}',
|
||||
|
formatter: '{a|{c}}\n{r|}\n{name|{b}}', |
||||
|
minMargin: 5, |
||||
|
edgeDistance: 1, |
||||
|
lineHeight: 15, |
||||
|
color: '#fff', |
||||
|
fontSize: 12, |
||||
|
// distanceToLabelLine: -60,
|
||||
|
rich: { |
||||
|
name: { |
||||
|
padding: [0, 6, 0, 6] |
||||
|
}, |
||||
|
a: { |
||||
|
fontSize: 30, |
||||
|
color: '#fff', |
||||
|
padding: [0, 6, 6, 6] |
||||
|
}, |
||||
|
r: { |
||||
|
backgroundColor: 'auto', |
||||
|
borderRadius: 6, |
||||
|
width: 6, |
||||
|
height: 6, |
||||
|
// padding: [3, 3, 0, -12]
|
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
labelLine: { |
||||
|
show: false, |
||||
|
smooth: 0.2, |
||||
|
length: 30, |
||||
|
length2: 0, |
||||
|
maxSurfaceAngle: 80 |
||||
|
}, |
||||
|
labelLayout: function (params) { |
||||
|
|
||||
|
const isLeft = params.labelRect.x < _charts.getWidth() / 2; |
||||
|
const points = params.labelLinePoints; |
||||
|
// Update the end point.
|
||||
|
if (points) { |
||||
|
points[2][0] = isLeft |
||||
|
? params.labelRect.x |
||||
|
: params.labelRect.x + params.labelRect.width; |
||||
|
} |
||||
|
|
||||
|
return { |
||||
|
labelLinePoints: points |
||||
|
}; |
||||
|
}, |
||||
|
itemStyle: { |
||||
|
|
||||
|
}, |
||||
|
data: [], |
||||
|
|
||||
|
}, |
||||
|
// 中间圆环
|
||||
|
{ |
||||
|
type: 'pie', |
||||
|
// 起始刻度的角度,默认为 90 度,即圆心的正上方。0 度为圆心的正右方。
|
||||
|
startAngle: 90, |
||||
|
hoverAnimation: false, |
||||
|
center: center, |
||||
|
left: 'left', |
||||
|
width: 400, |
||||
|
// tooltip: {
|
||||
|
// },
|
||||
|
radius: ['0%', '25%'], |
||||
|
label: { |
||||
|
|
||||
|
show: false |
||||
|
|
||||
|
}, |
||||
|
labelLine: { |
||||
|
show: false |
||||
|
|
||||
|
}, |
||||
|
data: [ |
||||
|
{ |
||||
|
value: 360, |
||||
|
itemStyle: { |
||||
|
color: 'rgba(8, 37, 134, 1)', |
||||
|
} |
||||
|
} |
||||
|
] |
||||
|
}, |
||||
|
] |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
@ -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//x方向平铺,也可以选择false |
|
||||
}), |
|
||||
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> |
|
||||