| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288 |
- <template>
- <div style="background-color: #f0f2f5; padding-bottom: 20px; min-height: 100%; " >
- <div style="padding: 20px; background-color: #fff;">
- 数据分析
- </div>
- <div class="contentx" v-if="item!=null">
- <div class="desct">
- 数据分析
- </div>
- <div class="statistics-container">
- <el-row :gutter="20" type="flex" justify="space-between">
- <el-col :span="6" >
- <el-card style="height: 100px">
- <div class="statistic-item">
- <h2>{{ item.addNum }} </h2>
- <p>添加人数</p>
- </div>
- </el-card>
- </el-col>
- <el-col :span="6" >
- <el-card style="height: 100px">
- <div class="statistic-item">
- <h2>{{ item.deleteNum }} </h2>
- <p>流失人数</p>
- </div>
- </el-card>
- </el-col>
- <el-col :span="6" >
- <el-card style="height: 100px">
- <div class="statistic-item">
- <h2>{{ item.addNum-item.deleteNum }} </h2>
- <p>剩余人数</p>
- </div>
- </el-card>
- </el-col>
- </el-row>
- </div>
- </div>
- <div class="contentx" v-if="item!=null">
- <div class="desct">
- 数据统计
- </div>
- <div>
- <el-select v-model="value" placeholder="请选择日期" style="margin-left: 40px;" @change="changeValue">
- <el-option
- v-for="item in options"
- :key="item.value"
- :label="item.label"
- :value="item.value">
- </el-option>
- </el-select>
- </div>
- <div id="echart-customer" style="width: 100%; height: 400px;"></div>
- </div>
- <div class="contentx" v-if="item!=null">
- <div class="desct">
- 数据表格
- </div>
- <div>
- <el-table
- :data="list"
- border
- :summary-method="getSummaries"
- show-summary
- max-height="500"
- style="width: 100%;">
- <el-table-column
- prop="type"
- label="日期">
- </el-table-column>
- <el-table-column
- prop="addNum"
- label="添加人数">
- </el-table-column>
- <el-table-column
- prop="deleteNum"
- label="流失人数">
- </el-table-column>
- <el-table-column
- prop="num"
- label="净人数">
- </el-table-column>
- </el-table>
- </div>
- </div>
- </div>
- </template>
- <script>
- import {statistics, sync,listContactWay, getContactWay, delContactWay, addContactWay, updateContactWay, exportContactWay } from "@/api/qw/contactWay";
- import echarts from 'echarts'
- export default {
- name: "statisDetails",
- props:["data"],
- data() {
- return {
- item:null,
- value: '5',
- options: [{
- value: '1',
- label: '今天'
- }, {
- value: '2',
- label: '昨天'
- }, {
- value: '3',
- label: '本周'
- }, {
- value: '4',
- label: '上周'
- }, {
- value: '5',
- label: '本月'
- }
- , {
- value: '6',
- label: '上月'
- }
- , {
- value: '7',
- label: '本季度'
- }
- , {
- value: '8',
- label: '上季度'
- }
- , {
- value: '9',
- label: '本年'
- }
- , {
- value: '10',
- label: '上年'
- }],
- list:[],
- dates:[],
- addNum:[],
- deleteNum:[],
- num:[],
- };
- },
- created() {
- },
- methods: {
- getDetails(orderId) {
- this.item=null;
- this.list=null;
- getContactWay(orderId).then(response => {
- this.item = response.data;
- this.getStatisList()
- });
- },
- changeValue(){
- this.getStatisList()
- },
- getStatisList(){
- var data={type:this.value,wayId:this.item.id}
- statistics(data).then(response => {
- this.list=response.list;
- this.dates=response.dates;
- this.addNum=response.addNum;
- this.deleteNum=response.deleteNum;
- this.num=response.num;
- setTimeout(() => {
- this.initEchart();
- }, 500);
- });
- },
- initEchart(){
- var option = {
- tooltip: {
- trigger: 'axis',
- axisPointer: { // 坐标轴指示器,坐标轴触发有效
- type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
- }
- },
- legend: {
- data: ['添加人数', '流失人数','净人数']
- },
- grid: {
- left: '3%',
- right: '4%',
- bottom: '3%',
- containLabel: true
- },
- xAxis: [
- {
- type: 'category',
- data: this.dates
- }
- ],
- yAxis: [
- {
- type: 'value',
- axisLabel:{
- formatter:'{value}'
- }
- }
- ],
- series: [
- {
- name: '添加人数',
- type: 'line',
- emphasis: {
- focus: 'series'
- },
- data: this.addNum
- },
- {
- name: '流失人数',
- type: 'line',
- emphasis: {
- focus: 'series'
- },
- data: this.deleteNum
- },
- {
- name: '净人数',
- type: 'line',
- emphasis: {
- focus: 'series'
- },
- data: this.num
- }
- ]
- };
- this.chart=echarts.init(document.getElementById("echart-customer"));
- this.chart.setOption(option,true);
- },
- }
- }
- </script>
- <style>
- .contentx{
- height: 100%;
- background-color: #fff;
- padding: 0px 20px 20px;
- margin: 20px;
- }
- .el-descriptions-item__label.is-bordered-label{
- font-weight: normal;
- }
- .el-descriptions-item__content {
- max-width: 150px;
- min-width: 100px;
- }
- .desct{
- padding-top: 20px;
- padding-bottom: 20px;
- color: #524b4a;
- font-weight: bold;
- }
- .require:before {
- content: '* ';
- color: red;
- }
- .noRequire:before{
- content: '* ';
- color: white;
- }
- .statistics-container {
- padding: 20px;
- }
- .statistic-item {
- text-align: center;
- margin-top: 5%;
- }
- .statistic-item h2 {
- font-size: 24px;
- margin: 0;
- }
- .statistic-item p {
- margin: 5px 0 0;
- color: #666;
- }
- .echart-box{
- margin: 0 auto;
- text-align: center;
- }
- </style>
|