<script setup lang="ts" name="OverTimeForLeaveDetailFlow">
/* 调休详情 */
import { ref } from 'vue'
import { getFlowChart } from '@/api/flowEngine/flowInterface'
import { getWorkOverTimeForLeave } from '@/api/attendance/overTimeForLeave'
import { useDict } from '@/common/utils/dict'
import FlowTimeline from '@/components/Flow/FlowTimeline.vue'

const { factory_att_overtime_type } = useDict('factory_att_overtime_type')

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

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

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

<template>
  <div class="container__card flex">
    <van-cell-group>
      <van-cell title="调休类型">
        <DictTag
          v-if="detail.workOverTimeType"
          :tag="false"
          :options="factory_att_overtime_type"
          :value="detail.workOverTimeType" />
      </van-cell>
      <van-cell title="开始时间" :value="detail.beginTime" />
      <van-cell title="结束时间" :value="detail.endTime" />
      <van-cell title="调休时长">
        {{ detail.hour }}小时
      </van-cell>
      <van-cell title="调休事由" :value="detail.reason" />
    </van-cell-group>
    <FlowTimeline :node-data="nodeData" />
  </div>
</template>

<style lang="less" scoped>
.grid {
  :deep(.van-image) {
    width: 100%;
    height: 0;
    padding-bottom: 100%;
    .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;
    }
  }
}
</style>
