gtsoft-snail-job-server/frontend/src/views/job/JobLogMessageList.vue

90 lines
1.8 KiB
Vue
Raw Normal View History

<template>
<div>
<a-card>
<s-table
ref="table"
size="default"
rowKey="key"
:columns="columns"
:data="loadData"
>
<span slot="serial" slot-scope="text, record">
{{ record.id }}
</span>
</s-table>
</a-card>
</div>
</template>
<script>
import moment from 'moment'
import { STable } from '@/components'
import { jobLogList } from '@/api/jobApi'
export default {
name: 'JobLogList',
components: {
STable
},
data () {
return {
// 表头
columns: [
{
title: '#',
scopedSlots: { customRender: 'serial' },
width: '5%'
},
{
title: '信息',
dataIndex: 'message',
width: '50%'
},
{
title: '触发时间',
dataIndex: 'createDt',
sorter: true,
customRender: (text) => moment(text).format('YYYY-MM-DD HH:mm:ss'),
width: '10%'
}
],
queryParam: {},
// 加载数据方法 必须为 Promise 对象
loadData: parameter => {
return jobLogList(Object.assign(parameter, this.queryParam))
.then(res => {
this.total = res.total
return res
})
},
total: 0
}
},
created () {
const taskBatchId = this.$route.query.taskBatchId
const jobId = this.$route.query.jobId
if (taskBatchId && jobId) {
this.queryParam = {
taskBatchId: taskBatchId,
jobId: jobId
}
this.$refs.table.refresh(true)
} else {
this.$router.push({ path: '/404' })
}
},
methods: {
refreshTable (v) {
this.queryParam = v
this.$refs.table.refresh(true)
}
}
}
</script>
<style scoped>
</style>