<template>
  <div id="handle-static" class="block h100">
    <div class="black-title">事项办件量(top10)</div>
    <div class="flex1 echarts" ref="echarts">

    </div>
  </div>
</template>

<script>
import {setHandleStaticOption} from "../../echarts/option";
import * as echarts from "echarts";
import {mapMutations} from "vuex";

export default {
  name: "HandleStatic",
  data(){
    return{
      HandleStaticDataX:[
      ],
      HandleStaticDataXTotal:[
      ],
      HandleStaticDataY:[
      ],
      HandleStaticCode:[
      ]
    }

  },
  mounted() {
    let ele = this.$refs.echarts
    this.$request({
      url:'/YWTBApi/queryMatterBanjianCountTop',

      method:'post',
      data:{
        // "pageIndex":"1",
        // "pageSize":"10"
      }
    }).then(response => {
      var dataArr = response.data.msg[0].Rows;
      console.log(dataArr)
      for(var i=0;i<10;i++){
        this.HandleStaticDataX.push(dataArr[i].NAME.length>8?dataArr[i].NAME.substr(0,8)+"...":dataArr[i].NAME);
        this.HandleStaticDataXTotal.push(dataArr[i].NAME);
        this.HandleStaticDataY.push(dataArr[i].DATA_COUNT);
        this.HandleStaticCode.push(dataArr[i].BASE_CODE);
      }
      this.HandleStaticCode.reverse()
      setHandleStaticOption(ele,this.HandleStaticDataX.reverse(),this.HandleStaticDataXTotal.reverse(),this.HandleStaticDataY.reverse())
      echarts.init(ele).on('click',(params)=> {
        console.log( this.HandleStaticCode[params.dataIndex])
        this.$router.push('/origion/handleAnalysis');
        this.analysisRefresh(false);
        this.$nextTick(() => {
          this.analysisSingleChange([
            {
              name:'analysisForthLevel',
              value:this.HandleStaticCode[params.dataIndex]
            },
            {
              name:'analysisTimer',
              value:'365'
            },
            {
              name:'analysisUrgeType',
              value:'SL_TX'
            },
          ])
        })
      })
    })
  },
  methods:{
    ...mapMutations(['analysis','analysisRefresh','analysisSingleChange'])
  }
}
</script>

<style scoped lang="scss">
#handle-static{

}
</style>
