提交 | 用户 | 时间
|
850106
|
1 |
<template> |
H |
2 |
<el-card shadow="never" class="aui-card--fill"> |
|
3 |
<div class="mod-job__schedule"> |
|
4 |
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()"> |
|
5 |
<el-form-item> |
|
6 |
<el-input v-model="dataForm.beanName" :placeholder="$t('schedule.beanName')" clearable></el-input> |
|
7 |
</el-form-item> |
|
8 |
<el-form-item> |
|
9 |
<el-button @click="getDataList()">{{ $t('query') }}</el-button> |
|
10 |
</el-form-item> |
|
11 |
<el-form-item> |
|
12 |
<el-button v-if="$hasPermission('mcs:schedule:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button> |
|
13 |
</el-form-item> |
|
14 |
<el-form-item> |
|
15 |
<el-button v-if="$hasPermission('mcs:schedule:delete')" type="danger" @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button> |
|
16 |
</el-form-item> |
|
17 |
<el-form-item> |
|
18 |
<el-button v-if="$hasPermission('mcs:schedule:pause')" type="danger" @click="pauseHandle()">{{ $t('schedule.pauseBatch') }}</el-button> |
|
19 |
</el-form-item> |
|
20 |
<el-form-item> |
|
21 |
<el-button v-if="$hasPermission('mcs:schedule:resume')" type="danger" @click="resumeHandle()">{{ $t('schedule.resumeBatch') }}</el-button> |
|
22 |
</el-form-item> |
|
23 |
<el-form-item> |
|
24 |
<el-button v-if="$hasPermission('mcs:schedule:run')" type="danger" @click="runHandle()">{{ $t('schedule.runBatch') }}</el-button> |
|
25 |
</el-form-item> |
|
26 |
</el-form> |
|
27 |
<el-table |
|
28 |
v-loading="dataListLoading" |
|
29 |
:data="dataList" |
|
30 |
border |
|
31 |
@selection-change="dataListSelectionChangeHandle" |
|
32 |
@sort-change="dataListSortChangeHandle" |
|
33 |
style="width: 100%;"> |
|
34 |
<el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column> |
|
35 |
<el-table-column prop="beanName" :label="$t('schedule.beanName')" header-align="center" align="center"></el-table-column> |
|
36 |
<el-table-column prop="params" :label="$t('schedule.params')" header-align="center" align="center"></el-table-column> |
|
37 |
<el-table-column prop="cronExpression" :label="$t('schedule.cronExpression')" header-align="center" align="center"></el-table-column> |
|
38 |
<el-table-column prop="remark" :label="$t('schedule.remark')" header-align="center" align="center"></el-table-column> |
|
39 |
<el-table-column prop="status" :label="$t('schedule.status')" sortable="custom" header-align="center" align="center"> |
|
40 |
<template slot-scope="scope"> |
|
41 |
<el-tag v-if="scope.row.status === 1" size="small">{{ $t('schedule.status1') }}</el-tag> |
|
42 |
<el-tag v-else size="small" type="danger">{{ $t('schedule.status0') }}</el-tag> |
|
43 |
</template> |
|
44 |
</el-table-column> |
|
45 |
<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150"> |
|
46 |
<template slot-scope="scope"> |
|
47 |
<el-button v-if="$hasPermission('mcs:schedule:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button> |
|
48 |
<el-button v-if="$hasPermission('mcs:schedule:pause')" type="text" size="small" @click="pauseHandle(scope.row.id)">{{ $t('schedule.pause') }}</el-button> |
|
49 |
<el-button v-if="$hasPermission('mcs:schedule:resume')" type="text" size="small" @click="resumeHandle(scope.row.id)">{{ $t('schedule.resume') }}</el-button> |
|
50 |
<el-button v-if="$hasPermission('mcs:schedule:run')" type="text" size="small" @click="runHandle(scope.row.id)">{{ $t('schedule.run') }}</el-button> |
|
51 |
<el-button v-if="$hasPermission('mcs:schedule:delete')" type="text" size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button> |
|
52 |
</template> |
|
53 |
</el-table-column> |
|
54 |
</el-table> |
|
55 |
<el-pagination |
|
56 |
:current-page="page" |
|
57 |
:page-sizes="[10, 20, 50, 100]" |
|
58 |
:page-size="limit" |
|
59 |
:total="total" |
|
60 |
layout="total, sizes, prev, pager, next, jumper" |
|
61 |
@size-change="pageSizeChangeHandle" |
|
62 |
@current-change="pageCurrentChangeHandle"> |
|
63 |
</el-pagination> |
|
64 |
<!-- 弹窗, 新增 / 修改 --> |
|
65 |
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update> |
|
66 |
<!-- 弹窗, 日志列表 --> |
|
67 |
<log v-if="logVisible" ref="log"></log> |
|
68 |
</div> |
|
69 |
</el-card> |
|
70 |
</template> |
|
71 |
|
|
72 |
<script> |
|
73 |
import mixinViewModule from '@/mixins/view-module' |
|
74 |
import AddOrUpdate from './schedule-add-or-update' |
|
75 |
import Log from './schedule-log' |
|
76 |
export default { |
|
77 |
mixins: [mixinViewModule], |
|
78 |
data () { |
|
79 |
return { |
|
80 |
mixinViewModuleOptions: { |
|
81 |
getDataListURL: '/iailab-ntt-model/mcs/schedule/page', |
|
82 |
getDataListIsPage: true, |
|
83 |
deleteURL: '/iailab-ntt-model/mcs/schedule', |
|
84 |
deleteIsBatch: true |
|
85 |
}, |
|
86 |
dataForm: { |
|
87 |
beanName: '' |
|
88 |
}, |
|
89 |
logVisible: false |
|
90 |
} |
|
91 |
}, |
|
92 |
components: { |
|
93 |
AddOrUpdate, |
|
94 |
Log |
|
95 |
}, |
|
96 |
methods: { |
|
97 |
// 暂停 |
|
98 |
pauseHandle (id) { |
|
99 |
debugger |
|
100 |
if (!id && this.dataListSelections.length <= 0) { |
|
101 |
return this.$message({ |
|
102 |
message: this.$t('prompt.deleteBatch'), |
|
103 |
type: 'warning', |
|
104 |
duration: 500 |
|
105 |
}) |
|
106 |
} |
|
107 |
this.$confirm(this.$t('prompt.info', { 'handle': this.$t('schedule.pause') }), this.$t('prompt.title'), { |
|
108 |
confirmButtonText: this.$t('confirm'), |
|
109 |
cancelButtonText: this.$t('cancel'), |
|
110 |
type: 'warning' |
|
111 |
}).then(() => { |
|
112 |
this.$http.put('/iailab-ntt-model/mcs/schedule/pause', id ? [id] : this.dataListSelections.map(item => item.id)).then(({ data: res }) => { |
|
113 |
if (res.code !== 0) { |
|
114 |
return this.$message.error(res.msg) |
|
115 |
} |
|
116 |
this.$message({ |
|
117 |
message: this.$t('prompt.success'), |
|
118 |
type: 'success', |
|
119 |
duration: 500, |
|
120 |
onClose: () => { |
|
121 |
this.getDataList() |
|
122 |
} |
|
123 |
}) |
|
124 |
}).catch(() => {}) |
|
125 |
}).catch(() => {}) |
|
126 |
}, |
|
127 |
// 恢复 |
|
128 |
resumeHandle (id) { |
|
129 |
if (!id && this.dataListSelections.length <= 0) { |
|
130 |
return this.$message({ |
|
131 |
message: this.$t('prompt.deleteBatch'), |
|
132 |
type: 'warning', |
|
133 |
duration: 500 |
|
134 |
}) |
|
135 |
} |
|
136 |
this.$confirm(this.$t('prompt.info', { 'handle': this.$t('schedule.resume') }), this.$t('prompt.title'), { |
|
137 |
confirmButtonText: this.$t('confirm'), |
|
138 |
cancelButtonText: this.$t('cancel'), |
|
139 |
type: 'warning' |
|
140 |
}).then(() => { |
|
141 |
this.$http.put('/iailab-ntt-model/mcs/schedule/resume', id ? [id] : this.dataListSelections.map(item => item.id)).then(({ data: res }) => { |
|
142 |
if (res.code !== 0) { |
|
143 |
return this.$message.error(res.msg) |
|
144 |
} |
|
145 |
this.$message({ |
|
146 |
message: this.$t('prompt.success'), |
|
147 |
type: 'success', |
|
148 |
duration: 500, |
|
149 |
onClose: () => { |
|
150 |
this.getDataList() |
|
151 |
} |
|
152 |
}) |
|
153 |
}).catch(() => {}) |
|
154 |
}).catch(() => {}) |
|
155 |
}, |
|
156 |
// 执行 |
|
157 |
runHandle (id) { |
|
158 |
if (!id && this.dataListSelections.length <= 0) { |
|
159 |
return this.$message({ |
|
160 |
message: this.$t('prompt.deleteBatch'), |
|
161 |
type: 'warning', |
|
162 |
duration: 500 |
|
163 |
}) |
|
164 |
} |
|
165 |
this.$confirm(this.$t('prompt.info', { 'handle': this.$t('schedule.run') }), this.$t('prompt.title'), { |
|
166 |
confirmButtonText: this.$t('confirm'), |
|
167 |
cancelButtonText: this.$t('cancel'), |
|
168 |
type: 'warning' |
|
169 |
}).then(() => { |
|
170 |
this.$http.put('/iailab-ntt-model/mcs/schedule/run', id ? [id] : this.dataListSelections.map(item => item.id)).then(({ data: res }) => { |
|
171 |
if (res.code !== 0) { |
|
172 |
return this.$message.error(res.msg) |
|
173 |
} |
|
174 |
this.$message({ |
|
175 |
message: this.$t('prompt.success'), |
|
176 |
type: 'success', |
|
177 |
duration: 500, |
|
178 |
onClose: () => { |
|
179 |
this.getDataList() |
|
180 |
} |
|
181 |
}) |
|
182 |
}).catch(() => {}) |
|
183 |
}).catch(() => {}) |
|
184 |
}, |
|
185 |
// 日志列表 |
|
186 |
logHandle () { |
|
187 |
this.logVisible = true |
|
188 |
this.$nextTick(() => { |
|
189 |
this.$refs.log.init() |
|
190 |
}) |
|
191 |
} |
|
192 |
} |
|
193 |
} |
|
194 |
</script> |