|
|
@ -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' ? '项目立项' : '事件上报' |
|
|
|
//状态:待处理 pending,已结案closed |
|
|
|
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}` }); |
|
|
|
}, |
|
|
|