dheat.vue 4.12 KB
<!-- 核心客群分析 -->
<template>
    <div>
        <!-- 顶部区域 S-->
        <div class="ipage_top">
            <div class="tit"><img :src="bindIcon('renyuan')"/>{{title||chartData.title}}</div>
            <div class="acts">
               <!-- <template>
                     <ul class="condition-box">
                          <li class="condition-item">
                            <span class="condition-item-text">筛选条件</span>
                            <div class="condition-item-option">
                              <el-select v-model="typeVal" filterable :placeholder="$t('pholder.zoneSelect')" class="floor-sel-box format-sel-box">
                                <el-option label="全部" value=""></el-option>
                                <el-option v-for="item in typeData" :key="item.id" :label="item.name" :value="item.id"></el-option>
                              </el-select>
                            </div>
                          </li> 
                    </ul>
                </template> -->
            </div>
        </div>
        <el-row v-loading="loading"> 
            <el-col class="ichart" >
                <heat-chart v-show="!isEmpty" :cdata="chartData" tval="heat"></heat-chart>
                <heat-chart :cdata="chartData2" tval="heat"></heat-chart>
            </el-col>
        </el-row> 
    </div>
</template>

<script>
import mixin from './mixin';
import mallData from '@/components/Echarts/data';
/**********************************************************/
const chartsConfig = {
    default:{ //默认
        otherConf:{
          visualColor:['#7A6DD7','#d0c9ff'],
          hideVisualMap:true,
          _yAxis:{
            name:'女性',
            nameRotate:0,
            nameLocation:'middle',
            nameGap:70,
            nameTextStyle:{
                fontWeight:'bold'
            },
          },
          _grid:{
             left:120,
             top:0,
             right:0,
             bottom:20
          }
        } 
    }
};
/*******************************************************/
export default {
    mixins: [mixin],
    data() {
        return {
            loading:true,
            isEmpty:false,
            configObj:{},
            chartData2:{},
            typeVal:'',
            ckeys:'',
            typeData:[{
                name:'人均逛店数',
                id:1
            },{
                name:'人均到场次数',
                id:2
            }]
        }
    },
    watch: {
        typeVal(){
           this.loadChartData();
        }  
    },
    created() {
        if(this.ckey=='core_customer_analysis_male'){
            this.ckeys = 'core_customer_analysis_male,core_customer_analysis_female';
        }else{
            this.ckeys = this.ckey;
        }
    },
    methods: {
        getChartsConfig(){
            return chartsConfig;
        },
        loadChartData(params){
            this.loading = true;
            this.chartId = [this.getChartId(this.ckeys.split(',')[0]),this.getChartId(this.ckeys.split(',')[1])].join(',');
            if(this.chartId){
               this.ajaxModuleData().then(data=>{
                  this.setChartData(data);
               });
            }
        },
        setChartData(data){

            /*****************男性*****************/
            this.chartData = Object.assign({},data[this.ckeys.split(',')[0]],{
                otherConf:{...this.configObj.otherConf,hidexAxis:true,_grid:{
                     left:120,
                     top:20,
                     right:0,
                     bottom:2
                },_yAxis:{
                   ...this.configObj.otherConf._yAxis,name:'男性'
                }}
            });
            if(this.chartData.series.length==0){
                this.isEmpty = true
            }else{
                this.isEmpty = false
            }
            /*****************女性***********************/
            this.chartData2 = Object.assign({},data[this.ckeys.split(',')[1]],{
               otherConf:this.configObj.otherConf||{}
            });  
            this.loading = false;
        }
    }
}
</script>

<style  lang="less">

</style>