任务日志新增时间轴显示

This commit is contained in:
不做码农 2022-03-22 17:49:16 +08:00
parent 21a0d27aa9
commit 6c376d5b0d

View File

@ -28,7 +28,7 @@
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['monitor:job:export']">导出</el-button>
</el-col>
<el-col :span="1.5">
<el-button plain v-hasPermi="['monitor:job:query']" type="info" icon="el-icon-s-operation" size="mini" @click="handleJobLog({id: 1})">日志
<el-button plain v-hasPermi="['monitor:job:query']" type="info" icon="el-icon-s-operation" size="mini" @click="handleJobLog()">日志
</el-button>
</el-col>
<right-toolbar :showSearch.sync="searchToggle" @queryTable="handleQuery"></right-toolbar>
@ -52,8 +52,9 @@
<el-table-column prop="remark" align="center" label="备注" :show-overflow-tooltip="true" />
<el-table-column label="操作" align="center" width="230" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button type="text" size="mini" icon="el-icon-view" v-hasPermi="['monitor:job:query']">
<router-link :to="{path: 'job/log', query: {jobId: scope.row.id}}">日志</router-link>
<el-button type="text" size="mini" icon="el-icon-view" v-hasPermi="['monitor:job:query']" @click="handleJobLog(scope.row.id, scope.row.name)">
日志
<!-- <router-link :to="{path: 'job/log', query: {jobId: scope.row.id}}">日志</router-link> -->
</el-button>
<el-button type="text" v-if="scope.row.isStart" v-hasPermi="['monitor:job:run']" size="mini" icon="el-icon-remove" title="运行"
@click="handleRun(scope.row)">运行</el-button>
@ -148,6 +149,16 @@
<el-button type="primary" @click="submitForm"> </el-button>
</div>
</el-dialog>
<el-drawer :title="logTitle" :visible.sync="drawer">
<el-timeline>
<el-timeline-item :timestamp="item.createTime" placement="top" v-for="(item, i) in jobLogList" :key="i">
<h4>{{item.jobMessage}}</h4>
<p>{{item.exception}}</p>
</el-timeline-item>
</el-timeline>
<el-empty v-if="jobLogList.length <= 0"></el-empty>
</el-drawer>
</div>
</template>
@ -162,6 +173,8 @@ import {
runTasks,
exportTasks
} from '@/api/monitor/job'
import { listJobLog } from '@/api/monitor/jobLog'
export default {
name: 'job',
data() {
@ -210,6 +223,7 @@ export default {
}
}
return {
drawer: false,
//
ids: [],
//
@ -240,6 +254,9 @@ export default {
},
//
dataTasks: [],
//
jobLogList: [],
logTitle: "",
//
isStartOptions: [
{ dictLabel: '运行中', dictValue: 'true' },
@ -289,7 +306,7 @@ export default {
//
pickerOptions: {
disabledDate(time) {
return time.getTime() < Date.now() - 8.64e7;
return time.getTime() < Date.now() - 8.64e7
}
}
}
@ -345,8 +362,17 @@ export default {
this.title = '修改计划任务'
},
/** 任务日志列表查询 */
handleJobLog(param) {
this.$router.push({ path: 'job/log', params: param })
handleJobLog(id, title) {
if (id == undefined) {
this.$router.push({ path: 'job/log' })
} else {
this.drawer = true
this.jobLogList = []
this.logTitle = title
listJobLog({ JobId: id }).then((response) => {
this.jobLogList = response.data.result
})
}
},
//
handleStart(row) {