Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
scrm-micro-custom
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 4a8d5c4d
authored
Apr 08, 2022
by
杨明
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fixed
1 parent
b2f6ad32
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
173 additions
and
5 deletions
src/mixins/tag.js
src/views/tagsManage/components/tagGroup.vue
src/views/tagsManage/index.vue
src/views/tagsManage/main.vue
src/mixins/tag.js
0 → 100644
View file @
4a8d5c4
import
{
getCustomersList
,
exportLabelList
}
from
'@/api/modules/tagsManage'
export
default
{
data
()
{
return
{
tagHeight
:
0
,
tagCheckItem
:
[],
allListParams
:
[],
crowdForm
:
{
crowdName
:
''
,
crowdDesc
:
''
}
}
},
mounted
()
{
this
.
getCustomersListData
()
},
watch
:
{
tagCheckItem
:
{
handler
()
{
if
(
this
.
tagCheckItem
.
length
==
0
)
{
setTimeout
(()
=>
{
this
.
tagHeight
=
0
},
300
)
}
this
.
allListParams
=
[]
const
tagNode
=
this
.
$common
.
utils
.
deepClone
(
this
.
tagCheckItem
)
tagNode
.
forEach
(
group_item
=>
{
group_item
.
children
.
forEach
(
label_item
=>
{
if
(
label_item
)
{
this
.
allListParams
.
push
({
groupId
:
group_item
.
id
,
groupName
:
group_item
.
name
,
groupType
:
group_item
.
labelType
,
labelId
:
label_item
.
id
,
labelName
:
label_item
.
name
})
}
})
})
this
.
getCustomersListData
()
},
deep
:
true
}
},
methods
:
{
//删除标签组
removeItem
(
index
)
{
this
.
tagCheckItem
.
splice
(
index
,
1
)
this
.
$refs
.
tagTree
.
getTreeNode
(
this
.
tagCheckItem
)
},
//获取选中的标签并排序
getCheckItem
(
item
)
{
const
tree_id
=
[]
const
labelTree
=
this
.
$refs
.
tagTree
.
labelTree
labelTree
.
forEach
(
tree_node
=>
{
tree_node
.
children
.
forEach
(
t_node
=>
{
tree_id
.
push
(
t_node
.
id
)
})
})
this
.
tagCheckItem
=
[]
let
group_all
=
item
.
getCheckedNodes
().
filter
(
item
=>
item
.
labelType
)
let
group_Label
=
item
.
getCheckedNodes
().
filter
(
item
=>
!
item
.
children
)
let
label_id
=
[]
group_Label
.
forEach
(
item
=>
{
label_id
.
push
(
item
.
id
)
})
let
group_half
=
item
.
getHalfCheckedNodes
().
filter
(
item
=>
item
.
labelType
)
let
group
=
[...
group_half
,
...
group_all
].
sort
((
a
,
b
)
=>
{
return
tree_id
.
indexOf
(
a
.
id
)
-
tree_id
.
indexOf
(
b
.
id
)
})
this
.
tagCheckItem
=
this
.
$common
.
utils
.
deepClone
(
group
)
group
.
forEach
((
tag
,
idx
)
=>
{
tag
.
children
.
forEach
((
item
,
index
)
=>
{
if
(
!
label_id
.
includes
(
item
.
id
))
{
this
.
tagCheckItem
[
idx
].
children
[
index
]
=
null
}
})
})
},
//导出
handleExport
()
{
const
params
=
{
...
JSON
.
parse
(
JSON
.
stringify
({
tagLists
:
this
.
allListParams
}))
}
exportLabelList
(
params
).
then
(
res
=>
{
this
.
$Utils
.
exportFn
(
res
)
})
},
//客户列表
getCustomersListData
()
{
const
tagLists
=
this
.
$common
.
utils
.
deepClone
(
this
.
allListParams
)
this
.
userLoading
=
true
const
params
=
{
...
JSON
.
parse
(
JSON
.
stringify
({
tagLists
})),
pageSize
:
this
.
$refs
.
viewCustomers
.
page
.
pageSize
,
pageNum
:
this
.
$refs
.
viewCustomers
.
page
.
pageNum
}
getCustomersList
(
params
).
then
(
res
=>
{
this
.
userLoading
=
false
this
.
tableData
=
res
.
data
this
.
tableTotal
=
res
.
count
})
},
//创建人群
groupConfirmDialog
()
{
console
.
log
(
this
.
allListParams
)
if
(
this
.
tagCheckItem
.
length
==
0
)
{
this
.
$message
.
error
(
'必须选择一个标签'
)
return
}
if
(
!
this
.
crowdForm
.
crowdName
)
{
this
.
$message
.
error
(
'请输入人群名称'
)
return
}
const
tagCombine
=
this
.
allListParams
.
reduce
((
prev
,
cur
)
=>
{
const
index
=
prev
.
findIndex
(
group
=>
cur
.
groupId
==
group
.
groupId
)
if
(
index
==
-
1
)
{
return
prev
.
concat
({
groupId
:
cur
.
groupId
,
labelIdList
:
[
cur
.
labelId
]
})
}
else
{
prev
[
index
].
labelIdList
.
push
(
cur
.
labelId
)
return
prev
}
},
[])
const
params
=
{
'req.merchantId'
:
this
.
merchantId
,
'req.crowdType'
:
2
,
//类型 1-推荐 2-自定义
'req.crowdName'
:
this
.
crowdForm
.
crowdName
,
'req.crowdDesc'
:
this
.
crowdForm
.
crowdDesc
,
'req.tagCombine'
:
JSON
.
stringify
(
tagCombine
)
}
this
.
$apis
.
crowdManage
.
addCrowd
(
params
)
.
then
(
res
=>
{
if
(
res
)
{
this
.
$message
({
type
:
'success'
,
message
:
'操作成功!'
})
this
.
groupVisible
=
false
}
else
{
this
.
$message
({
type
:
'error'
,
message
:
'操作失败'
})
}
})
.
catch
(
err
=>
{
this
.
$message
({
type
:
'error'
,
message
:
err
.
message
})
})
}
}
}
src/views/tagsManage/components/tagGroup.vue
View file @
4a8d5c4
<
template
>
<
template
>
<div
class=
"content-wrap"
>
<div
class=
"content-wrap"
v-loading=
"loading"
>
<div
class=
"tree-input"
>
<div
class=
"tree-input"
>
<el-input
placeholder=
"请输入标签组或标签关键字"
v-model=
"filterText"
size=
"small"
><i
slot=
"suffix"
class=
"el-input__icon el-icon-search"
></i></el-input>
<el-input
placeholder=
"请输入标签组或标签关键字"
v-model=
"filterText"
size=
"small"
><i
slot=
"suffix"
class=
"el-input__icon el-icon-search"
></i></el-input>
<span
@
click=
"resetTree"
>
重置
</span>
<span
@
click=
"resetTree"
>
重置
</span>
...
@@ -76,6 +76,7 @@ export default {
...
@@ -76,6 +76,7 @@ export default {
edition
:
this
.
$globalState
.
session
.
merchantModel
edition
:
this
.
$globalState
.
session
.
merchantModel
}
}
}
}
this
.
loading
=
true
getTableList
(
params
).
then
(
res
=>
{
getTableList
(
params
).
then
(
res
=>
{
const
labelTreeRets
=
res
.
labelTreeRets
.
map
(
item
=>
{
const
labelTreeRets
=
res
.
labelTreeRets
.
map
(
item
=>
{
return
{
return
{
...
@@ -92,13 +93,15 @@ export default {
...
@@ -92,13 +93,15 @@ export default {
this
.
labelTree
.
push
({
this
.
labelTree
.
push
({
id
:
item
.
id
+
'000'
,
id
:
item
.
id
+
'000'
,
name
:
item
.
labelType
,
name
:
item
.
labelType
,
children
:
[
item
]
children
:
[
item
],
sort
:
item
.
labelType
==
'系统标签'
?
1
:
item
.
labelType
==
'企业标签'
?
2
:
3
})
})
}
else
{
}
else
{
this
.
labelTree
[
index
].
children
.
push
(
item
)
this
.
labelTree
[
index
].
children
.
push
(
item
)
}
}
})
})
// console.log(this.labelTree)
this
.
labelTree
=
this
.
labelTree
.
sort
((
a
,
b
)
=>
a
.
sort
-
b
.
sort
)
this
.
loading
=
false
})
})
}
}
},
},
...
@@ -127,7 +130,7 @@ export default {
...
@@ -127,7 +130,7 @@ export default {
}
}
.tag-tree
{
.tag-tree
{
margin-top
:
20px
;
margin-top
:
20px
;
height
:
calc
(
100%
-
10
0px
);
height
:
calc
(
100%
-
8
0px
);
overflow-y
:
auto
;
overflow-y
:
auto
;
/deep/
{
/deep/
{
.el-tree-node
{
.el-tree-node
{
...
...
src/views/tagsManage/index.vue
View file @
4a8d5c4
This diff is collapsed.
Click to expand it.
src/views/tagsManage/main.vue
View file @
4a8d5c4
...
@@ -148,7 +148,7 @@
...
@@ -148,7 +148,7 @@
</template>
</template>
<
script
>
<
script
>
import
{
getTableList
,
getTableTagNum
,
newAddTag
,
updateTag
,
queryLabelListByGroupId
}
from
'@/api/modules/tagsManage'
import
{
getTableList
,
getTableTagNum
,
newAddTag
,
updateTag
,
exportLabelList
}
from
'@/api/modules/tagsManage'
import
{
getLoginCount
}
from
'@/api/modules/loginCount'
import
{
getLoginCount
}
from
'@/api/modules/loginCount'
import
url
from
'@/assets/clientDataOverview/nodata.png'
import
url
from
'@/assets/clientDataOverview/nodata.png'
// import { debounce } from '@/utils/index'
// import { debounce } from '@/utils/index'
...
@@ -585,6 +585,15 @@ export default {
...
@@ -585,6 +585,15 @@ export default {
this
.
tagVisible
=
!
this
.
tagVisible
this
.
tagVisible
=
!
this
.
tagVisible
},
},
//导出
handleExport
()
{
const
params
=
{
...
JSON
.
parse
(
JSON
.
stringify
(
this
.
exportParams
))
}
exportLabelList
(
params
).
then
(
res
=>
{
this
.
$Utils
.
exportFn
(
res
)
})
},
newAddTagFun
()
{
newAddTagFun
()
{
//满足条件进行提交
//满足条件进行提交
let
params
=
{}
let
params
=
{}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment