PurchaseProgress.vue 2.14 KB
<!--
 * @Description: 
 * @Author: huyue
 * @Date: 2023-07-07 17:34:48
 * @LastEditors: huyue
 * @LastEditTime: 2023-07-17 14:29:07
-->
<template>
  <div class="purchase-progress-box">
    <box-title title="商城采购进度分析"></box-title>
    <RightViewContent v-if="progressData.length" class="content-box" :chart="progressChart" :listData="progressData" :legentList="progressLegend" :legendColors="progressChart.colors"></RightViewContent>
    <div v-else class="empty">
      <Empty></Empty>
    </div>
  </div>
</template>

<script>
import RightViewContent from './RightViewContent.vue'
import { changeMixin } from '@/mixins'
export default {
  name: 'PurchaseProgress',
  mixins: [changeMixin],
  components: {
    RightViewContent
  },

  data() {
    return {
      // 采购进度饼图结构
      progressChart: {
        id: 'progress',
        keys: ['progress', 'purchaseamount'],
        height: '16.34vh',
        colors: ['#4FA0FF', '#7CFFB2', '#FDF006']
      },
      // 采购进度数据
      progressData: [],
      progressLegend: [
        {
          name: 'progress',
          width: '5vw'
        },
        {
          name: 'rate',
          type: 'decimal',
          width: '2.4vw'
        },
        {
          name: 'purchaseamount',
          hasIcon: '¥',
          type: 'number',
          width: '5.5vw'
        }
      ]
    }
  },

  mounted() {},

  methods: {
    init() {
      this.getBugProgress()
    },
    // 获取商品采购进度占比
    getBugProgress() {
      this.api.solar.getBugProgress({ year: this.$store.state.app.solarYear }).then(res => {
        if (!res.code === '0') {
          this.openMessage('获取采购进度占比失败')
          return
        }
        this.progressData = res.data.dataList || []
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.purchase-progress-box {
  width: 100%;
  background: #061422;
  box-shadow: inset 0 0 20px 0 #3d57ff69;
  height: 25vh;
  margin-bottom: 1.78vh;
  .content-box {
    // padding: 2.78vh 1.39vw 2.78vh 0;
    margin-right: 1.54vw;
    height: 21.67vh;
  }
  .empty {
    height: 21.67vh;
    display: flex;
    align-items: center;
  }
}
</style>