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
8e6fae5a
Commit
8e6fae5a
authored
Mar 22, 2025
by
lijin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化广告任务执行
parent
6bea7a14
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
101 additions
and
8 deletions
+101
-8
campaignTaskDetail.js
src/api/campaignTaskDetail.js
+16
-0
CampaignTaskManage.vue
src/views/campaignTask/CampaignTaskManage.vue
+85
-8
No files found.
src/api/campaignTaskDetail.js
0 → 100644
View file @
8e6fae5a
import
request
from
'@/utils/request'
export
function
getCampaignTaskDetailById
(
id
)
{
return
request
({
url
:
process
.
env
.
PUTIN_API
+
`/campaign-task-details/
${
id
}
`
,
method
:
'get'
})
}
export
function
getCampaignTaskDetails
(
params
)
{
return
request
({
url
:
process
.
env
.
PUTIN_API
+
'/campaign-task-details'
,
method
:
'get'
,
params
})
}
src/views/campaignTask/CampaignTaskManage.vue
View file @
8e6fae5a
...
@@ -90,7 +90,7 @@
...
@@ -90,7 +90,7 @@
@
click=
"handleEdit(scope.row)"
>
编辑
</el-button>
@
click=
"handleEdit(scope.row)"
>
编辑
</el-button>
<el-button
<el-button
size=
"mini"
size=
"mini"
type=
"
info
"
type=
"
success
"
@
click=
"handleDetail(scope.row)"
>
详情
</el-button>
@
click=
"handleDetail(scope.row)"
>
详情
</el-button>
<el-button
<el-button
v-if=
"scope.row.status === 1"
v-if=
"scope.row.status === 1"
...
@@ -103,11 +103,11 @@
...
@@ -103,11 +103,11 @@
type=
"success"
type=
"success"
disabled
disabled
>
开始
</el-button>
>
开始
</el-button>
<el-button
<
!--
<
el-button
v-if=
"scope.row.status === 4"
v-if=
"scope.row.status === 4"
size=
"mini"
size=
"mini"
type=
"warning"
type=
"warning"
@
click=
"handleRetry(scope.row)"
>
重试
</el-button>
@
click=
"handleRetry(scope.row)"
>
重试
</el-button>
-->
</
template
>
</
template
>
</el-table-column>
</el-table-column>
</el-table>
</el-table>
...
@@ -138,12 +138,51 @@
...
@@ -138,12 +138,51 @@
<el-button
type=
"primary"
@
click=
"submitForm"
>
确 定
</el-button>
<el-button
type=
"primary"
@
click=
"submitForm"
>
确 定
</el-button>
</div>
</div>
</el-dialog>
</el-dialog>
<!-- 计划任务详情对话框 -->
<el-dialog
title=
"计划任务详情"
:visible
.
sync=
"detailVisible"
width=
"80%"
>
<el-table
:data=
"currentTaskDetail"
border
>
<el-table-column
prop=
"id"
label=
"ID"
></el-table-column>
<el-table-column
prop=
"advertiserId"
label=
"广告账户ID"
></el-table-column>
<el-table-column
prop=
"campaignId"
label=
"广告计划ID"
></el-table-column>
<el-table-column
prop=
"adgroupId"
label=
"广告组ID"
></el-table-column>
<el-table-column
prop=
"startTime"
label=
"开始时间"
>
<
template
slot-scope=
"scope"
>
{{
scope
.
row
.
startTime
?
moment
(
scope
.
row
.
startTime
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
:
''
}}
</
template
>
</el-table-column>
<el-table-column
prop=
"finishTime"
label=
"结束时间"
>
<
template
slot-scope=
"scope"
>
{{
scope
.
row
.
finishTime
?
moment
(
scope
.
row
.
finishTime
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
:
''
}}
</
template
>
</el-table-column>
<el-table-column
label=
"执行时间"
width=
"150"
>
<
template
slot-scope=
"scope"
>
{{
calculateDuration
(
scope
.
row
)
}}
</
template
>
</el-table-column>
<el-table-column
prop=
"status"
label=
"状态"
>
<
template
slot-scope=
"scope"
>
<el-tag
:type=
"getStatusType(scope.row.status)"
>
{{
getStatusText
(
scope
.
row
.
status
)
}}
</el-tag>
</
template
>
</el-table-column>
</el-table>
</el-dialog>
</div>
</div>
</template>
</template>
<
script
>
<
script
>
import
CampaignTemplateSelector
from
'@/components/GroupSelectors/CampaignTemplateSelector'
import
CampaignTemplateSelector
from
'@/components/GroupSelectors/CampaignTemplateSelector'
import
{
getCampaignTaskList
,
createCampaignTask
,
updateCampaignTask
}
from
'@/api/campaignTask'
import
{
getCampaignTaskList
,
createCampaignTask
,
updateCampaignTask
}
from
'@/api/campaignTask'
import
{
getCampaignTaskDetailById
,
getCampaignTaskDetails
}
from
'@/api/campaignTaskDetail'
import
axios
from
'axios'
import
axios
from
'axios'
import
moment
from
'moment'
import
moment
from
'moment'
...
@@ -180,7 +219,10 @@ export default {
...
@@ -180,7 +219,10 @@ export default {
{
required
:
true
,
message
:
'请选择计划模板'
,
trigger
:
'change'
}
{
required
:
true
,
message
:
'请选择计划模板'
,
trigger
:
'change'
}
]
]
},
},
templateMap
:
new
Map
()
templateMap
:
new
Map
(),
detailVisible
:
false
,
errorReasonVisible
:
false
,
currentTaskDetail
:
null
}
}
},
},
created
()
{
created
()
{
...
@@ -302,16 +344,32 @@ export default {
...
@@ -302,16 +344,32 @@ export default {
},
},
handleDetail
(
row
)
{
handleDetail
(
row
)
{
// TODO: 实现详情查看功能
this
.
detailVisible
=
true
;
console
.
log
(
'查看详情:'
,
row
)
this
.
detailLoading
=
true
;
},
this
.
currentTaskDetail
=
null
;
getCampaignTaskDetails
({
taskId
:
row
.
id
}).
then
(
response
=>
{
if
(
response
.
status
===
200
)
{
this
.
currentTaskDetail
=
response
.
result
.
data
;
}
else
{
this
.
$message
.
error
(
response
.
msg
||
'获取任务详情失败'
);
}
}).
catch
(
error
=>
{
console
.
error
(
'获取任务详情失败:'
,
error
);
this
.
$message
.
error
(
'获取任务详情失败: '
+
error
.
message
);
}).
finally
(()
=>
{
this
.
detailLoading
=
false
;
});
},
async
handleStart
(
row
)
{
async
handleStart
(
row
)
{
try
{
try
{
const
response
=
await
axios
.
post
(
process
.
env
.
PUTIN_API
+
`/campaign-tasks/start?campaignTaskId=
${
row
.
id
}
`
)
const
response
=
await
axios
.
post
(
process
.
env
.
PUTIN_API
+
`/campaign-tasks/start?campaignTaskId=
${
row
.
id
}
`
)
if
(
response
.
status
==
200
&&
response
.
data
&&
response
.
data
.
result
&&
response
.
data
.
result
.
data
)
{
if
(
response
.
status
==
200
)
{
this
.
$message
.
success
(
'任务开始成功'
)
this
.
$message
.
success
(
'任务开始成功'
)
this
.
fetchData
()
}
else
{
this
.
$message
.
error
(
'任务开始失败'
)
}
}
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
'Failed to start task:'
,
error
)
console
.
error
(
'Failed to start task:'
,
error
)
...
@@ -348,6 +406,21 @@ export default {
...
@@ -348,6 +406,21 @@ export default {
}
}
}
}
})
})
},
showErrorReason
()
{
this
.
errorReasonVisible
=
true
;
},
formatJson
(
jsonString
)
{
try
{
// 如果是字符串,则解析为JSON对象
const
jsonObj
=
typeof
jsonString
===
'string'
?
JSON
.
parse
(
jsonString
)
:
jsonString
;
// 美化格式
return
JSON
.
stringify
(
jsonObj
,
null
,
2
);
}
catch
(
e
)
{
return
jsonString
;
}
}
}
}
}
}
}
...
@@ -459,4 +532,8 @@ export default {
...
@@ -459,4 +532,8 @@ export default {
.el-pagination__sizes
{
.el-pagination__sizes
{
margin-left
:
10px
;
margin-left
:
10px
;
}
}
.mt-3
{
margin-top
:
1rem
;
}
</
style
>
</
style
>
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