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 b2f6ad32
authored
Apr 08, 2022
by
杨明
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fixed
1 parent
c66f3130
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
1777 additions
and
309 deletions
src/utils/index.js
src/utils/util.js
src/views/clientManage/clientDetail.vue
src/views/crowdManage/crowdAdd.vue
src/views/tagsManage/components/tagGroup.vue
src/views/tagsManage/index.vue
src/views/tagsManage/main.vue
vue.config.js
src/utils/index.js
View file @
b2f6ad3
export
function
debounce
(
fn
,
delay
,
triggerNow
)
{
var
t
=
null
;
console
.
log
(
'ceshi'
)
var
debounced
=
function
(){
var
_self
=
this
,
args
=
arguments
;
if
(
t
){
clearTimeout
(
t
);
}
if
(
triggerNow
){
var
exec
=
!
t
;
t
=
setTimeout
(
function
(){
t
=
null
;
},
delay
);
var
t
=
null
console
.
log
(
'ceshi'
)
var
debounced
=
function
()
{
var
_self
=
this
,
args
=
arguments
if
(
t
)
{
clearTimeout
(
t
)
}
if
(
triggerNow
)
{
var
exec
=
!
t
if
(
exec
){
// 初次进来
fn
.
apply
(
_self
,
args
);
}
}
else
{
t
=
setTimeout
(
function
(){
fn
.
apply
(
_self
,
args
);
},
delay
);
t
=
setTimeout
(
function
()
{
t
=
null
},
delay
)
if
(
exec
)
{
// 初次进来
fn
.
apply
(
_self
,
args
)
}
}
else
{
t
=
setTimeout
(
function
()
{
fn
.
apply
(
_self
,
args
)
},
delay
)
}
}
debounced
.
remove
=
function
(){
clearTimeout
(
t
);
t
=
null
;
debounced
.
remove
=
function
()
{
clearTimeout
(
t
)
t
=
null
}
return
debounced
;
}
return
debounced
}
//格式化日期
export
const
formatDate
=
(
date
,
fmt
)
=>
{
if
(
!
date
)
{
date
=
new
Date
();
}
let
o
=
{
"M+"
:
date
.
getMonth
()
+
1
,
//月份
"d+"
:
date
.
getDate
(),
//日
"h+"
:
date
.
getHours
(),
//小时
"m+"
:
date
.
getMinutes
(),
//分
"s+"
:
date
.
getSeconds
(),
//秒
"q+"
:
Math
.
floor
((
date
.
getMonth
()
+
3
)
/
3
),
//季度
S
:
date
.
getMilliseconds
(),
//毫秒 1-3 位 只能一位占位符
"U+"
:
date
.
getMilliseconds
()
//毫秒 可以1-3位占位符
};
fmt
=
fmt
||
"yyyy-MM-dd hh:mm"
;
if
(
/
(
y+
)
/
.
test
(
fmt
))
fmt
=
fmt
.
replace
(
RegExp
.
$1
,
(
date
.
getFullYear
()
+
""
).
substr
(
4
-
RegExp
.
$1
.
length
)
);
for
(
let
k
in
o
)
if
(
new
RegExp
(
"("
+
k
+
")"
).
test
(
fmt
))
fmt
=
fmt
.
replace
(
RegExp
.
$1
,
RegExp
.
$1
.
length
==
1
?
o
[
k
]
:
(
"00"
+
o
[
k
]).
substr
((
""
+
o
[
k
]).
length
)
);
return
fmt
;
};
export
const
formatDate
=
(
date
,
fmt
)
=>
{
if
(
!
date
)
{
date
=
new
Date
()
}
let
o
=
{
'M+'
:
date
.
getMonth
()
+
1
,
//月份
'd+'
:
date
.
getDate
(),
//日
'h+'
:
date
.
getHours
(),
//小时
'm+'
:
date
.
getMinutes
(),
//分
's+'
:
date
.
getSeconds
(),
//秒
'q+'
:
Math
.
floor
((
date
.
getMonth
()
+
3
)
/
3
),
//季度
S
:
date
.
getMilliseconds
(),
//毫秒 1-3 位 只能一位占位符
'U+'
:
date
.
getMilliseconds
()
//毫秒 可以1-3位占位符
}
fmt
=
fmt
||
'yyyy-MM-dd hh:mm'
if
(
/
(
y+
)
/
.
test
(
fmt
))
fmt
=
fmt
.
replace
(
RegExp
.
$1
,
(
date
.
getFullYear
()
+
''
).
substr
(
4
-
RegExp
.
$1
.
length
))
for
(
let
k
in
o
)
if
(
new
RegExp
(
'('
+
k
+
')'
).
test
(
fmt
))
fmt
=
fmt
.
replace
(
RegExp
.
$1
,
RegExp
.
$1
.
length
==
1
?
o
[
k
]
:
(
'00'
+
o
[
k
]).
substr
((
''
+
o
[
k
]).
length
))
return
fmt
}
//正则表示式是干什么的? 字符串匹配利器(难,规则多)
export
function
formatDate2
(
date
,
fmt
)
{
//1.获取年份
if
(
/
(
y+
)
/
.
test
(
fmt
))
{
fmt
=
fmt
.
replace
(
RegExp
.
$1
,
(
date
.
getFullYear
()
+
''
).
substr
(
4
-
RegExp
.
$1
.
length
))
;
fmt
=
fmt
.
replace
(
RegExp
.
$1
,
(
date
.
getFullYear
()
+
''
).
substr
(
4
-
RegExp
.
$1
.
length
))
}
//2.获取
//M+ ->正则表达式一个规则
...
...
@@ -79,16 +69,16 @@ export function formatDate2(date, fmt) {
'h+'
:
date
.
getHours
(),
'm+'
:
date
.
getMinutes
(),
's+'
:
date
.
getSeconds
()
}
;
}
for
(
let
k
in
o
)
{
if
(
new
RegExp
(
`(
${
k
}
)`
).
test
(
fmt
))
{
let
str
=
o
[
k
]
+
''
;
fmt
=
fmt
.
replace
(
RegExp
.
$1
,
(
RegExp
.
$1
.
length
===
1
)
?
str
:
padLeftZero
(
str
));
let
str
=
o
[
k
]
+
''
fmt
=
fmt
.
replace
(
RegExp
.
$1
,
RegExp
.
$1
.
length
===
1
?
str
:
padLeftZero
(
str
))
}
}
return
fmt
;
}
;
return
fmt
}
//填补左边的零(一般返回字符串最后两位)
function
padLeftZero
(
str
)
{
return
(
'00'
+
str
).
substr
(
str
.
length
)
;
}
;
function
padLeftZero
(
str
)
{
return
(
'00'
+
str
).
substr
(
str
.
length
)
}
src/utils/util.js
View file @
b2f6ad3
import
{
Message
}
from
'element-ui'
let
util
=
{}
util
.
cloneText
=
function
(
message
)
{
let
input
=
document
.
createElement
(
'input'
)
input
.
value
=
message
document
.
body
.
appendChild
(
input
)
input
.
select
()
input
.
setSelectionRange
(
0
,
input
.
value
.
length
),
document
.
execCommand
(
'Copy'
)
document
.
body
.
removeChild
(
input
)
Message
.
success
(
'复制成功'
)
util
.
cloneText
=
function
(
message
)
{
let
input
=
document
.
createElement
(
'input'
)
input
.
value
=
message
document
.
body
.
appendChild
(
input
)
input
.
select
()
input
.
setSelectionRange
(
0
,
input
.
value
.
length
),
document
.
execCommand
(
'Copy'
)
document
.
body
.
removeChild
(
input
)
Message
.
success
(
'复制成功'
)
}
util
.
getBeforeDate
=
function
(
sign
=
'-'
)
{
let
day
=
new
Date
();
let
month
=
day
.
getMonth
()
+
1
;
let
date
=
day
.
getDate
();
if
(
month
<
10
)
month
=
'0'
+
month
;
if
(
date
<
10
)
date
=
'0'
+
date
;
var
s
=
day
.
getFullYear
()
+
sign
+
month
+
sign
+
date
;
return
s
;
util
.
getBeforeDate
=
function
(
sign
=
'-'
)
{
let
day
=
new
Date
()
let
month
=
day
.
getMonth
()
+
1
let
date
=
day
.
getDate
()
if
(
month
<
10
)
month
=
'0'
+
month
if
(
date
<
10
)
date
=
'0'
+
date
var
s
=
day
.
getFullYear
()
+
sign
+
month
+
sign
+
date
return
s
}
util
.
getBeforeMonth
=
function
(
days
)
{
let
month
=
new
Date
().
getMonth
()
+
1
;
let
year
=
new
Date
().
getFullYear
();
let
arr
=
new
Array
();
for
(
let
i
=
0
;
i
<
days
;
i
++
)
{
if
(
month
<=
0
)
{
year
=
year
-
1
;
month
=
month
+
12
;
}
if
(
month
<
10
)
month
=
'0'
+
month
;
arr
[
i
]
=
year
+
'年'
+
month
+
'月'
month
--
util
.
getBeforeMonth
=
function
(
days
)
{
let
month
=
new
Date
().
getMonth
()
+
1
let
year
=
new
Date
().
getFullYear
()
let
arr
=
new
Array
()
for
(
let
i
=
0
;
i
<
days
;
i
++
)
{
if
(
month
<=
0
)
{
year
=
year
-
1
month
=
month
+
12
}
return
arr
;
if
(
month
<
10
)
month
=
'0'
+
month
arr
[
i
]
=
year
+
'年'
+
month
+
'月'
month
--
}
return
arr
}
/**
* 格式化时间
* @param {Array} time
*/
util
.
formatTime
=
function
(
time
)
{
return
{
startTime
:
time
?
time
[
0
]
+
' '
+
'00:00:00'
:
''
,
endTime
:
time
?
time
[
1
]
+
' '
+
'23:59:59'
:
''
}
util
.
formatTime
=
function
(
time
)
{
return
{
startTime
:
time
?
time
[
0
]
+
' '
+
'00:00:00'
:
''
,
endTime
:
time
?
time
[
1
]
+
' '
+
'23:59:59'
:
''
}
}
util
.
tringToDate
=
function
(
dateStr
,
separator
)
{
if
(
!
separator
)
{
separator
=
"-"
;
}
var
dateArr
=
dateStr
.
split
(
separator
);
var
year
=
parseInt
(
dateArr
[
0
]);
var
month
;
//处理月份为04这样的情况
if
(
dateArr
[
1
].
indexOf
(
"0"
)
==
0
)
{
month
=
parseInt
(
dateArr
[
1
].
substring
(
1
));
}
else
{
month
=
parseInt
(
dateArr
[
1
]);
}
var
day
=
parseInt
(
dateArr
[
2
]);
var
date
=
new
Date
(
year
,
month
-
1
,
day
);
return
date
;
util
.
tringToDate
=
function
(
dateStr
,
separator
)
{
if
(
!
separator
)
{
separator
=
'-'
}
var
dateArr
=
dateStr
.
split
(
separator
)
var
year
=
parseInt
(
dateArr
[
0
])
var
month
//处理月份为04这样的情况
if
(
dateArr
[
1
].
indexOf
(
'0'
)
==
0
)
{
month
=
parseInt
(
dateArr
[
1
].
substring
(
1
))
}
else
{
month
=
parseInt
(
dateArr
[
1
])
}
var
day
=
parseInt
(
dateArr
[
2
])
var
date
=
new
Date
(
year
,
month
-
1
,
day
)
return
date
}
util
.
getDay
=
function
(
num
,
str
=
'-'
)
{
var
today
=
new
Date
();
var
nowTime
=
today
.
getTime
();
var
ms
=
24
*
3600
*
1000
*
num
;
today
.
setTime
(
parseInt
(
nowTime
+
ms
));
var
oYear
=
today
.
getFullYear
();
var
oMoth
=
(
today
.
getMonth
()
+
1
).
toString
();
if
(
oMoth
.
length
<=
1
)
oMoth
=
'0'
+
oMoth
;
var
oDay
=
today
.
getDate
().
toString
();
if
(
oDay
.
length
<=
1
)
oDay
=
'0'
+
oDay
;
return
oYear
+
str
+
oMoth
+
str
+
oDay
;
util
.
getDay
=
function
(
num
,
str
=
'-'
)
{
var
today
=
new
Date
()
var
nowTime
=
today
.
getTime
()
var
ms
=
24
*
3600
*
1000
*
num
today
.
setTime
(
parseInt
(
nowTime
+
ms
))
var
oYear
=
today
.
getFullYear
()
var
oMoth
=
(
today
.
getMonth
()
+
1
).
toString
()
if
(
oMoth
.
length
<=
1
)
oMoth
=
'0'
+
oMoth
var
oDay
=
today
.
getDate
().
toString
()
if
(
oDay
.
length
<=
1
)
oDay
=
'0'
+
oDay
return
oYear
+
str
+
oMoth
+
str
+
oDay
}
util
.
openUrl
=
function
(
url
)
{
const
link
=
document
.
createElement
(
'a'
)
link
.
href
=
url
link
.
target
=
'_blank'
link
.
rel
=
'opener'
link
.
click
()
util
.
openUrl
=
function
(
url
)
{
const
link
=
document
.
createElement
(
'a'
)
link
.
href
=
url
link
.
target
=
'_blank'
link
.
rel
=
'opener'
link
.
click
()
}
util
.
debounce
=
function
(
fn
,
timer
)
{
var
t
=
null
return
function
()
{
if
(
t
)
{
clearTimeout
(
t
)
}
t
=
setTimeout
(()
=>
{
fn
.
apply
(
this
,
arguments
)
},
timer
)
}
}
util
.
downloadIamge
=
function
(
imgsrc
,
name
=
new
Date
().
getTime
())
{
//下载图片地址和图片名
var
image
=
new
Image
();
// 解决跨域 Canvas 污染问题
image
.
setAttribute
(
"crossOrigin"
,
"anonymous"
);
image
.
onload
=
function
()
{
var
canvas
=
document
.
createElement
(
"canvas"
);
canvas
.
width
=
image
.
width
;
canvas
.
height
=
image
.
height
;
var
context
=
canvas
.
getContext
(
"2d"
);
context
.
drawImage
(
image
,
0
,
0
,
image
.
width
,
image
.
height
);
var
url
=
canvas
.
toDataURL
(
"image/png"
);
//得到图片的base64编码数据
util
.
downloadIamge
=
function
(
imgsrc
,
name
=
new
Date
().
getTime
())
{
//下载图片地址和图片名
var
image
=
new
Image
()
// 解决跨域 Canvas 污染问题
image
.
setAttribute
(
'crossOrigin'
,
'anonymous'
)
image
.
onload
=
function
()
{
var
canvas
=
document
.
createElement
(
'canvas'
)
canvas
.
width
=
image
.
width
canvas
.
height
=
image
.
height
var
context
=
canvas
.
getContext
(
'2d'
)
context
.
drawImage
(
image
,
0
,
0
,
image
.
width
,
image
.
height
)
var
url
=
canvas
.
toDataURL
(
'image/png'
)
//得到图片的base64编码数据
var
a
=
document
.
createElement
(
"a"
);
// 生成一个a元素
var
event
=
new
MouseEvent
(
"click"
);
// 创建一个单击事件
a
.
download
=
name
||
"photo"
;
// 设置图片名称
a
.
href
=
url
;
// 将生成的URL设置为a.href属性
a
.
dispatchEvent
(
event
);
// 触发a的单击事件
};
image
.
src
=
imgsrc
;
var
a
=
document
.
createElement
(
'a'
)
// 生成一个a元素
var
event
=
new
MouseEvent
(
'click'
)
// 创建一个单击事件
a
.
download
=
name
||
'photo'
// 设置图片名称
a
.
href
=
url
// 将生成的URL设置为a.href属性
a
.
dispatchEvent
(
event
)
// 触发a的单击事件
}
image
.
src
=
imgsrc
}
export
default
util
\ No newline at end of file
export
default
util
src/views/clientManage/clientDetail.vue
View file @
b2f6ad3
...
...
@@ -46,7 +46,17 @@
</div>
<p>
<span>
联系电话:
</span>
<span
class=
"ellipsis-1"
>
{{
leftPanelInfo
.
customerPhone
}}
</span>
<span
class=
"ellipsis-1"
v-if=
"leftPanelInfo.customerPhone"
>
{{
leftPanelInfo
.
customerPhone
}}
</span>
<span
class=
"phone-fill"
v-else
@
click=
"
phoneVisible = true
contactPhone = ''
"
>
待完善
</span>
</p>
<p>
<span>
证件号码:
</span>
...
...
@@ -225,6 +235,12 @@
<el-button
type=
"primary"
@
click=
"goBack"
>
返回
</el-button>
</div>
</div>
<basic-dialog
class=
"phone-fill-box"
title=
"添加联系电话"
:isVisible=
"phoneVisible"
@
confirmDialog=
"phoneConfirmDialog"
@
closeDialog=
"phoneVisible = false"
>
<div
class=
"dialog-form"
>
<label>
联系电话:
</label>
<el-input
v-model
.
trim=
"contactPhone"
size=
"small"
placeholder=
"请输入11位的手机号"
maxlength=
"11"
></el-input>
</div>
</basic-dialog>
<basic-dialog
class=
"tags"
:title=
"tagsDialogTitle"
:width=
"'712px'"
:isDestroyClose=
"true"
:btnLoading=
"sloading"
:isShowThirdBtn=
"true"
:isShowCloseBtn=
"true"
@
btnEvent=
"goNewTag"
:isVisible=
"tagsVisible"
@
confirmDialog=
"handleConfirm"
@
closeDialog=
"handleClose"
>
<slot>
<p
class=
"hint-text color-6"
>
...
...
@@ -273,6 +289,7 @@ export default {
},
data
()
{
return
{
contactPhone
:
''
,
isShowBaseInfo
:
true
,
isShowTooltip
:
false
,
remark
:
''
,
...
...
@@ -551,7 +568,7 @@ export default {
//弹窗数据
tagsDialogTitle
:
'设置标签'
,
tagsVisible
:
false
,
phoneVisible
:
false
,
companyTagsList
:
[],
ownShopTagsList
:
[],
...
...
@@ -776,6 +793,17 @@ export default {
})
this
.
handleClose
()
},
phoneConfirmDialog
()
{
if
(
!
this
.
contactPhone
)
{
this
.
$message
.
error
(
'请输入联系号码'
)
return
}
if
(
!
/^1
[
3456789
]\d{9}
$/
.
test
(
this
.
contactPhone
))
{
this
.
$message
.
error
(
'联系号码格式错误'
)
return
}
this
.
phoneVisible
=
false
},
handleConfirm
()
{
this
.
sloading
=
true
let
labelIdAddList
=
[]
// 新增的标签
...
...
@@ -877,6 +905,22 @@ export default {
.pure-yello-text
{
color
:
#fb8f28
;
}
.phone-fill
{
font-size
:
14px
;
font-weight
:
400
;
color
:
#5850ff
!important
;
line-height
:
20px
;
text-decoration
:
underline
;
cursor
:
pointer
;
}
.dialog-form
{
display
:
flex
;
align-items
:
center
;
padding
:
30px
;
label
{
width
:
100px
;
}
}
.newStyle
{
display
:
flex
;
font-size
:
14px
;
...
...
src/views/crowdManage/crowdAdd.vue
View file @
b2f6ad3
...
...
@@ -656,7 +656,7 @@ export default {
}
},
destroyed
()
{
window
.
removeEventListener
(
'scroll'
,
this
.
initHeight
)
window
.
removeEventListener
(
'scroll'
,
this
.
initHeight
,
true
)
}
}
</
script
>
...
...
@@ -895,7 +895,7 @@ export default {
width
:
100%
;
background
:
#ffffff
;
box-shadow
:
0px
-1px
1px
0px
rgba
(
88
,
80
,
255
,
0.1
);
z-index
:
999
;
z-index
:
999
;
.
el-button
:
nth-child
(
2
)
{
margin-left
:
20px
;
}
...
...
src/views/tagsManage/components/tagGroup.vue
0 → 100644
View file @
b2f6ad3
<
template
>
<div
class=
"content-wrap"
>
<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>
<span
@
click=
"resetTree"
>
重置
</span>
</div>
<el-tree
@
check=
"checkChange"
class=
"tag-tree"
ref=
"tagTree"
:data=
"labelTree"
:props=
"defaultProps"
show-checkbox
node-key=
"id"
default-expand-all
:expand-on-click-node=
"false"
:filter-node-method=
"filterNode"
>
<div
class=
"custom-tree-node"
slot-scope=
"
{ node, data }">
<span
class=
"tree-node"
>
{{
node
.
label
}}
</span>
<span
v-if=
"data.labelType"
@
click=
"editTree(data)"
>
<i
class=
"el-icon-edit-outline"
></i>
</span>
</div>
</el-tree>
</div>
</
template
>
<
script
>
import
{
getTableList
}
from
'@/api/modules/tagsManage'
export
default
{
name
:
'tagGroup'
,
data
()
{
return
{
loading
:
false
,
heightBox
:
200
,
dialogVisible
:
false
,
filterText
:
''
,
selectNum
:
0
,
searchStatus
:
false
,
labelTree
:
[],
defaultProps
:
{
children
:
'children'
,
label
:
'name'
}
}
},
watch
:
{
filterText
(
val
)
{
this
.
$refs
.
tagTree
.
filter
(
val
)
}
},
methods
:
{
resetTree
()
{
this
.
$refs
.
tagTree
.
setCheckedKeys
([])
this
.
$emit
(
'getCheckItem'
,
this
.
$refs
.
tagTree
)
},
filterNode
(
value
,
data
)
{
if
(
!
value
)
return
true
return
data
.
name
.
indexOf
(
value
)
!==
-
1
},
//勾选
checkChange
()
{
this
.
$emit
(
'getCheckItem'
,
this
.
$refs
.
tagTree
)
},
getTreeNode
(
item
)
{
let
tree_id
=
[]
item
.
forEach
(
group_item
=>
{
group_item
.
children
.
forEach
(
label_item
=>
{
label_item
&&
tree_id
.
push
(
label_item
.
id
)
})
})
this
.
$refs
.
tagTree
.
setCheckedKeys
(
tree_id
)
},
editTree
(
data
)
{
this
.
$emit
(
'editTag'
,
'edit'
,
data
.
labelDTO
)
},
getTableList
()
{
let
params
=
{
labelTreeReq
:
{
pageNum
:
1
,
pageSize
:
1000
,
shopId
:
this
.
$globalState
.
session
.
merchantId
,
labelGroupName
:
this
.
filterText
,
edition
:
this
.
$globalState
.
session
.
merchantModel
}
}
getTableList
(
params
).
then
(
res
=>
{
const
labelTreeRets
=
res
.
labelTreeRets
.
map
(
item
=>
{
return
{
id
:
item
.
labelGroup
.
id
,
name
:
item
.
labelGroup
.
name
,
children
:
item
.
labelList
,
labelType
:
item
.
labelType
,
labelDTO
:
item
}
})
labelTreeRets
.
forEach
(
item
=>
{
const
index
=
this
.
labelTree
.
findIndex
(
ret
=>
ret
.
name
==
item
.
labelType
)
if
(
index
==
-
1
)
{
this
.
labelTree
.
push
({
id
:
item
.
id
+
'000'
,
name
:
item
.
labelType
,
children
:
[
item
]
})
}
else
{
this
.
labelTree
[
index
].
children
.
push
(
item
)
}
})
// console.log(this.labelTree)
})
}
},
mounted
()
{
this
.
getTableList
()
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.content-wrap
{
padding
:
16px
;
box-sizing
:
border-box
;
height
:
100%
;
.tree-input
{
display
:
flex
;
align-items
:
center
;
span
{
display
:
inline-block
;
color
:
#5850ff
;
font-size
:
14px
;
width
:
40px
;
margin-left
:
6px
;
cursor
:
pointer
;
}
}
.tag-tree
{
margin-top
:
20px
;
height
:
calc
(
100%
-
100px
);
overflow-y
:
auto
;
/deep/
{
.el-tree-node
{
.el-tree-node__content
{
height
:
30px
;
>
.el-checkbox
{
display
:
none
;
}
}
}
.el-tree-node__children
{
.el-tree-node__content
{
.el-checkbox
{
display
:
block
;
}
}
}
.custom-tree-node
{
font-size
:
14px
;
color
:
#333
;
}
.tree-node
{
width
:
140px
;
display
:
inline-block
;
white-space
:
nowrap
;
text-overflow
:
ellipsis
;
overflow
:
hidden
;
}
.el-tree-node__expand-icon
{
font-size
:
15px
;
margin-top
:
-2px
;
color
:
#000000
;
}
.el-tree-node__expand-icon.is-leaf
{
color
:
transparent
;
}
.el-checkbox__inner
{
margin-right
:
10px
;
}
.el-icon-edit-outline
{
color
:
#5850ff
;
font-size
:
15px
;
cursor
:
pointer
;
}
}
}
}
</
style
>
src/views/tagsManage/index.vue
View file @
b2f6ad3
...
...
@@ -28,53 +28,113 @@
<img
src=
"@/assets/tagsManage/Shape.png"
alt=
""
/>
<i
class=
"el-icon-close"
@
click=
"closeInitPanel"
></i>
</div>
<div
class=
"pageContent"
>
<!-- @setTableHeightEvent="setTableHeightEvent" -->
<search-form
class=
"searchTop border-shadow"
:formModel=
"searchForm"
:formList=
"tagsPartFormList"
@
setTableHeightEvent=
"setTableHeightEvent"
labelWidth=
"54px"
>
<span
class=
"inline-b"
slot=
"form-slot"
>
<el-button
@
click=
"resetTable"
plain
>
重置
</el-button>
<!-- :id="tableParams.btnId" -->
<el-button
type=
"primary"
@
click=
"searchTable"
>
查询
</el-button>
</span>
</search-form>
<!-- noDataText="你当前还没有添加的标签" -->
<GLTable
@
setTableFinishFun=
"setTableFinishFun"
v-if=
"isReload"
ref=
"tagsManage"
:hasNum=
"false"
:getListApi=
"getListApi"
:searchForm=
"searchForm"
:pageConf=
"pageConf"
:noDataImg=
"url"
:tableParams=
"tableParams"
:headerStyle=
"{ height: '54px', background: '#F4F6FC', color: '#333333', fontSize: '14px' }"
>
<span
slot=
"labelGroup"
slot-scope=
"scope"
>
<span>
{{ scope.scope.labelGroup.name }}
</span>
</span>
<span
slot=
"labelList"
slot-scope=
"scope"
>
<!-- :class="[expande ? 'expande' : 'close']" -->
<div
id=
"allTagsWrap"
class=
"allTagsWrap"
>
<span
v-for=
"(item, index) in showTagArray(scope.scope.labelList)"
:key=
"index"
class=
"ellipsis-1 tag-box-wrap"
>
<el-tooltip
class=
"item"
:content=
"item.name"
placement=
"top"
>
<span>
{{ item.name }}
</span>
</el-tooltip>
<div
class=
"client-main-box"
>
<div
class=
"client-tag"
:style=
"{ height: heightBox + 'px' }"
>
<tag-group
@
getCheckItem=
"getCheckItem"
ref=
"tagTree"
@
editTag=
"btnClick"
></tag-group>
</div>
<div
class=
"client-tabel"
>
<div
class=
"client-title-panel"
>
<div
class=
"client-tabel-title"
>
<div
class=
"client-tabel-label"
>
已选标签
<span
@
click=
"dialogRuleVisible = true"
>
人群规则说明
</span>
</div>
<div
class=
"client-expand"
v-if=
"!tagHeight && tagCheckItem.length"
>
<el-button
type=
"text"
size=
"small"
@
click=
"tagHeight = 180"
>
<span>
展开
</span>
<i
class=
"expand el-icon-arrow-down"
></i>
</el-button>
</div>
</div>
<div
class=
"select-tag-panel"
:style=
"{ 'max-height': tagHeight + 'px' }"
>
<el-tag
effect=
"plain"
slot=
"reference"
type=
"info"
class=
"select-tagGroup"
v-for=
"(item, idx) in tagCheckItem"
:key=
"idx"
closable
:disable-transitions=
"false"
@
close=
"removeItem(idx)"
>
<label>
{{ item.name }}:
</label>
<
template
v-for=
"(tag, index) in item.children"
>
<div
class=
"select-tagLabel"
:key=
"index"
v-if=
"tag"
>
{{
tag
.
name
}}
</div>
</
template
>
</el-tag>
</div>
<div
class=
"client-expand"
v-if=
"tagHeight"
>
<el-button
type=
"text"
size=
"small"
@
click=
"tagHeight = 0"
>
<span>
收起
</span>
<i
class=
"expand el-icon-arrow-up"
></i>
</el-button>
</div>
</div>
<div
class=
"pageContent"
>
<!-- @setTableHeightEvent="setTableHeightEvent" -->
<search-form
class=
"searchTop border-shadow"
:formModel=
"searchForm"
:formList=
"tagsPartFormList"
@
setTableHeightEvent=
"setTableHeightEvent"
labelWidth=
"54px"
>
<span
class=
"inline-b"
slot=
"form-slot"
>
<el-button
@
click=
"resetTable"
plain
>
重置
</el-button>
<!-- :id="tableParams.btnId" -->
<el-button
type=
"primary"
@
click=
"searchTable"
>
查询
</el-button>
</span>
<el-popover
v-if=
"scope.scope.labelList.length > 9"
class=
"ellipsis-1 tag-box-wrap"
placement=
"top"
width=
"800"
trigger=
"hover"
content=
"这是一段内容,这是一段内容,这是一段内容,这是一段内容。"
>
<span
slot=
"reference"
>
...({{ scope.scope.labelList.length }})
</span>
<div
class=
"entmicro-hover"
style=
"height: 214px; overflow-y: auto"
>
<el-tag
type=
"info"
class=
"ellipsis-1"
style=
"margin-right: 10px; margin-bottom: 10px; max-width: 200px"
v-for=
"(i, sindex) in scope.scope.labelList"
:key=
"sindex"
:disable-transitions=
"false"
>
<el-tooltip
class=
"item"
:content=
"i.name"
placement=
"top"
>
<span>
{{ i.name }}
</span>
</search-form>
<!-- noDataText="你当前还没有添加的标签" -->
<GLTable
@
setTableFinishFun=
"setTableFinishFun"
v-if=
"isReload"
ref=
"tagsManage"
:hasNum=
"false"
:getListApi=
"getListApi"
:searchForm=
"searchForm"
:pageConf=
"pageConf"
:noDataImg=
"url"
:tableParams=
"tableParams"
:headerStyle=
"{ height: '54px', background: '#F4F6FC', color: '#333333', fontSize: '14px' }"
>
<span
slot=
"labelGroup"
slot-scope=
"scope"
>
<span>
{{ scope.scope.labelGroup.name }}
</span>
</span>
<span
slot=
"labelList"
slot-scope=
"scope"
>
<!-- :class="[expande ? 'expande' : 'close']" -->
<div
id=
"allTagsWrap"
class=
"allTagsWrap"
>
<span
v-for=
"(item, index) in showTagArray(scope.scope.labelList)"
:key=
"index"
class=
"ellipsis-1 tag-box-wrap"
>
<el-tooltip
class=
"item"
:content=
"item.name"
placement=
"top"
>
<span>
{{ item.name }}
</span>
</el-tooltip>
</el-tag>
</span>
<el-popover
v-if=
"scope.scope.labelList.length > 9"
class=
"ellipsis-1 tag-box-wrap"
placement=
"top"
width=
"800"
trigger=
"hover"
content=
"这是一段内容,这是一段内容,这是一段内容,这是一段内容。"
>
<span
slot=
"reference"
>
...({{ scope.scope.labelList.length }})
</span>
<div
class=
"entmicro-hover"
style=
"height: 214px; overflow-y: auto"
>
<el-tag
type=
"info"
class=
"ellipsis-1"
style=
"margin-right: 10px; margin-bottom: 10px; max-width: 200px"
v-for=
"(i, sindex) in scope.scope.labelList"
:key=
"sindex"
:disable-transitions=
"false"
>
<el-tooltip
class=
"item"
:content=
"i.name"
placement=
"top"
>
<span>
{{ i.name }}
</span>
</el-tooltip>
</el-tag>
</div>
</el-popover>
</div>
</
el-popover
>
</div
>
</span
>
<
template
slot=
"xxx"
slot-scope=
"scope"
>
<!-- //这版关掉自店标签 1.0.1允许集团的门店打字店标签,也可以编辑--
>
<!-- v-if="scope.scope.labelType != '系统标签' && isShowEditBtn(scope.scope)" --
>
<span
@
click=
"btnClick('edit', scope.scope)"
v-if=
"scope.scope.labelType != '系统标签' && isShowEditBtn(scope.scope)"
class=
"blue-text"
>
编辑标签组
</span
>
<
GLButton
class=
"blue-text leftDistance"
type=
"text"
fn=
"查看客户"
v-if=
"userType!==2"
@
click=
"toViewCustomer(scope.scope)"
>
查看客户
</GLButton
>
</
template
>
</
GLTable
>
</
span
>
<
template
slot=
"xxx"
slot-scope=
"scope"
>
<!-- //这版关掉自店标签 1.0.1允许集团的门店打字店标签,也可以编辑--
>
<!-- v-if="scope.scope.labelType != '系统标签' && isShowEditBtn(scope.scope)" --
>
<span
@
click=
"btnClick('edit', scope.scope)"
v-if=
"scope.scope.labelType != '系统标签' && isShowEditBtn(scope.scope)"
class=
"blue-text"
>
编辑标签组
</span
>
<GLButton
class=
"blue-text leftDistance"
type=
"text"
fn=
"查看客户"
v-if=
"userType !== 2"
@
click=
"toViewCustomer(scope.scope)"
>
查看客户
</GLButton
>
</
template
>
<
/GLTable
>
</
div
>
</
div
>
</div>
<el-dialog
title=
"人群规则说明"
class=
"crowd-dialog"
width=
"720px"
:before-close=
"handleRuleClose"
:visible
.
sync=
"dialogRuleVisible"
:show-close=
"isShowCloseBtn"
>
<div
class=
"crowd-dialog-wrap color-3"
>
<div
class=
"condition font-14"
>
<b>
说明:
</b>
<br
/>
<span>
标签组内已选标签取
<b>
并集(或)
</b>
,即满足一个条件即可、标签组之间取
<b>
交集(且)
</b>
,即同时满足标签组条件。
</span>
</div>
<div
class=
"flex-between"
>
<div
class=
"static-image"
>
<img
src=
"@/assets/crowdManage/sum.png"
alt=
""
/>
</div>
<div
class=
"static-image"
>
<img
src=
"@/assets/crowdManage/intersection.png"
alt=
""
/>
</div>
</div>
</div>
</el-dialog>
<basic-dialog
class=
"role"
:title=
"tagDialogTitle"
width=
"712px"
:isVisible=
"tagVisible"
@
confirmDialog=
"handleConfirm"
@
closeDialog=
"handleClose"
>
<slot>
<div
class=
"form-title"
>
<span>
说明:
</span>
此处添加的标签均为人工标签,即后续标签更新由员工更新打标签
</div>
<rule-form
:ruleForm=
"tagForm"
:rules=
"tagRules"
:ruleData=
"tagDialogData"
:labelWidth=
"'120px'"
labelPosition=
"right"
ref=
"tagForm"
>
<div
slot=
"tagsGroup-type"
>
<el-select
v-model=
"tagForm.initTagsGroup"
placeholder=
"请选择"
:disabled=
"tagDialogTitle != '添加标签组'"
@
change=
"handleSelect"
>
...
...
@@ -108,6 +168,9 @@
<!-- 企业标签最多3000个,已创建3个 -->
<!-- 自店标签最多3000个,已创建3个 -->
</div>
<div
slot=
"modeType"
>
<el-input
v-model
.
trim=
"tagForm.mode"
disabled
style=
"width:190px"
></el-input>
</div>
<div
slot=
"tagsInput-type"
>
<div
class=
"tagsWrap"
v-if=
"tagDialogTitle == '编辑标签组'"
>
<span
class=
"tag"
:class=
"{ inputWrapShow: item.inputVisible }"
v-for=
"item in editTagList"
:key=
"item.id"
>
...
...
@@ -150,6 +213,7 @@
<
script
>
import
{
getTableList
,
getTableTagNum
,
newAddTag
,
updateTag
,
queryLabelListByGroupId
}
from
'@/api/modules/tagsManage'
import
{
getLoginCount
}
from
'@/api/modules/loginCount'
import
tagGroup
from
'./components/tagGroup.vue'
import
url
from
'@/assets/clientDataOverview/nodata.png'
// import { debounce } from '@/utils/index'
export
default
{
...
...
@@ -186,6 +250,11 @@ export default {
}
}
return
{
dialogRuleVisible
:
false
,
expand
:
false
,
tagHeight
:
0
,
heightBox
:
0
,
tagCheckItem
:
[],
isReload
:
true
,
isAllowCloseDialog
:
false
,
isHasSameTag
:
false
,
...
...
@@ -220,7 +289,7 @@ export default {
label
:
'标签组'
,
prop
:
'labelGroup'
,
addHtml
:
'labelGroup'
,
width
:
230
,
width
:
230
},
{
label
:
'标签组类型'
,
...
...
@@ -239,7 +308,7 @@ export default {
fixed
:
'right'
,
addHtml
:
'xxx'
,
width
:
180
}
}
]
// tableOption: {
// width: 120
...
...
@@ -252,6 +321,7 @@ export default {
tagForm
:
{
tagsName
:
''
,
initTagsGroup
:
1
,
mode
:
'人工'
,
tagsList
:
[]
},
tagDialogData
:
[
...
...
@@ -263,7 +333,7 @@ export default {
// maxlength: 30,
// showWordLimit: true,
disabled
:
false
,
clickFunc
:
this
.
watchInput
clickFunc
:
this
.
watchInput
},
{
label
:
'标签组类型'
,
...
...
@@ -271,7 +341,12 @@ export default {
type
:
'customize'
,
slotName
:
'tagsGroup-type'
},
{
label
:
'更新方式'
,
prop
:
'initTagsGroup'
,
type
:
'customize'
,
slotName
:
'modeType'
},
{
label
:
'标签'
,
prop
:
'tagsList'
,
...
...
@@ -282,7 +357,7 @@ export default {
],
tagRules
:
{
tagsName
:
[
{
required
:
true
,
message
:
'请输入名称'
,
trigger
:
'blur'
}
,
{
required
:
true
,
message
:
'请输入名称'
,
trigger
:
'blur'
}
// {
// validator: checkName,
// trigger: 'change'
...
...
@@ -295,6 +370,7 @@ export default {
{
id
:
1
,
name
:
'企业标签'
},
{
id
:
2
,
name
:
'自店标签'
}
],
modeList
:
[{
id
:
1
,
name
:
'人工'
}],
//编辑便签输入的值
editTagList
:
[],
...
...
@@ -308,7 +384,14 @@ export default {
userType
:
0
//1是商户,2是员工
}
},
computed
:
{},
components
:
{
tagGroup
},
computed
:
{
classIcon
()
{
return
!
this
.
expand
?
'el-icon-arrow-down'
:
'el-icon-arrow-up'
}
},
created
()
{
if
(
window
.
__POWERED_BY_QIANKUN__
)
{
//运行在qiankun容器中
...
...
@@ -349,6 +432,8 @@ export default {
this
.
getTableTagNumFun
()
},
mounted
()
{
let
clientHeight
=
document
.
documentElement
.
clientHeight
this
.
heightBox
=
clientHeight
-
140
//没数据的时候要算高度
// setTimeout(() => {
// if (!this.$refs.tagsManage.data.length) {
...
...
@@ -356,21 +441,65 @@ export default {
// }
// }, 200)
},
watch
:
{
tagCheckItem
:
{
handler
()
{
if
(
this
.
tagCheckItem
.
length
==
0
)
{
setTimeout
(()
=>
{
this
.
tagHeight
=
0
},
300
)
}
},
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
}
})
})
},
// toViewCustomer(info) {
// this.$router.push('/tagsManage/viewCustomers')
// },
toViewCustomer
(
info
)
{
console
.
log
(
info
)
const
id
=
info
.
labelGroup
.
id
const
type
=
info
.
labelType
this
.
$router
.
push
({
// path:`/tagsManage/viewCustomers/530`
path
:
`/tagsManage/viewCustomers/
${
id
}
/
${
type
}
`
})
toViewCustomer
(
info
)
{
console
.
log
(
info
)
const
id
=
info
.
labelGroup
.
id
const
type
=
info
.
labelType
this
.
$router
.
push
({
// path:`/tagsManage/viewCustomers/530`
path
:
`/tagsManage/viewCustomers/
${
id
}
/
${
type
}
`
})
},
watchInput
(){
console
.
log
(
'点击标签组名称输入框'
)
watchInput
()
{
console
.
log
(
'点击标签组名称输入框'
)
},
showTagArray
(
list
)
{
if
(
list
.
length
==
0
)
{
...
...
@@ -380,14 +509,13 @@ export default {
return
list
.
slice
(
0
,
9
)
},
checkInputContent
(
e
)
{
//确保每个输入框的内容不和已存在的编辑标签相同
//确保每个输入框的内容不和已存在的编辑标签相同
let
isHasSameTag
=
this
.
editTagList
.
some
(
ele
=>
ele
.
name
==
e
)
if
(
isHasSameTag
)
{
this
.
$message
.
error
(
'不允许输入已存在的标签'
)
return
e
}
return
this
.
$Utils
.
cutMaxCharStr
(
e
)
return
this
.
$Utils
.
cutMaxCharStr
(
e
)
},
isShowEditBtn
(
row
)
{
//集团模式下,只有集团能可以编辑企业,自店,其他只能编辑自店
...
...
@@ -568,6 +696,9 @@ export default {
}
})
},
handleRuleClose
()
{
this
.
dialogRuleVisible
=
false
},
handleClose
()
{
this
.
tagNameRules
=
false
if
(
!
this
.
tagVisible
&&
this
.
$refs
.
tagForm
)
{
...
...
@@ -697,7 +828,7 @@ export default {
i
.
inputVisible
=
false
}
})
return
this
.
$Utils
.
cutMaxCharStr
(
inputValue
)
return
this
.
$Utils
.
cutMaxCharStr
(
inputValue
)
},
handleSelect
(
value
)
{
console
.
log
(
'值内容'
,
value
)
...
...
@@ -718,9 +849,37 @@ export default {
<
style
lang=
"scss"
scoped
>
@import
'@/styles/variables.scss'
;
@import
'@/styles/resetelement.scss'
;
.leftDistance
{
.leftDistance
{
margin-left
:
10px
;
}
.form-title
{
padding-left
:
30px
;
margin-bottom
:
15px
;
font-size
:
12px
;
font-weight
:
400
;
color
:
#333333
;
line-height
:
21px
;
}
.crowd-dialog-wrap
{
.condition
{
margin-bottom
:
16px
;
line-height
:
21px
;
b
{
color
:
#666666
;
}
span
{
white-space
:
nowrap
;
}
}
.static-image
{
width
:
335px
;
height
:
325px
;
img
{
width
:
100%
;
}
}
}
.scrm-sub-client-container
{
/deep/.search-form
.el-form-item__content
{
width
:
auto
;
...
...
@@ -822,6 +981,81 @@ export default {
cursor
:
pointer
;
}
}
.client-main-box
{
display
:
flex
;
.client-tag
{
width
:
260px
;
margin-right
:
20px
;
box-shadow
:
0
10px
20px
0
rgba
(
88
,
80
,
255
,
0.1
);
margin-top
:
20px
;
background-color
:
#fff
;
}
.client-tabel
{
flex
:
1
;
.client-expand
{
text-align
:
center
;
}
.client-title-panel
{
padding
:
16px
;
margin-top
:
20px
;
background-color
:
#fff
;
box-shadow
:
0
10px
20px
0
rgba
(
88
,
80
,
255
,
0.1
);
}
&
-title
{
font-size
:
16px
;
font-weight
:
600
;
color
:
#333333
;
line-height
:
22px
;
display
:
flex
;
justify-content
:
space-between
;
span
{
font-size
:
14px
;
font-weight
:
400
;
color
:
#5850ff
;
line-height
:
20px
;
cursor
:
pointer
;
}
}
.select-tag-panel
{
display
:
flex
;
flex-wrap
:
wrap
;
font-size
:
14px
;
margin-top
:
10px
;
transition
:
all
0.3s
linear
;
overflow-y
:
auto
;
.select-tagGroup
{
display
:
inline-block
;
background
:
#ffffff
;
border-radius
:
4px
;
border
:
1px
solid
#e8e8ea
;
padding
:
4px
8px
;
line-height
:
20px
;
margin-right
:
8px
;
margin-bottom
:
8px
;
height
:
38px
;
box-sizing
:
border-box
;
/deep/
{
.el-icon-close
{
right
:
0px
;
}
}
label
{
color
:
#333333
;
font-weight
:
600
;
}
}
.select-tagLabel
{
display
:
inline-block
;
background
:
#fafbfe
;
border-radius
:
4px
;
border
:
1px
solid
#e8e8ea
;
padding
:
3px
8px
;
line-height
:
20px
;
margin-right
:
4px
;
}
}
}
}
.pageContent
{
padding
:
6px
20px
30px
;
box-shadow
:
0
10px
20px
0
rgba
(
88
,
80
,
255
,
0.1
);
...
...
src/views/tagsManage/main.vue
0 → 100644
View file @
b2f6ad3
<
template
>
<div
class=
"scrm-sub-client-container"
>
<!--
<p
class=
"pageTitle"
>
标签管理
</p>
-->
<button
class=
"addTagsBtn"
@
click=
"btnClick('create')"
>
添加标签组
</button>
<!--
<button
class=
"addTagsBtn"
@
click=
"btnClick('edit')"
>
修改标签组
</button>
-->
<span
class=
"toptips"
>
<!-- v-if="!((merchantModel==2 && accountLevel==4) || (merchantModel==1 && accountLevel==1))" -->
<span>
共有
{{
numberObj
.
groupCount
||
0
}}
个标签组
<!-- v-if="!(merchantModel == 1 && accountLevel == 4)" -->
<template>
,
{{
numberObj
.
bizLabelCount
||
0
}}
个企业标签
</
template
>
<
template
v-if=
"!((merchantModel == 2 && accountLevel == 4) || (merchantModel == 1 && accountLevel == 1))"
>
,
{{
numberObj
.
rcLabelCount
||
0
}}
个自店标签
</
template
>
</span>
<span
class=
"iconPanelWrap"
v-if=
"!isFirstShow"
>
<el-popover
placement=
"top"
width=
"666"
trigger=
"hover"
>
<!-- v-if="!(merchantModel == 1 && accountLevel == 4)" -->
<div>
企业标签为全局标签,员工可在企微APP端客户详情、客户跟进等模块查看和打标签,最多3000个;
</div>
<div
v-if=
"!((merchantModel == 2 && accountLevel == 4) || (merchantModel == 1 && accountLevel == 1))"
>
自店标签为企业商户自有标签,员工可在企微APP端客户跟进等模块查看和打标签,最多3000个;
</div>
<div>
系统标签为通过大数据算法规则生成的标签
</div>
<img
src=
"@/assets/tagsManage/question.png"
slot=
"reference"
alt=
""
/>
</el-popover>
</span>
</span>
<div
class=
"initPanel"
v-if=
"isFirstShow"
>
<
template
>
企业标签为全局标签,员工可在企微APP端客户详情、客户跟进等模块查看和打标签,最多3000个;
</
template
>
<
template
v-if=
"!((merchantModel == 2 && accountLevel == 4) || (merchantModel == 1 && accountLevel == 1))"
>
自店标签为企业商户自有标签,员工可在企微APP端客户跟进等模块查看和打标签,最多3000个;
</
template
>
系统标签为通过大数据算法规则生成的标签
<img
src=
"@/assets/tagsManage/Shape.png"
alt=
""
/>
<i
class=
"el-icon-close"
@
click=
"closeInitPanel"
></i>
</div>
<div
class=
"pageContent"
>
<!-- @setTableHeightEvent="setTableHeightEvent" -->
<search-form
class=
"searchTop border-shadow"
:formModel=
"searchForm"
:formList=
"tagsPartFormList"
@
setTableHeightEvent=
"setTableHeightEvent"
labelWidth=
"54px"
>
<span
class=
"inline-b"
slot=
"form-slot"
>
<el-button
@
click=
"resetTable"
plain
>
重置
</el-button>
<!-- :id="tableParams.btnId" -->
<el-button
type=
"primary"
@
click=
"searchTable"
>
查询
</el-button>
</span>
</search-form>
<!-- noDataText="你当前还没有添加的标签" -->
<GLTable
@
setTableFinishFun=
"setTableFinishFun"
v-if=
"isReload"
ref=
"tagsManage"
:hasNum=
"false"
:getListApi=
"getListApi"
:searchForm=
"searchForm"
:pageConf=
"pageConf"
:noDataImg=
"url"
:tableParams=
"tableParams"
:headerStyle=
"{ height: '54px', background: '#F4F6FC', color: '#333333', fontSize: '14px' }"
>
<span
slot=
"labelGroup"
slot-scope=
"scope"
>
<span>
{{ scope.scope.labelGroup.name }}
</span>
</span>
<span
slot=
"labelList"
slot-scope=
"scope"
>
<!-- :class="[expande ? 'expande' : 'close']" -->
<div
id=
"allTagsWrap"
class=
"allTagsWrap"
>
<span
v-for=
"(item, index) in showTagArray(scope.scope.labelList)"
:key=
"index"
class=
"ellipsis-1 tag-box-wrap"
>
<el-tooltip
class=
"item"
:content=
"item.name"
placement=
"top"
>
<span>
{{ item.name }}
</span>
</el-tooltip>
</span>
<el-popover
v-if=
"scope.scope.labelList.length > 9"
class=
"ellipsis-1 tag-box-wrap"
placement=
"top"
width=
"800"
trigger=
"hover"
content=
"这是一段内容,这是一段内容,这是一段内容,这是一段内容。"
>
<span
slot=
"reference"
>
...({{ scope.scope.labelList.length }})
</span>
<div
class=
"entmicro-hover"
style=
"height: 214px; overflow-y: auto"
>
<el-tag
type=
"info"
class=
"ellipsis-1"
style=
"margin-right: 10px; margin-bottom: 10px; max-width: 200px"
v-for=
"(i, sindex) in scope.scope.labelList"
:key=
"sindex"
:disable-transitions=
"false"
>
<el-tooltip
class=
"item"
:content=
"i.name"
placement=
"top"
>
<span>
{{ i.name }}
</span>
</el-tooltip>
</el-tag>
</div>
</el-popover>
</div>
</span>
<
template
slot=
"xxx"
slot-scope=
"scope"
>
<!-- //这版关掉自店标签 1.0.1允许集团的门店打字店标签,也可以编辑-->
<!-- v-if="scope.scope.labelType != '系统标签' && isShowEditBtn(scope.scope)" -->
<span
@
click=
"btnClick('edit', scope.scope)"
v-if=
"scope.scope.labelType != '系统标签' && isShowEditBtn(scope.scope)"
class=
"blue-text"
>
编辑标签组
</span>
<GLButton
class=
"blue-text leftDistance"
type=
"text"
fn=
"查看客户"
v-if=
"userType !== 2"
@
click=
"toViewCustomer(scope.scope)"
>
查看客户
</GLButton>
</
template
>
</GLTable>
</div>
<basic-dialog
class=
"role"
:title=
"tagDialogTitle"
width=
"712px"
:isVisible=
"tagVisible"
@
confirmDialog=
"handleConfirm"
@
closeDialog=
"handleClose"
>
<slot>
<rule-form
:ruleForm=
"tagForm"
:rules=
"tagRules"
:ruleData=
"tagDialogData"
:labelWidth=
"'120px'"
labelPosition=
"right"
ref=
"tagForm"
>
<div
slot=
"tagsGroup-type"
>
<el-select
v-model=
"tagForm.initTagsGroup"
placeholder=
"请选择"
:disabled=
"tagDialogTitle != '添加标签组'"
@
change=
"handleSelect"
>
<el-option
v-for=
"item in tagsGroupList"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
></el-option>
</el-select>
<!-- id="tagTipMsgRef" -->
<span
class=
"tagTipMsg"
v-if=
"tagDialogTitle == '添加标签组' && !tagForm.initTagsGroup"
>
<
template
v-if=
"!(merchantModel == 1 && (accountLevel == 2 || accountLevel == 3 || accountLevel == 4))"
>
企业标签
</
template
>
<
template
v-if=
"!((merchantModel == 2 && accountLevel == 4) || (merchantModel == 1 && accountLevel == 1))"
>
<template
v-if=
"!(merchantModel == 1 && (accountLevel == 2 || accountLevel == 3 || accountLevel == 4))"
>
和
</
template
>
自店标签分别
</template>
最多3000个
</span>
<span
class=
"tagTipMsg"
v-if=
"tagDialogTitle == '添加标签组' && tagForm.initTagsGroup == 1"
>
企业标签已创建
<span
class=
"pure-blue-text"
>
{{ numberObj.bizLabelCount }}
</span>
个
</span>
<span
class=
"tagTipMsg"
v-if=
"tagDialogTitle == '添加标签组' && tagForm.initTagsGroup == 2"
>
自店标签已创建
<span
class=
"pure-blue-text"
>
{{ numberObj.rcLabelCount }}
</span>
个
</span>
<span
class=
"tagTipMsg"
v-if=
"tagDialogTitle == '编辑标签组'"
>
{{ tagForm.initTagsGroup == 1 ? '企业标签' : '自店标签' }}最多3000个,已创建
<span
class=
"pure-blue-text"
>
{{ tagForm.initTagsGroup == 1 ? numberObj.bizLabelCount : numberObj.rcLabelCount }}
</span>
个
</span>
<!-- 企业标签最多3000个,已创建3个 -->
<!-- 自店标签最多3000个,已创建3个 -->
</div>
<div
slot=
"tagsInput-type"
>
<div
class=
"tagsWrap"
v-if=
"tagDialogTitle == '编辑标签组'"
>
<span
class=
"tag"
:class=
"{ inputWrapShow: item.inputVisible }"
v-for=
"item in editTagList"
:key=
"item.id"
>
<!-- maxlength="30" show-word-limit -->
<el-input
class=
"input-new-tag"
v-if=
"item.inputVisible"
v-model
.
trim=
"item.name"
ref=
"saveTagInput"
size=
"small"
@
blur=
"item.name = handleInputConfirm(item.name, item.id)"
@
keyup
.
enter
.
native=
"item.name = handleInputConfirm(item.name, item.id)"
></el-input>
<el-tooltip
class=
"item"
:content=
"item.name"
placement=
"top"
>
<span
class=
"ellipsis-1"
v-if=
"!item.inputVisible"
>
{{ item.name }}
</span>
</el-tooltip>
<img
class=
"editIcon"
src=
"@/assets/tagsManage/edit.png"
@
click=
"showInput(item.id)"
alt=
""
v-show=
"!item.inputVisible"
/>
</span>
</div>
<div
class=
"row-tag"
v-for=
"(item, index) in tagForm.tagsList"
:key=
"index"
>
<!-- :onkeyup="(item.name = item.name.replace(/\s+/g, ''))" maxlength="30" show-word-limit @input="checkInputContent"-->
<el-input
v-model
.
trim=
"item.name"
placeholder=
"添加标签名称(至少添加一个标签)"
@
keyup
.
native=
"item.name = checkInputContent(item.name)"
></el-input>
<span
class=
"el-icon-circle-close"
@
click=
"deleteRow(index)"
></span>
</div>
<!-- 需要后台告诉已经创建多少个标签了 -->
<div
class=
"addtagIcon"
v-if=
"tagForm.initTagsGroup == 1"
:style=
"{ color: numberObj.bizLabelCount >= 3000 ? '#EEE' : '' }"
@
click=
"addRow(tagForm.initTagsGroup)"
>
<i
class=
"el-icon-circle-plus-outline"
></i>
<span
class=
"addTagText"
>
新增标签
</span>
</div>
<div
class=
"addtagIcon"
v-if=
"tagForm.initTagsGroup == 2"
:style=
"{ color: numberObj.rcLabelCount >= 3000 ? '#EEE' : '' }"
@
click=
"addRow(tagForm.initTagsGroup)"
>
<i
class=
"el-icon-circle-plus-outline"
></i>
<span
class=
"addTagText"
>
新增标签
</span>
</div>
<div
class=
"addtagIcon"
v-if=
"tagForm.initTagsGroup == ''"
@
click=
"addRow(tagForm.initTagsGroup)"
>
<i
class=
"el-icon-circle-plus-outline"
></i>
<span
class=
"addTagText"
>
新增标签
</span>
</div>
<!-- v-if="tagNameRules" -->
<div
class=
"el-form-item__error"
v-if=
"tagNameRules"
>
请至少添加一个标签
</div>
</div>
</rule-form>
</slot>
</basic-dialog>
</div>
</template>
<
script
>
import
{
getTableList
,
getTableTagNum
,
newAddTag
,
updateTag
,
queryLabelListByGroupId
}
from
'@/api/modules/tagsManage'
import
{
getLoginCount
}
from
'@/api/modules/loginCount'
import
url
from
'@/assets/clientDataOverview/nodata.png'
// import { debounce } from '@/utils/index'
export
default
{
name
:
'tagsManage'
,
data
()
{
//这里就是整个checkName啦,就是方法一的使用
var
checkName
=
(
rule
,
value
,
callback
)
=>
{
var
len
=
0
for
(
var
i
=
0
;
i
<
value
.
length
;
i
++
)
{
var
c
=
value
.
charCodeAt
(
i
)
//单字节加1
if
((
c
>=
0x0001
&&
c
<=
0x007e
)
||
(
0xff60
<=
c
&&
c
<=
0xff9f
))
{
len
++
}
else
{
len
+=
2
}
}
if
(
len
>
30
)
{
//重点重点,下面就是填写提示的文字 (len < 4 && len> 0) ||
// callback(new Error('名称长度为4-30个字符,一个中文字等于2个字符。'));
callback
(
new
Error
(
'字数已达上限'
))
}
else
{
callback
()
}
}
var
checkTagsInput
=
(
rule
,
value
,
callBack
)
=>
{
console
.
log
(
'value值为:'
,
value
,
typeof
value
,
value
.
length
)
if
(
value
&&
value
.
length
==
0
)
{
return
callBack
(
new
Error
(
'请添加标签'
))
}
else
{
return
callBack
()
}
}
return
{
isReload
:
true
,
isAllowCloseDialog
:
false
,
isHasSameTag
:
false
,
tagNameRules
:
false
,
numberObj
:
{},
url
:
url
,
isFirstShow
:
false
,
searchForm
:
{},
tagsPartFormList
:
[
{
type
:
'select'
,
prop
:
'labelTreeReq.labelTypesStr'
,
label
:
'标签组'
,
placeholder
:
'请选择标签组类型'
,
options
:
this
.
$Constants
.
LABEL_OPTION
},
{
type
:
'input'
,
inputType
:
'text'
,
prop
:
'labelTreeReq.labelGroupName'
,
label
:
'搜索'
,
placeholder
:
'请输入标签组或标签名称'
,
clearable
:
true
}
],
pageConf
:
{
pageSize
:
'labelTreeReq.pageSize'
,
pageNum
:
'labelTreeReq.pageNum'
,
totalCount
:
'labelGroupCount'
},
tableParams
:
{
// btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName
:
'labelTreeRets'
,
tableColumns
:
[
{
label
:
'标签组'
,
prop
:
'labelGroup'
,
addHtml
:
'labelGroup'
,
width
:
230
},
{
label
:
'标签组类型'
,
prop
:
'labelType'
,
width
:
180
},
{
label
:
'标签'
,
prop
:
'labelList'
,
addHtml
:
'labelList'
,
align
:
'center'
},
{
label
:
'操作'
,
prop
:
'xxx'
,
fixed
:
'right'
,
addHtml
:
'xxx'
,
width
:
180
}
]
// tableOption: {
// width: 120
// }
},
getListApi
:
getTableList
,
// 弹窗数据
tagDialogTitle
:
'添加标签组'
,
tagVisible
:
false
,
tagForm
:
{
tagsName
:
''
,
initTagsGroup
:
1
,
tagsList
:
[]
},
tagDialogData
:
[
{
label
:
'标签组名称'
,
prop
:
'tagsName'
,
type
:
'input'
,
placeholder
:
'最多30个字符,1个汉字为2个字符'
,
// maxlength: 30,
// showWordLimit: true,
disabled
:
false
,
clickFunc
:
this
.
watchInput
},
{
label
:
'标签组类型'
,
prop
:
'initTagsGroup'
,
type
:
'customize'
,
slotName
:
'tagsGroup-type'
},
{
label
:
'标签'
,
prop
:
'tagsList'
,
type
:
'customize'
,
slotName
:
'tagsInput-type'
,
class
:
'is-required'
//添加红色标志
}
],
tagRules
:
{
tagsName
:
[
{
required
:
true
,
message
:
'请输入名称'
,
trigger
:
'blur'
}
// {
// validator: checkName,
// trigger: 'change'
// }
],
initTagsGroup
:
[{
required
:
true
,
message
:
'请选择标签组类型'
,
trigger
:
'change'
}]
// tagsList: [{ required: true }]
},
tagsGroupList
:
[
{
id
:
1
,
name
:
'企业标签'
},
{
id
:
2
,
name
:
'自店标签'
}
],
//编辑便签输入的值
editTagList
:
[],
tagGroupId
:
0
,
//标签组id,编辑提交接口要用
//控制展开收起按钮
expande
:
true
,
needShowExpande
:
false
,
merchantId
:
10001001
,
//子系统默认这个门店id
merchantModel
:
1
,
//集团:1,门店:2
accountLevel
:
0
,
//1,2,3,4工厂,省代,市代,门店
userType
:
0
//1是商户,2是员工
}
},
computed
:
{},
created
()
{
if
(
window
.
__POWERED_BY_QIANKUN__
)
{
//运行在qiankun容器中
this
.
merchantId
=
this
.
$globalState
.
session
.
merchantId
this
.
merchantModel
=
this
.
$globalState
.
session
.
merchantModel
this
.
accountLevel
=
this
.
$globalState
.
session
.
accountLevel
this
.
userType
=
this
.
$globalState
.
session
.
userType
console
.
log
(
this
.
$globalState
.
session
,
'555'
)
// if (this.merchantModel == 1) {
// if (!(this.accountLevel == 1 && this.userType == 1)) this.tagsGroupList.splice(0, 1) //只能创建自店标签
// }
//1.0.1集团下的省代、市代,门店只能创建自店标签
if
(
this
.
merchantModel
==
1
)
{
if
(
this
.
accountLevel
==
2
||
this
.
accountLevel
==
3
||
this
.
accountLevel
==
4
)
{
this
.
tagsGroupList
.
splice
(
0
,
1
)
//只能创建自店标签
// this.tagsPartFormList[0].options.splice(0, 1)
}
}
if
(
this
.
merchantModel
==
1
)
{
if
(
this
.
accountLevel
==
1
)
{
//集团下的工厂只能创建企微标签,自店标签不要了
this
.
tagsGroupList
.
splice
(
1
,
1
)
this
.
tagsPartFormList
[
0
].
options
.
splice
(
1
,
1
)
}
}
// 集团授权模式下的门店账号,拥有标签管理模块权限,修改为:去掉门店的“标签管理”模块权限
// 单店授权模式下的门店账号,创建标签组时,可创建企业标签和自店标签,修改为:创建标签组时,仅能选择企业标签,去掉自店标签选项;
if
(
this
.
merchantModel
==
2
)
{
if
(
this
.
accountLevel
==
4
)
{
this
.
tagsGroupList
.
splice
(
1
,
1
)
this
.
tagsPartFormList
[
0
].
options
.
splice
(
1
,
1
)
}
}
}
this
.
searchForm
=
{
'labelTreeReq.shopId'
:
this
.
merchantId
,
'labelTreeReq.edition'
:
this
.
merchantModel
}
this
.
getLoginCountFun
()
this
.
getTableTagNumFun
()
},
mounted
()
{
//没数据的时候要算高度
// setTimeout(() => {
// if (!this.$refs.tagsManage.data.length) {
// this.$refs.tagsManage.setTableHeightFun()
// }
// }, 200)
},
methods
:
{
// toViewCustomer(info) {
// this.$router.push('/tagsManage/viewCustomers')
// },
toViewCustomer
(
info
)
{
console
.
log
(
info
)
const
id
=
info
.
labelGroup
.
id
const
type
=
info
.
labelType
this
.
$router
.
push
({
// path:`/tagsManage/viewCustomers/530`
path
:
`/tagsManage/viewCustomers/
${
id
}
/
${
type
}
`
})
},
watchInput
()
{
console
.
log
(
'点击标签组名称输入框'
)
},
showTagArray
(
list
)
{
if
(
list
.
length
==
0
)
{
return
[]
}
// return list
return
list
.
slice
(
0
,
9
)
},
checkInputContent
(
e
)
{
//确保每个输入框的内容不和已存在的编辑标签相同
let
isHasSameTag
=
this
.
editTagList
.
some
(
ele
=>
ele
.
name
==
e
)
if
(
isHasSameTag
)
{
this
.
$message
.
error
(
'不允许输入已存在的标签'
)
return
e
}
return
this
.
$Utils
.
cutMaxCharStr
(
e
)
},
isShowEditBtn
(
row
)
{
//集团模式下,只有集团能可以编辑企业,自店,其他只能编辑自店
//单店模式下,仅门店和员工可以编辑
if
(
row
.
labelType
==
'自店标签'
&&
!
(
this
.
merchantModel
==
1
&&
(
this
.
accountLevel
==
2
||
this
.
accountLevel
==
3
||
this
.
accountLevel
==
4
)))
{
return
false
}
if
(
this
.
merchantModel
==
1
)
{
if
(
this
.
accountLevel
==
1
&&
this
.
userType
==
1
)
{
return
true
}
if
(
this
.
accountLevel
!==
1
)
{
//如果是企业标签不显示
if
(
row
.
labelType
==
'企业标签'
)
{
return
false
}
return
true
}
}
return
true
//门店版都显示编辑按钮
},
expandeClick
()
{
// console.log('expandeClick')
this
.
expande
=
!
this
.
expande
},
closeInitPanel
()
{
this
.
isFirstShow
=
false
},
setTableHeightEvent
()
{
this
.
$refs
.
tagsManage
.
setTableHeightFun
()
},
setTableFinishFun
(
content
)
{
console
.
log
(
'表格完成'
,
this
.
$refs
.
tagsManage
.
data
)
this
.
$refs
.
tagsManage
.
data
.
length
?
(
this
.
$refs
.
tagsManage
.
tableHeightValues
=
''
)
:
this
.
$refs
.
tagsManage
.
setTableHeightFun
()
},
getLoginCountFun
()
{
//loginType:3是查客户数据概览浏览次数
getLoginCount
({
loginType
:
3
}).
then
(
res
=>
{
//获取是否第一次点击该页面
this
.
isFirstShow
=
res
})
},
getTableTagNumFun
()
{
getTableTagNum
({
'labelStatReq.shopId'
:
this
.
merchantId
,
'labelStatReq.edition'
:
this
.
merchantModel
}).
then
(
res
=>
{
if
(
!
res
)
{
return
false
}
this
.
numberObj
=
res
})
},
//搜索表格
searchTable
()
{
this
.
$refs
.
tagsManage
.
refreshTable
()
},
//重置表格
resetTable
()
{
// this.isReload = false
this
.
searchForm
=
{
'labelTreeReq.shopId'
:
this
.
merchantId
,
'labelTreeReq.edition'
:
this
.
merchantModel
}
this
.
$refs
.
tagsManage
.
refreshTable
()
// this.$nextTick(() => {
// this.isReload = true
// })
},
btnClick
(
pType
,
rowData
)
{
console
.
log
(
pType
,
rowData
,
'btnClick'
)
switch
(
pType
)
{
case
'create'
:
this
.
tagDialogTitle
=
'添加标签组'
this
.
tagForm
.
tagsForm
=
''
this
.
tagForm
.
initTagsGroup
=
1
//默认改成,企业标签
if
(
this
.
merchantModel
==
1
&&
(
this
.
accountLevel
==
2
||
this
.
accountLevel
==
3
||
this
.
accountLevel
==
4
))
{
this
.
tagForm
.
initTagsGroup
=
2
}
this
.
$set
(
this
.
tagDialogData
[
0
],
'disabled'
,
false
)
this
.
handleClose
()
break
case
'edit'
:
this
.
tagDialogTitle
=
'编辑标签组'
this
.
$set
(
this
.
tagDialogData
[
0
],
'disabled'
,
true
)
this
.
editEvent
(
rowData
)
break
}
},
isHasSome
(
array
)
{
var
temp
=
[]
//一个新的临时数组
for
(
var
i
=
0
;
i
<
array
.
length
;
i
++
)
{
if
(
temp
.
indexOf
(
array
[
i
])
!==
-
1
)
{
return
true
}
if
(
temp
.
indexOf
(
array
[
i
])
==
-
1
)
{
temp
.
push
(
array
[
i
])
}
}
return
false
},
//编辑触发事件
editEvent
(
rowData
)
{
this
.
handleClose
()
this
.
tagsForm
=
JSON
.
parse
(
JSON
.
stringify
(
rowData
))
this
.
editTagList
=
rowData
.
labelList
.
map
(
item
=>
{
return
{
...
item
,
inputVisible
:
false
}
})
this
.
tagGroupId
=
rowData
.
labelGroup
.
id
//标签组id
this
.
tagForm
.
tagsName
=
rowData
.
labelGroup
.
name
//标签组名
this
.
tagForm
.
initTagsGroup
=
rowData
.
labelType
==
'企业标签'
?
1
:
rowData
.
labelType
==
'自店标签'
?
2
:
''
//标签组类型
},
handleConfirm
()
{
console
.
log
(
this
.
$refs
.
tagForm
.
$children
,
'kkk'
)
this
.
$refs
.
tagForm
.
$children
[
0
].
validate
(
valid
=>
{
if
(
!
valid
)
{
if
(
this
.
tagForm
.
tagsList
.
length
<=
0
&&
this
.
tagDialogTitle
==
'添加标签组'
)
{
this
.
tagNameRules
=
true
this
.
$message
.
error
(
'至少要添加一个标签'
)
// return
}
return
}
if
(
this
.
tagForm
.
tagsList
.
length
<=
0
&&
this
.
tagDialogTitle
==
'添加标签组'
)
{
this
.
tagNameRules
=
true
this
.
$message
.
error
(
'至少要添加一个标签'
)
return
}
if
(
this
.
tagDialogTitle
==
'添加标签组'
)
{
//过滤掉没有输入值得标签输入框
this
.
tagForm
.
tagsList
=
this
.
tagForm
.
tagsList
.
filter
(
item
=>
item
.
name
!=
''
)
if
(
this
.
tagForm
.
tagsList
.
length
<=
0
)
{
this
.
$message
.
error
(
'不能提交空标签'
)
return
}
//如果存在添加标签的输入框的内容的标签相同则不提交
let
isSameTagFlag
=
false
var
tempArr
=
this
.
tagForm
.
tagsList
.
map
(
item
=>
item
.
name
)
isSameTagFlag
=
this
.
isHasSome
(
tempArr
)
if
(
isSameTagFlag
)
{
this
.
$message
.
error
(
'不能提交相同的标签,请修改'
)
return
}
this
.
newAddTagFun
()
//this.handleClose() //这里不管
}
else
{
//修改标签(允许同时增加标签)
let
isHasEmpty
=
this
.
editTagList
.
some
(
ele
=>
ele
.
name
==
''
)
if
(
isHasEmpty
)
{
this
.
$message
.
error
(
'不能提交空的编辑标签'
)
return
}
if
(
this
.
tagForm
.
tagsList
.
length
>
0
)
{
//过滤掉没有输入值得标签输入框
this
.
tagForm
.
tagsList
=
this
.
tagForm
.
tagsList
.
filter
(
item
=>
item
.
name
!=
''
)
//如果存在添加标签的输入框的内容和可编辑的标签相同则不提交
let
ishasSameTagFlag
=
false
this
.
editTagList
.
forEach
(
item
=>
{
for
(
let
i
=
0
;
i
<
this
.
tagForm
.
tagsList
.
length
;
i
++
)
{
if
(
this
.
tagForm
.
tagsList
[
i
].
name
==
item
.
name
)
{
ishasSameTagFlag
=
true
}
}
})
if
(
ishasSameTagFlag
)
{
this
.
$message
.
error
(
'不能提交已存在的标签,请修改'
)
return
}
}
this
.
updateTagFun
()
this
.
newAddTagFun
()
// this.handleClose()
}
})
},
handleClose
()
{
this
.
tagNameRules
=
false
if
(
!
this
.
tagVisible
&&
this
.
$refs
.
tagForm
)
{
this
.
$refs
.
tagForm
.
$children
[
0
].
resetFields
()
this
.
tagForm
.
initTagsGroup
=
1
if
(
this
.
merchantModel
==
1
&&
(
this
.
accountLevel
==
2
||
this
.
accountLevel
==
3
||
this
.
accountLevel
==
4
))
{
this
.
tagForm
.
initTagsGroup
=
2
}
this
.
tagForm
.
tagsName
=
''
// console.log(this.tagForm.initTagsGroup, '7777')
// console.log(this.tagForm, '内')
}
// console.log(this.tagForm, '外')
this
.
tagForm
.
tagsList
=
[]
//取消时清空新增标签
this
.
tagVisible
=
!
this
.
tagVisible
},
newAddTagFun
()
{
//满足条件进行提交
let
params
=
{}
params
[
'labelDTO.dataFrom'
]
=
'cs'
params
[
'labelDTO.shopId'
]
=
this
.
merchantId
params
[
'labelDTO.edition'
]
=
this
.
merchantModel
// params.staffId = '员工A'
params
[
'labelDTO.labelGroup.name'
]
=
this
.
tagForm
.
tagsName
params
[
'labelDTO.labelType'
]
=
this
.
tagForm
.
initTagsGroup
==
1
?
'企业标签'
:
'自店标签'
params
[
'labelDTO.labelList'
]
=
this
.
tagForm
.
tagsList
params
[
'labelDTO.isAddLabelGroupEnter'
]
=
this
.
tagDialogTitle
==
'添加标签组'
?
true
:
false
console
.
log
(
params
)
newAddTag
(
params
).
then
(
res
=>
{
if
(
!
res
)
{
return
}
if
(
res
.
data
.
code
==
0
)
{
if
(
this
.
tagForm
.
tagsList
.
length
>
0
)
{
this
.
$message
.
success
(
'添加成功'
)
}
if
(
this
.
tagDialogTitle
==
'编辑标签组'
)
{
this
.
tagForm
.
tagsName
=
''
this
.
tagForm
.
initTagsGroup
=
''
this
.
tagForm
.
tagsList
=
[]
}
this
.
handleClose
()
}
else
if
(
res
.
data
.
code
==
1
)
{
this
.
$message
.
error
(
`
${
res
.
data
.
message
}
`
)
}
else
if
(
res
.
data
.
code
==
2
)
{
//编辑弹框, 空标签调接口返回信息
if
(
this
.
tagDialogTitle
==
'编辑标签组'
)
{
this
.
tagForm
.
tagsName
=
''
this
.
tagForm
.
initTagsGroup
=
''
this
.
tagForm
.
tagsList
=
[]
}
this
.
handleClose
()
}
this
.
resetTable
()
//刷新下表格
this
.
getTableTagNumFun
()
})
},
updateTagFun
()
{
let
param
=
{}
param
[
'labelDTO.dataFrom'
]
=
'cs'
param
[
'labelDTO.edition'
]
=
this
.
merchantModel
param
[
'labelDTO.labelGroup.id'
]
=
this
.
tagGroupId
param
[
'labelDTO.labelGroup.name'
]
=
this
.
tagForm
.
tagsName
param
[
'labelDTO.labelType'
]
=
this
.
tagForm
.
initTagsGroup
==
1
?
'企业标签'
:
'自店标签'
param
[
'labelDTO.shopId'
]
=
this
.
merchantId
let
editTagList
=
this
.
editTagList
.
map
(
item
=>
{
return
{
id
:
item
.
id
,
name
:
item
.
name
}
})
param
[
'labelDTO.labelList'
]
=
editTagList
updateTag
(
param
).
then
(
res
=>
{
if
(
!
res
)
{
return
}
this
.
$message
.
success
(
'修改成功'
)
// this.tagForm.tagsName = ''
// this.tagForm.initTagsGroup = ''
// this.tagForm.tagsList = []
this
.
resetTable
()
//刷新下表格
})
},
//删除一行标签
deleteRow
(
index
)
{
this
.
tagForm
.
tagsList
.
splice
(
index
,
1
)
},
//添加一行标签
addRow
(
type
)
{
this
.
tagNameRules
=
false
if
(
type
==
1
&&
this
.
numberObj
.
bizLabelCount
>=
3000
)
{
this
.
$message
.
error
(
'企业标签数量已达上限'
)
return
}
if
(
type
==
2
&&
this
.
numberObj
.
rcLabelCount
>=
3000
)
{
this
.
$message
.
error
(
'自店标签数量已达上限'
)
return
}
this
.
tagForm
.
tagsList
.
push
({
name
:
''
})
},
showInput
(
id
)
{
// this.inputVisible = true
this
.
editTagList
.
forEach
(
item
=>
{
if
(
item
.
id
==
id
)
{
item
.
inputVisible
=
true
}
})
//聚焦到输入框
this
.
$nextTick
(
_
=>
{
this
.
$refs
.
saveTagInput
[
0
].
focus
()
})
},
handleInputConfirm
(
inputValue
,
id
)
{
this
.
editTagList
.
forEach
(
i
=>
{
if
(
i
.
id
==
id
)
{
i
.
inputVisible
=
false
}
})
return
this
.
$Utils
.
cutMaxCharStr
(
inputValue
)
},
handleSelect
(
value
)
{
console
.
log
(
'值内容'
,
value
)
}
//注意问问他们后台怎么处理转义字符
//限制输入特殊字符
// keyUp(e) {
// e.target.value = e.target.value.replace(/[`~!@#$%^&*()_\-+=<>?:"{}|,.\/;'\\[\]·~!@#¥%……&*()——\-+={}|《》?:“”【】、;‘’,。、]/g, '')
// },
// // 只能输入汉字、英文、数字
// keydown(e) {
// e.target.value = e.target.value.replace(/[^\a-\z\A-\Z0-9\u4E00-\u9FA5]/g, '')
// }
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
@import
'@/styles/variables.scss'
;
@import
'@/styles/resetelement.scss'
;
.leftDistance
{
margin-left
:
10px
;
}
.scrm-sub-client-container
{
/deep/.search-form
.el-form-item__content
{
width
:
auto
;
}
//
//
el-form-item__label
//
/
deep
/
.el-table
tbody
tr
:hover
>
td
{
//
background-color
:
#f4f3ff
;
//
}
.pageTitle
{
position
:
relative
;
//
margin-top
:
30px
;
margin-bottom
:
20px
;
height
:
20px
;
font-size
:
20px
;
font-weight
:
700
;
color
:
#333333
;
line-height
:
20px
;
letter-spacing
:
1px
;
}
.addTagsBtn
{
height
:
32px
;
background
:
$
btnBlue
;
border-radius
:
4px
;
padding
:
0
20px
;
color
:
#fff
;
font-size
:
14px
;
&:hover
{
background-color
:
$
lightBtnBlue
;
}
}
.toptips
{
display
:
inline-block
;
position
:
relative
;
margin-left
:
10px
;
height
:
20px
;
min-width
:
440px
;
font-size
:
14px
;
font-weight
:
400
;
color
:
#666666
;
line-height
:
20px
;
.tipsPanel
{
position
:
absolute
;
display
:
inline-block
;
padding
:
6px
10px
10px
;
box-sizing
:
border-box
;
font-size
:
14px
;
font-weight
:
400
;
color
:
#999999
;
line-height
:
22px
;
display
:
none
;
z-index
:
100
;
background
:
#fff
;
width
:
560px
;
height
:
82px
;
right
:
-280px
;
top
:
-84px
;
}
.iconPanelWrap
{
img
{
display
:
inline-block
;
margin-left
:
20px
;
vertical-align
:
middle
;
}
&
:hover
{
.tipsPanel
{
display
:
block
!important
;
}
}
}
}
.initPanel
{
position
:
relative
;
margin-top
:
20px
;
width
:
708px
;
min-height
:
80px
;
box-sizing
:
border-box
;
background
:
#e6e9ff
;
border
:
1px
solid
$
btnBlue
;
border-radius
:
4px
;
padding
:
10px
42px
;
height
:
60px
;
font-size
:
14px
;
font-weight
:
400
;
color
:
rgba
(
0
,
0
,
0
,
0.65
);
line-height
:
20px
;
img
{
position
:
absolute
;
left
:
16px
;
top
:
13px
;
}
i
{
position
:
absolute
;
top
:
14px
;
right
:
18px
;
width
:
9px
;
height
:
9px
;
cursor
:
pointer
;
}
}
.pageContent
{
padding
:
6px
20px
30px
;
box-shadow
:
0
10px
20px
0
rgba
(
88
,
80
,
255
,
0.1
);
margin-top
:
20px
;
background-color
:
#fff
;
.el-button
+
.el-button
{
margin-left
:
10px
;
}
.allTagsWrap
{
position
:
relative
;
//
display
:
-webkit-box
;
//
overflow
:
hidden
;
//
-webkit-line-clamp
:
2
;
//
-webkit-box-orient
:
vertical
;
//
padding-bottom
:
-2px
;
//
box-sizing
:
border-box
;
//
&:hover
{
//
-webkit-line-clamp
:
9999
;
//
//
.tag-box-wrap
{
//
//
margin-bottom
:
10px
;
//
//
}
//
}
.tag-box-wrap
{
display
:
inline-block
;
margin-right
:
10px
;
margin-top
:
5px
;
margin-bottom
:
5px
;
padding
:
0
10px
;
box-sizing
:
border-box
;
min-width
:
76px
;
max-width
:
200px
;
height
:
26px
;
line-height
:
26px
;
border-radius
:
4px
;
border
:
1px
solid
#e8e8ea
;
background
:
#fafbfe
;
text-align
:
center
;
font-size
:
14px
;
font-weight
:
400
;
color
:
#666666
;
max-width
:
245px
;
cursor
:
pointer
;
//
&:first-child{
//
margin-bottom
:
4px
;
//
}
}
.expande-button-wrap
{
position
:
absolute
;
right
:
0
;
bottom
:
0
;
.expande-button
{
color
:
$
btnBlue
;
cursor
:
pointer
;
i
{
height
:
8px
;
}
span
{
height
:
20px
;
font-size
:
14px
;
font-weight
:
400
;
color
:
$
btnBlue
;
line-height
:
20px
;
}
}
}
}
.close
{
overflow
:
hidden
;
height
:
65px
;
}
}
.role
{
::v-deep
.el-input--small,
.el-input__inner
{
width
:
423px
;
}
::v-deep
.container
{
position
:
relative
;
.tagTipMsg
{
position
:
absolute
;
display
:
inline-block
;
width
:
240px
;
left
:
200px
;
top
:
0
;
font-size
:
12px
;
font-weight
:
400
;
color
:
#999999
;
}
}
::v-deep
.el-select
>
.el-input--small
{
width
:
190px
;
}
::v-deep
.el-form-item--small
:nth-child
(
2
)
{
display
:
inline-block
;
width
:
310px
;
position
:
relative
;
}
.tagsWrap
{
display
:
flex
;
flex-wrap
:
wrap
;
align-content
:
flex-start
;
padding-top
:
3px
;
img
{
display
:
none
;
}
::v-deep
.tag
{
text-align
:
center
;
display
:
inline-block
;
padding
:
0
10px
;
min-width
:
68px
;
max-width
:
200px
;
margin-right
:
10px
;
margin-bottom
:
10px
;
height
:
26px
;
line-height
:
26px
;
background
:
#fafbfe
;
border-radius
:
4px
;
border
:
1px
solid
#e8e8ea
;
position
:
relative
;
box-sizing
:
border-box
;
/deep/.input-new-tag
{
//
position
:
relative
;
width
:
100%
;
}
.el-input--small
.el-input__inner
{
height
:
26px
;
line-height
:
26px
;
font-size
:
14px
;
}
.ellipsis-1
{
display
:
inline-block
;
width
:
100%
;
font-weight
:
400
;
color
:
#666666
;
font-size
:
14px
;
}
&
:hover
{
.editIcon
{
display
:
inline-block
;
cursor
:
pointer
;
position
:
absolute
;
top
:
-8px
;
right
:
-8px
;
//
z-index
:
9999
;
}
}
.el-input
{
max-width
:
200px
;
}
}
.inputWrapShow
{
//显示输入框时,不显示外面框的左右边距
padding
:
0
0
;
border
:
0
;
}
}
.row-tag
{
display
:
flex
;
&:not(:first-child)
{
margin-top
:
5px
;
}
align-items
:
center
;
.el-icon-circle-close
{
margin-left
:
15px
;
font-size
:
18px
;
color
:
#999999
;
cursor
:
pointer
;
}
}
.addtagIcon
{
width
:
75px
;
height
:
40px
;
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
color
:
$
btnBlue
;
cursor
:
pointer
;
i
{
font-size
:
20px
;
}
.addTagText
{
font-size
:
12px
;
}
}
}
}
</
style
>
vue.config.js
View file @
b2f6ad3
...
...
@@ -8,99 +8,92 @@ const baseUrl = '/'
const
resolve
=
dir
=>
path
.
join
(
__dirname
,
dir
)
const
CDN_DOMAIN
=
'https://img02.glsx.com.cn/'
const
cdn
=
{
css
:
[
`
${
CDN_DOMAIN
}
ajax/libs/element-ui/2.11.1/theme-chalk/index.css`
],
js
:
[
`
${
CDN_DOMAIN
}
ajax/libs/vue/2.6.11/vue.min.js`
,
`
${
CDN_DOMAIN
}
ajax/libs/vue-router/3.2.0/vue-router.min.js`
,
`
${
CDN_DOMAIN
}
ajax/libs/element-ui/2.11.1/index.js`
,
`
${
CDN_DOMAIN
}
ajax/libs/vuex/3.6.2/vuex.min.js`
,
// `${CDN_DOMAIN}ajax/libs/axios/0.21.0/axios.min.js`,
`
${
CDN_DOMAIN
}
ajax/libs/echarts/5.1.2/echarts.min.js`
]
css
:
[
`
${
CDN_DOMAIN
}
ajax/libs/element-ui/2.11.1/theme-chalk/index.css`
],
js
:
[
`
${
CDN_DOMAIN
}
ajax/libs/vue/2.6.11/vue.min.js`
,
`
${
CDN_DOMAIN
}
ajax/libs/vue-router/3.2.0/vue-router.min.js`
,
`
${
CDN_DOMAIN
}
ajax/libs/element-ui/2.11.1/index.js`
,
`
${
CDN_DOMAIN
}
ajax/libs/vuex/3.6.2/vuex.min.js`
,
// `${CDN_DOMAIN}ajax/libs/axios/0.21.0/axios.min.js`,
`
${
CDN_DOMAIN
}
ajax/libs/echarts/5.1.2/echarts.min.js`
]
}
module
.
exports
=
{
outputDir
:
`../dist/
${
packageName
}
`
,
publicPath
,
//node_env ? baseUrl : '/'
assetsDir
:
'static'
,
configureWebpack
:
{
resolve
:
{
alias
:
{
'@'
:
resolve
(
'src'
),
assets
:
resolve
(
'src/assets'
),
views
:
resolve
(
'src/views'
),
components
:
resolve
(
'src/components'
),
// 'jquery': 'jquery'
}
},
plugins
:
[
new
webpack
.
ProvidePlugin
({
$
:
'jquery'
,
// 创建 '$'、'jQuery'、'window.jQuery' 三个变量指向依赖jquery
jQuery
:
'jquery'
,
'window.jQuery'
:
'jquery'
})
],
output
:
{
library
:
`
${
packageName
}
-[name]`
,
libraryTarget
:
'umd'
,
// 把微应用打包成 umd 库格式
jsonpFunction
:
`webpackJsonp_
${
packageName
}
`
},
externals
:
{
'vue'
:
'Vue'
,
'element-ui'
:
'ELEMENT'
,
'vue-router'
:
'VueRouter'
,
'vuex'
:
'Vuex'
,
'axios'
:
'axios'
,
'echarts'
:
'echarts'
}
outputDir
:
`../dist/
${
packageName
}
`
,
publicPath
,
//node_env ? baseUrl : '/'
assetsDir
:
'static'
,
configureWebpack
:
{
resolve
:
{
alias
:
{
'@'
:
resolve
(
'src'
),
assets
:
resolve
(
'src/assets'
),
views
:
resolve
(
'src/views'
),
components
:
resolve
(
'src/components'
)
// 'jquery': 'jquery'
}
},
devServer
:
{
hot
:
true
,
disableHostCheck
:
true
,
host
:
process
.
env
.
VUE_APP_HOST
,
port
:
process
.
env
.
VUE_APP_PORT
,
headers
:
{
'Access-Control-Allow-Origin'
:
'*'
// 主应用获取子应用时跨域响应头
},
// proxy: {
// '/api': {
// target: 'http://rop-merchant.test.glsx.com.cn',
//
// changeOrigin: true,
//
// pathRewrite: {
// '^/api': '/'
// }
// },
// },
plugins
:
[
new
webpack
.
ProvidePlugin
({
$
:
'jquery'
,
// 创建 '$'、'jQuery'、'window.jQuery' 三个变量指向依赖jquery
jQuery
:
'jquery'
,
'window.jQuery'
:
'jquery'
})
],
output
:
{
library
:
`
${
packageName
}
-[name]`
,
libraryTarget
:
'umd'
,
// 把微应用打包成 umd 库格式
jsonpFunction
:
`webpackJsonp_
${
packageName
}
`
},
chainWebpack
:
config
=>
{
config
.
plugin
(
'html'
)
.
tap
(
args
=>
{
// args[0].minify.removeComments = false;
args
[
0
].
cdn
=
cdn
return
args
})
config
.
plugins
.
delete
(
'preload'
)
// TODO: need test
config
.
plugins
.
delete
(
'prefetch'
)
// TODO: need test
config
.
module
.
rule
(
'fonts'
)
.
test
(
/.
(
ttf|otf|eot|woff|woff2
)
$/
)
.
use
(
'url-loader'
)
.
loader
(
'url-loader'
)
.
tap
(
options
=>
{
options
=
{
// limit: 10000,
name
:
'/static/fonts/[name].[ext]'
}
return
options
})
.
end
()
externals
:
{
vue
:
'Vue'
,
'element-ui'
:
'ELEMENT'
,
'vue-router'
:
'VueRouter'
,
vuex
:
'Vuex'
,
axios
:
'axios'
,
echarts
:
'echarts'
}
},
devServer
:
{
hot
:
true
,
disableHostCheck
:
true
,
host
:
process
.
env
.
VUE_APP_HOST
,
port
:
process
.
env
.
VUE_APP_PORT
,
headers
:
{
'Access-Control-Allow-Origin'
:
'*'
// 主应用获取子应用时跨域响应头
}
}
\ No newline at end of file
// proxy: {
// '/api': {
// target: 'http://rop-merchant.test.glsx.com.cn',
//
// changeOrigin: true,
//
// pathRewrite: {
// '^/api': '/'
// }
// },
// },
},
chainWebpack
:
config
=>
{
config
.
plugin
(
'html'
).
tap
(
args
=>
{
// args[0].minify.removeComments = false;
args
[
0
].
cdn
=
cdn
return
args
})
config
.
plugins
.
delete
(
'preload'
)
// TODO: need test
config
.
plugins
.
delete
(
'prefetch'
)
// TODO: need test
config
.
module
.
rule
(
'fonts'
)
.
test
(
/.
(
ttf|otf|eot|woff|woff2
)
$/
)
.
use
(
'url-loader'
)
.
loader
(
'url-loader'
)
.
tap
(
options
=>
{
options
=
{
// limit: 10000,
name
:
'/static/fonts/[name].[ext]'
}
return
options
})
.
end
()
}
}
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