<template>
  <div class="detail-info">
    <div class="status" :class="`feedback-detail-status-${info.status}`">
      {{ STATUS_OBJ[info.status] }}
    </div>
    <div class="info-body">
      <div v-for="label in infoLabel" :key="label.prop">
        <span class="info-label">{{ label.label }}：</span>
        <span class="info-value">{{ info[label.prop] }}</span>
      </div>
    </div>
  </div>
</template>

<script setup>
const STATUS_OBJ = {
  finish: "已完成",
  close: "已关闭",
  info: "待处置",
};
const props = defineProps({
  info: {
    type: Object,
    default: () => ({}),
  },
});
const infoLabel = [
  {
    label: "下发对象",
    prop: "target",
  },
  {
    label: "工单反馈",
    prop: "feedback",
  },
  {
    label: "操作时间",
    prop: "time",
  },
];
</script>

<style lang="scss" scoped>
.detail-info {
  background-color: #ffffff;
  border-radius: 4px;
  border: solid 1px #e3e4ef;
  width: 100%;
  height: auto;
  font-size: 14px;
  .status {
    width: 100%;
    height: 38px;
    line-height: 37px;
    background-color: #f9fafc;
    padding: 0 16px;
    font-weight: bold;
    border-bottom: 1px solid #e3e4ef;
    &.feedback-detail-status {
      $statusObj: (
        finish: #48ad97,
        close: #242c43,
        info: #3759be,
      );
      @each $status, $color in $statusObj {
        &-#{$status} {
          color: $color;
        }
      }
    }
  }
  .info-body {
    padding: 16px 24px;
    & > div {
      line-height: 30px;
      display: flex;
      align-items: flex-start;
      .info-label {
        width: auto;
        color: #7784a6;
      }
      .info-value {
        flex: 1;
        color: #242c43;
      }
    }
  }
}
</style>
