Category.vue 1.84 KB
<!--
 * @Description: 
 * @Author: huyue
 * @Date: 2024-01-25 16:52:03
 * @LastEditors: huyue
 * @LastEditTime: 2024-01-26 21:05:08
-->
<template>
  <div class="category-box">
    <div class="title title-icon">
      <span class="icon-title"></span>
      <span class="title-bg">品类业务</span>
    </div>
    <div class="category-container flex">
      <pie-chart ref="pieChartCategory" :id="chart.id" :list="categoryData" :formatter="chart.formatter" :colors="chart.colors"></pie-chart>
      <OperationaLegend class="category-legend" :list="categoryData" :width="'4.17vw'" :height="'2.44vh'" :colors="chart.colors"></OperationaLegend>
    </div>
  </div>
</template>

<script>
import OperationaLegend from './OperationaLegend.vue'
export default {
  name: 'Category',
  components: {
    OperationaLegend
  },
  data() {
    return {
      chart: {
        id: 'category',
        colors: ['#6578FF', '#34AFFF', '#EB6001', '#16E193', '#BF98FF'],
        formatter: 'rate'
      }
    }
  },
  props: {
    categoryData: {
      type: Array,
      default: () => []
    }
  },
  methods: {}
}
</script>
<style lang="scss" scoped>
.category-box {
  overflow: hidden;
  height: 13.9vh;
  background-color: rgba(11, 44, 142, 0.28);
  .title-icon {
    font-weight: 500;
    font-size: 14px;
    color: #ffffff;
    // .title-bg {
    //   background-image: linear-gradient(90deg, #003f57 0%, #111056 54%, #06142200 100%);
    //   padding-left: 0.83vw;
    // }
  }
  .category-container {
    height: 11.34vh;
    // margin: 1.59vh 1.67vw 1.46vh 1.11vw;
    .category-legend {
      width: 4.2vw;
      margin-right: 1.81vw;
      /deep/ .legend-item {
        width: 5.3vw !important;
        height: 1.44vh !important;
      }
      /deep/ .item-content {
        width: 5.8vw;
      }
    }
  }
}
</style>