|
|
|
|
<template>
|
|
|
|
|
<div class="m-fwqd">
|
|
|
|
|
<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" :key="'pie' + item.name" v-for="item in pieData" @click="handleClickItem(item)">
|
|
|
|
|
<div class="name">{{ item.name }}</div>
|
|
|
|
|
<div class="content">
|
|
|
|
|
<div class="num">{{ item.value }}</div>
|
|
|
|
|
<div class="unit">人</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 './fwqdPieOption.js';
|
|
|
|
|
import { requestPostBi } from '@/js/dai/request-bipass';
|
|
|
|
|
export default {
|
|
|
|
|
props: {
|
|
|
|
|
orgId: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: ''
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
data: {},
|
|
|
|
|
showNoData: false,
|
|
|
|
|
timer: null,
|
|
|
|
|
pieChart: '',
|
|
|
|
|
pieOption: {},
|
|
|
|
|
pieInitState: false,
|
|
|
|
|
pieData: [],
|
|
|
|
|
tabList: [
|
|
|
|
|
'公共服务',
|
|
|
|
|
'个性服务'
|
|
|
|
|
// "下级人口分布",
|
|
|
|
|
],
|
|
|
|
|
currentTab: '公共服务'
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
components: {
|
|
|
|
|
screenEchartsFrame
|
|
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
this.init();
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
orgId() {
|
|
|
|
|
this.init();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
handleClick(item) {
|
|
|
|
|
this.currentTab = item;
|
|
|
|
|
this.getInfo();
|
|
|
|
|
},
|
|
|
|
|
async init() {
|
|
|
|
|
await this.getInfo();
|
|
|
|
|
this.getPie();
|
|
|
|
|
},
|
|
|
|
|
handleClickItem(item) {
|
|
|
|
|
// const { type, name } = item;
|
|
|
|
|
// this.$router.push({
|
|
|
|
|
// path: '/dataBoard/renfang/resi-analyze',
|
|
|
|
|
// query: {
|
|
|
|
|
// org_id: this.orgId,
|
|
|
|
|
// type,
|
|
|
|
|
// type_category: this.currentTab,
|
|
|
|
|
// type_name: name
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
},
|
|
|
|
|
// 获取房屋总数等
|
|
|
|
|
async getInfo() {
|
|
|
|
|
let url = '';
|
|
|
|
|
if (this.currentTab == '公共服务') {
|
|
|
|
|
url = 'common_service_view';
|
|
|
|
|
} else {
|
|
|
|
|
url = 'self_service_views';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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) {
|
|
|
|
|
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'));
|
|
|
|
|
|
|
|
|
|
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>
|