relevanceDetailChart.vue 2.42 KB
<template>
  <div style="overflow:hidden">
    <div  class="detail-box">
       <div class="chart-box">
        <img
          :src="floorPath"
          id="shopfloorpic"
          @load="imgLoaded('shopfloorpic')"
          class="detail-floor-img"
        />
        <div id="linkgraphChart" class="graph-box graph-chart-container"></div>
    </div> 
    <div class="floor-nav">
      <div v-for="(item,index) in floorData" :key="index" @click="changeFloor(item,index)" :class="{'floorTab':true,'activefloor':index==cindex}">{{item.name}}</div>
    </div>
    </div>
   
        
  </div>
</template>

<script>
import {mapState} from 'vuex'
export default {
  data() {
    return {
      floorPath:"",
       imgWidth: 0,
       cindex:0,
       floorData:""
    }
  },
  computed: {
    ...mapState(["account"])
  },
  methods:{
   getFloorData() {
    	let account_id = this.$cookie.get('accountId');
			let localMallId = window.sessionStorage.getItem('mallId');
			this.dataMsg = this.$t("echartsTitle.loading");
			this.tableData = [];
      var tabelParams = {
        accountId: account_id,
        mallId: localMallId,
        status: null,
        page: 0,
        pageSize: 100
        // _t: Date.parse(new Date()) / 1000
      };
      this.$api.base
        .floor(tabelParams, null, true)
        .then(data => {
          var result = data.data.data;
          this.floorData = result;
          this.floorPath =
            window._vionConfig.picUrl +
            result[0].floorPlan;
        })
        .catch(error => {});
    },
    imgLoaded(domId){
      const { offsetWidth } = this.queryIdDom(domId);
      this.imgWidth = offsetWidth > this.imgWidth ? offsetWidth : this.imgWidth;
      console.log(this.imgWidth )
      this.$nextTick(() => {
      
      });
    },
    changeFloor(item,index){
      this.floorPath =
            window._vionConfig.picUrl +
            item.floorPlan;
      this.cindex = index;
    }
  },
  created(){
    console.log(this.account)
    this.getFloorData()
  }
}
</script>

<style scoped>
.detail-box{
  display:flex;
  flex-direction: row;
  margin-top:50px
}
.chart-box{
  flex:1;
}
.detail-floor-img{
  width:100%;
}
.floor-nav{
  width: 100px;
}
.floorTab{
  height:25px;
  width:80px;
  text-align: center;
  line-height: 25px;
  border:1px solid #ccc;
  border-radius: 5px;
  margin-top: 10px;
  overflow: hidden;
}
.activefloor{
  background: #4BBEFF;
  color: #fff;
  border: 1px solid #4BBEFF;
}
</style>