<template>
  <el-dialog title="招聘记录详情" :visible.sync="visibleProxy" width="900px" append-to-body>
    <div class="detail-container">
      <el-divider content-position="left">招聘项目信息</el-divider>
      <el-descriptions :column="2" border>
        <el-descriptions-item label="招聘项目编号">{{ detail.recruitId || "-" }}</el-descriptions-item>
        <el-descriptions-item label="招聘项目名称">{{ detail.recruitName || "-" }}</el-descriptions-item>
      </el-descriptions>

      <el-divider content-position="left">职位信息</el-divider>
      <el-descriptions :column="2" border>
        <el-descriptions-item label="职位名称">{{ detail.posName || "-" }}</el-descriptions-item>
        <el-descriptions-item label="职位类别">{{ detail.posCategory || "-" }}</el-descriptions-item>
        <el-descriptions-item label="职位描述" :span="2">{{ detail.posDesc || "-" }}</el-descriptions-item>
      </el-descriptions>

      <el-divider content-position="left">候选人信息</el-divider>
      <el-descriptions :column="2" border>
        <el-descriptions-item label="候选人姓名">{{ detail.candName || "-" }}</el-descriptions-item>
        <el-descriptions-item label="学历">{{ detail.candEdu || "-" }}</el-descriptions-item>
        <el-descriptions-item label="证件号码">{{ detail.candId || "-" }}</el-descriptions-item>
        <el-descriptions-item label="毕业年月">{{ detail.candGrad || "-" }}</el-descriptions-item>
        <el-descriptions-item label="毕业院校">{{ detail.candSchool || "-" }}</el-descriptions-item>
        <el-descriptions-item label="专业">{{ detail.candMajor || "-" }}</el-descriptions-item>
      </el-descriptions>

      <el-divider content-position="left">录用信息</el-divider>
      <el-descriptions :column="1" border>
        <el-descriptions-item label="录用情况">{{ detail.admitStatus || "-" }}</el-descriptions-item>
      </el-descriptions>

      <el-divider content-position="left">面试官信息</el-divider>
      <el-descriptions :column="2" border>
        <el-descriptions-item label="面试官1">{{ detail.interviewerName1 || "-" }} ({{ detail.interviewerId1 || "-" }})</el-descriptions-item>
        <el-descriptions-item label="面试官2">{{ detail.interviewerName2 || "-" }} ({{ detail.interviewerId2 || "-" }})</el-descriptions-item>
      </el-descriptions>

      <el-divider content-position="left">审计信息</el-divider>
      <el-descriptions :column="2" border>
        <el-descriptions-item label="创建人">{{ detail.createdBy || "-" }}</el-descriptions-item>
        <el-descriptions-item label="创建时间">{{ formatDate(detail.createTime) }}</el-descriptions-item>
        <el-descriptions-item label="更新人">{{ detail.updatedBy || "-" }}</el-descriptions-item>
        <el-descriptions-item label="更新时间">{{ formatDate(detail.updateTime) }}</el-descriptions-item>
      </el-descriptions>
    </div>
    <div slot="footer" class="dialog-footer">
      <el-button @click="visibleProxy = false">关闭</el-button>
    </div>
  </el-dialog>
</template>

<script>
export default {
  name: "ExtendedRecruitmentDetailDialog",
  props: {
    visible: {
      type: Boolean,
      default: false,
    },
    detail: {
      type: Object,
      default: () => ({}),
    },
  },
  computed: {
    visibleProxy: {
      get() {
        return this.visible;
      },
      set(value) {
        this.$emit("update:visible", value);
      },
    },
  },
  methods: {
    formatDate(value) {
      return value ? this.parseTime(value) : "-";
    },
  },
};
</script>
