<template>
  <div class="TabComp">
    <div class="title">
      <div class="title-left">最新任务</div>
      <div class="title-right" @click="$router.push('/task/task-manage')">查看更多</div>
    </div>
    <n-space vertical>
      <n-table striped style="table-layout:fixed;">
        <thead>
          <tr>
            <th class="one">序号</th>
            <th style="text-align: center;">任务名称</th>
            <th style="text-align: center;">执行时间</th>
          </tr>
        </thead>
        <tbody>
          <tr v-for="(it, i) in tabList" :key="'list' + it.name">
            <td class="one">{{ i + 1 }}</td>
            <td class="hid">{{ it.taskName }}</td>
            <td class="hid">{{ it.taskStartTime }}</td>
          </tr>
        </tbody>
      </n-table>
    </n-space>
  </div>
</template>

<script setup name="tabComp">
import { ref } from 'vue'
import { newestTask } from '@/api/dashboard/index'

const tabList = ref([])

newestTask().then(({ data }) => {
  tabList.value = data
})

</script>

<style lang="scss" scoped>
.TabComp {
  height: 500px;

  .title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;

    &-left {
      font-size: 16px;
      font-weight: bold;
    }

    &-right {
      font-size: 12px;
      color: rgba(36, 158, 255, 1);
      cursor: pointer;
    }
  }

  .one {
    width: 45px;
    text-align: center;
  }

  .hid {
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}
</style>
