<template>
  <div class="expand-temp">
    <el-form
      label-position="right"
      v-loading="loading"
      label-width="120px"
      inline
      class="demo-table-expand"
    >
      <el-row>
        <el-col :span="12">
          <el-form-item label="用户昵称：">
            <span>{{ infoData.nickname }}</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="性别：">
            <span v-if="infoData.sex === '0'">男</span>
            <span v-else-if="infoData.sex === '1'">女</span>
            <span v-else>未知</span>
          </el-form-item>
        </el-col>
      </el-row>

      <el-row>
        <el-col :span="12">
          <el-form-item label="用户类型：">
            <span v-text="infoData.userType === 'PERSONAL' ? '租户' : '项目'"></span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="登录密码：">
            <span>{{ infoData.password }}</span>
          </el-form-item>
        </el-col>
      </el-row>

      <el-row v-if="infoData.state === 1">
        <el-col :span="12">
          <el-form-item label="所属租户：">
            <span>{{ infoData.tenantName }}</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="所属部门：">
            <span>{{ infoData.deptName }}</span>
          </el-form-item>
        </el-col>
      </el-row>

      <el-row v-if="infoData.state === 1">
        <el-col :span="12">
          <el-form-item label="用户角色：">
            <span v-text="infoData.roleNames"></span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="用户岗位：">
            <span>{{ infoData.postNames }}</span>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>
<script>
import { getRegistered } from "@/api/system/registered";
export default {
  name: "ExpandTemp",
  props: ["sourceId"],
  data() {
    return {
      infoData: {},
      loading: false
    };
  },
  created() {
    this.getDetails();
  },
  methods: {
    getDetails() {
      this.loading = true;
      getRegistered(this.sourceId).then(response => {
        this.infoData = response.data;
        // this.$emit("expandExent", this.infoData);
        this.loading = false;
      });
    }
  }
};
</script>
