03207d5d
wwk
1
|
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
<template>
<transition name="el-zoom-in-center">
<div class="NCC-preview-main">
<div class="NCC-common-page-header">
<el-page-header @back="goBack" :content="title" />
<div class="options">
<el-button @click="goBack()">{{$t('common.cancelButton')}}</el-button>
</div>
</div>
<div class="main">
<el-row class="NCC-common-search-box" :gutter="16">
<el-form @submit.native.prevent>
<el-col :span="6">
<el-form-item label="执行时间">
<el-date-picker v-model="pickerVal" type="daterange" start-placeholder="开始日期"
end-placeholder="结束日期" :picker-options="pickerOptions" value-format="timestamp"
clearable :editable="false" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="执行结果">
<el-select v-model="listQuery.runResult" placeholder="选择执行结果" clearable>
<el-option label="成功" :value="0"></el-option>
<el-option label="失败" :value="1"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="search()">
{{$t('common.search')}}</el-button>
<el-button icon="el-icon-refresh-right" @click="reset()">{{$t('common.reset')}}
</el-button>
</el-form-item>
</el-col>
</el-form>
</el-row>
<NCC-table v-loading="listLoading" :data="list">
<el-table-column prop="runTime" label="执行时间" :formatter="ncc.tableDateFormat"
width="130" />
<el-table-column prop="runResult" label="执行结果" width="100" align="center">
<template slot-scope="scope">
<el-tag :type="scope.row.runResult == 0 ? 'success' : 'danger'">
{{scope.row.runResult==0?'成功':'失败'}}</el-tag>
</template>
</el-table-column>
<el-table-column prop="description" label="执行说明" />
</NCC-table>
<pagination :total="total" :page.sync="listQuery.currentPage"
:limit.sync="listQuery.pageSize" @pagination="initData" />
</div>
</div>
</transition>
</template>
<script>
import { TimeTaskTaskLogList } from '@/api/system/timeTask'
import { deepClone } from '@/utils'
const listQuery = {
runResult: '',
startTime: '',
endTime: '',
currentPage: 1,
pageSize: 20,
sort: 'desc',
sidx: ''
}
export default {
data() {
return {
id: '',
title: '',
list: [],
total: 0,
listLoading: true,
listQuery: {},
pickerOptions: {
shortcuts: [{
text: '最近一周',
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
picker.$emit('pick', [start, end]);
}
}, {
text: '最近一个月',
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
picker.$emit('pick', [start, end]);
}
}, {
text: '最近三个月',
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
picker.$emit('pick', [start, end]);
}
}]
},
pickerVal: []
}
},
methods: {
goBack() {
this.$emit('close')
},
init(id, title) {
if (!id) return this.$emit('close')
this.id = id
this.title = title
this.reset()
},
initData() {
this.listLoading = true
TimeTaskTaskLogList(this.id, this.listQuery).then(res => {
this.list = res.data.list
this.total = res.data.pagination.total
this.listLoading = false
})
},
reset() {
this.pickerVal = []
this.listQuery = deepClone(listQuery)
this.initData()
},
search() {
const runResult = this.listQuery.runResult
this.listQuery = deepClone(listQuery)
this.listQuery.runResult = runResult
if (this.pickerVal && this.pickerVal.length) {
this.listQuery.startTime = this.pickerVal[0]
this.listQuery.endTime = this.pickerVal[1]
} else {
this.listQuery.startTime = ''
this.listQuery.endTime = ''
}
this.initData()
}
}
}
</script>
<style lang="scss" scoped>
.main {
overflow: hidden;
display: flex;
flex-direction: column;
padding: 0 0 10px;
>>> .el-table {
flex: 1;
border-top: none;
}
}
</style>
|