<template>
  <div class="m-subbox m-sqrfph">
    <div class="table">
      <div class="tr">
        <div class="th">排名</div>
        <div class="th">社区</div>
        <div class="th">房屋更新数</div>
        <div class="th">人口更新数</div>
        <div class="th">人房更新总数</div>
      </div>
      <div class="tr" v-for="(item,index) in pmList" :key="index">
        <div :class="index - 0 + 1 < 4 ? `td tdbg${index-0+1}` : 'td'">
          {{ index - 0 + 1 }}
        </div>
        <div class="td">{{ item.orgName }}</div>
        <div class="td">{{ item.houseNum }}</div>
        <div class="td">{{ item.residentNum }}</div>
        <div class="td">{{ item.sumNum }}</div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: "sqrfph",
  props: {
    date: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      org: this.$store.state.chooseArea.chooseName,
      pmList: [],
    };
  },
  watch: {
    "$store.state.chooseArea.chooseName"(val) {
      if (val.orgId) {
        this.getList()
      }
    },
    date() {
      this.getList()
    }
  },
  mounted() {
    if (this.org.orgId) {
      this.getList()
    }
  },
  methods: {
    getList() {
      this.$http.get('/actual/base/streetOverview/residentHouseUpdateGroup?month='+this.date+'&level='+this.$store.state.chooseArea.chooseName.level+'&orgId='+this.$store.state.chooseArea.chooseName.orgId).then(({data: {data}}) => {
        this.pmList = data
      })
    }
  }
};
</script>

<style
  lang="scss"
  src="@/assets/scss/dataBoard/overview/index.scss"
  scoped
></style>
