<template>
  <div class="app_content from-table">
    <a-spin :spinning="loading" style="width: 100%;height: 100%;">
      <user-info :data="personInfo" />
    </a-spin>
  </div>
</template>
<script>

import userInfo from '@/views/manager/user/components/userInfo'

export default {
  name: "userView",
  components: {
    userInfo
  },
  data () {
    return {
      personInfo: { personName: null, sex: null, certId: null, mobile: null, specName: null, titleName: null, educationName: null, unitName: null },
      loading: false,
    }
  },
  props: {
    value: {
      type: String,
      default: () => {
        return null
      }
    },
  },
  created () {
    this.getPersonById()
  },
  methods: {
    getPersonById () {
      this.loading = true
      this.$api.person.getPersonById({ id: this.value }).then(({ data = {} }) => {
        if (data) {
          this.personInfo = data
        }
        this.loading = false
      }).catch(() => { this.loading = false })
    }
  }
}
</script>