Skip to content

Commit 17c5d9f

Browse files
author
shenshuo
committed
修复定时任务搜索问题
1 parent f0f2915 commit 17c5d9f

File tree

2 files changed

+10
-36
lines changed

2 files changed

+10
-36
lines changed

src/api/cron.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
import axios from '@/libs/api.request'
22

3-
export const getCronJobslist = (page, limit, key, value, date = ['', '']) => {
3+
export const getCronJobslist = (page, limit, value) => {
44
return axios.request({
55
url: '/cron//v1/cron/job/',
66
method: 'get',
77
params: {
88
page,
99
limit,
10-
key,
11-
value,
12-
start_date: date[0],
13-
end_date: date.length > 1 ? date[1] : ''
10+
'job_id': value
1411
}
1512
})
1613
}

src/view/cron/cron-jobs.vue

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
<template>
22
<Card>
33
<div class="search-con search-con-top">
4-
<Select v-model="searchKey" class="search-col">
5-
<Option v-for="item in columns" v-if="item.key !== 'handle' && item.key !== 'status' && item.key !== ''" :value="item.key" :key="`search-col-${item.key}`">{{ item.title }}</Option>
6-
</Select>
7-
<Input @on-change="handleClear" clearable placeholder="输入关键字搜索" class="search-input" v-model="searchValue"/>
4+
<Input clearable placeholder="输入任务ID搜索" class="search-input" v-model="searchValue"/>
85
<Button @click="handleSearch" class="search-btn" type="primary">搜索</Button>
96
<slot name="new_btn" ><Button type="primary" @click="editModal('', 'post', '新建任务')" class="search-btn" >新建</Button></slot>
107
</div>
@@ -137,13 +134,12 @@ export default {
137134
formList: [],
138135
editModalData: '',
139136
//
140-
searchKey: '',
141137
searchValue: ''
142138
}
143139
},
144140
methods: {
145-
getCronJobsList (page, limit, key, value) {
146-
getCronJobslist(page, limit, key, value).then(res => {
141+
getCronJobsList (value) {
142+
getCronJobslist(this.pageNum, this.pageSize, value).then(res => {
147143
if (res.data.code === 0) {
148144
this.pageTotal = res.data.count
149145
this.tableData = res.data.data
@@ -192,12 +188,7 @@ export default {
192188
operationCron(value.data, this.editModalData).then(res => {
193189
if (res.data.code === 0) {
194190
this.$Message.success(`${res.data.msg}`)
195-
this.getCronJobsList(
196-
this.pageNum,
197-
this.pageSize,
198-
this.searchKey,
199-
this.searchValue
200-
)
191+
this.getCronJobsList(this.searchValue)
201192
this.modalMap.modalVisible = false
202193
} else {
203194
this.$Message.error(`${res.data.msg}`)
@@ -208,12 +199,7 @@ export default {
208199
// 删除
209200
delData (params) {
210201
if (confirm(`确定要删除 ${params.row.job_id}`)) {
211-
operationCron(
212-
{
213-
job_id: params.row.job_id
214-
},
215-
'delete'
216-
).then(res => {
202+
operationCron( { job_id: params.row.job_id}, 'delete' ).then(res => {
217203
if (res.data.code === 0) {
218204
this.$Message.success(`${res.data.msg}`)
219205
this.tableData.splice(params.index, 1)
@@ -241,31 +227,22 @@ export default {
241227
changePage (value) {
242228
this.pageNum = value
243229
this.getCronJobsList(
244-
this.pageNum,
245-
this.pageSize,
246-
this.searchKey,
247230
this.searchValue
248231
)
249232
},
250233
// 每页条数
251234
handlePageSize (value) {
252235
this.pageSize = value
253-
this.getCronJobsList(1, this.pageSize, this.searchKey, this.searchValue)
254-
},
255-
handleClear (e) {
256-
if (e.target.value === '') this.tableData = this.value
236+
this.getCronJobsList( this.searchValue )
257237
},
258238
handleSearch () {
259239
this.getCronJobsList(
260-
this.pageNum,
261-
this.pageSize,
262-
this.searchKey,
263240
this.searchValue
264241
)
265242
}
266243
},
267244
mounted () {
268-
this.getCronJobsList(this.pageNum, this.pageSize)
245+
this.getCronJobsList()
269246
}
270247
}
271248
</script>
@@ -280,7 +257,7 @@ export default {
280257
}
281258
&-input {
282259
display: inline-block;
283-
width: 200px;
260+
width: 250px;
284261
margin-left: 2px;
285262
}
286263
&-btn {

0 commit comments

Comments
 (0)