<script setup lang="ts" name="LeaveDetailFlow">
/* 离职详情 */
import { ref } from 'vue'
import { resignationDetail } from '@/api/personnel/resignation'
import { getEmployeesByCode } from '@/api/personnel/employees'
import { getDeptName, getPostName } from '@/common/utils/transcoding'

const props = defineProps<{
  id: string
  instanceId: string
}>()

const detail = ref<any>({})

resignationDetail(props.id).then(res => {
  detail.value = res.data
  getEmployeesByCode(res.data.staffNumber).then(resEmployees => {
    detail.value.department = getDeptName(resEmployees.data.serviceDeptId)
    detail.value.post = getPostName(resEmployees.data.servicePostId)
  })
})
</script>

<template>
  <van-cell-group>
    <van-cell title="姓名" :value="detail.staffName" />
    <van-cell title="身份证号码" :value="detail.documentNumber" />
    <van-cell title="部门" :value="detail.department" />
    <van-cell title="岗位" :value="detail.post" />
    <van-cell title="入职日期" :value="detail.hireDate" />
    <van-cell title="离职日期" :value="detail.departureDate" />
    <van-cell title="工龄" :value="detail.yearsOfService" />
    <van-cell title="离职原因" :value="detail.departureReason" />
  </van-cell-group>
</template>

<style lang="less" scoped>
.grid {
  :deep(.van-image) {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 100%;
    border-radius: 0.6rem;
    box-shadow: 0.2rem 0.2rem 0.5rem rgba(0,0,0,0.5);
    overflow: hidden;
    .van-image__img {
      position: absolute;
      object-fit: cover;
    }
  }
}

:deep(.van-cell) {
  .van-cell__title {
    margin-right: 1rem;
    flex: none;
  }
  .van-cell__value {
    display: flex;
    justify-content: flex-end;
    color: var(--van-cell-text-color);
    overflow: hidden;
    span {
      text-align: justify;
    }
  }
}

:deep(.tag-label) {
  font-size: 1.4rem;
}

.list {

}
</style>
