moveLine.vue 6.24 KB
<template>
    <div class="base-analysis">
        <el-header height="70px">
            <span class="asis-title">{{ asisName }}&nbsp;{{$t('asis.MoveLine')}}</span>
        </el-header>
        <moveline-option ref="init" :mallData="mallData" @reportTime="reportHandler" @initData="initTab"></moveline-option>
        <div class="element-main base-main">
            <!-- ref="takeTime" -->
            <router-view :propparam="propParams"></router-view>
        </div>
    </div> 
</template>

<script>
import mlOption from '../common/option/mlMoreOption'
export default {
    data() {
        return {
            mallData: [],
            asisName: '',
            asisLevel: '',
            propParams: {}
        }
    },
    components: {
        'moveline-option': mlOption,
    },
    created() {
        window.addEventListener('resize', () => {
            try {
                let timeHeatEChartsUtil = {
                    chart1: $('#cusGraphChart')[0],
                    chart2: $('#mGraphChart')[0],
                    chart3: $('#graphChart')[0],
                    chart4: $('#wGraphChart')[0],
                    chart5: $('#yGraphChart')[0],
                }
                for(let k in timeHeatEChartsUtil) {
                    if(timeHeatEChartsUtil.hasOwnProperty(k) && timeHeatEChartsUtil[k] != undefined) {
                        timeHeatEChartsUtil[k] = this.$echarts.init(timeHeatEChartsUtil[k]);
                        var element = timeHeatEChartsUtil[k];
                        element.resize();
                    }
                }
            } catch (err) { }
        })
    },
    mounted() {
        // this.router.push('/analysis/comprehenAnalysis/daily')
        this.getMallOpt();
        // $('.element-main').niceScroll();
    },
    methods: {
        getMallOpt() {
            this.$api.base.mall({
                accountId: this.$cookie.get('accountId'),
                status: 1,
                // _t: Date.parse(new Date()) / 1000
            }).then(res => {
                let titleName = '', refMallId = null;
                if(res.data.data.length >= 1) {
                    let localMallId = window.sessionStorage.getItem('mallId');
                    localMallId ? Number(localMallId) : false;
                    res.data.data.forEach((item, index) => {
                        this.mallData.push(item);
                        if(localMallId) {
                            if(item.id == localMallId) {
                                titleName = item.name;
                            }
                        }
                    });
                    this.asisName = titleName ? titleName : res.data.data[0].name;
                    refMallId = localMallId ? Number(localMallId) : res.data.data[0].id;
                    this.$refs.init.initAsis(refMallId);
                }
            })
        },
        initTab(data) {
            switch (data.asis_date) {
                case 'day':
                    this.$router.push('/customer/trafficeline/daily');
                    this.propParams = {
                        dateType: '/trafficeline/daily',
                        data: data
                    };
                    break;
                case 'week':
                    this.$router.push('/customer/trafficeline/weekly')
                    this.propParams = {
                        dateType: '/trafficeline/weekly',
                        data: data
                    };
                    break;
                case 'month':
                    this.$router.push('/customer/trafficeline/monthly')
                    this.propParams = {
                        dateType: '/trafficeline/monthly',
                        data: data
                    };
                    break;
                case 'year':
                    this.$router.push('/customer/trafficeline/yearly')
                    this.propParams = {
                        dateType: '/trafficeline/yearly',
                        data: data
                    };
                    break;
                case 'custom':
                    this.$router.push('/customer/trafficeline/customly')
                    this.propParams = {
                        dateType: '/trafficeline/customly',
                        data: data
                    };
                    break;
                default:
                    break;
            }
            
            // setTimeout(() => {
            //     this.$refs.takeTime.refreshHandle(data);
            // }, 1000);
        },
        reportHandler(emitData) {
            this.asisName = emitData.asis_tit;
            switch (emitData.asis_date) {
                case 'day':
                    this.$router.push('/customer/trafficeline/daily');
                    this.propParams = {
                        dateType: '/trafficeline/daily',
                        data: emitData
                    };
                    break;
                case 'week':
                    this.$router.push('/customer/trafficeline/weekly');
                    this.propParams = {
                        dateType: '/trafficeline/weekly',
                        data: emitData
                    };
                    break;
                case 'month':
                    this.$router.push('/customer/trafficeline/monthly');
                    this.propParams = {
                        dateType: '/trafficeline/monthly',
                        data: emitData
                    };
                    break;
                case 'year':
                    this.$router.push('/customer/trafficeline/yearly');
                    this.propParams = {
                        dateType: '/trafficeline/yearly',
                        data: emitData
                    };
                    break;
                case 'custom':
                    this.$router.push('/customer/trafficeline/customly');
                    this.propParams = {
                        dateType: '/trafficeline/customly',
                        data: emitData
                    };
                    break;
                default:
                    break;
            }
            // setTimeout(() => {
            //     this.$refs.takeTime.refreshHandle(emitData);
            // }, 200);
        }
    },
}
</script>

<style scoped>
</style>