<template>
  <div class="top-scroll-bar">
    <div class="column-row-title">
      <span class="title-text"><img src="@/assets/images/title-icon.png" alt=""/>最近巡检</span>
      <span class="t-span">
        <span class="t-time">{{ result.time }}</span> |
        <span class="text-a"  @click="nowCheck(false)">查看详情 </span></span>
      <span class="right-btn" @click="nowCheck(true)">立即巡检</span>
    </div>
    <div class="column-content scroll-text">
      巡检结果：本次自动巡检共{{result.model}}个模块，共发现{{result.problem}}问题
    </div>
  </div>
</template>
<script setup lang="ts">
import {hlCheck} from "@/api/index/hl"
import {onMounted, ref} from "vue";
import {useRouter} from "vue-router"
const router = useRouter()

const nowCheck = (query) => {
  if(query){
    router.push({path: '/hl/check',query:{check:'true'}})
  }else{
    router.push({path: '/hl/check'})
  }
}
const result = ref({})
onMounted(async () => {
  const res = await hlCheck()
  result.value = res.data
})
</script>
