<template>
  <transition
    appear
    name="animate__animated animate__move"
    enter-active-class="animate__fadeInUp"
    leave-active-class="animate__fadeOutDown"
  >
    <div class="widget-ContractSettlement">
      <div class="head">
        <div class="title">
          <div class="icon"></div>
          <span class="site-info">合同结算</span>
        </div>
      </div>
      <div class="content-info">
        <ComContractBarChart :chartData="chartData" />
      </div>
    </div>
  </transition>
</template>

<script lang="ts">
import { Vue, Component, Prop, Watch } from 'vue-property-decorator'
import { getRequestResult, getSafetyPatrolCountData } from '../../../apis'
import ComContractBarChart from '@/views/groupPage/components/BarChart/ComContractBarChart.vue'
import { getEpcjsyddetailList } from '../../../apis'
import { roundFun } from '@/views/groupPage/util'
//合同结算
@Component({ name: 'ContractSettlement', components: { ComContractBarChart } })
export default class ContractSettlement extends Vue {
  chartData = null
  get projectCode() {
    return this.$store.state.bigScreen.currentProjectCode
  }
  mounted() {
    this.getData()
  }
  async getData() {
    const res = await getEpcjsyddetailList({ dataOwner: this.projectCode })
    if (res.code == 1 && res.result && res.result.length != 0) {
      let xData = [],
        seriesData = []
      res.result.forEach((item) => {
        const { yearMonth, cost_month_count } = item
        xData.unshift(yearMonth)
        seriesData.unshift(roundFun(cost_month_count, 2))
      })
      this.chartData = { xData, seriesData }
    }
  }
}
</script>

<style lang='scss' scoped>
.animate__fadeInUp,
.animate__fadeOutDown {
  animation-duration: 3s; //动画持续时间
  animation-delay: 0s; //动画延迟时间
}
.widget-ContractSettlement {
  background-color: #000;
  bottom: 0.052083rem /* 10/192 */;
  left: 50%;
  margin-left: -2.645833rem /* 508/192 */;
  height: 1.572917rem /* 302/192 */;
  width: 5.291667rem /* 1016/192 */;
  position: absolute;
  font-family: Source Han Sans CN;
  .head {
    height: 0.166667rem /* 32/192 */;
    width: 100%;
    background: linear-gradient(-90deg, rgba(43, 167, 255, 0.2) 0%, rgba(43, 167, 255, 0.08) 100%);
    font-family: Source Han Sans CN-HEAVY;
    .title {
      width: 100%;
      height: 100%;
      display: flex;
      font-weight: 400;
      align-items: center;
      .icon {
        height: 0.166667rem /* 32/192 */;
        width: 0.34375rem /* 66/192 */;
        background: url('~@/views/groupPage/images/模块图标/统计分析/结算.png') no-repeat center center;
        background-size: 100% 100%;
      }
      span {
        flex: 1;
        font-weight: bold;
        font-size: 0.083333rem /* 16/192 */;
        color: #ffffff;
        padding: 0.041667rem /* 8/192 */;
        background: linear-gradient(0deg, #9bd2fa 0%, #ffffff 100%);
        background-clip: text;
        -webkit-text-fill-color: transparent;
      }
    }
  }
  .content-info {
    width: 100%;
    height: calc(100% - 0.166667rem);
    display: inline-block;
    background: linear-gradient(0deg, rgba(14, 167, 255, 0.238) 0%, rgba(14, 167, 255, 0) 100%);
    font-family: Source Han Sans CN;
  }
}
</style>
