ViewSurface.vue 3.63 KB
<!--
 * @Author: 前端 qianduan01@didihu.com.cn
 * @Date: 2022-10-25 10:12:26
 * @LastEditors: 前端 qianduan01@didihu.com.cn
 * @LastEditTime: 2022-10-27 10:58:34
 * @FilePath: \dj-data-view\src\components\ViewSurface.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class='surface box' :class="isEqually?'whetherToDivideEqually':''">
    <div class='title title-icon'>
      <!--      <span class='icon'></span>-->
      <div class='title-h3' v-if='title'>{{ title }}</div>
      <span class='merchantName' v-if='merchantName'>{{ merchantName }}</span>
      <!--      <div class='go'>-->
      <!--        <img src='@/assets/images/go.png' />-->
      <!--      </div>-->
      <SelectCpn
        v-if='showSeletion'
        :selectName="'业务:'"
        :selectArr='businessList'
        :selectType="'springbudAtion'"></SelectCpn>
      <div
        v-if='isMonthDay'
        class='month-day-wrap'
        v-for='(item,index) in monthDayList' :key='index'
        @click='changeMonthDay(item,index)'>
        <div class='form' :class="currentIndex==index? 'light':''">{{ item.label }}</div>
      </div>
    </div>
    <div class='line-chart'>
      <line-bar :domId='domId' :isDatazoom='isDatazoom' :boxHeight='boxHeight' :dataList='dataList'></line-bar>
    </div>
  </div>
</template>
<script type='text/ecmascript-6'>
import SelectCpn from 'views/sassPlus/componts/selectCpn'

export default {
  name: 'ViewSurface',
  components: {
    SelectCpn
  },
  props: {
    title: {
      type: String,
      default: ''
    },
    isMonthDay: {
      type: Boolean,
      default: false
    },
    isDatazoom: {
      type: Boolean,
      default: false
    },
    showSeletion: {
      type: Boolean,
      default: false
    },
    isEqually: {
      type: Boolean,
      default: true
    },
    merchantName: {
      type: String,
      default: ''
    },
    boxHeight: {
      type: String,
      // default: '19.5vh'
      default: '20vh'
    },
    dataList: {
      type: Array,
      default: () => []
    },

    domId: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      businessList: [
        { label: '1.1转换+', value: 'transwork' },
        { label: '1.2膨胀金', value: 'expandedgold' },
        { label: '1.3众筹', value: 'crowdfunding' },
        { label: '2.1车损无忧', value: 'noworries' }
      ],
      monthDayList: [{
        label: '日表', value: 1
      }, {
        label: '月表', value: 0
      }],
      currentIndex: 0
    }
  },
  mounted() {

  },
  methods: {
    changeMonthDay(item, index) {
      this.currentIndex = index
      this.$bus.$emit('monthDayEvent', { queryItem: item.value })
    }
  }
}
</script>

<style scoped lang='scss'>
.whetherToDivideEqually {
  height: 21.46vh;
  width: calc(50% - 0.5vw);
  height: calc(50% - 0.5vw);
}

.surface {
  //height: 21.46vh;
  margin-bottom: 0.98vh;
  border: 2px solid black;
  border-radius: 5px;
  box-sizing: border-box;
  //width: calc(50% - 5px);
  //height: calc(50% - 5px);

  .title {
    //margin-bottom: 0.5vh;
    .go {
      margin-left: 0.2vw;
    }

    .merchantName {
      margin-left: 0.5vw;
    }

    .month-day-wrap {
      margin-left: 1vw;
      display: flex;
      width: 4.4vw;
      justify-content: space-between;
      align-items: center;

      .form {
        width: 100%;
        border-radius: 3px;
        text-align: center;
        padding: 0.1vw;
      }

      .light {
        background: #2436b7;

      }
    }
  }

  //.line-chart{
  //  padding-left: 2vw;
  //}
}
</style>