<template>
  <div class="page-box">
    <div class="card-box">
      <div class="title">
        <h5>Result Details</h5>
      </div>
      <div class="content-box">
        <div class="base-info">
          <div>任务ID：{{ jobId }}</div>
          <div>
            Status:
            <el-tag type="info">{{ getStatus(detail.status) }}</el-tag>
          </div>
        </div>
      </div>
      <div>
        <img v-if="detail.SC_GRS" :src="detail.SC_GRS" alt="" />
        <img v-if="detail.OR_GRS" :src="detail.OR_GRS" alt="" />
        <img v-if="detail.DL_GRS" :src="detail.DL_GRS" alt="" />
      </div>
    </div>
  </div>
</template>

<script>
import { createOrder, orderDetail } from "@/api";
export default {
  name: "result",
  data() {
    return {
      jobId: "",
      detail: {},
    };
  },
  mounted() {
    this.jobId = this.$route.query.jobId;
    this.getDetailFn();
  },
  methods: {
    async getDetailFn() {
      if (!this.jobId) return;
      const res = await orderDetail({
        id: this.jobId,
      });
      if (res.code === 200) {
        this.detail = res.data;
      }
    },
    getTag(row) {
      if (row.status === "success") {
        return "success";
      }
      if (row.status === "waiting") {
        return "info";
      }
      return "danger";
    },
    getStatus(status) {
      if (status === 0) {
        return "已创建";
      }
      if (status === 1) {
        return "已创建任务";
      }
      if (status === 2) {
        return "任务运行中";
      }
      if (status === 3) {
        return "已完成";
      }
      return "正在初始化中";
    },
  },
};
</script>
<style lang="less" scoped>
.page-box {
  padding: 24px;

  .card-box {
    background-color: rgb(255, 255, 255);
    color: rgba(0, 0, 0, 0.87);
    transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
    border-radius: 4px;
    box-shadow: rgba(0, 0, 0, 0.2) 0px 3px 3px -2px,
      rgba(0, 0, 0, 0.14) 0px 3px 4px 0px, rgba(0, 0, 0, 0.12) 0px 1px 8px 0px;
    min-width: 300px;
    margin-top: 16px;
    margin-bottom: 16px;
    overflow: hidden;
    padding-right: 15px;
    padding-top: 15px;
    padding-bottom: 15px;

    .title {
      border-left: 6px solid rgb(246, 144, 61);
      border-top-color: rgb(246, 144, 61);
      border-right-color: rgb(246, 144, 61);
      border-bottom-color: rgb(246, 144, 61);
      background-color: rgb(16, 126, 100);
      color: rgb(255, 255, 255);
      padding: 8px 8px 8px 16px;

      h5 {
        font-size: 24px;
        margin: 0px;
        font-family: Roboto, Helvetica, Arial, sans-serif;
        font-weight: 400;
        font-size: 1.5rem;
        line-height: 1.334;
        letter-spacing: 0em;
        display: flex;
        -webkit-box-align: center;
        align-items: center;
      }
    }

    .content-box {
      display: flex;

      .base-info {
        width: 150px;
        padding: 15px;
      }
    }
  }
}
</style>
