<template>
  <div class="app-container home">
    <h3 class="toolbar">
      <span class="title">数据累计</span>
    </h3>
    <template v-if="userType == 'ADMIN'">
      <el-row :gutter="20">
        <el-col :span="8">
          <div class="stat_box">
            <i class="icon icon_1"></i>
            <span class="num">{{info.entSumCnt}}</span>
            <span class="label">企业总数</span>
          </div>
        </el-col>
        <el-col :span="8">
          <div class="stat_box">
            <i class="icon icon_9"></i>
            <span class="num">{{info.entValidCnt}}</span>
            <span class="label">服务中企业</span>
          </div>
        </el-col>
        <el-col :span="8">
          <div class="stat_box">
            <i class="icon icon_8"></i>
            <span class="num">{{info.entExpiredCnt}}</span>
            <span class="label">服务已到期企业</span>
          </div>
        </el-col>
        <el-col :span="8">
          <div class="stat_box">
            <i class="icon icon_5"></i>
            <span class="num">{{info.entSumCnt}}</span>
            <span class="label">项目总数</span>
          </div>
        </el-col>
        <el-col :span="8">
          <div class="stat_box">
            <i class="icon icon_6"></i>
            <span class="num">{{info.proFinishCnt}}</span>
            <span class="label">已完成项目</span>
          </div>
        </el-col>
        <el-col :span="8">
          <div class="stat_box">
            <i class="icon icon_7"></i>
            <span class="num">{{info.proUnfinishCnt}}</span>
            <span class="label">待完成项目</span>
          </div>
        </el-col>
      </el-row>
    </template>
    <template v-if="userType == 'GOV_PROV' || userType == 'GOV_CITY' || userType == 'GOV_DISTRI'">
      <el-row :gutter="20">
        <el-col :span="8">
          <div class="stat_box">
            <i class="icon icon_1"></i>
            <span class="num">{{info.entSumCnt}}</span>
            <span class="label">企业总数</span>
          </div>
        </el-col>
        <el-col :span="8">
          <div class="stat_box">
            <i class="icon icon_1"></i>
            <span class="num">{{info.proFinishCnt}}</span>
            <span class="label">项目申报数</span>
          </div>
        </el-col>
      </el-row>
    </template>
    <template v-if="userType == 'ENT_ADMIN' || userType == 'ENT_TECH' || userType == 'ENT_ADMIN_TECH' || userType == 'ENT_FIN' || userType == 'ENT_ADMIN_FIN'">
      <el-row :gutter="20">
        <el-col :span="8">
          <div class="stat_box">
            <i class="icon icon_5"></i>
            <span class="num">{{info.proSumCnt}}</span>
            <span class="label">项目总数</span>
          </div>
        </el-col>
        <el-col :span="8">
          <div class="stat_box">
            <i class="icon icon_6"></i>
            <span class="num">{{info.proFinishCnt}}</span>
            <span class="label">已完成项目</span>
          </div>
        </el-col>
        <el-col :span="8">
          <div class="stat_box">
            <i class="icon icon_7"></i>
            <span class="num">{{info.proUnfinishCnt}}</span>
            <span class="label">待完成项目</span>
          </div>
        </el-col>
      </el-row>
    </template>
  </div>
</template>

<script>
  import {getIndexDataApi} from "@/api/common/common.js"
export default {
  name: "Index",
  computed: {
    userType() {
      return this.$store.state.user.userType
    },
  },
  data() {
    return {
      // 版本号
      version: "1.0.0",
      info: {}
    };
  },
  created() {
    this.getData()
  },
  methods: {
    goTarget(href) {
      window.open(href, "_blank");
    },
    getData() {
      getIndexDataApi().then(res => {
        this.info = res.data || {}
      })
    }
  },
};
</script>

<style scoped lang="scss">
.home {
  blockquote {
    padding: 10px 20px;
    margin: 0 0 20px;
    font-size: 17.5px;
    border-left: 5px solid #eee;
  }
  hr {
    margin-top: 20px;
    margin-bottom: 20px;
    border: 0;
    border-top: 1px solid #eee;
  }
  .col-item {
    margin-bottom: 20px;
  }

  ul {
    padding: 0;
    margin: 0;
  }

  font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13px;
  color: #676a6c;
  overflow-x: hidden;

  ul {
    list-style-type: none;
  }

  h4 {
    margin-top: 0px;
  }

  h2 {
    margin-top: 10px;
    font-size: 26px;
    font-weight: 100;
  }

  p {
    margin-top: 10px;

    b {
      font-weight: 700;
    }
  }

  .update-log {
    ol {
      display: block;
      list-style-type: decimal;
      margin-block-start: 1em;
      margin-block-end: 1em;
      margin-inline-start: 0;
      margin-inline-end: 0;
      padding-inline-start: 40px;
    }
  }
}
</style>
