pbar.vue 1.95 KB
<!-- 业务态客流综合指标分布 -->
<template>
    <div>
        <!-- 顶部区域 S-->
        <div class="ipage_top">
            <div class="tit"><img :src="bindIcon('xiaoshou')"/>{{title||chartData.title}}</div>
            <div class="acts">
                <!-- <el-tabs v-model="numPerVal" @tab-click="handlePerClick" class="no_bar">
                    <el-tab-pane label="人次" name="count"></el-tab-pane>
                    <el-tab-pane label="百分比" name="percent"></el-tab-pane>
                </el-tabs> -->
                <slot name="action"></slot>
            </div>
        </div>
        <div class="ichart">
            <pictorial-bar :cdata="chartData"></pictorial-bar>
        </div>
    </div>
</template>

<script>
import mixin from './mixin';
import mallData from '@/components/Echarts/data';
export default {
    mixins: [mixin],
    data() {
        return {
            numPerVal:'count',
        }
    },
    created() {
        
    },
    methods: {
        handlePerClick(){

        },
        loadChartData(params){
            this.chartId = this.getChartId(this.ckey);
            if(this.chartId){
              this.ajaxModuleData().then(data=>{
                  this.setChartData(data);
               });
            }else{
               this.setChartData(); 
            }
        },
        setChartData(data){
            try{
                data.series[0].data = data.series[0].data.map((value,i)=>{
                    let arr = String(value).match(/^\d+\.?\d+/);
                    let item =  {
                        value:arr?arr[0]:0
                    }
                    return item;
                })
                this.chartData = Object.assign({},data/*mallData.body.retentionInAndOutLine*/,{
                    otherConf:{
                    }
                });
            }catch(err){
                this.chartData = {otherConf:{}}
            }
        }
    }
}
</script>

<style  lang="less">

</style>