<!--
 * @Author: your name
 * @Date: 2022-04-11 15:07:47
 * @LastEditTime: 2022-04-12 09:55:18
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: /gassafety-progress/gassafetyprogress-web/src/views/operationMonitor/xunjianxuncha/topChars/left.vue
-->
<template>
  <div class="charsCom all-flex-h">
    <div id="main1" class="two all-flex">
      <!--<chars :options="options"></chars>-->
    </div>
  </div>
</template>

<script>
import Chars from "@/components/allCharsCom/Chars";
import { indoorsummary } from "@/api/statistic/statisticAnalysis";
export default {
  components: {
    Chars,
  },
  props:{
    annual: {
      type: String,
      default: 2025,
    },
    companyInfoId: {
      type: String,
      default: 23,
    },
  },
  data(){
    return{
      totalObj: {
        taskTotal: 0,
        taskFeedbackTotal: 0
      },
      maps:{},
      options: {
        grid: {
          top: '10%',     // 上边距
          right: '5%',    // 右边距
          bottom: '0%',  // 下边距
          left: '5%',    // 左边距
          containLabel: true // 保证坐标轴标签等内容不被遮挡
        },
        legend: {},
        tooltip: {},
        dataset: {
          source: [
            ['product', '已安检', '未安检', '到访不遇','拒绝安检'],
            ['2026', 43.3, 85.8, 93.7,10],
            ['2025', 83.1, 73.4, 55.1,10],
            ['2024', 86.4, 65.2, 82.5,10],
            ['2023', 72.4, 53.9, 39.1,10]
          ]
        },
        xAxis: { type: 'category' },
        yAxis: {},
        series: [{ type: 'bar' }, { type: 'bar' }, { type: 'bar' }, { type: 'bar' }]
      }
    }
  },
  created(){
    //this.getStatiData();
    setTimeout(this.getzhanshi,1000);
  },
  methods:{
    getzhanshi(){
      var myChart =  this.$echarts.init(document.getElementById('main1'));
      myChart.setOption(this.options);
    },
    getStatiData() {
      indoorsummary().then(response => {
        console.log(response.data);
        var source = [
          ['product', '已安检', '未安检', '到访不遇','拒绝安检']
        ]
        for(var map of response.data){
          source.push([map.yearNum,map.doneNum,map.allNum-map.yearNum-map.noneNum-map.rejNum,map.noneNum,map.rejNum]);
        }
        console.log('canshu',source)
        this.options.dataset.source = source;
        var myChart =  this.$echarts.init(document.getElementById('main1'));
        myChart.setOption(this.options);
      // source: [
      //   ['product', '已安检', '未安检', '到访不遇','拒绝安检'],
      //   ['2026', 43.3, 85.8, 93.7,10],
      //   ['2025', 83.1, 73.4, 55.1,10],
      //   ['2024', 86.4, 65.2, 82.5,10],
      //   ['2023', 72.4, 53.9, 39.1,10]
      // ]
      });
    },
  }
};
</script>

<style lang="scss" scoped>
.charsCom {
  width: 100%;
  height: 100%;
  color: #333333;
}
.title {
  text-align: center;
  font-size: 24px;
  margin-bottom: 7px;
}
.two {
  flex: 1;
  > .left {
    margin-right: 70px;
  }
  > .right {
  }
  > div {
    font-size: 16px;
    flex: 1;
    // display: flex;
    // flex-direction: column;
  }
  .left,
  .right {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    .first {
      margin-bottom: 6px;
      text-align: left;
      .text {
        display: inline-block;
        margin-right: 8px;
      }
    }
    .second {
      width: 250px;
      height: 30px;
      line-height: 30px;
      box-sizing: border-box;
      box-shadow: 0px 0px 3px 1px #dddddd;
      margin-bottom: 19px;

      > div {
        // flex: 1;
        text-align: center;

        &.left {
          color: #1d8cf3;
        }
        &.right {
          color: #00c3f1;
        }
      }
    }
    .third {
      text-align: center;
      width: 250px;
      margin-bottom: 24px;
    }
    .fifth {
      flex: 1;
      // background: red;
      padding-top: 5px;
      .contant {
        width: 120px;
        height: 120px;
        margin: 0 auto;
      }
    }
  }
}
</style>
