Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
scrm-micro-marketing
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 3d54ecbd
authored
Apr 26, 2022
by
匡雅琴
Committed by
chenwq
May 25, 2022
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
选择标签更换成多选
1 parent
d0f90e4b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
139 additions
and
107 deletions
src/views/customerTransform/addCustomer.vue
src/views/customerTransform/components/selectLabel.vue
src/views/customerTransform/addCustomer.vue
View file @
3d54ecb
...
...
@@ -406,7 +406,7 @@ export default {
if
(
item
.
attType
==
1
)
{
const
list
=
emoji
.
flat
(
Infinity
)
const
cutImg
=
item
.
attContent
.
replaceAll
(
'<img src="https://img01.glsx.com.cn/weapp/resource/saas/scrm/emoji/'
,
''
)
const
replaceImg
=
cutImg
.
replace
(
/
(\d){3}
.png">/g
,
function
(
str
)
{
const
replaceImg
=
cutImg
.
replace
(
/
(\d){3}
.png">/g
,
function
(
str
)
{
let
s
=
list
[
parseInt
(
str
.
split
(
'.'
)[
0
])
-
1
]
return
`[
${
s
}
]`
})
...
...
@@ -587,7 +587,9 @@ export default {
const
date
=
new
Date
(
v
).
getTime
()
if
(
date
<
Date
.
now
())
{
this
.
timeOptions
=
{
selectableRange
:
`
${
dayjs
().
add
(
1
,
'm'
).
format
(
'HH:mm'
)}
:00 - 23:59:59`
selectableRange
:
`
${
dayjs
()
.
add
(
1
,
'm'
)
.
format
(
'HH:mm'
)}
:00 - 23:59:59`
}
}
else
{
this
.
timeOptions
=
{
...
...
src/views/customerTransform/components/selectLabel.vue
View file @
3d54ecb
<
template
>
<div
class=
"tag-main"
>
<el-dialog
title=
"选择标签"
:visible
.
sync=
"dialogVisible"
width=
"
5
0%"
:before-close=
"handleClose"
>
<el-dialog
title=
"选择标签"
:visible
.
sync=
"dialogVisible"
width=
"
7
0%"
:before-close=
"handleClose"
>
<div
class=
"tag-panel"
>
<div
class=
"tag-panel-select"
>
<div
class=
"tag-title"
>
预选标签
</div>
<div
class=
"tag-select-box"
>
<div
class=
"tag-box-header"
>
<el-input
size=
"small"
v-model=
"labelGroupName"
placeholder=
"请输入搜索内容"
clearable
@
keydown
.
enter
.
native=
"handleSearch"
></el-input>
<el-input
size=
"small"
v-model=
"labelGroupName"
placeholder=
"请输入搜索内容"
></el-input>
<el-button
size=
"small"
type=
"primary"
@
click=
"handleSearch"
>
查询
</el-button>
<el-button
size=
"small"
@
click=
"handleReset"
>
重置
</el-button>
</div>
<div
class=
"checkbox-group-box"
:style=
"
{ height: heightBox + 'px' }">
<div
style=
"margin-bottom: 8px"
class=
"checkbox-box"
v-for=
"(item, index) in labelTreeRets"
:key=
"index"
@
click
.
self=
"item.checked = !item.checked
"
>
<div
class=
"checkbox-group-box"
:style=
"
{ height: heightBox + 'px' }"
v-loading="loading"
>
<div
style=
"margin-bottom: 8px"
v-for=
"(item, index) in labelTreeRets"
:key=
"index
"
>
<span
class=
"el-tree-node__expand-icon el-icon-caret-right"
:class=
"
{ expanded: item.checked }" @click.self="item.checked = !item.checked">
</span>
{{
item
.
labelGroup
.
name
}}
<el-tag
:size=
"size"
>
{{
item
.
labelType
}}
</el-tag>
<el-radio-group
class=
"tag-group"
v-model=
"item.tagChecked"
v-show=
"item.checked"
>
<el-checkbox
:indeterminate=
"item.isIndeterminate"
v-model=
"item.checkAll"
@
change=
"handleCheckAllChange(item.checkAll, index)"
>
{{
item
.
labelGroup
.
name
}}
(
{{
item
.
tagChecked
.
length
}}
/
{{
item
.
labelList
.
length
}}
项)
</el-checkbox>
<el-tag
:size=
"size"
class=
"tag-show"
>
{{
item
.
labelType
}}
</el-tag>
<div
style=
"margin: 15px 0"
></div>
<el-checkbox-group
class=
"tag-group"
v-model=
"item.tagChecked"
@
change=
"handleCheckedChange(item.tagChecked, index)"
v-show=
"item.checked"
>
<div
v-for=
"(itm, idx) in item.labelList"
:key=
"idx"
class=
"radio-tag"
>
<el-tooltip
effect=
"dark"
placement=
"top"
:disabled=
"itm.name.length
< 8
"
>
<el-radio
class=
"radio-text"
:label=
"itm"
>
{{
itm
.
name
}}
</el-radio>
<!--
<el-radio
:label=
"itm"
>
{{
itm
.
name
.
length
>
4
?
itm
.
name
.
slice
(
0
,
3
)
+
'...'
:
itm
.
name
}}
</el-radio>
-->
<el-checkbox
class=
"check-text"
:label=
"itm"
>
{{
itm
.
name
}}
</el-checkbox>
<div
slot=
"content"
>
{{
itm
.
name
}}
</div>
</el-tooltip>
</div>
</el-
radio
-group>
</el-
checkbox
-group>
</div>
</div>
</div>
...
...
@@ -33,10 +33,12 @@
<div
class=
"tag-select-box"
>
<div
class=
"tag-box-header"
>
标签名称(
{{
selectNum
}}
项)
</div>
<div
class=
"tag-selected-box"
:style=
"
{ height: heightBox + 'px' }">
<template
v-for=
"item in labelTreeRets"
>
<el-tag
:title=
"item.tagChecked.name"
v-if=
"item.tagChecked"
type=
"info"
class=
"tag-selected-item"
:key=
"item.tagChecked"
closable
:disable-transitions=
"false"
@
close=
"remove(item, idx)"
>
{{
item
.
tagChecked
.
name
}}
</el-tag>
<template
v-for=
"item in labelTreeRetSelect"
>
<template
v-for=
"(tag, idx) in item.tagChecked"
>
<el-tag
:title=
"tag.name"
type=
"info"
class=
"tag-selected-item"
:key=
"idx"
v-if=
"tag"
closable
:disable-transitions=
"false"
@
close=
"remove(item, idx)"
>
{{
tag
.
name
}}
</el-tag>
</
template
>
</template>
</div>
</div>
...
...
@@ -58,47 +60,22 @@ export default {
name
:
'activityModel'
,
data
()
{
return
{
loading
:
false
,
heightBox
:
200
,
dialogVisible
:
false
,
labelGroupName
:
''
,
selectNum
:
0
,
searchStatus
:
false
,
labelTreeRets
:
[
// {
// labelGroup: { id: '109', name: '湖口123' },
// labelList: [
// { id: '372', name: '12345678' },
// { id: '371', name: '7654321' },
// { id: '370', name: '1234567' }
// ],
// checked: false,
// tagChecked: [],
// isIndeterminate: false,
// checkAll: false
// },
// {
// labelGroup: { id: '65', name: '自店标签111' },
// labelList: [
// { id: '179', name: '标签44' },
// { id: '178', name: '标签33' },
// { id: '176', name: '标签1112' }
// ],
// checked: false,
// tagChecked: [],
// isIndeterminate: false,
// checkAll: false
// }
]
labelTreeRetSelect
:
[],
labelTreeRets
:
[]
}
},
watch
:
{
labelTreeRet
s
:
{
labelTreeRet
Select
:
{
handler
()
{
this
.
selectNum
=
0
this
.
labelTreeRets
.
forEach
(
item
=>
{
if
(
item
.
tagChecked
)
{
this
.
selectNum
++
}
this
.
labelTreeRetSelect
.
forEach
(
item
=>
{
this
.
selectNum
+=
item
.
tagChecked
.
length
})
},
deep
:
true
...
...
@@ -119,18 +96,16 @@ export default {
this
.
querylabeltree
()
},
querylabeltree
(
selectItem
)
{
console
.
log
(
selectItem
,
'-----'
)
this
.
loading
=
true
this
.
$apis
.
customerTransform
.
querylabeltree
({
labelTreeReq
:
{
pageNum
:
1
,
pageSize
:
1000
,
shopId
:
this
.
$globalState
.
session
.
merchantId
,
// shopId: '44210934',
labelGroupName
:
this
.
labelGroupName
,
// labelTypesStr: '自店标签,企业标签',
edition
:
this
.
$globalState
.
session
.
merchantModel
// edition: 4
}
})
.
then
(
res
=>
{
...
...
@@ -142,7 +117,7 @@ export default {
labelGroup
:
item
.
labelGroup
,
labelList
:
item
.
labelList
,
checked
:
false
,
tagChecked
:
null
,
tagChecked
:
[]
,
isIndeterminate
:
false
,
checkAll
:
false
}
...
...
@@ -151,55 +126,94 @@ export default {
selectItem
.
forEach
(
item
=>
{
this
.
labelTreeRets
.
forEach
(
tag
=>
{
if
(
item
.
labelGroup
.
id
==
tag
.
labelGroup
.
id
)
{
let
labelId
=
item
.
labelList
[
0
].
id
let
index
=
tag
.
labelList
.
findIndex
(
iem
=>
iem
.
id
==
labelId
)
console
.
log
(
index
)
// tag.tagChecked = item.tagChecked
tag
.
tagChecked
=
tag
.
labelList
[
index
]
let
labelList
=
[]
item
.
labelList
.
forEach
(
x
=>
{
labelList
.
push
(
x
.
id
)
})
this
.
$nextTick
(()
=>
{
tag
.
tagChecked
=
tag
.
labelList
.
filter
(
i
=>
labelList
.
includes
(
i
.
id
))
})
}
})
})
console
.
log
(
this
.
labelTreeRets
)
this
.
labelTreeRets
.
forEach
((
item
,
index
)
=>
{
this
.
$nextTick
(()
=>
{
this
.
handleCheckedChange
(
item
.
tagChecked
,
index
)
})
})
this
.
labelTreeRetSelect
=
utils
.
deepClone
(
this
.
labelTreeRets
)
}
else
{
const
labelTreeRets
=
utils
.
deepClone
(
this
.
labelTreeRets
)
console
.
log
(
labelTreeRets
)
this
.
labelTreeRets
=
res
.
labelTreeRets
.
map
(
item
=>
{
return
{
labelType
:
item
.
labelType
==
'企业标签'
?
(
this
.
$globalState
.
session
.
merchantModel
==
1
?
'集团标签'
:
'企业标签'
)
:
item
.
labelType
,
labelGroup
:
item
.
labelGroup
,
labelList
:
item
.
labelList
,
checked
:
false
,
tagChecked
:
null
,
tagChecked
:
[]
,
isIndeterminate
:
false
,
checkAll
:
false
}
})
console
.
log
(
labelTreeRets
)
labelTreeRets
.
forEach
(
item
=>
{
this
.
labelTreeRets
.
forEach
(
tag
=>
{
if
(
item
.
labelGroup
.
id
==
tag
.
labelGroup
.
id
)
{
let
labelId
=
item
.
tagChecked
?
item
.
tagChecked
.
id
:
''
let
index
=
tag
.
labelList
.
findIndex
(
iem
=>
iem
.
id
==
labelId
)
tag
.
tagChecked
=
tag
.
labelList
[
index
]
this
.
labelTreeRets
.
forEach
((
item
,
index
)
=>
{
this
.
labelTreeRetSelect
.
forEach
(
itm
=>
{
if
(
itm
.
labelGroup
.
id
==
item
.
labelGroup
.
id
&&
itm
.
tagChecked
.
length
>
0
)
{
let
tagChecked
=
[]
itm
.
tagChecked
.
forEach
(
x
=>
{
tagChecked
.
push
(
x
.
id
)
})
this
.
$nextTick
(()
=>
{
item
.
tagChecked
=
item
.
labelList
.
filter
(
i
=>
tagChecked
.
includes
(
i
.
id
))
})
this
.
$nextTick
(()
=>
{
this
.
handleCheckedChange
(
itm
.
tagChecked
,
index
,
1
)
})
}
})
})
if
(
this
.
labelTreeRetSelect
.
length
==
0
)
{
this
.
labelTreeRetSelect
=
utils
.
deepClone
(
this
.
labelTreeRets
)
}
}
this
.
$nextTick
(()
=>
{
this
.
loading
=
false
})
})
},
remove
(
item
,
idx
)
{
item
.
tagChecked
=
null
remove
(
items
,
idx
)
{
items
.
tagChecked
.
splice
(
idx
,
1
)
this
.
labelTreeRets
.
forEach
(
item
=>
{
this
.
labelTreeRetSelect
.
forEach
(
itm
=>
{
if
(
item
.
labelGroup
.
id
==
itm
.
labelGroup
.
id
)
{
let
tagChecked
=
[]
itm
.
tagChecked
.
forEach
(
x
=>
{
tagChecked
.
push
(
x
.
id
)
})
this
.
$nextTick
(()
=>
{
item
.
tagChecked
=
item
.
labelList
.
filter
(
i
=>
tagChecked
.
includes
(
i
.
id
))
})
}
if
(
item
.
tagChecked
.
length
==
0
)
{
this
.
$nextTick
(()
=>
{
item
.
checkAll
=
false
})
}
})
})
this
.
labelTreeRets
.
forEach
((
item
,
index
)
=>
{
this
.
$nextTick
(()
=>
{
this
.
handleCheckedChange
(
item
.
tagChecked
,
index
)
})
})
},
//选中
handleSelect
()
{
this
.
dialogVisible
=
false
let
labelTreeRets
=
this
.
labelTreeRet
s
let
labelTreeRets
=
this
.
labelTreeRet
Select
.
map
(
item
=>
{
if
(
item
.
tagChecked
)
{
if
(
item
.
tagChecked
.
length
)
{
return
{
labelGroup
:
item
.
labelGroup
,
labelType
:
item
.
labelType
,
labelList
:
[
item
.
tagChecked
]
labelList
:
item
.
tagChecked
}
}
})
...
...
@@ -207,6 +221,45 @@ export default {
console
.
log
(
labelTreeRets
)
this
.
$emit
(
'tagSelected'
,
labelTreeRets
)
},
//全选
handleCheckAllChange
(
val
,
index
)
{
console
.
log
(
val
,
index
)
console
.
log
(
this
.
labelTreeRetSelect
,
'==12'
)
if
(
val
)
{
this
.
labelTreeRets
[
index
].
tagChecked
=
[]
this
.
labelTreeRets
[
index
].
labelList
.
forEach
(
item
=>
{
this
.
labelTreeRets
[
index
].
tagChecked
.
push
(
item
)
})
}
else
{
this
.
labelTreeRets
[
index
].
tagChecked
=
[]
}
this
.
labelTreeRets
[
index
].
isIndeterminate
=
false
this
.
labelTreeRets
.
forEach
(
item
=>
{
this
.
labelTreeRetSelect
.
forEach
(
itm
=>
{
if
(
item
.
labelGroup
.
id
==
itm
.
labelGroup
.
id
)
{
itm
.
tagChecked
=
utils
.
deepClone
(
item
.
tagChecked
)
}
})
})
console
.
log
(
this
.
labelTreeRets
,
'==1532'
)
},
//选中
handleCheckedChange
(
value
,
index
,
status
)
{
console
.
log
(
value
,
index
,
status
)
let
checkedCount
=
value
.
length
this
.
labelTreeRets
[
index
].
checkAll
=
checkedCount
===
this
.
labelTreeRets
[
index
].
labelList
.
length
this
.
labelTreeRets
[
index
].
isIndeterminate
=
checkedCount
>
0
&&
checkedCount
<
this
.
labelTreeRets
[
index
].
labelList
.
length
if
(
!
status
)
{
this
.
labelTreeRets
.
forEach
(
item
=>
{
this
.
labelTreeRetSelect
.
forEach
(
itm
=>
{
if
(
item
.
labelGroup
.
id
==
itm
.
labelGroup
.
id
)
{
itm
.
tagChecked
=
utils
.
deepClone
(
item
.
tagChecked
)
}
})
})
}
},
// 重置
handleReset
()
{
this
.
labelGroupName
=
''
this
.
querylabeltree
()
...
...
@@ -220,9 +273,6 @@ export default {
</
script
>
<
style
lang=
"scss"
scoped
>
//
::v-deep
.el-tag
{
//
color
:
red
!important
;
//
}
.dialog-jump
{
color
:
#5850ff
;
float
:
left
;
...
...
@@ -299,50 +349,30 @@ export default {
font-size
:
16px
;
}
.tag-group
{
margin-left
:
26
px
;
margin-left
:
40
px
;
display
:
flex
;
flex-wrap
:
wrap
;
.radio-tag
{
display
:
inline-block
;
width
:
50%
;
.el-radio
{
margin
:
8px
0
;
display
:
inline-flex
;
.el-checkbox
{
width
:
40%
;
margin-bottom
:
6px
;
display
:
flex
;
align-items
:
center
;
/deep/.el-radio__inner
{
box-shadow
:
none
!important
;
}
/
deep
/
.el-radio__label
{
display
:
inline-block
;
max-width
:
120px
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
overflow
:
hidden
;
word-wrap
:
break-word
;
}
}
}
}
}
}
.tag-show
{
color
:
#aaa5fa
!important
;
font-size
:
12px
;
border
:
none
;
background
:
rgba
(
88
,
80
,
255
,
0.1
);
}
.checkbox-group-box
{
overflow
:
auto
;
.checkbox-box
{
cursor
:
pointer
;
font-size
:
14px
;
font-family
:
PingFangSC-Regular
,
PingFang
SC
;
font-weight
:
400
;
color
:
#333333
;
line-height
:
20px
;
/deep/
{
.el-tag
{
color
:
#aaa5fa
!important
;
font-size
:
12px
;
border
:
none
;
background
:
rgba
(
$
color
:
#5850ff
,
$
alpha
:
0.1
);
}
}
}
}
.tag-selected-box
{
min-height
:
200px
;
...
...
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