Browse Source

项目分布分析

shibei_master
jiangyy 4 years ago
parent
commit
07741c17d0
  1. 181
      src/assets/scss/modules/visual/distributionAnalyze.scss
  2. 2
      src/router/index.js
  3. 469
      src/views/modules/visual/communityGovern/distributionAnalyze.vue
  4. 44
      src/views/modules/visual/communityGovern/distributionLineOption.js

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

@ -8,44 +8,94 @@
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;
}
.card-title {
display: flex;
align-items: center;
.second-select {
margin: 0 10px 0 40px;
img {
display: block;
margin-right: 5px;
}
span {
display: block;
}
}
::v-deep .el-input {
width: 140px;
height: 36px;
.el-input__inner {
height: 100%;
padding: 0 10px;
color: #fff;
line-height: 36px;
.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-icon-arrow-up:before {
content: '\e78f';
.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;
}
}
}
::v-deep .el-date-editor {
.el-input__prefix {
left: unset;
right: 5px;
}
.second-select:last-child {
margin-left: 0;
}
}
.cascader {
::v-deep .el-input {
width: 220px;
@ -66,70 +116,29 @@
flex-direction: row;
// flex-wrap: wrap;
// justify-content: center;
height: calc(100vh - 130px);
height: calc(100vh - 230px);
.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: 50%;
height: calc(100vh - 290px);
.echart-line {
margin-left: 30px;
// margin-top: 100px;
text-align: center;
position: relative;
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;
height: 100%;
box-sizing: border-box;
.echart-org {
width: 100%;
height: 90%;
}
}
}
}
.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%;
.g-r {
width: 50%;
height: calc(100vh - 290px);
}
}

2
src/router/index.js

@ -274,7 +274,7 @@ router.beforeEach((to, from, next) => {
},
{
url: "/visual/communityGovern/distributionAnalyze",
name: "事件分类分析",
name: "项目分布分析",
id: "distributionAnalyze",
},
],

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

@ -1,62 +1,50 @@
<template>
<cpt-card>
<div class="title">
<img src="@/assets/img/shuju/title-tip.png" />
<span>事件分类分析</span>
<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 class="card-title">
<img src="@/assets/img/shuju/title-tip.png" />
<span>项目分布分析</span>
</div>
<div class="second-select ">
<el-date-picker v-model="dateId"
type="date"
:clearable="false"
@change="handleChangeDate"
prefix-icon="el-icon-caret-bottom"
placeholder="选择日期"
value-format="yyyyMMdd">
</el-date-picker>
<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-wr"
@myChartMethod="pieInitOk"
ref="pieChart"></screen-echarts-frame>
<screen-echarts-frame class="echart-line"
@myChartMethod="lineInitOk"
ref="lineChart"></screen-echarts-frame>
</div>
<div class="g-r">
<div class="m-tb">
<div class="tb">
<cpt-tb :col-list="demand.colList"
:loading="demand.loading"
:header="demand.header"
:list="demand.list"></cpt-tb>
<div class="m-pagination">
<el-pagination :current-page="demand.pageNo"
:page-size="demand.pageSize"
:total="demand.total"
background
layout="prev, pager, next"
@current-change="handlePageNoChange_demand">
</el-pagination>
</div>
</div>
</div>
<div class="g-r">111
<!-- <screen-echarts-frame class="echart-wr"
@myChartMethod="lineInitOk"
ref="lineChart"></screen-echarts-frame> -->
</div>
</div>
@ -70,7 +58,8 @@ 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 { pieOption } from './typePieOption.js'
import { lineOption } from './distributionLineOption.js'
import * as echarts from 'echarts'
export default {
@ -79,77 +68,6 @@ export default {
return {
showNoData: false,
timer: null,
pieChartS: null,
pieChart: '',
pieOption: {},
pieInitState: false,
pieTotal: 0,
colorArray: [],
pieData: [
{ total: 1048, categoryName: '城市管理', color: '#1B51FF', selected: true },
{ total: 735, categoryName: '为民服务', color: '#00E5ED' },
{ total: 580, categoryName: '安全监管', color: '#7800FF' },
{ total: 484, categoryName: '民政', color: '#16D783' },
{ total: 300, categoryName: '环境保护', color: '#FF7800' },
{ total: 1049, categoryName: '建设管理', color: '#FFBA00' },
{ total: 735, categoryName: '街道吹哨部门报到', color: '#FFD685' },
{ total: 580, categoryName: '社会治安综合', color: '#2A00FF' },
{ total: 484, categoryName: '公安交通管理', color: '#C600FF' },
{ total: 300, categoryName: '卫生计生监管执法', color: '#FF2A00' },
{ total: 484, categoryName: '民生', color: '#3DDA83' },
{ total: 300, categoryName: '街道安全', color: '#FAC126' }
],
agencyId: '',
dateId: '',
categoryCode: '',
demand: {
loading: true,
colList: [
{
align: "center",
width: "5%",
},
{
align: "center",
width: "10%",
},
{
align: "center",
width: "10%",
},
{
align: "center",
width: "10%",
},
{
align: "center",
width: "10%",
},
{
align: "center",
width: "5%",
},
{
align: "center",
width: "20%",
},
{
align: "center",
width: "10%",
},
{
align: "center",
width: "10%",
},
],
header: ["序号", "项目编号", "类别", "反映渠道", "所属网格", "状态", "项目标题", "转成项目时间", "操作"],
list: [],
pageSize: 10,
pageNo: 1,
total: 0,
},
casOptions: [],
agencyIdArray: [],
@ -164,6 +82,74 @@ export default {
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]
@ -180,14 +166,45 @@ export default {
methods: {
initData () {
var time = (new Date).getTime() - 24 * 60 * 60 * 1000;
this.dateId = new Date(time); //
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.getPie()
await this.getTable();
await this.getLine()
// await this.getTable();
},
async getAgencylist () {
@ -220,180 +237,126 @@ export default {
},
pieInitOk (dom) {
console.log('pie准备好了', dom)
this.pieChartS = dom
this.pieInitState = true
lineInitOk (dom) {
console.log('line准备好了', dom)
this.lineInitState = true
},
getPie () {
if (this.pieInitState) {
this.getPieChart()
getLine () {
if (this.lineInitState) {
this.getLineChart()
} else {
setTimeout(() => {
this.getPie()
this.getLine()
}, 500)
}
},
//
async getPieChart () {
this.$refs.pieChart.clear()
this.pieTotal = 0
// 线
async getLineChart () {
this.$refs.lineChart.clear()
const _that = this
// this.$refs.pieChart.showLoading()
// const url ="/data/aggregator/project/projectcategorylist";
const url = "http://yapi.elinkservice.cn/mock/245/data/aggregator/project/projectcategorylist";
// this.$refs.lineChart.showLoading()
// const url ="/gov/project/project/projectdistributionanalysisleft";
const url = "http://yapi.elinkservice.cn/mock/245/gov/project/project/projectdistributionanalysisleft";
let params = {
agencyId: this.agencyId,
dateId: this.dateId,
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);
// pieChart
if (code === 0) {
// pieChart
this.pieOption = pieOption(this.pieChartS)
if (data && data.length > 0) {
// this.pieData = data
} else {
this.pieData = [{ total: 0, categoryName: '无分类', color: '#00E5ED' }]
}
this.lineOption = lineOption()
let maxValue = this.pieData[0].total
let maxIndex = 0
this.pieData[0].selected = true
this.pieData.forEach((item, index) => {
item.name = item.categoryName
item.value = item.total
this.colorArray.push(item.color)
this.pieTotal = this.pieTotal + item.value
if (item.value > maxValue) {
maxValue = item.value
maxIndex = index
item.selected = true
} else if (index !== 0) {
item.selected = false
}
});
if (data && data.length > 0) {
this.loadCategoryData()
} else {
this.pieOption.title.text = this.pieTotal
this.pieOption.series[1].itemStyle = {
color: function (params) {
return _that.colorArray[params.dataIndex]
}
}
this.$refs.lineChart.setOption(this.lineOption, true)
this.$refs.lineChart.setOption({
xAxis: { data: this.xaxis },
legend: { data: this.legend },
series: this.series
}, true)
let fun = function (params) {
_that.clickPie(params.dataIndex)
_that.categoryCode = _that.pieData[params.dataIndex].categoryCode
_that.getTable()
}
this.$refs.pieChart.handleClick(fun)
this.clickPie(maxIndex)
} else {
this.$message.error(msg);
}
},
clickPie (seriesIndex) {
this.pieData.forEach((element, index) => {
if (index === seriesIndex) {
element.label = {
show: true,
};
element.labelLine = {
show: true,
lineStyle: {
opacity: 1,
}
//
loadCategoryData () {
};
console.log('zhilma')
this.xaxis = []
this.series = []
this.legend = []
let num = this.lineList[0].categoryList.length
} else {
element.label = {
show: false,
};
element.labelLine = {
show: false,
lineStyle: {
opacity: 0,
color: 'rgba(255,255,255,0)'
}
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.pieOption.series[1].data = this.pieData
// this.$refs.pieChart.hideLoading()
this.$refs.pieChart.setOption(this.pieOption)
//
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.agencyId = this.agencyIdArray.length > 0 ? this.agencyIdArray[this.agencyIdArray.length - 1] : ''
this.orgId = this.agencyIdArray.length > 0 ? this.agencyIdArray[this.agencyIdArray.length - 1] : ''
this.getApiData()
console.log(this.agencyIdArray)
},
//
async getTable () {
// const url = "/data/aggregator/project/categoryprojectlist";
const url = "http://yapi.elinkservice.cn/mock/245/data/aggregator/project/categoryprojectlist";
let params = {
dateId: this.dateId,
agencyId: this.agencyId,
categoryCode: this.categoryCode,
pageNo: this.demand.pageNo,
pageSize: this.demand.pageSize,
isPage: true
};
const { data, code, msg } = await requestPost(url, params);
this.demand.loading = false;
if (code === 0) {
this.demand.total = data.total;
this.demand.list = data.list.map((item) => {
//:issue :agency :resi_event
item.originShow = item.origin === 'issue' ? '楼院小组' : item.origin === 'agency' ? '项目立项' : '事件上报'
//: pendingclosed
item.statusShow = item.status === 'pending' ? '待处理' : '已结案'
return [
{ type: "index" },
item.projectCode,
item.categoryNames.join(','),
item.originShow,
item.gridName,
item.statusShow,
item.title,
item.time,
{ type: "operate", list: ["查看"] },
];
});
} else {
this.$message.error(msg);
}
},
handlePageNoChange_demand (val) {
this.demand.pageNo = val;
this.getTable();
},
toUserInfo (uid) {
this.$router.push({ path: `/main-shuju/visual-basicinfo-people/${uid}` });
},

44
src/views/modules/visual/communityGovern/distributionLineOption.js

@ -2,7 +2,18 @@ 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,
@ -51,21 +62,22 @@ export function lineOption () {
}
},
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' }
]
)
}
},
// {
// 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',

Loading…
Cancel
Save