<template>
  <view v-if="realDuration && planDuration">
    <!-- 任务时长延迟插件 -->
    <!-- 超时 -->
    <span class="font-bold text-green-500" v-if="realDuration - 0 > planDuration - 0">
      +{{ $t.time.formatDuration(realDuration - planDuration) }}
    </span>
    <!-- 延时 -->
    <span class="font-bold text-red-500" v-if="realDuration - 0 < planDuration - 0">
      -{{ $t.time.formatDuration(planDuration - realDuration) }}
    </span>
  </view>
</template>

<script>
export default {
  name: 'p-task-duration-delay',
  props: {
    task: {
      type: Object,
      default: () => {},
    },
  },

  computed: {
    realDuration() {
      return this.task.realDuration;
    },
    planDuration() {
      return this.task.planDuration;
    },
  },
};
</script>
