<template>
  <div>
    <app-search v-model="searchForm" :options @submit="resetPagination" />
    <app-table ref="tableRef" v-model:pagination="pagination" :data="list">
      <el-table-column prop="beanName" label="bean名称" />
      <el-table-column prop="jobName" label="任务名称" />
      <el-table-column prop="params" label="参数" />
      <el-table-column prop="status" label="状态">
        <template #default="{ row }">
          <el-tag v-if="row.status === 0" type="success">正常</el-tag>
          <el-tag v-else type="danger">暂停</el-tag>
        </template>
      </el-table-column>
      <el-table-column prop="error" label="失败信息" />
      <el-table-column prop="times" label="耗时（毫秒）" />
      <el-table-column prop="createTime" label="创建时间" />

      <el-table-column v-slot="{ row }" label="操作" width="260">
        <el-button
          type="primary"
          text
          link
          @click="
            router.push({
              path: '/schedule_management/scheduleLog/info',
              query: { logId: row.logId },
            })
          "
        >
          查看
        </el-button>
      </el-table-column>
    </app-table>
  </div>
</template>

<script setup>
import AppSearch from "@/components/search/index.vue";
import useListData from "@/hooks/useListData.js";
import { getScheduleLogList } from "@/request/system_management.js";
import AppTable from "@/components/table/index.vue";
import { useRouter } from "vue-router";

const router = useRouter();

const { list, pagination, searchForm, resetPagination, tableRef } =
  useListData(getScheduleLogList);
const options = [{ key: "jobName", label: "任务名称" }];
</script>

<style scoped></style>
