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
dd18a2ca
Commit
dd18a2ca
authored
Sep 23, 2025
by
hzl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 处理资源组多选逻辑
parent
ec541dd1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
47 deletions
+81
-47
ResourceGroupSelector.vue
src/components/GroupSelectors/ResourceGroupSelector.vue
+22
-15
CampaignTaskManage.vue
src/views/campaignTask/CampaignTaskManage.vue
+18
-11
CampaignTemplateManage.vue
src/views/campaignTemplate/CampaignTemplateManage.vue
+41
-21
No files found.
src/components/GroupSelectors/ResourceGroupSelector.vue
View file @
dd18a2ca
...
...
@@ -3,6 +3,7 @@
<el-select
v-model=
"selectedGroup"
filterable
multiple
placeholder=
"请选择资源组"
@
change=
"handleChange"
>
<el-option
...
...
@@ -23,7 +24,7 @@ export default {
props
:
{
value
:
{
type
:
[
Number
,
String
],
type
:
[
Number
,
String
,
Array
],
default
:
null
}
},
...
...
@@ -31,7 +32,7 @@ export default {
data
()
{
return
{
resourceGroups
:
[],
selectedGroup
:
null
selectedGroup
:
[]
}
},
...
...
@@ -39,7 +40,13 @@ export default {
value
:
{
immediate
:
true
,
handler
(
newVal
)
{
if
(
Array
.
isArray
(
newVal
))
{
this
.
selectedGroup
=
newVal
}
else
if
(
newVal
!==
null
&&
newVal
!==
undefined
)
{
this
.
selectedGroup
=
[
newVal
]
}
else
{
this
.
selectedGroup
=
[]
}
}
}
},
...
...
src/views/campaignTask/CampaignTaskManage.vue
View file @
dd18a2ca
...
...
@@ -191,9 +191,9 @@
@
change=
"handleAdvertiserChange"
>
<el-option
v-for=
"item in advertiserOptions"
:key=
"item"
:label=
"item"
:value=
"item"
>
:key=
"item
.advertiserId
"
:label=
"item
.advertiserName
"
:value=
"item
.advertiserId
"
>
</el-option>
</el-select>
</el-form-item>
...
...
@@ -387,8 +387,8 @@
<description-group-selector
v-model=
"form.description_groups"
/>
</el-form-item>
<el-form-item
label=
"资源组"
prop=
"resource_group
_id
"
>
<resource-group-selector
v-model=
"form.resource_group
_id
"
/>
<el-form-item
label=
"资源组"
prop=
"resource_group
s
"
>
<resource-group-selector
v-model=
"form.resource_group
s
"
/>
</el-form-item>
</div>
...
...
@@ -732,7 +732,7 @@ export default {
material_groups
:
[],
title_groups
:
[],
description_groups
:
[],
resource_group
_id
:
null
,
resource_group
s
:
[]
,
// 修改字段名为tiktok_json
tiktok_json
:
{
optimizationGoal
:
'VALUE'
,
...
...
@@ -1037,7 +1037,7 @@ export default {
material_groups
:
[],
title_groups
:
[],
description_groups
:
[],
resource_group
_id
:
null
,
resource_group
s
:
[]
,
// 修改字段名为tiktok_json
tiktok_json
:
{
optimizationGoal
:
'VALUE'
,
...
...
@@ -1086,7 +1086,7 @@ export default {
material_groups
:
[],
title_groups
:
[],
description_groups
:
[],
resource_group
_id
:
null
,
resource_group
s
:
[]
,
// 修改字段名为tiktok_json
tiktok_json
:
{
optimizationGoal
:
'VALUE'
,
...
...
@@ -1194,7 +1194,7 @@ export default {
daily_budget
:
this
.
form
.
daily_budget
,
bidding_type
:
this
.
form
.
bidding_type
,
target_roas
:
this
.
form
.
target_roas
,
resource_group
_id
:
this
.
form
.
resource_group_id
,
resource_group
s
:
this
.
form
.
resource_groups
,
}
// 根据模板类型传递不同的字段
...
...
@@ -1363,10 +1363,10 @@ export default {
this
.
form
.
material_groups
=
Array
.
isArray
(
template
.
material_groups
)
?
[...
template
.
material_groups
]
:
[];
this
.
form
.
title_groups
=
Array
.
isArray
(
template
.
title_groups
)
?
[...
template
.
title_groups
]
:
[];
this
.
form
.
description_groups
=
Array
.
isArray
(
template
.
description_groups
)
?
[...
template
.
description_groups
]
:
[];
this
.
form
.
resource_group
_id
=
template
.
resource_group_id
||
null
;
this
.
form
.
resource_group
s
=
Array
.
isArray
(
template
.
resource_groups
)
?
[...
template
.
resource_groups
]
:
(
template
.
resource_group_id
?
[
template
.
resource_group_id
]
:
[])
;
console
.
log
(
'模板数据中的resource_group_id:'
,
template
.
resource_group_id
);
console
.
log
(
'设置后的form.resource_group
_id:'
,
this
.
form
.
resource_group_id
);
console
.
log
(
'设置后的form.resource_group
s:'
,
this
.
form
.
resource_groups
);
// 处理tiktok_json字段(所有平台都需要处理)
try
{
...
...
@@ -1455,6 +1455,13 @@ export default {
const
response
=
await
axios
.
get
(
process
.
env
.
PUTIN_API
+
'/campaign-tasks/getTiktokAdvertiserId'
);
if
(
response
.
data
&&
response
.
data
.
status
===
200
)
{
this
.
advertiserOptions
=
response
.
data
.
result
.
data
||
[];
// 如果有账户列表,默认选择第一个
if
(
this
.
advertiserOptions
.
length
>
0
)
{
this
.
form
.
tiktok_json
.
advertiserId
=
this
.
advertiserOptions
[
0
].
advertiserId
;
// 异步调用第一个账户的计划列表,不等待完成
this
.
fetchCampaignList
(
this
.
advertiserOptions
[
0
].
advertiserId
);
}
}
else
{
this
.
$message
.
error
(
response
.
data
.
msg
||
'获取账户列表失败'
);
}
...
...
src/views/campaignTemplate/CampaignTemplateManage.vue
View file @
dd18a2ca
...
...
@@ -139,11 +139,23 @@
</el-tag>
</
template
>
</el-table-column>
<el-table-column
label=
"资源组"
width=
"
15
0"
>
<el-table-column
label=
"资源组"
width=
"
20
0"
>
<
template
slot-scope=
"scope"
>
<el-tag
v-if=
"scope.row.resource_group_id"
type=
"success"
size=
"small"
>
<div
v-if=
"scope.row.resource_groups && scope.row.resource_groups.length > 0"
>
<el-tag
v-for=
"group in scope.row.resource_groups"
:key=
"group"
type=
"success"
size=
"small"
style=
"margin: 2px"
>
{{
getResourceGroupName
(
group
)
}}
</el-tag>
</div>
<div
v-else-if=
"scope.row.resource_group_id"
>
<el-tag
type=
"success"
size=
"small"
>
{{
getResourceGroupName
(
scope
.
row
.
resource_group_id
)
}}
</el-tag>
</div>
<span
v-else
style=
"color: #999; font-size: 12px;"
>
未选择
</span>
</
template
>
</el-table-column>
...
...
@@ -237,12 +249,15 @@
v-model=
"tiktokAdvertiserId"
placeholder=
"请选择账户"
:loading=
"advertiserLoading"
@
change=
"handleAdvertiserChange"
>
@
change=
"handleAdvertiserChange"
filterable
>
<el-option
v-for=
"item in advertiserOptions"
:key=
"item"
:label=
"item"
:value=
"item"
>
:key=
"item.advertiserId"
:label=
"item.advertiserName"
:value=
"item.advertiserId"
>
<span
style=
"float: left"
>
{{
item
.
advertiserName
}}
</span>
<span
style=
"float: right; color: #8492a6; font-size: 13px"
>
{{
item
.
advertiserId
}}
</span>
</el-option>
</el-select>
</el-form-item>
...
...
@@ -379,8 +394,8 @@
<description-group-selector
v-model=
"form.description_groups"
/>
</el-form-item>
<el-form-item
label=
"资源组"
prop=
"resource_group
_id
"
>
<resource-group-selector
v-model=
"form.resource_group
_id
"
/>
<el-form-item
label=
"资源组"
prop=
"resource_group
s
"
>
<resource-group-selector
v-model=
"form.resource_group
s
"
/>
</el-form-item>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
...
...
@@ -430,7 +445,7 @@ export default {
dialogTitle
:
''
,
form
:
{
name
:
''
,
platform
:
1
,
platform
:
2
,
// 默认选择TikTok平台
campaign_type
:
1
,
appStore
:
3
,
daily_budget
:
0
,
...
...
@@ -441,7 +456,7 @@ export default {
material_groups
:
[],
title_groups
:
[],
description_groups
:
[],
resource_group
_id
:
null
,
resource_group
s
:
[]
,
// 初始化tiktok_json为对象而不是null
tiktok_json
:
{
optimizationGoal
:
'VALUE'
,
...
...
@@ -808,7 +823,7 @@ export default {
this
.
dialogTitle
=
'新增模板'
this
.
form
=
{
name
:
''
,
platform
:
1
,
platform
:
2
,
// 默认选择TikTok平台
campaign_type
:
1
,
appStore
:
3
,
daily_budget
:
0
,
...
...
@@ -819,7 +834,7 @@ export default {
material_groups
:
[],
title_groups
:
[],
description_groups
:
[],
resource_group
_id
:
null
,
resource_group
s
:
[]
,
// 初始化为对象而不是null
tiktok_json
:
{
optimizationGoal
:
'VALUE'
,
...
...
@@ -837,10 +852,8 @@ export default {
}
this
.
dialogVisible
=
true
// 如果默认选择的是TikTok平台,获取广告主列表
if
(
this
.
form
.
platform
===
2
)
{
// 默认选择TikTok平台,获取广告主列表
this
.
fetchAdvertiserList
();
}
},
// 平台变化时的处理
...
...
@@ -949,7 +962,7 @@ export default {
material_groups
:
Array
.
isArray
(
row
.
material_groups
)
?
[...
row
.
material_groups
]
:
[],
title_groups
:
Array
.
isArray
(
row
.
title_groups
)
?
[...
row
.
title_groups
]
:
[],
description_groups
:
Array
.
isArray
(
row
.
description_groups
)
?
[...
row
.
description_groups
]
:
[],
resource_group
_id
:
row
.
resource_group_id
||
null
resource_group
s
:
Array
.
isArray
(
row
.
resource_groups
)
?
[...
row
.
resource_groups
]
:
(
row
.
resource_group_id
?
[
row
.
resource_group_id
]
:
[])
};
// 使用Vue.set确保响应式更新
...
...
@@ -1000,7 +1013,7 @@ export default {
material_groups
:
Array
.
isArray
(
this
.
form
.
material_groups
)
?
[...
this
.
form
.
material_groups
]
:
[],
title_groups
:
Array
.
isArray
(
this
.
form
.
title_groups
)
?
[...
this
.
form
.
title_groups
]
:
[],
description_groups
:
Array
.
isArray
(
this
.
form
.
description_groups
)
?
[...
this
.
form
.
description_groups
]
:
[],
resource_group
_id
:
this
.
form
.
resource_group_id
resource_group
s
:
this
.
form
.
resource_groups
};
// 如果是TikTok平台,处理tiktok_json
...
...
@@ -1098,6 +1111,13 @@ export default {
const
response
=
await
axios
.
get
(
process
.
env
.
PUTIN_API
+
'/campaign-tasks/getTiktokAdvertiserId'
);
if
(
response
.
data
&&
response
.
data
.
status
===
200
)
{
this
.
advertiserOptions
=
response
.
data
.
result
.
data
||
[];
// 如果有账户列表,默认选择第一个
if
(
this
.
advertiserOptions
.
length
>
0
)
{
this
.
tiktokAdvertiserId
=
this
.
advertiserOptions
[
0
].
advertiserId
;
// 异步调用第一个账户的计划列表,不等待完成
this
.
fetchCampaignList
(
this
.
advertiserOptions
[
0
].
advertiserId
);
}
}
else
{
this
.
$message
.
error
(
response
.
data
.
msg
||
'获取账户列表失败'
);
}
...
...
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