<template>
  <div class="main-container">
    <div class="clear">
      <!-- <div class="fl left_side">
        <site-nav default_active="1" active="1-2"></site-nav>
      </div> -->
      <div class="con1 grid_wrapper">
        <table>
          <tr>
            <th>序号</th>
            <th>任务号</th>
            <th>出发起点</th>
            <th>目标站点</th>
            <th>任务状态</th>
            <th>生成时间</th>
          </tr>
          <tr v-for="(e, index) in dataList" :key="e.task_id">
            <td>{{index+1}}</td>
            <td>{{e.task_num}}</td>
            <td>{{e.next_point}}</td>
            <td>{{e.target_point}}</td>
            <td>{{e.task_status_name}}</td>
            <td class="last-td">{{e.create_time}}</td>
          </tr>
        </table>
      </div>
    </div>
  </div>
</template>

<script>
import SiteNav from '@components/SiteNav.vue'
import {queryTaskList} from '@/config/getData.js'
export default {
  name: 'TaskList',
  components: {
    SiteNav
  },
  data () {
    return {
      pkId: '',
      dataList: []
      // dataList: [
      //   {
      //     task_id: '1',
      //     task_no: '1001',
      //     next_point: '1001',
      //     status: '正在执行',
      //     time: '2021-07-14  12:00:00'
      //   },
      //   {
      //     task_id: '2',
      //     task_no: '1002',
      //     next_point: '1001',
      //     status: '未执行',
      //     time: '2021-07-15  12:00:00'
      //   },
      //   {
      //     task_id: '3',
      //     task_no: '1003',
      //     next_point: '1001',
      //     status: '未执行',
      //     time: '2021-07-18  12:00:00'
      //   },
      //   {
      //     task_id: '4',
      //     task_no: '1004',
      //     next_point: '1001',
      //     status: '未执行',
      //     time: '2021-09-10  12:00:00'
      //   }
      // ]
    }
  },
  created () {
    this.initData()
  },
  methods: {
    async initData () {
      let res = await queryTaskList()
      if (res.code === '1') {
        this.dataList = res.result
      } else {
        this.toast(res.desc)
      }
    }
  }
}
</script>

<style lang="stylus" scoped>
.con1
  float left
  width 100%
  padding 0.25rem
.last-td
  width 4.4rem
  text-align left
  padding-left 1.7rem
  box-sizing border-box
</style>
