timer.vue
7.21 KB
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
<template>
<el-container style="padding: 20px">
<el-aside>
<el-card :style="{ height: asideHeight }">
<el-form label-width="80px">
<el-form-item label="任务名称">
<el-input v-model="paramCode" placeholder="请输入内容"></el-input>
</el-form-item>
<el-form-item label="分组">
<el-input v-model="paramName" placeholder="请输入内容"></el-input>
</el-form-item>
<el-form-item label="job状态">
<el-select v-model="crontabJobStatus" placeholder="请选择库存状态">
<el-option label="全部" value="0"></el-option>
<el-option label="运行" value="Run"></el-option>
<el-option label="暂停" value="Pause"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-row>
<el-col :span="8">
<el-button type="primary" size="small" @click="handleQuery"
>查询</el-button
>
</el-col>
<el-col :span="8">
<el-button type="success" size="small" @click="handleAdd"
>新增</el-button
>
</el-col>
</el-row>
<el-row style="margin-top: 5px">
<el-col :span="8">
<el-button type="warning" size="small" @click="handleEdit"
>编辑</el-button
>
</el-col>
<el-col :span="8">
<el-button type="danger" size="small" @click="handleDelete"
>删除</el-button
>
</el-col>
</el-row>
<el-row style="margin-top: 5px">
<el-col :span="8">
<el-button type="info" size="small" @click="handleStart"
>启动</el-button
>
</el-col>
<el-col :span="8">
<el-button type="info" size="small" @click="handlePause"
>暂停</el-button
>
</el-col>
</el-row>
</el-form-item>
</el-form>
</el-card>
</el-aside>
<el-main>
<el-card>
<el-table
:data="tableData"
style="width: 100%"
:height="TableHeight"
border
stripe
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column prop="id" label="ID" width="80"></el-table-column>
<el-table-column prop="taskName" label="任务名称"></el-table-column>
<el-table-column prop="group" label="分组"></el-table-column>
<el-table-column prop="jobStatus" label="job状态"></el-table-column>
<el-table-column
prop="assemblyName"
width="180"
label="程序集"
></el-table-column>
<el-table-column
prop="className"
width="300"
label="类名"
></el-table-column>
<el-table-column
prop="cron"
width="150"
label="表达式"
></el-table-column>
<el-table-column
prop="excludedCron"
width="180"
label="排除表达式"
></el-table-column>
<el-table-column
prop="executedCount"
label="已执行次数"
width="100"
></el-table-column>
<el-table-column
prop="taskParams"
width="180"
label="任务参数"
></el-table-column>
<el-table-column
prop="lastExecuteTime"
width="180"
label="最后一次运行时间"
></el-table-column>
<el-table-column
prop="lastExecuteSuccess"
width="180"
label="最后一次运行是否成功"
></el-table-column>
<el-table-column
prop="executeMsg"
label="执行携带的消息"
width="430"
></el-table-column>
<el-table-column
prop="remark"
width="180"
label="备注"
></el-table-column>
<el-table-column
prop="created"
width="180"
label="创建时间"
></el-table-column>
<el-table-column prop="createdBy" label="创建人"></el-table-column>
<el-table-column
prop="updated"
width="180"
label="更新时间"
></el-table-column>
<el-table-column prop="updatedBy" label="更新人"></el-table-column>
</el-table>
<el-pagination
style="margin-top: 15px"
align="center"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
/>
</el-card>
</el-main>
</el-container>
</template>
<script>
import {
GetCrontabJobsByPage,
AddJob,
RemoveJob,
UpdateJob,
StartJob,
PauseJob,
} from "@/api/systemManage/timer";
export default {
name: "Timer",
computed: {
TableHeight() {
return `calc(100vh - 220px )`;
},
asideHeight() {
return `calc(100vh - 150px)`;
},
},
data() {
return {
paramCode: "",
paramName: "",
currentPage: 1,
total: 0,
pageSize: 10,
selectedItems: [],
tableData: [],
crontabJobStatus: "0",
};
},
methods: {
handleSelectionChange(val) {
this.selectedItems = val;
},
handleSizeChange(val) {
this.pageSize = val;
this.currentPage = 1;
this.handleQuery();
},
handleCurrentChange(val) {
this.currentPage = val;
this.handleQuery();
},
handleQuery() {
const requestData = {
pageNumber: this.currentPage,
perPageCount: this.pageSize,
queryConfig: {
code: this.paramCode.trim(),
name: this.paramName.trim(),
crontabJobStatus: this.crontabJobStatus,
},
};
GetCrontabJobsByPage(requestData).then((res) => {
if (res.code == "Success" && res.data) {
this.tableData = res.data.data || res.data;
this.total = res.data.totalCount || res.data.data.length;
}
});
},
handleAdd() {
// 新增逻辑
},
handleEdit() {
// 编辑逻辑
},
handleDelete() {
// 删除逻辑
},
handleStart() {
// 启动逻辑
},
handlePause() {
// 暂停逻辑
},
},
};
</script>
<style scoped lang="scss">
::v-deep .el-table__body-wrapper::-webkit-scrollbar {
width: 8px;
height: 8px;
}
::v-deep .el-table__body-wrapper::-webkit-scrollbar-thumb {
background-color: #777f87;
border-radius: 4px;
}
::v-deep .el-table__body-wrapper::-webkit-scrollbar-track {
background-color: #f5f5f5;
}
.el-card__body,
.el-main {
padding: 0 10px 0 10px;
}
::v-deep.el-table thead {
color: #101010;
font-weight: 600;
}
.el-form-item {
margin-bottom: 18px;
}
/* 样式定义 */
</style>