<template>
  <div class="line-container-p24">
    <i class="el-icon-arrow-left"></i>
    <div
      class="dib go-back ml8 pointer"
      @click="router.replace('/shipManage/shipList')"
    >
      返回船舶列表
    </div>
  </div>
  <ShipInfo :shipInfos="shipInfos"></ShipInfo>
</template>
<script setup>
import { ref, h, reactive, toRefs, onMounted } from "vue";
import { ElNotification, ElMessageBox, ElMessage } from "element-plus";
import store from "../../store";
import router from "../../router";
import md5 from "md5";
import api from "../../apis/fetch";
import { useRoute } from "vue-router";
import _ from "lodash";
const route = useRoute();
let shipInfos = ref([{}]);
async function getShipDetail(shipCode) {
  let { data } = await api.getShipDetail({ shipCode });
  for (const i of data.result.shipCerts) {
    i.date = [i.startValidTime, i.endValidTime];
    for (let j of i.certs) {
      j.url = j.viewUrl;
    }
  }
  data.result.disabled = true;

  shipInfos.value = [data.result];
  console.log(data);
}
onMounted(() => {
  getShipDetail(route.query.shipCode);
});
</script>
<style scoped></style>
