<template>
  <Card title="安全管理">
    <div class="container">
      <div class="woria">
        <div class="left">
          <div style="color: #5ce2f6; font-size: 10px">
            已闭合
            <p style="font-size: 16px; color: #fff; margin-bottom: 10px">
              {{ safetyPatrolInspection.allRectificationNum }}条
            </p>
          </div>
          <div style="color: #5ce2f6; font-size: 10px">
            占比
            <p style="font-size: 16px; color: #fff">
              {{ safetyPatrolInspection.allRectificationRatio }}%
            </p>
          </div>
        </div>
        <div class="right">
          <div style="color: #e7622a; font-size: 10px">
            未闭合
            <p style="font-size: 16px; color: #fff; margin-bottom: 10px">
              {{ safetyPatrolInspection.allNoRectificationNum }}条
            </p>
          </div>
          <div style="color: #e7622a; font-size: 10px">
            占比
            <p style="font-size: 16px; color: #fff">
              {{ safetyPatrolInspection.allNoRectificationRatio }}%
            </p>
          </div>
        </div>
        <div class="woriaTwo">
          <JRingChart
            :title="{
              text: '安全巡检',
              subTitle: `${safetyPatrolInspection.allTotalNum}条`,
              fontSize: 16,
              x: '49%',
              y: '55'
            }"
            :color="['#6EE4F0', '#E7622A']"
            :data="[
              {
                value: safetyPatrolInspection.allRectificationNum,
                name: '已巡检'
              },
              {
                value: safetyPatrolInspection.allNoRectificationNum,
                name: '未巡检'
              }
            ]"
            :radius="['71%', '101%']"
            :legend="false"
          />
        </div>
      </div>
      <div class="count1">
        总次数<span>96</span>次
        <!-- 总次数<span>{{ allTotalNum2 }}</span
        >次 -->
      </div>
      <div class="count2">
        本周次数<span>{{ safetyPatrolInspection.weekTotalNum }}</span
        >次
      </div>
    </div>
  </Card>
</template>

<script>
import Card from '../components/Card'
import JRingChart from '../../common/jChart/pie/JRingChart.vue'
import { getAllWeekDataHdirApi } from '@/assets/js/api/zhongjianFourth'
import { resourceManagement } from '@/assets/js/api/zhongjianFourth'

import { mapState } from 'vuex'

export default {
  components: { Card, JRingChart },
  data() {
    return {
      safetyPatrolInspection: {
        allTotalNum: 0,
        allRectificationNum: 0,
        allNoRectificationNum: 0,
        allRectificationRatio: 0,
        allNoRectificationRatio: 0,
        weekTotalNum: 0
      },
      allTotalNum2: 0
    }
  },
  created() {
    this.getList()

    this.getAllTodayDataHdir()
  },
  mounted() {},
  computed: {
    ...mapState(['projectSn'])
  },
  methods: {
    getAllTodayDataHdir() {
      getAllWeekDataHdirApi({ projectSn: this.projectSn }).then((res) => {
        this.safetyPatrolInspection = res.result
        console.log(
          this.safetyPatrolInspection,
          '安全管理========================='
        )
      })
    },
    getList() {
      resourceManagement({ projectSn: this.projectSn }).then((res) => {
        console.log('安全管理getAllTodayDataHdir------------111', res)
        this.allTotalNum2 = parseInt(res.result.constructionDay * 1.2)
      })
    }
  }
}
</script>

<style lang="less" scoped>
.container {
  display: flex;
  box-sizing: border-box;
  padding: 10px 0;

  width: 100%;
  height: 100%;

  .woria {
    width: 100%;
    height: calc(115% - 92px);
    background: url(../assets/images/common/blueH.png) no-repeat;
    background-size: 99% 101%;
    // margin-top: 10px;
    .woriaTwo {
      width: 100%;
      height: 104%;
      margin: 3px 0 0 1px;
    }
  }
  .left {
    float: left;
    margin: 30px 0 0 85px;
  }
  .right {
    float: right;
    margin: 30px 75px 0 0px;
  }
  .countBox {
    display: flex;
  }
  .count1,
  .count2 {
    width: 300px;
    padding-top: 170px;
    font-size: 16px;
    color: rgba(110, 228, 240, 0.85);
    display: flex;
    align-items: center;
    position: absolute;

    // margin-left: -300px;
    // margin: 0 322px 0 -413px;
    span {
      width: 90px;
      height: 40px;
      line-height: 40px;
      text-align: center;
      font-size: 20px;
      color: #fff;
      background: url(../assets/images/sourse/bg-car-count.png) no-repeat;
      background-size: 100% 100%;
      margin-right: 10px;
      margin-left: 10px;
    }
  }
  .count1 {
    margin: 5px 0 0 0px;
  }
  .count2 {
    margin: 5px 0 0 225px;
  }
}
</style>
