<template>
  <div>
    <div>调度日志</div>
    <div class="search"></div>
    <div>
      <el-table
        :data="tableData"
        style="width: 100%"
        :header-cell-style="{ background: '#EAF1FE', color: '#666666' }"
      >
        <el-table-column prop="jobId" label="任务ID" align="center" />
        <el-table-column prop="triggerTime" label="调度时间" align="center" />
        <el-table-column prop="triggerCode" label="调度结果" align="center">
          <template slot-scope="scope">
            <el-tag
              :type="scope.row.triggerCode === 200 ? 'success' : 'danger'"
              >{{ scope.row.triggerCode === 200 ? "成功" : "失败" }}</el-tag
            >
          </template>
        </el-table-column>
        <el-table-column prop="triggerMsg" label="调度备注" align="center">
          <template slot-scope="scope">
            <el-button type="text" @click="handleView(scope.row.triggerMsg)"
              >查看</el-button
            >
            <!-- <div v-html="scope.row.triggerMsg"></div> -->
          </template>
        </el-table-column>
        <el-table-column prop="handleTime" label="执行时间" align="center" />
        <el-table-column prop="handleCode" label="执行结果" align="center">
          <template slot-scope="scope">
            <el-tag
              :type="scope.row.handleCode === 200 ? 'success' : 'danger'"
              >{{ scope.row.handleCode === 200 ? "成功" : "失败" }}</el-tag
            >
          </template>
        </el-table-column>
        <el-table-column prop="handleMsg" label="执行备注" align="center" />
      </el-table>
    </div>
    <el-dialog
      title="告警详情"
      :visible.sync="centerDialogVisible"
      width="600px"
      center
    >
      <div v-html="dialogInfo"></div>
    </el-dialog>
  </div>
</template>

<script>
import { joblogList } from "@/api/job.js";
export default {
  data() {
    return {
      tableData: [],
      dialogInfo: "",
      centerDialogVisible: false,
    };
  },
  mounted() {
    this.handleJoblogList();
  },
  methods: {
    handleView(e) {
      this.dialogInfo = e;
      this.centerDialogVisible = true;
    },
    async handleJoblogList() {
      let data = {
        jobGroup: 0,
        jobId: 0,
        logStatus: -1,
        filterTime: "2024-12-09 00:00:00 - 2025-01-09 23:59:59",
        start: 0,
        length: 10,
      };
      const queryParams = new URLSearchParams(data).toString();
      const res = await joblogList(queryParams);
      console.log(res);
      this.tableData = res.data;
    },
  },
};
</script>

<style lang="scss" scoped>
</style>