timeflow.vue 2.68 KB
<template>
  <div class="template-box content_div_main noBackGround">
    <el-form :inline="true" class="search-form" size="small">
      <el-form-item label="社区选择:">
        <el-select v-model="mallId" placeholder="请选择">
         <el-option
           v-for="item in mallData"
          :key="item.unid" :value="item.id" :label="item.name"
         ></el-option>
         </el-select>
      </el-form-item>
       <el-form-item label="查询时间:">
          <el-date-picker
               v-model="datatime"
               type="month"
               value-format="yyyy-MM"
               placeholder="选择日期"
               :picker-options="pickerOptions">
             </el-date-picker>
      </el-form-item>
       <el-form-item>
        <el-button  class="search-btn" @click="searchFaceCheck" icon="el-icon-search">查询</el-button>
        <!-- <el-button  class="search-btn ml10"  @click="exportCluster()" icon="el-icon-upload">导出</el-button> -->
      </el-form-item>
    </el-form>
    <div class="chartBox">
      <chart chartId="chart1" :chartType="type" :chartData="chartData" class="chart"></chart>
    </div>

  </div>
</template>

<script>
  import chart from "../public/chart.vue"
export default {
   data() {
      return {
        type:"Heatmap",
        pickerOptions:{
          disabledDate(time) {
            return time.getTime() > Date.now();
          },
        },
        datatime:this.common.formatDateFun(new Date(), "yyyy-MM"),
        chartData:{},
        mallData:[],
        mallId:'',
        accountId:localStorage.getItem("accountId")
      }
  },
  watch:{
  },
  components:{
    chart
  },
  methods: {
    searchFaceCheck(){
      this.initChart();
    },
    getMallList(){
          this.axios.get(this.API.url + "/malls",{
            params:{
              accountId:this.accountId,
              status:1
            }
          }).then((response)=> {
             this.mallData = response.data.data;
             if(response.data.data.length>0){
               this.mallId=response.data.data[0].id
             }
            this.initChart();
          });

    },
    initChart(){
      this.axios.get(this.API.url+"/report/thermodynamic/mall",{
        params:{
          orgIds: this.mallId,
          startDate: this.datatime+'-01',
          endDate:this.common.getEndDay("month",this.datatime),
          chartIds: '267',
        }
      }).then((res)=>{
        this.chartData=res.data.data.body.TimeThermodynamic;
        this.chartData.otherConf={
          _color:["#4BBEFF", "#87D14B", "#FFC62E", "#FF9631"]
        }
      })
    },
  },
  mounted() {
    this.getMallList();
  }
 }
</script>
<style  scoped>
  .chart{
    height: 500px;
  }
</style>