You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
168 lines
3.7 KiB
168 lines
3.7 KiB
<template>
|
|
<div class="m-wtqd">
|
|
<div class="tablist">
|
|
<div v-for="item in tabList" :key="item" :class="['item', { 'item-sel': currentTab == item }]" @click="handleClick(item)">{{ item }}</div>
|
|
</div>
|
|
<div class="pieMain">
|
|
<div class="legend">
|
|
<div class="legend-row cur" :key="'pie' + item.name" v-for="(item, index) in pieData" @click="handleClickItem(item)">
|
|
<div class="name">{{ item.name }}</div>
|
|
<div class="content">
|
|
<div class="num">{{ item.value }}</div>
|
|
<div class="unit" v-if="currentTab == '综治人群'">人</div>
|
|
<div class="unit" v-else>件</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="pie"><screen-echarts-frame @myChartMethod="pieInitOk" ref="pieChart"></screen-echarts-frame></div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<script>
|
|
import screenEchartsFrame from '@/views/dataBoard/cpts/screen-echarts-frame/index';
|
|
import { pieOption } from './wtqdPieOption.js';
|
|
import { requestPostBi } from '@/js/dai/request-bipass';
|
|
export default {
|
|
props: {
|
|
orgId: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
searchDate:Array
|
|
},
|
|
data() {
|
|
return {
|
|
data: {},
|
|
showNoData: false,
|
|
timer: null,
|
|
pieChart: '',
|
|
pieOption: {},
|
|
pieInitState: false,
|
|
pieData: [],
|
|
tabList: [
|
|
'治理事件',
|
|
'安全隐患',
|
|
'综治人群'
|
|
// "下级人口分布",
|
|
],
|
|
currentTab: '治理事件'
|
|
};
|
|
},
|
|
components: {
|
|
screenEchartsFrame
|
|
},
|
|
mounted() {
|
|
// this.init();
|
|
},
|
|
watch: {
|
|
orgId() {
|
|
this.init();
|
|
},
|
|
searchDate() {
|
|
|
|
this.init();
|
|
}
|
|
},
|
|
methods: {
|
|
handleClick(item) {
|
|
this.currentTab = item;
|
|
this.getInfo();
|
|
},
|
|
async init() {
|
|
await this.getInfo();
|
|
this.getPie();
|
|
},
|
|
handleClickItem(item) {
|
|
|
|
let path=""
|
|
if(this.currentTab=="治理事件")
|
|
{
|
|
path="eventList"
|
|
}else if(this.currentTab=="安全隐患"){
|
|
path="hiddenDangerList"
|
|
}else{
|
|
path="specialCategoryList"
|
|
}
|
|
this.getInfo();
|
|
this.$router.push({
|
|
path: `/dataBoard/sida/wt/${path}`,
|
|
query: {
|
|
org_id: this.orgId,
|
|
type: this.currentTab,
|
|
type2: item.name,
|
|
start_date: this.searchDate[0],
|
|
end_date: this.searchDate[1]
|
|
}
|
|
});
|
|
},
|
|
// 获取房屋总数等
|
|
async getInfo() {
|
|
let url = '';
|
|
console.log(this.currentTab);
|
|
if (this.currentTab == '治理事件') {
|
|
url = 'event_view';
|
|
} else if (this.currentTab == '安全隐患') {
|
|
url = 'risk_view';
|
|
} else {
|
|
url = 'special_view';
|
|
}
|
|
this.$refs.pieChart.showLoading();
|
|
const { data, code, msg } = await requestPostBi(
|
|
url,
|
|
{
|
|
queryParam: {
|
|
org_id: this.orgId
|
|
}
|
|
},
|
|
{
|
|
// mockId: 60041615,
|
|
}
|
|
);
|
|
this.$refs.pieChart.hideLoading();
|
|
if (code === 0) {
|
|
console.log("data",data)
|
|
if (data && Array.isArray(data) && data.length > 0) {
|
|
let info = data[0];
|
|
this.info = {
|
|
...this.info,
|
|
...info
|
|
};
|
|
}
|
|
this.data = data;
|
|
this.setPieData();
|
|
} else {
|
|
this.$message.error(msg);
|
|
}
|
|
},
|
|
pieInitOk() {
|
|
this.pieInitState = true;
|
|
},
|
|
getPie() {
|
|
if (this.pieInitState) {
|
|
this.setPieData();
|
|
} else {
|
|
setTimeout(() => {
|
|
this.getPie();
|
|
}, 500);
|
|
}
|
|
},
|
|
setPieData() {
|
|
let { data } = this;
|
|
data = JSON.parse(JSON.stringify(data).replace(/count/g, 'value'));
|
|
console.log('data', data);
|
|
this.pieData = data;
|
|
this.iniPieChart();
|
|
},
|
|
// 获取饼状图
|
|
async iniPieChart() {
|
|
this.$refs.pieChart.clear();
|
|
// 获取pieChart配置
|
|
this.pieOption = pieOption();
|
|
this.pieOption.series[0].name = this.currentTab;
|
|
this.pieOption.series[0].data = this.pieData;
|
|
this.$refs.pieChart.setOption(this.pieOption);
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
<style lang="scss" src="@/assets/scss/dataBoard/renfang/index.scss" scoped></style>
|
|
|