<script setup lang="ts" name="CardSignDetailFlow">
/* 签卡详情 */
import { ref } from 'vue'
// import { useRoute } from 'vue-router'
import { getRegistrationCardDetail } from '@/api/attendance/cardSign'
import { getFlowChart } from '@/api/flowEngine/flowInterface'
import FlowTimeline from '../../../components/Flow/FlowTimeline.vue'

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

// const route = useRoute()

const detail = ref<any>({})
const nodeData = ref<any>()

getRegistrationCardDetail(props.id).then(res => {
  detail.value = res.data
})
getFlowChart({ instanceId: props.instanceId }).then(res => {
  nodeData.value = res.data
})
</script>

<template>
  <div>
    <van-cell-group>
      <van-cell title="员工名称" :value="detail.userName" />
      <van-cell title="员工工号" :value="detail.employeesCode" />
      <van-cell title="部门名称" :value="detail.deptName ?? '-'" />
      <van-cell title="岗位名称" :value="detail.postName" />
      <van-cell title="签卡时间" :value="detail.signTime" />
      <van-cell title="签卡事由" :value="detail.signReason" />
    </van-cell-group>
    <FlowTimeline :node-data="nodeData" />
  </div>
</template>

<style lang="less" scoped>
: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;
    }
  }
}
</style>
