<template>
  <div>
    <div class="dialog-h-content scroll-h">

      <div v-if="initLoading"
           class="m-row">
        <div class="m-info">
          <div class="info-prop">
            <span class="info-title-3">所属网格：</span>
            <span>{{ fmData.gridName  }}</span>
          </div>

          <div class="info-prop">
            <span class="info-title-3">所属房屋：</span>
            <span>{{ fmData.homeAllName ?fmData.homeAllName :'--' }}</span>
          </div>

          <div class="info-prop">
            <span class="info-title-3">姓名：</span>
            <span>{{ fmData.name}}</span>
          </div>

          <div class="info-prop">
            <span class="info-title-3">手机号：</span>
            <span>{{ fmData.mobile?fmData.mobile:'--'}}</span>
          </div>

          <div class="info-prop">
            <span class="info-title-3">证件号：</span>
            <span>{{ fmData.idCard?fmData.idCard:'--'}}</span>
          </div>
          <div class="info-prop">
            <span class="info-title-3">性别：</span>
            <span>{{fmData.gender==='1' ?'男' :fmData.gender==='2'?'女':'未知' }}</span>
          </div>

          <div class="info-prop">
            <span class="info-title-3">出生日期：</span>
            <span>{{ fmData.birthday?fmData.birthday:'--' }}</span>
          </div>
          <div class="info-prop">
            <span class="info-title-3">出生地：</span>
            <span>{{ fmData.birthplace?fmData.birthplace:'--' }}</span>
          </div>
          <div class="info-prop">
            <span class="info-title-3">出生父亲姓名：</span>
            <span>{{ fmData.father?fmData.father:'--' }}</span>
          </div>
          <div class="info-prop">
            <span class="info-title-3">出生母亲姓名：</span>
            <span>{{ fmData.mother?fmData.mother:'--' }}</span>
          </div>
          <div class="info-prop">
            <span class="info-title-3">胎次：</span>
            <span>{{ fmData.count? fmData.count:0}}</span>
          </div>
          <div class="info-prop">
            <span class="info-title-3">申报户口日期：</span>
            <span>{{ fmData.reportDate?fmData.reportDate:'--' }}</span>
          </div>
          <div class="info-prop">
            <span class="info-title-3">户主姓名：</span>
            <span>{{ fmData.householderName? fmData.householderName:'--'  }}</span>
          </div>
          <div class="info-prop">
            <span class="info-title-3">与户主关系：</span>
            <span>{{ fmData.householderRelationName ? fmData.householderRelationName :'--' }}</span>
          </div>

        </div>
      </div>

    </div>

  </div>
</template>

<script>
import { Loading } from "element-ui"; // 引入Loading服务
import { requestPost } from "@/js/dai/request";


let loading; // 加载动画

function iniFmData () {
  return {
    id: "",
    gridId: "",
    villageId: "",
    buildId: "",
    unitId: "",
    homeId: "",
    name: "",
    mobile: "",
    idCard: "",
    isWelfare: "0", //福利0否，1是
    isCheck: "0",
    isReplace: "0",
    gender: "",
    birthplace: "",
    father: "",
    mother: "",
    count: "",
    reportDate: "",
    householderName: "",
    householderRelation: "",
    alreadyHaveMaster: false,
  };
}

export default {
  data () {
    return {

      btnDisable: false,
      initLoading: false,

      fmData: iniFmData(),

    };
  },
  components: {},
  computed: {

  },
  props: {},
  watch: {},

  async mounted () {

  },

  methods: {


    async initForm (row) {

      await this.getInfo(row.id);
      this.initLoading = true

    },

    async getInfo (id) {
      const { data, code, msg } = await requestPost(
        "/epmetuser/icBirthRecord/" + id,
        {
          // id,
        }
      );
      if (code === 0) {
        this.fmData = { ...this.fmData, ...data };
      } else {
        this.$message.error(msg);
      }
    },




    resetData () {

      this.fmData = iniFmData();
    },
    // 开启加载动画
    startLoading () {
      loading = Loading.service({
        lock: true, // 是否锁定
        text: "正在加载……", // 加载中需要显示的文字
        background: "rgba(0,0,0,.7)", // 背景颜色
      });
    },
    // 结束加载动画
    endLoading () {
      // clearTimeout(timer);
      if (loading) {
        loading.close();
      }
    },
  },
};
</script>

<style lang="scss" scoped >
@import "@/assets/scss/modules/management/detail-main.scss";
</style>
