<template>
  <div class="taskLog">
      <div class="moduler">
        <!--  :rowSelection="{selectedRowKeys: selectedRowKeys,...rowSelection}" -->
        <div class="tableOpt">
          <!-- <a-button type='primary' @click="addTask">新增任务</a-button> -->
        </div>
          <div class="table">
                <a-table
                    :columns="columns"
                    :data-source="tableData"                 
                    bordered
                    :pagination="ipagination"
                    :loading="loading"
                    @change="sort"
                    size='middle'
                >

                    <span slot="options" slot-scope="text,record">
                        <a href="javascript:;" style="margin-right:10px" @click="editItem(record)">编辑</a>
                        <a-popconfirm
                          title="确定删除该任务?"
                          ok-text="确定"
                          cancel-text="取消"
                          @confirm="deleteItem(record)"
                         
                        >
                          <a href="javascript:;">删除</a>
                        </a-popconfirm>
                        
                    </span>
                   
                    
                    <span slot="exeResult" slot-scope="text">
                        {{text?'已执行':'未执行'}}
                    </span>
                    <span slot="notifyState" slot-scope="text">
                        {{text?'已通知':'未通知'}}
                    </span>
                </a-table>
            </div>
      </div>
  </div>
</template>

<script>
import moment from 'moment';
import { getAction, postAction, downFile, downFilePost } from '@/api/manage';
import { JeecgListMixin } from '@/mixins/ipagination'
import qs from 'qs'
const columns = [
  {
    title: '任务ID',
    dataIndex: 'checkTaskId',
    key: 'checkTaskId',
    align: 'center',
    scopedSlots: { customRender: 'checkTaskId' }
  },
  {
    title: '任务名',
    dataIndex: 'checkTaskId_dictText',
    key: 'checkTaskId_dictText',
    align: 'center',
    scopedSlots: { customRender: 'checkTaskId_dictText' }
  },
  
 

  {
    title: '执行时间秒数',
    dataIndex: 'exeTime',
    key: 'exeTime',
    align: 'exeTime',
     align: 'center',
    
  },
  {
    title: '执行结果',
    dataIndex: 'exeResult',
    key: 'exeResult',
    align: 'center',
    scopedSlots: { customRender: 'exeResult' }
  },
  {
    title: '通知状态',
    dataIndex: 'notifyState',
    key: 'notifyState',
    align: 'center',
    scopedSlots: { customRender: 'notifyState' }
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    key: 'createTime',
    align: 'center',
    scopedSlots: { customRender: 'createTime' }
  },
 
    // {
    //   title: '操作',
    //   dataIndex: 'options',
    //   key: 'options',
    //   align: 'center',
    //   scopedSlots: { customRender: 'options' }
    // },
];
  export default {
    mixins: [JeecgListMixin],
    data() {
      return {
        columns,
        tableData:[],
        loading:false,

      }
    },
    methods: {
       //点击分页
      sort(pagination, filters, sorter, { currentDataSource }){
          
          this.ipagination.current=pagination.current;
          // this.search();
          this.tableHttp()
      },
      // 获取展示列的table
      tableHttp(){
        this.loading=true;
        getAction('/ctop/checkTaskExecuteLog/list',{
          pageNo:this.ipagination.current,
        }).then(res=>{
          console.log(res);
          this.loading=false
          if(res.success){
            this.tableData=res.result.records.map(item=>{
                return {
                    ...item,
                   key:item.id
                }
            });
            this.ipagination.total=res.result.total
          }
          
        })
      },
    },
    mounted() {
      this.tableHttp()
    },
  }
</script>

<style lang="scss" scoped>
.taskLog{
   font-family: PingFangSC-Regular, tahoma, arial, 'Hiragino Sans GB', 'Microsoft yahei', sans-serif;
  color: #333;
  ul,
  li {
    margin: 0;
    padding: 0;
  }
  .moduler {
    background: #fff;
    margin-bottom: 16px;
    position: relative;
    padding: 32px 24px 48px 32px;
    border-radius: 4px;
    box-shadow: 0px 1px 6px 0px rgba(0, 0, 0, 0.05);
    .moduler-title {
      display: flex;
      align-items: center;
      font-size: 22px;
      margin-bottom: 20px;
    }
    .row-item {
      display: flex;
      justify-content: flex-start;
      align-items: center;
      margin-bottom: 32px;
    }
    .row-item:last-of-type {
      margin-bottom: 0;
    }
    .row-item .hint-item {
      width: 24px;
      min-width: 24px;
      align-self: flex-start;
      line-height: 20px;
      height: 20px;
      margin-top: 5px;
    }
    .row-item .label-item {
      position: relative;
      align-items: flex-start;
      align-self: flex-start;
      line-height: 20px;
      height: 20px;
      margin-top: 7px;
      width: 80px;
      min-width: 80px;
      .text-item {
        font-size: 14px;
        width: 60px;
      }
    }
    .row-item .required-item {
      width: 4px;
      height: 4px;
      border-radius: 2px;
      background: #f45858;
      position: absolute;
      right: 10px;
      top: 50%;
      transform: translateY(-50%);
    }
    .row-item .input-item {
      min-width: 480px;
      position: relative;
      // height: 35px;
      .tip {
        font-size: 12px;
        color: tomato;
      }
    }
  }
  .tableOpt{
    margin-bottom: 20px;
  }
}
</style>