<template>
  <div>
<!--    <div class="refresh">-->
<!--      <div class="refresh-icon">-->
<!--        <i class="el-icon-refresh"></i>-->
<!--        <span>刷新</span>-->
<!--      </div>-->
<!--    </div>-->
    <!--    <div class="chart-container">-->
    <!--      <div class="chart-instance">-->
    <!--        <div>定时任务执行记录</div>-->
    <!--        <lineChart />-->
    <!--      </div>-->
    <!--    </div>-->
    <div class="table-content">
      <el-table :data="tableData" border style="width: 100%">
        <el-table-column prop="triggerTime" label="触发时间"> </el-table-column>
        <el-table-column prop="startTime" label="开始时间"> </el-table-column>
        <el-table-column prop="triggerType" label="触发方式" :formatter="row => ['','定时任务', '手动'][row.triggerType]">
        </el-table-column>
        <el-table-column prop="resultDesc" label="情况描述"> </el-table-column>
        <el-table-column prop="status" label="状态" :formatter="row => ['','成功', '失败'][row.status]">
        </el-table-column>
        <el-table-column prop="sendStatus" label="发送状态" :formatter="row => ['未发送','已发送'][row.sendStatus]">
        </el-table-column>
        <el-table-column prop="costTime" label="执行耗时（毫秒）">
        </el-table-column>
        <!--        <el-table-column fixed="right" label="操作">-->
        <!--          <template slot-scope="scope">-->
        <!--            <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button>-->
        <!--          </template>-->
        <!--        </el-table-column>-->
      </el-table>
      <div>
        <pagination
          v-show="total > 0"
          :total="total"
          :page.sync="queryParams.pageNum"
          :limit.sync="queryParams.pageSize"
          @pagination="getData"
        />
      </div>
    </div>
  </div>
</template>

<script>
import lineChart from "./lineChart.vue";
import {taskResultListByTaskId} from "@/api/test/task";
export default {
  components: {
    lineChart,
  },
  mounted() {
    // 在这里进行数据预处理
    this.getData();
  },
  data() {
    return {
      value: "",
      tableData: [],
      total: 0,
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        id: null,
      },
    };
  },
  methods: {
    getData() {
      this.tableData=[]
      this.queryParams.id = this.$route.query.id;
      taskResultListByTaskId(this.queryParams).then(res => {
        this.tableData = res.rows;
        this.total = res.total;
      })
    },
  },
};
</script>
<style scoped lang="scss">
.row {
  border-bottom: 1px solid #e3e8f2;
  display: flex;
  flex-direction: row-reverse;
  padding: 0 24px 8px 24px;
  .button {
    align-items: center;
    display: inline-flex;
  }
  .el-icon-setting {
    font-size: 14px;
    color: #343434;
    margin-left: 10px;
  }

  .el-button {
    height: 24px;
    line-height: 22px;
    padding: 0 12px;
    font-size: 12px;
  }
}
.refresh {
  display: flex;
  flex-direction: row-reverse;
  padding: 16px 24px;
  .refresh-icon {
    font-size: 12px;
    color: #343434;
    align-items: center;
    display: inline-flex;
  }
  span {
    font-size: 12px;
    color: #343434;
    margin-left: 10px;
  }
}
.chart-container {
  display: flex;

  .chart-instance {
    width: 100%;
    padding: 16px;
    border: 1px solid #e9f3fb;
    margin-right: 16px;
    &:last-of-type {
      margin-right: 0;
    }
  }
}
.trend-chart {
  display: flex;
  justify-content: space-between;
}
.select {
  color: #4f597f;
  font-size: 12px;
  padding-right: 8px;
}
.table-content {
  padding-top: 24px;
}

.status-icon {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.status-icon.success {
  background-color: green; // 成功状态图标颜色
}

.status-icon.pending {
  background-color: gray; // 未发送状态图标颜色
}

.pagination {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
  text-align: right;
}
</style>
