Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
Z
zxn-adputin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lijin
zxn-adputin
Commits
582335c1
Commit
582335c1
authored
Sep 28, 2025
by
hzl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 运行执行成功的任务再执行
parent
8be65610
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
18 deletions
+29
-18
CampaignTaskManage.vue
src/views/campaignTask/CampaignTaskManage.vue
+29
-18
No files found.
src/views/campaignTask/CampaignTaskManage.vue
View file @
582335c1
...
@@ -48,8 +48,8 @@
...
@@ -48,8 +48,8 @@
class=
"batch-execute-btn"
class=
"batch-execute-btn"
@
click=
"batchExecuteTasks"
@
click=
"batchExecuteTasks"
:loading=
"batchExecuteLoading"
:loading=
"batchExecuteLoading"
:disabled=
"
!hasExecutableTasks
"
>
:disabled=
"
selectedTasks.length === 0
"
>
一键执行
执行选中任务 (
{{
selectedTasks
.
length
}}
)
</el-button>
</el-button>
<div
class=
"header-right"
>
<div
class=
"header-right"
>
<el-button
icon=
"el-icon-refresh"
@
click=
"fetchData"
>
刷新
</el-button>
<el-button
icon=
"el-icon-refresh"
@
click=
"fetchData"
>
刷新
</el-button>
...
@@ -61,7 +61,13 @@
...
@@ -61,7 +61,13 @@
:data=
"tableData"
:data=
"tableData"
border
border
style=
"width: 100%"
style=
"width: 100%"
v-loading=
"loading"
>
v-loading=
"loading"
@
selection-change=
"handleSelectionChange"
>
<el-table-column
type=
"selection"
width=
"55"
:selectable=
"isTaskSelectable"
>
</el-table-column>
<el-table-column
prop=
"id"
label=
"ID"
width=
"80"
></el-table-column>
<el-table-column
prop=
"id"
label=
"ID"
width=
"80"
></el-table-column>
<el-table-column
prop=
"campaignTemplateId"
label=
"计划模板"
width=
"250"
>
<el-table-column
prop=
"campaignTemplateId"
label=
"计划模板"
width=
"250"
>
<template
slot-scope=
"scope"
>
<template
slot-scope=
"scope"
>
...
@@ -132,7 +138,7 @@
...
@@ -132,7 +138,7 @@
title=
"详情"
title=
"详情"
@
click=
"handleDetail(scope.row)"
></el-button>
@
click=
"handleDetail(scope.row)"
></el-button>
<el-button
<el-button
v-if=
"scope.row.status === 1 || scope.row.status === 4"
v-if=
"scope.row.status === 1 || scope.row.status ===
3 || scope.row.status ===
4"
size=
"mini"
size=
"mini"
type=
"success"
type=
"success"
icon=
"el-icon-video-play"
icon=
"el-icon-video-play"
...
@@ -1216,17 +1222,11 @@ export default {
...
@@ -1216,17 +1222,11 @@ export default {
newCampaignLocationGroups
:
[],
newCampaignLocationGroups
:
[],
// 新建计划修改状态跟踪
// 新建计划修改状态跟踪
newCampaignModifiedStatus
:
[],
newCampaignModifiedStatus
:
[],
// 选中的任务列表
selectedTasks
:
[],
}
}
},
},
computed
:
{
computed
:
{
// 计算是否有可执行的任务(只包括状态为1未执行的任务)
hasExecutableTasks
()
{
return
this
.
tableData
.
some
(
row
=>
row
.
status
===
1
);
},
// 获取当前页可执行的任务列表(只包括状态为1未执行的任务)
executableTasks
()
{
return
this
.
tableData
.
filter
(
row
=>
row
.
status
===
1
);
},
// 计算是否有独立配置(已有计划或新建计划)
// 计算是否有独立配置(已有计划或新建计划)
hasMultiCampaignConfig
()
{
hasMultiCampaignConfig
()
{
if
(
this
.
form
.
platform
!==
2
)
return
false
;
if
(
this
.
form
.
platform
!==
2
)
return
false
;
...
@@ -1266,6 +1266,8 @@ export default {
...
@@ -1266,6 +1266,8 @@ export default {
if
(
response
.
status
===
200
)
{
if
(
response
.
status
===
200
)
{
this
.
tableData
=
response
.
result
.
data
.
value
this
.
tableData
=
response
.
result
.
data
.
value
this
.
total
=
response
.
result
.
data
.
count
this
.
total
=
response
.
result
.
data
.
count
// 清空选择
this
.
selectedTasks
=
[]
}
else
{
}
else
{
this
.
$message
.
error
(
response
.
msg
||
'获取数据失败'
)
this
.
$message
.
error
(
response
.
msg
||
'获取数据失败'
)
}
}
...
@@ -1521,19 +1523,28 @@ export default {
...
@@ -1521,19 +1523,28 @@ export default {
}
}
},
},
// 判断任务是否可选(未执行、执行成功、执行失败的任务都可以选择)
isTaskSelectable
(
row
)
{
return
row
.
status
===
1
||
row
.
status
===
3
||
row
.
status
===
4
;
},
// 处理选择变化
handleSelectionChange
(
selection
)
{
this
.
selectedTasks
=
selection
;
},
// 批量执行任务
// 批量执行任务
async
batchExecuteTasks
()
{
async
batchExecuteTasks
()
{
if
(
!
this
.
hasExecutableTasks
)
{
if
(
this
.
selectedTasks
.
length
===
0
)
{
this
.
$message
.
warning
(
'
当前页没有可
执行的任务'
);
this
.
$message
.
warning
(
'
请先选择要
执行的任务'
);
return
;
return
;
}
}
const
executableTasks
=
this
.
executableTasks
;
const
taskCount
=
this
.
selectedTasks
.
length
;
const
taskCount
=
executableTasks
.
length
;
// 确认对话框
// 确认对话框
const
confirmResult
=
await
this
.
$confirm
(
const
confirmResult
=
await
this
.
$confirm
(
`确定要执行
当前页
的
${
taskCount
}
个任务吗?`
,
`确定要执行
选中
的
${
taskCount
}
个任务吗?`
,
'批量执行确认'
,
'批量执行确认'
,
{
{
confirmButtonText
:
'确定执行'
,
confirmButtonText
:
'确定执行'
,
...
@@ -1551,7 +1562,7 @@ export default {
...
@@ -1551,7 +1562,7 @@ export default {
try
{
try
{
// 调用批量执行接口
// 调用批量执行接口
const
response
=
await
axios
.
post
(
process
.
env
.
PUTIN_API
+
'/campaign-tasks/batch-start'
,
{
const
response
=
await
axios
.
post
(
process
.
env
.
PUTIN_API
+
'/campaign-tasks/batch-start'
,
{
taskIds
:
executable
Tasks
.
map
(
task
=>
task
.
id
)
taskIds
:
this
.
selected
Tasks
.
map
(
task
=>
task
.
id
)
});
});
if
(
response
.
status
===
200
)
{
if
(
response
.
status
===
200
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment