Browse Source

发布

shibei_master
jiangyy 4 years ago
parent
commit
49e60cfd52
  1. 9
      src/assets/scss/modules/visual/distributionAnalyze.scss
  2. 173
      src/views/modules/visual/communityGovern/distributionAnalyze.vue

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

@ -135,6 +135,15 @@
width: 100%; width: 100%;
height: 90%; height: 90%;
} }
> img {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
}
} }
} }

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

@ -37,19 +37,21 @@
<div class="g-cpt-resi"> <div class="g-cpt-resi">
<div class="g-l"> <div class="g-l">
<screen-echarts-frame class="echart-line" <screen-echarts-frame v-if="!showNoData"
class="echart-line"
@myChartMethod="lineInitOk" @myChartMethod="lineInitOk"
ref="lineChart"></screen-echarts-frame> ref="lineChart"></screen-echarts-frame>
<div v-else
class="echart-line">
<img src="../../../../assets/img/modules/visual/noData.png" />
</div>
<!-- <div class="table-status" <!-- <div class="table-status"
v-if="loading"> v-if="loading">
<screen-loading>加载中</screen-loading> <screen-loading>加载中</screen-loading>
</div> </div>
<div class="table-status" <div class="table-status"
v-if="lineList.length == 0 && !loading"> v-if="lineList.length == 0 && !loading">
<div class="no-data">
<img src="../../../../assets/img/modules/visual/noData.png"
class="no-data-img" />
</div>
</div> --> </div> -->
</div> </div>
@ -209,6 +211,7 @@ export default {
await this.getAgencylist()// await this.getAgencylist()//
await nextTick(500) await nextTick(500)
await this.loadOrgData() await this.loadOrgData()
await this.getApiData(); await this.getApiData();
}, },
@ -238,6 +241,15 @@ export default {
if (month2 < 10) { if (month2 < 10) {
month2 = '0' + month2; month2 = '0' + month2;
} }
if (month < 10) {
month = '0' + month;
}
if (day < 10) {
day = '0' + day;
}
if (day2 < 10) {
day2 = '0' + day2;
}
var t2 = year2 + '-' + month2 + '-' + day2; var t2 = year2 + '-' + month2 + '-' + day2;
var t1 = year + '-' + month + '-' + day; var t1 = year + '-' + month + '-' + day;
// let t3 = formate(t2, style); // let t3 = formate(t2, style);
@ -251,9 +263,19 @@ export default {
}, },
async getApiData () { async getApiData () {
await this.getLineChart()
await this.getLine()
await this.loadMapData(); await this.loadMapData();
this.assignData()
},
assignData () {
if (!this.showNoData) {
this.getLine()
}
this.loadMap()
this.isfirstInit = false
}, },
// //
@ -352,17 +374,17 @@ export default {
if (code === 0) { if (code === 0) {
this.legendArray = [] this.legendArray = []
if (data.under) { if (data.under === 0 || data.under) {
this.under = data.under this.under = data.under
this.legendArray.push( this.legendArray.push(
{ {
color: this.colorArray[0], color: this.colorArray[0],
name: data.under + '以下' name: data.under + '以下'
} }
) )
} }
if (data.above) { if (data.above === 0 || data.above) {
this.above = data.above this.above = data.above
this.legendArray.push( this.legendArray.push(
{ {
@ -373,7 +395,7 @@ export default {
this.legendArray.push( this.legendArray.push(
{ {
color: this.colorArray[2], color: this.colorArray[2],
name: data.above + '以上' name: data.above + '以上'
} }
) )
} }
@ -394,12 +416,12 @@ export default {
item.latitude = agencyItem.latitude item.latitude = agencyItem.latitude
item.coordinates = agencyItem.coordinates item.coordinates = agencyItem.coordinates
if (this.under) { if (this.under === 0 || this.under) {
if (item.count < this.under || item.count === this.under) { if (item.count < this.under || item.count === this.under) {
item.color = this.colorArray[0] item.color = this.colorArray[0]
item.fillColor = this.colorFillArray[0] item.fillColor = this.colorFillArray[0]
} else { } else {
if (this.above) { if (this.above === 0 || this.above) {
if (item.count > this.under && item.count < this.above) { if (item.count > this.under && item.count < this.above) {
item.color = this.colorArray[1] item.color = this.colorArray[1]
item.fillColor = this.colorFillArray[1] item.fillColor = this.colorFillArray[1]
@ -410,7 +432,6 @@ export default {
} }
} }
} }
break break
} }
@ -420,8 +441,7 @@ export default {
}); });
console.log(this.mapList) console.log(this.mapList)
this.loadMap()
this.isfirstInit = false
} else { } else {
this.$message.error(msg); this.$message.error(msg);
@ -446,7 +466,7 @@ export default {
}, },
getLine () { getLine () {
if (this.lineInitState) { if (this.lineInitState) {
this.getLineChart() this.assignLineChart()
} else { } else {
setTimeout(() => { setTimeout(() => {
this.getLine() this.getLine()
@ -455,9 +475,13 @@ export default {
}, },
// 线 // 线
async getLineChart () { async getLineChart () {
this.$refs.lineChart.clear() if (!this.showNoData) {
this.$refs.lineChart.clear()
this.$refs.lineChart.showLoading()
}
const _that = this const _that = this
this.$refs.lineChart.showLoading()
const url = "/gov/project/project/projectdistributionanalysisleft"; const url = "/gov/project/project/projectdistributionanalysisleft";
// const url = "http://yapi.elinkservice.cn/mock/245/gov/project/project/projectdistributionanalysisleft"; // const url = "http://yapi.elinkservice.cn/mock/245/gov/project/project/projectdistributionanalysisleft";
let params = { let params = {
@ -467,28 +491,20 @@ export default {
}; };
const { data, code, msg } = await requestPost(url, params); const { data, code, msg } = await requestPost(url, params);
this.$refs.lineChart.hideLoading() if (!this.showNoData) {
this.$refs.lineChart.hideLoading()
}
if (code === 0) { if (code === 0) {
// pieChart
this.lineOption = lineOption()
if (data && data.length > 0) { if (data && data.length > 0) {
this.lineList = data this.lineList = data
this.loadCategoryData() this.showNoData = false
this.$refs.lineChart.setOption(this.lineOption, true)
this.$refs.lineChart.setOption({
xAxis: { data: this.xaxis },
legend: { data: this.legend },
series: this.series
}, true)
} else { } else {
this.lineList = [] this.lineList = []
this.showNoData = true
} }
this.loadCategoryData()
} else { } else {
this.$message.error(msg); this.$message.error(msg);
@ -496,60 +512,75 @@ export default {
}, },
assignLineChart () {
// pieChart
this.lineOption = lineOption()
this.$refs.lineChart.setOption(this.lineOption, true)
this.$refs.lineChart.setOption({
xAxis: { data: this.xaxis },
legend: { data: this.legend },
series: this.series
}, true)
},
//线 //线
loadCategoryData () { loadCategoryData () {
this.xaxis = [] this.xaxis = []
this.series = [] this.series = []
this.legend = [] this.legend = []
let num = this.lineList[0].categoryList.length if (this.lineList.length > 0) {
let dataArray = new Array(num)
//
this.lineList[0].categoryList.forEach((categoryItem, index) => {
this.legend.push(categoryItem.categoryName)
dataArray[index] = []
});
// let num = this.lineList[0].categoryList.length
this.lineList.forEach(item => {
this.xaxis.push(item.time)
let dataArray = new Array(num)
// //
item.categoryList.forEach((categoryItem, index) => { this.lineList[0].categoryList.forEach((categoryItem, index) => {
dataArray[index].push(categoryItem.count) this.legend.push(categoryItem.categoryName)
dataArray[index] = []
}); });
});
//
this.lineList[0].categoryList.forEach((categoryItem, index) => {
let object = {
name: categoryItem.categoryName,
type: 'line',
smooth: true,
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) //
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.categoryName,
type: 'line',
smooth: true,
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)
});
}
}, },
handleChangeAgency (value) { handleChangeAgency (value) {

Loading…
Cancel
Save