<template>
  <div class="widget-groupPageModules" v-if="showGroupPage">
    <!--左侧模块-->
    <ContractInfo :show="showGroupPage" v-on="{ fontSize, getRequestResult, setNullAndUndefinedEmpty }" />
    <!--中部模块-->
    <IndexStatistic :show="showGroupPage" v-on="{ fontSize, getRequestResult, setNullAndUndefinedEmpty }" />
    <!--右侧模块-->
    <ProjectInfo :show="showGroupPage" v-on="{ fontSize, getRequestResult, setNullAndUndefinedEmpty }" />
    <!--底部模块-->
    <ProjectStatistic :show="showGroupPage" v-on="{ fontSize, getRequestResult, setNullAndUndefinedEmpty }" />
  </div>
</template>

<script>
import { getBlockPage, getResultList } from '@/api/bigScreenAPI/bigScreenRequest'
//信息模块
import ContractInfo from '@/views/groupPage/groupPageModules/ContractInfo.vue'
import ProjectStatistic from '@/views/groupPage/groupPageModules/ProjectStatistic.vue'
import ProjectInfo from '@/views/groupPage/groupPageModules/ProjectInfo.vue'
import IndexStatistic from '@/views/groupPage/groupPageModules/IndexStatistic.vue'
export default {
  name: 'groupPageModules', //集团分公司页面模块
  components: {
    ContractInfo,
    ProjectStatistic,
    ProjectInfo,
    IndexStatistic
  },
  props: {
    show: {}
  },
  computed: {
    showGroupPage() {
      return this.show
    },
    fontSize() {
      return this.$listeners.fontSize
    }
  },
  mounted() {
    getBlockPage({ size: 999 }).then((res) => {
      // console.log('code列表', res)
    })
  },
  methods: {
    async getRequestResult(params) {
      let returnData = await new Promise((resolve, reject) => {
        getResultList(params)
          .then((res) => {
            if (res.code == 1) resolve(res.result)
          })
          .catch((err) => {})
      })
      return returnData
    },
    //数据检查公共方法(针对数字)
    setNullAndUndefinedEmpty(input) {
      if (
        input === 'Null' ||
        input === 'null' ||
        input === 'NULL' ||
        input === null ||
        input === undefined ||
        input === ''
      ) {
        return 0
      } else {
        return input
      }
    }
  }
}
</script>

<style lang='scss' scoped>
</style>