<template>
  <div class="txtSize">
    <div class="title">
      <span>销售转单数</span>
      <!-- <span style="width"></span> -->
      <div style="display: flex">
        <span style="width: 100px">
          <el-select v-model="region" size="mini">
            <el-option label="不限部门" value="1"></el-option>
            <el-option label="网络部" value="2"></el-option>
          </el-select>
        </span>
        <span style="width: 60px">
          <el-select v-model="region1" size="mini">
            <el-option label="日" value="1"></el-option>
            <el-option label="月" value="2"></el-option>
            <el-option label="年" value="3"></el-option>
          </el-select>
        </span>
        <span style="width: 140px">

          <el-date-picker
            style="width:100%"
            size="mini"
            :clearable="false"
            v-model="region2"
            :type="region1 == 1 ? 'date' : region1 == 2 ? 'month' : 'year'"
            placeholder="选择日期">
          </el-date-picker>
        </span>
      </div>
    </div>
    <!-- <div id="centerLeft" style="width: auto; height: 400px"></div> -->
    <Echart
      :options="options"
      id="centerLeft"
      height="300px"
      width="100%"
    ></Echart>
  </div>
</template>

<script>
import Echart from "@/common/echart";

export default {
  components: {
    Echart,
  },
  props: {
    cdata: {
      type: Object,
      default: () => ({}),
    },
  },
  data() {
    return {
      region: "1",
      region1: "1",
      region2: "1",
      options: {
        label: {
          show: true,
          position: "inner",
          formatter: function (params) {
            return params.value + "%";
          },
        },
        title: {
          text: "总单数/中标单数/转单率",
          left: "center",
        },
        tooltip: {
          trigger: "item",
        },
        legend: {
          orient: "vertical",
          left: "left",
        },
        series: [
          {
            name: "Access From",
            type: "pie",
            radius: "50%",
            data: [
              { value: 1048, name: "Search Engine" },
              { value: 735, name: "Direct" },
              { value: 580, name: "Email" },
              { value: 484, name: "Union Ads" },
              { value: 300, name: "Video Ads" },
            ],
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: "rgba(0, 0, 0, 0.5)",
              },
            },
          },
        ],
      },
    };
  },
  mounted() {
    // this.cinit();
  },
  methods: {
    cinit() {
      this.$echarts
        .init(document.getElementById("centerLeft"))
        .setOption(this.options);
    },
  },
};
</script>

<style lang="scss" scoped>
.txtSize {
  // font-size: 0px;
}
.title {
  font-size: 18px;
  margin: 20px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

</style>