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
3a040af1
Commit
3a040af1
authored
Apr 20, 2025
by
lijin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modified
parent
a10d50a5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
165 additions
and
27 deletions
+165
-27
CampaignTaskManage.vue
src/views/campaignTask/CampaignTaskManage.vue
+165
-27
No files found.
src/views/campaignTask/CampaignTaskManage.vue
View file @
3a040af1
...
@@ -197,18 +197,22 @@
...
@@ -197,18 +197,22 @@
<app-group-selector
v-model=
"form.app_groups"
@
change=
"handleAppGroupsChange"
/>
<app-group-selector
v-model=
"form.app_groups"
@
change=
"handleAppGroupsChange"
/>
<!-- 展示应用组下的所有应用 -->
<!-- 展示应用组下的所有应用 -->
<div
v-if=
"form.app_groups && form.app_groups.length > 0"
class=
"group-detail-container"
>
<div
v-if=
"form.app_groups && form.app_groups.length > 0"
class=
"group-detail-container"
>
<div
class=
"group-detail-title"
>
应用组中的应用列表
</div>
<div
class=
"group-detail-title"
>
应用组中的应用列表
<el-button
type=
"primary"
size=
"mini"
@
click=
"showAddAppDialog"
icon=
"el-icon-plus"
style=
"float: right;"
>
添加应用
</el-button>
</div>
<el-table
:data=
"appListData"
size=
"mini"
border
style=
"width: 100%"
>
<el-table
:data=
"appListData"
size=
"mini"
border
style=
"width: 100%"
>
<el-table-column
prop=
"name"
label=
"应用名称"
></el-table-column>
<el-table-column
prop=
"name"
label=
"应用名称"
></el-table-column>
<el-table-column
prop=
"appId"
label=
"包名"
></el-table-column>
<el-table-column
prop=
"appId"
label=
"包名"
></el-table-column>
<el-table-column
prop=
"platform"
label=
"平台"
>
<el-table-column
label=
"计划数"
width=
"200"
align=
"center"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
{{
scope
.
row
.
platform
===
2
?
'iOS'
:
(
scope
.
row
.
platform
===
3
?
'Android'
:
'其他'
)
}}
<el-input-number
v-model=
"scope.row.campaignCount"
:min=
"1"
@
change=
"updateAppCampaignCount(scope.row, $event)"
size=
"mini"
></el-input-number>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
label=
"
计划数"
width=
"20
0"
align=
"center"
>
<el-table-column
label=
"
操作"
width=
"8
0"
align=
"center"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<el-
input-number
v-model=
"scope.row.campaignCount"
:min=
"1"
@
change=
"updateAppCampaignCount(scope.row, $event)"
size=
"mini"
></el-input-number
>
<el-
button
type=
"danger"
size=
"mini"
icon=
"el-icon-delete"
circle
@
click=
"removeApp(scope.row)"
></el-button
>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
</el-table>
</el-table>
...
@@ -491,6 +495,38 @@
...
@@ -491,6 +495,38 @@
</span>
</span>
</el-dialog>
</el-dialog>
<!-- 添加应用对话框 -->
<el-dialog
title=
"选择应用"
:visible
.
sync=
"addAppDialogVisible"
width=
"50%"
>
<div
class=
"app-selector-container"
>
<el-form
label-width=
"120px"
>
<el-form-item
label=
"关联应用"
>
<el-select
v-model=
"selectedAppId"
filterable
placeholder=
"请选择关联应用"
style=
"width: 100%"
>
<el-option
v-for=
"item in selectApps"
:key=
"item.id"
:label=
"item.label"
:value=
"item.id"
>
</el-option>
</el-select>
</el-form-item>
</el-form>
</div>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
@
click=
"addAppDialogVisible = false"
>
取消
</el-button>
<el-button
type=
"primary"
@
click=
"confirmAddApp"
:disabled=
"!selectedAppId"
>
确定
</el-button>
</div>
</el-dialog>
</div>
</div>
</template>
</template>
...
@@ -506,7 +542,9 @@ import { getCampaignTaskList, createCampaignTask, updateCampaignTask, deleteCamp
...
@@ -506,7 +542,9 @@ import { getCampaignTaskList, createCampaignTask, updateCampaignTask, deleteCamp
import
{
getCampaignTemplateById
}
from
'@/api/campaignTemplate'
import
{
getCampaignTemplateById
}
from
'@/api/campaignTemplate'
import
axios
from
'axios'
import
axios
from
'axios'
import
moment
from
'moment'
import
moment
from
'moment'
import
{
getSelectApps
}
from
"@/api/cloud"
;
// 设置moment语言为中文
// 设置moment语言为中文
moment
.
locale
(
'zh-cn'
)
moment
.
locale
(
'zh-cn'
)
...
@@ -608,6 +646,11 @@ export default {
...
@@ -608,6 +646,11 @@ export default {
descriptionGroupOptions
:
[],
descriptionGroupOptions
:
[],
appListData
:
[],
appListData
:
[],
selectedLocationGroups
:
[],
selectedLocationGroups
:
[],
selectedLocationGroupId
:
null
,
addAppDialogVisible
:
false
,
selectedAppId
:
''
,
selectApps
:
[],
appsLoading
:
false
,
}
}
},
},
created
()
{
created
()
{
...
@@ -1075,13 +1118,13 @@ export default {
...
@@ -1075,13 +1118,13 @@ export default {
this
.
form
.
material_groups
=
[...(
template
.
material_groups
||
[])]
this
.
form
.
material_groups
=
[...(
template
.
material_groups
||
[])]
this
.
form
.
title_groups
=
[...(
template
.
title_groups
||
[])]
this
.
form
.
title_groups
=
[...(
template
.
title_groups
||
[])]
this
.
form
.
description_groups
=
[...(
template
.
description_groups
||
[])]
this
.
form
.
description_groups
=
[...(
template
.
description_groups
||
[])]
// 主动触发应用列表和地域组列表的查询
// 主动触发应用列表和地域组列表的查询
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
if
(
this
.
form
.
app_groups
&&
this
.
form
.
app_groups
.
length
>
0
)
{
if
(
this
.
form
.
app_groups
&&
this
.
form
.
app_groups
.
length
>
0
)
{
this
.
handleAppGroupsChange
(
this
.
form
.
app_groups
);
this
.
handleAppGroupsChange
(
this
.
form
.
app_groups
);
}
}
if
(
this
.
form
.
location_groups
&&
this
.
form
.
location_groups
.
length
>
0
)
{
if
(
this
.
form
.
location_groups
&&
this
.
form
.
location_groups
.
length
>
0
)
{
this
.
handleLocationGroupsChange
(
this
.
form
.
location_groups
);
this
.
handleLocationGroupsChange
(
this
.
form
.
location_groups
);
}
}
...
@@ -1183,16 +1226,15 @@ export default {
...
@@ -1183,16 +1226,15 @@ export default {
const
response
=
await
axios
.
post
(
process
.
env
.
PUTIN_API
+
'/apps/by-app-groups'
,
{
const
response
=
await
axios
.
post
(
process
.
env
.
PUTIN_API
+
'/apps/by-app-groups'
,
{
appGroupIds
:
appGroupIds
appGroupIds
:
appGroupIds
});
});
if
(
response
.
data
&&
response
.
data
.
status
===
200
&&
response
.
data
.
result
&&
response
.
data
.
result
.
data
)
{
if
(
response
.
data
&&
response
.
data
.
status
===
200
&&
response
.
data
.
result
&&
response
.
data
.
result
.
data
)
{
// 处理返回的应用数据
// 处理返回的应用数据
const
apps
=
response
.
data
.
result
.
data
;
const
apps
=
response
.
data
.
result
.
data
;
// 转换为组件需要的格式
// 转换为组件需要的格式
this
.
appListData
=
apps
.
map
(
app
=>
({
this
.
appListData
=
apps
.
map
(
app
=>
({
name
:
app
.
appName
,
name
:
app
.
appName
,
appId
:
app
.
pkg
,
appId
:
app
.
pkg
,
platform
:
app
.
pkg
.
toLowerCase
().
includes
(
'.ios'
)
?
2
:
3
,
id
:
app
.
id
,
id
:
app
.
id
,
description
:
app
.
description
,
description
:
app
.
description
,
operateType
:
app
.
operateType
,
operateType
:
app
.
operateType
,
...
@@ -1220,7 +1262,7 @@ export default {
...
@@ -1220,7 +1262,7 @@ export default {
}
}
return
;
return
;
}
}
// 更新计划数
// 更新计划数
const
index
=
this
.
appListData
.
findIndex
(
item
=>
item
.
appId
===
app
.
appId
);
const
index
=
this
.
appListData
.
findIndex
(
item
=>
item
.
appId
===
app
.
appId
);
if
(
index
!==
-
1
)
{
if
(
index
!==
-
1
)
{
...
@@ -1241,17 +1283,17 @@ export default {
...
@@ -1241,17 +1283,17 @@ export default {
try
{
try
{
// 打印地域组选项,便于调试
// 打印地域组选项,便于调试
console
.
log
(
'地域组选项:'
,
this
.
locationGroupOptions
);
console
.
log
(
'地域组选项:'
,
this
.
locationGroupOptions
);
this
.
selectedLocationGroups
=
locationGroupIds
.
map
(
id
=>
{
this
.
selectedLocationGroups
=
locationGroupIds
.
map
(
id
=>
{
// 确保ID为数字类型进行比较
// 确保ID为数字类型进行比较
const
numId
=
Number
(
id
);
const
numId
=
Number
(
id
);
// 尝试在选项中找到对应的地域组
// 尝试在选项中找到对应的地域组
const
group
=
this
.
locationGroupOptions
.
find
(
item
=>
Number
(
item
.
id
)
===
numId
);
const
group
=
this
.
locationGroupOptions
.
find
(
item
=>
Number
(
item
.
id
)
===
numId
);
console
.
log
(
`查找地域组ID:
${
id
}
, 找到:
${
group
}
`
);
console
.
log
(
`查找地域组ID:
${
id
}
, 找到:
${
group
}
`
);
if
(
group
)
{
if
(
group
)
{
return
{
return
{
id
:
group
.
id
,
id
:
group
.
id
,
...
@@ -1260,15 +1302,15 @@ export default {
...
@@ -1260,15 +1302,15 @@ export default {
countryCodes
:
group
.
countryCodes
||
[]
countryCodes
:
group
.
countryCodes
||
[]
};
};
}
else
{
}
else
{
return
{
return
{
id
:
id
,
id
:
id
,
name
:
`地域组
${
id
}
`
,
name
:
`地域组
${
id
}
`
,
campaignCount
:
1
,
campaignCount
:
1
,
countryCodes
:
[]
countryCodes
:
[]
};
};
}
}
});
});
// 打印选中的地域组,便于调试
// 打印选中的地域组,便于调试
console
.
log
(
'选中的地域组:'
,
this
.
selectedLocationGroups
);
console
.
log
(
'选中的地域组:'
,
this
.
selectedLocationGroups
);
}
catch
(
error
)
{
}
catch
(
error
)
{
...
@@ -1289,7 +1331,7 @@ export default {
...
@@ -1289,7 +1331,7 @@ export default {
}
}
return
;
return
;
}
}
// 更新计划数
// 更新计划数
const
index
=
this
.
selectedLocationGroups
.
findIndex
(
item
=>
item
.
id
===
group
.
id
);
const
index
=
this
.
selectedLocationGroups
.
findIndex
(
item
=>
item
.
id
===
group
.
id
);
if
(
index
!==
-
1
)
{
if
(
index
!==
-
1
)
{
...
@@ -1311,12 +1353,21 @@ export default {
...
@@ -1311,12 +1353,21 @@ export default {
},
},
removeLocationGroup
(
group
)
{
removeLocationGroup
(
group
)
{
// 实现从选中列表中移除地域组
this
.
$confirm
(
`确定要移除地域组 "
${
group
.
name
}
" 吗?`
,
'提示'
,
{
const
index
=
this
.
form
.
location_groups
.
indexOf
(
group
.
id
);
confirmButtonText
:
'确定'
,
if
(
index
!==
-
1
)
{
cancelButtonText
:
'取消'
,
this
.
form
.
location_groups
.
splice
(
index
,
1
);
type
:
'warning'
this
.
handleLocationGroupsChange
(
this
.
form
.
location_groups
);
}).
then
(()
=>
{
}
const
index
=
this
.
form
.
location_groups
.
indexOf
(
Number
(
group
.
id
));
if
(
index
!==
-
1
)
{
this
.
form
.
location_groups
.
splice
(
index
,
1
);
// 更新地域组列表
this
.
handleLocationGroupsChange
(
this
.
form
.
location_groups
);
this
.
$message
.
success
(
'已移除地域组'
);
}
}).
catch
(()
=>
{
// 取消操作
});
},
},
getLocationGroupCountries
(
group
)
{
getLocationGroupCountries
(
group
)
{
...
@@ -1330,6 +1381,84 @@ export default {
...
@@ -1330,6 +1381,84 @@ export default {
this
.
$message
.
info
(
`已选择针对应用:
${
app
.
name
}
(
${
app
.
appId
}
)`
);
this
.
$message
.
info
(
`已选择针对应用:
${
app
.
name
}
(
${
app
.
appId
}
)`
);
// 这里可以实现实际的过滤逻辑
// 这里可以实现实际的过滤逻辑
},
},
showAddAppDialog
()
{
// 显示一个带有应用选择列表的弹窗,而不是简单的输入框
this
.
addAppDialogVisible
=
true
;
// 如果还没有加载应用列表,则加载
if
(
!
this
.
selectApps
||
this
.
selectApps
.
length
===
0
)
{
this
.
fetchAppsForSelector
();
}
},
async
fetchAppsForSelector
()
{
try
{
const
params
=
{
platformId
:
5
,
menuCode
:
"game.Overview,android"
,
};
const
response
=
await
getSelectApps
(
params
);
if
(
response
.
status
===
200
)
{
this
.
selectApps
=
response
.
result
.
data
||
[];
}
}
catch
(
error
)
{
console
.
error
(
"获取应用列表失败:"
,
error
);
this
.
$message
.
error
(
"获取应用列表失败"
);
}
},
removeApp
(
app
)
{
this
.
$confirm
(
`确定要移除应用 "
${
app
.
name
}
" 吗?`
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
}).
then
(()
=>
{
const
index
=
this
.
appListData
.
findIndex
(
item
=>
item
.
appId
===
app
.
appId
);
if
(
index
!==
-
1
)
{
this
.
appListData
.
splice
(
index
,
1
);
this
.
$message
.
success
(
'已移除应用'
);
}
}).
catch
(()
=>
{
// 取消操作
});
},
// 确认添加选中的应用
confirmAddApp
()
{
if
(
!
this
.
selectedAppId
)
{
this
.
$message
.
warning
(
'请先选择一个应用'
);
return
;
}
// 查找选中的应用信息
const
appInfo
=
this
.
selectApps
.
find
(
app
=>
app
.
id
===
this
.
selectedAppId
);
if
(
!
appInfo
)
{
this
.
$message
.
error
(
'无法获取应用信息'
);
return
;
}
// 检查是否已经存在
const
exists
=
this
.
appListData
.
some
(
item
=>
item
.
appId
===
appInfo
.
pkg
||
item
.
id
===
appInfo
.
id
);
if
(
exists
)
{
this
.
$message
.
warning
(
'该应用已经在列表中'
);
return
;
}
// 添加到应用列表
this
.
appListData
.
push
({
name
:
appInfo
.
label
||
appInfo
.
appName
,
// 显示名称
appId
:
appInfo
.
value
,
// 包名
id
:
appInfo
.
id
,
// 应用ID
description
:
appInfo
.
description
||
''
,
// 描述(如果有)
operateType
:
appInfo
.
operateType
||
''
,
// 操作类型(如果有)
campaignCount
:
1
// 默认计划数为1
});
this
.
$message
.
success
(
'添加应用成功'
);
this
.
addAppDialogVisible
=
false
;
this
.
selectedAppId
=
''
;
},
}
}
}
}
</
script
>
</
script
>
...
@@ -1687,4 +1816,13 @@ export default {
...
@@ -1687,4 +1816,13 @@ export default {
font-weight
:
bold
;
font-weight
:
bold
;
margin-bottom
:
10px
;
margin-bottom
:
10px
;
}
}
/* 应用选择器样式 */
.app-selector-container
{
padding
:
10px
;
}
.app-selector-container
.el-select
{
width
:
100%
;
}
</
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