TaskHistory.vue
942 字节
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<template>
<el-dialog :title="'任务历史记录'" :visible.sync="visible">
<el-table :data="history">
<el-table-column prop="executedAt" label="执行时间"></el-table-column>
<el-table-column prop="status" label="状态"></el-table-column>
<el-table-column prop="result" label="执行结果"></el-table-column>
</el-table>
<span slot="footer">
<el-button @click="visible = false">关闭</el-button>
</span>
</el-dialog>
</template>
<script>
import api from '../../../api/task/index';
export default {
props: ['taskId', 'visible'],
data() {
return {
history: []
};
},
watch: {
taskId: async function(newVal) {
if (newVal) {
try {
const res = await api.getExecutionHistory(newVal);
this.history = res.data.data;
} catch (e) {
this.$message.error('加载历史记录失败');
}
}
}
}
};
</script>