<template>
  <el-dialog title="离岗详情" v-model="visible">
    <el-descriptions :column="1" border>
      <el-descriptions-item label="部门">
        {{ info.DEPARTMENTNAME_ALL }}
      </el-descriptions-item>
      <el-descriptions-item label="岗位">
        {{ info.POSTNAME }}
      </el-descriptions-item>
      <el-descriptions-item label="姓名">
        {{ info.USER_NAME }}
      </el-descriptions-item>
      <el-descriptions-item label="离岗申请时间">
        {{ info.STARTTIME }}-{{ info.ENDTIME }}
      </el-descriptions-item>
      <el-descriptions-item label="离岗原因">
        {{ info.DESCR }}
      </el-descriptions-item>
      <el-descriptions-item label="审批状态">
        <div v-if="info.REVIEW_STATUS === '0'">待审批</div>
        <div v-else-if="info.REVIEW_STATUS === '1'">审批通过</div>
        <div v-else-if="info.ISDELETE === '1' && info.REVIEW_STATUS === '-1'">
          <div v-if="info.CREATOR === info.OPERATOR">申请人取消</div>
          <div v-else>审批人取消</div>
        </div>
        <div v-else-if="info.REVIEW_STATUS === '-1'">审批打回</div>
        <div v-else-if="info.REVIEW_STATUS === '2'">无需审批</div>
      </el-descriptions-item>
      <el-descriptions-item label="审批人" v-if="info.REVIEW_STATUS !== '2'">
        {{
          info.REVIEW_USER_NAME + " [" + info.REVIEW_USER_DEPARTMENTNAME + "]"
        }}
      </el-descriptions-item>
      <el-descriptions-item
        :label="info.ISDELETE === '0' ? '审批意见' : '取消原因'"
        v-if="info.REVIEW_STATUS === '1' || info.REVIEW_STATUS === '-1'"
      >
        {{ info.REVIEW_DESC }}
      </el-descriptions-item>
    </el-descriptions>
    <template #footer>
      <el-button @click="visible = false">关闭</el-button>
    </template>
  </el-dialog>
</template>

<script setup>
import { useVModel } from "@vueuse/core";

const props = defineProps({
  visible: {
    type: Boolean,
    required: true,
    default: false,
  },
  info: {
    type: Object,
    required: true,
    default: () => ({}),
  },
});
const emits = defineEmits(["update:visible"]);
const visible = useVModel(props, "visible", emits);
</script>

<style scoped lang="scss"></style>
