|
@@ -0,0 +1,91 @@
|
|
|
+<template>
|
|
|
+ <div id="down-pie">
|
|
|
+ <div id="chartPie" class="" style="height:450px;"></div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions } = createNamespacedHelpers('transaction');
|
|
|
+const { mapActions: personalRoom } = createNamespacedHelpers('personalroom');
|
|
|
+import echarts from 'echarts/lib/echarts';
|
|
|
+import 'echarts/lib/chart/pie';
|
|
|
+import 'echarts/lib/chart/pie';
|
|
|
+import 'echarts/lib/chart/line';
|
|
|
+import 'echarts/lib/component/title';
|
|
|
+import 'echarts/lib/component/legend';
|
|
|
+import 'echarts/lib/component/toolbox';
|
|
|
+import 'echarts/lib/component/markPoint';
|
|
|
+import 'echarts/lib/component/tooltip';
|
|
|
+export default {
|
|
|
+ name: 'downPie',
|
|
|
+ props: {},
|
|
|
+ components: {},
|
|
|
+ data: () => {
|
|
|
+ return {
|
|
|
+ myChart: null,
|
|
|
+ type: 'pie',
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.init();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ ...mapActions(['query']),
|
|
|
+ ...personalRoom(['countRoom']),
|
|
|
+ async init() {
|
|
|
+ let res = await this.query();
|
|
|
+ let rooms = await this.countRoom();
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ let taking = rooms.errcode == 0 ? rooms.total : 0;
|
|
|
+ let s1 = res.data.filter(f => f.status == '1'); //达成意向
|
|
|
+ let s2 = res.data.filter(f => f.status == '2'); //对接完成
|
|
|
+ let s3 = res.data.filter(f => f.status == '3'); //未达成意向
|
|
|
+ this.myChart = echarts.init(document.getElementById('chartPie'));
|
|
|
+ const option = {
|
|
|
+ title: {},
|
|
|
+ tooltip: { trigger: 'item', formatter: '{a} <br/>{b} : {c} ({d}%)' },
|
|
|
+ legend: {
|
|
|
+ data: ['正在洽谈', '达成意向', '对接完成', '未达成意向'],
|
|
|
+ },
|
|
|
+ series: [
|
|
|
+ {
|
|
|
+ name: '统计',
|
|
|
+ label: {
|
|
|
+ show: true,
|
|
|
+ position: 'top',
|
|
|
+ },
|
|
|
+ type: this.type,
|
|
|
+ data: [
|
|
|
+ { name: '正在洽谈', value: taking, itemStyle: { color: 'gray' } },
|
|
|
+ { name: '达成意向', value: s1.length, itemStyle: { color: 'blue' } },
|
|
|
+ { name: '对接完成', value: s2.length, itemStyle: { color: 'green' } },
|
|
|
+ ],
|
|
|
+ animationType: 'scale',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ toolbox: {
|
|
|
+ show: true,
|
|
|
+ feature: {
|
|
|
+ dataView: { readOnly: false },
|
|
|
+ saveAsImage: {},
|
|
|
+ },
|
|
|
+ },
|
|
|
+ };
|
|
|
+ this.myChart.setOption(option);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState(['user']),
|
|
|
+ pageTitle() {
|
|
|
+ return `${this.$route.meta.title}`;
|
|
|
+ },
|
|
|
+ },
|
|
|
+ metaInfo() {
|
|
|
+ return { title: this.$route.meta.title };
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped></style>
|