Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
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 217b2ad4
authored
Jan 17, 2023
by
姜鹏凯
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
标签组可更改
1 parent
796954e9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
178 additions
and
146 deletions
linkwe-pc/src/components/AddTag.vue
linkwe-pc/src/views/customerManage/tag/list.vue
linkwe-pc/src/components/AddTag.vue
View file @
217b2ad
...
...
@@ -19,7 +19,7 @@
})
}
},
data
()
{
data
()
{
return
{
// 添加标签输入框
newInput
:
''
,
...
...
@@ -35,7 +35,7 @@
watch
:
{},
computed
:
{
Pvisible
:
{
get
()
{
get
()
{
if
(
this
.
visible
)
{
this
.
$nextTick
(()
=>
{
this
.
$refs
[
'form'
].
clearValidate
()
...
...
@@ -43,15 +43,15 @@
}
return
this
.
visible
},
set
(
val
)
{
set
(
val
)
{
this
.
$emit
(
'update:visible'
,
val
)
}
}
},
created
()
{
},
mounted
()
{
},
created
()
{
},
mounted
()
{
},
methods
:
{
closeTag
(
tag
,
index
)
{
closeTag
(
tag
,
index
)
{
// if (tag.id) {
// tag.status = 1
// this.$forceUpdate()
...
...
@@ -60,13 +60,13 @@
// }
},
showInput
()
{
showInput
()
{
this
.
visibleAdd
=
true
this
.
$nextTick
((
_
)
=>
{
this
.
$refs
.
saveTagInput
.
$refs
.
input
.
focus
()
})
},
newInputConfirm
()
{
newInputConfirm
()
{
let
name
=
this
.
newInput
if
(
name
)
{
Array
.
isArray
(
this
.
form
.
weTags
)
||
(
this
.
form
.
weTags
=
[])
...
...
@@ -82,7 +82,7 @@
this
.
visibleAdd
=
false
this
.
newInput
=
''
},
submit
()
{
submit
()
{
if
(
!
this
.
visibleAdd
)
{
this
.
$refs
[
'form'
].
validate
((
valid
)
=>
{
this
.
newInput
=
''
...
...
@@ -96,26 +96,56 @@
this
.
$emit
(
'success'
)
})
})
}
}
}
}
}
</
script
>
<
template
>
<el-dialog
:title=
"(form.groupId ? '修改' : '添加') + '标签/组'"
:visible
.
sync=
"Pvisible"
width=
"500px"
append-to-body
:close-on-click-modal=
"false"
>
<el-dialog
:title=
"(form.groupId ? '修改' : '添加') + '标签/组'"
:visible
.
sync=
"Pvisible"
width=
"500px"
append-to-body
:close-on-click-modal=
"false"
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
label-width=
"100px"
>
<el-form-item
label=
"标签组名称"
prop=
"groupName"
>
<el-input
v-model
.
trim=
"form.groupName"
maxlength=
"15"
show-word-limit
placeholder=
"请输入标签组名称,该名称不支持再次修改"
:disabled=
"!!form.groupId"
/>
<el-input
v-model
.
trim=
"form.groupName"
maxlength=
"15"
show-word-limit
placeholder=
"请输入标签组名称,该名称不支持再次修改"
/>
</el-form-item>
<el-form-item
label=
"标签"
prop=
"weTags"
>
<template
v-for=
"(item, index) in form.weTags"
>
<el-tag
v-if=
"item.status !== 1"
type=
"primary"
closable
size=
"medium"
:key=
"index"
@
close=
"closeTag(item, index)"
>
<el-tag
v-if=
"item.status !== 1"
type=
"primary"
closable
size=
"medium"
:key=
"index"
@
close=
"closeTag(item, index)"
>
{{
item
.
name
}}
</el-tag>
</
template
>
<el-input
class=
"input-new-tag"
v-if=
"visibleAdd"
v-model
.
trim=
"newInput"
ref=
"saveTagInput"
size=
"mini"
maxlength=
"10"
show-word-limit
@
keyup
.
enter
.
native=
"newInputConfirm"
@
blur=
"newInputConfirm"
></el-input>
<el-button
v-else
type=
"primary"
plain
class=
"button-new-tag"
size=
"mini"
@
click=
"showInput"
>
+ 添加标签
</el-button>
<el-input
class=
"input-new-tag"
v-if=
"visibleAdd"
v-model
.
trim=
"newInput"
ref=
"saveTagInput"
size=
"mini"
maxlength=
"10"
show-word-limit
@
keyup
.
enter
.
native=
"newInputConfirm"
@
blur=
"newInputConfirm"
></el-input>
<el-button
v-else
type=
"primary"
plain
class=
"button-new-tag"
size=
"mini"
@
click=
"showInput"
>
+ 添加标签
</el-button
>
</el-form-item>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
...
...
linkwe-pc/src/views/customerManage/tag/list.vue
View file @
217b2ad
<
script
>
import
*
as
api
from
'@/api/customer/tag'
import
AddTag
from
'@/components/AddTag'
import
*
as
api
from
'@/api/customer/tag'
import
AddTag
from
'@/components/AddTag'
export
default
{
name
:
'GroupTag'
,
components
:
{
AddTag
},
props
:
{
// "标签分组类型(1:客户标签;2:群标签)"
type
:
{
type
:
String
,
default
:
'1'
}
},
data
()
{
return
{
query
:
{
pageNum
:
1
,
pageSize
:
10
,
groupTagType
:
this
.
type
},
// 遮罩层
loading
:
false
,
dialogVisible
:
false
,
// 表单参数
form
:
{
groupName
:
''
,
weTags
:
[]
},
// 添加标签输入框
newInput
:
''
,
// 添加标签显隐
newInputVisible
:
false
,
// 表单验证规则
rules
:
Object
.
freeze
({
groupName
:
[{
required
:
true
,
message
:
'必填项'
,
trigger
:
'blur'
}]
}),
// 选中数组
ids
:
[],
// 非多个禁用
multiple
:
true
,
// 总条数
total
:
0
,
// 表格数据
list
:
[],
lastSyncTime
:
0
}
},
computed
:
{},
created
()
{
// this.query.groupTagType = this.type
this
.
getList
()
},
methods
:
{
getList
(
page
)
{
page
&&
(
this
.
query
.
pageNum
=
page
)
this
.
loading
=
true
api
.
getList
(
this
.
query
)
.
then
(({
rows
,
total
,
lastSyncTime
})
=>
{
this
.
list
=
rows
this
.
total
=
+
total
this
.
lastSyncTime
=
lastSyncTime
this
.
loading
=
false
})
.
catch
(()
=>
{
this
.
loading
=
false
})
export
default
{
name
:
'GroupTag'
,
components
:
{
AddTag
},
props
:
{
// "标签分组类型(1:客户标签;2:群标签)"
type
:
{
type
:
String
,
default
:
'1'
}
},
edit
(
data
,
type
)
{
this
.
form
=
JSON
.
parse
(
JSON
.
stringify
(
Object
.
assign
({
groupTagType
:
this
.
type
,
weTags
:
[]
},
data
||
{}))
)
this
.
dialogVisible
=
true
data
()
{
return
{
query
:
{
pageNum
:
1
,
pageSize
:
10
,
groupName
:
''
,
groupTagType
:
this
.
type
},
// 遮罩层
loading
:
false
,
dialogVisible
:
false
,
// 表单参数
form
:
{
groupName
:
''
,
weTags
:
[]
},
// 添加标签输入框
newInput
:
''
,
// 添加标签显隐
newInputVisible
:
false
,
// 表单验证规则
rules
:
Object
.
freeze
({
groupName
:
[{
required
:
true
,
message
:
'必填项'
,
trigger
:
'blur'
}]
}),
// 选中数组
ids
:
[],
// 非多个禁用
multiple
:
true
,
// 总条数
total
:
0
,
// 表格数据
list
:
[],
lastSyncTime
:
0
}
},
syncTag
()
{
const
loading
=
this
.
$loading
({
lock
:
true
,
text
:
'Loading'
,
spinner
:
'el-icon-loading'
,
background
:
'rgba(0, 0, 0, 0.7)'
})
api
.
syncTag
()
.
then
(()
=>
{
loading
.
close
()
this
.
msgSuccess
(
'后台开始同步数据,请稍后关注进度'
)
this
.
getList
()
})
.
catch
(()
=>
{
loading
.
close
()
})
computed
:
{},
created
()
{
// this.query.groupTagType = this.type
this
.
getList
()
},
// 多选框选中数据
handleSelectionChange
(
selection
)
{
this
.
ids
=
selection
.
map
((
item
)
=>
item
.
groupId
)
this
.
multiple
=
!
selection
.
length
},
/** 删除按钮操作 */
remove
(
id
)
{
const
operIds
=
id
||
this
.
ids
+
''
this
.
$confirm
(
'是否确认删除吗?'
,
'警告'
,
{
type
:
'warning'
})
.
then
(
function
()
{
return
api
.
remove
(
operIds
)
methods
:
{
resetQuery
()
{
this
.
query
.
groupName
=
''
this
.
getList
(
1
)
},
getList
(
page
)
{
page
&&
(
this
.
query
.
pageNum
=
page
)
this
.
loading
=
true
api
.
getList
(
this
.
query
)
.
then
(({
rows
,
total
,
lastSyncTime
})
=>
{
this
.
list
=
rows
this
.
total
=
+
total
this
.
lastSyncTime
=
lastSyncTime
this
.
loading
=
false
})
.
catch
(()
=>
{
this
.
loading
=
false
})
},
edit
(
data
,
type
)
{
this
.
form
=
JSON
.
parse
(
JSON
.
stringify
(
Object
.
assign
({
groupTagType
:
this
.
type
,
weTags
:
[]
},
data
||
{})))
this
.
dialogVisible
=
true
},
syncTag
()
{
const
loading
=
this
.
$loading
({
lock
:
true
,
text
:
'Loading'
,
spinner
:
'el-icon-loading'
,
background
:
'rgba(0, 0, 0, 0.7)'
})
.
then
(()
=>
{
this
.
getList
()
this
.
msgSuccess
(
'删除成功'
)
api
.
syncTag
()
.
then
(()
=>
{
loading
.
close
()
this
.
msgSuccess
(
'后台开始同步数据,请稍后关注进度'
)
this
.
getList
()
})
.
catch
(()
=>
{
loading
.
close
()
})
},
// 多选框选中数据
handleSelectionChange
(
selection
)
{
this
.
ids
=
selection
.
map
((
item
)
=>
item
.
groupId
)
this
.
multiple
=
!
selection
.
length
},
/** 删除按钮操作 */
remove
(
id
)
{
const
operIds
=
id
||
this
.
ids
+
''
this
.
$confirm
(
'是否确认删除吗?'
,
'警告'
,
{
type
:
'warning'
})
.
then
(
function
()
{
return
api
.
remove
(
operIds
)
})
.
then
(()
=>
{
this
.
getList
()
this
.
msgSuccess
(
'删除成功'
)
})
}
}
}
}
</
script
>
<
template
>
<div
class=
""
>
<div
class=
"mid-action"
>
<div>
<!-- v-hasPermi="['customerManage:tag:add']" -->
<el-button
type=
"primary"
class=
"mr10"
@
click=
"edit()"
>
新建标签组
</el-button
>
<el-form
:inline=
"true"
label-width=
"0"
label-position=
"left"
>
<el-form-item
label=
""
>
<el-input
v-model=
"query.groupName"
placeholder=
"请输入标签组名称"
clearable
@
keyup
.
enter
.
native=
"getList(1)"
/>
</el-form-item>
<el-form-item
label-width=
"0"
>
<el-button
type=
"primary"
@
click=
"getList(1)"
>
查询
</el-button>
<el-button
@
click=
"resetQuery"
type=
"info"
plain
>
清空
</el-button>
</el-form-item>
</el-form>
</div>
<div
class=
"mid-action"
>
<div>
<!-- v-hasPermi="['customerManage:tag:add']" -->
<el-button
type=
"primary"
class=
"mr10"
@
click=
"edit()"
>
新建标签组
</el-button>
<ButtonSync
v-if=
"type == 1"
:lastSyncTime=
"lastSyncTime"
@
click=
"syncTag"
>
同步企微标签
</ButtonSync>
</div>
<div>
<!-- v-hasPermi="['customerManage:tag:remove']" -->
<el-button
:disabled=
"!ids.length"
type=
"danger"
@
click=
"remove()"
>
批量删除
</el-button
>
<!-- v-hasPermi="['customerManage:tag:remove']" -->
<el-button
:disabled=
"!ids.length"
type=
"danger"
@
click=
"remove()"
>
批量删除
</el-button>
</div>
</div>
...
...
@@ -168,18 +178,10 @@ export default {
</el-table-column>
-->
<el-table-column
label=
"操作"
align=
"center"
class-name=
"small-padding fixed-width"
>
<
template
slot-scope=
"scope"
>
<!-- v-hasPermi="['customerManage:tag:edit']" -->
<el-button
type=
"text"
@
click=
"edit(scope.row, scope.index)"
>
编辑
</el-button
>
<el-button
@
click=
"remove(scope.row.groupId)"
type=
"text"
>
删除
</el-button
>
<!-- v-hasPermi="['customerManage:tag:remove']" -->
<!-- v-hasPermi="['customerManage:tag:edit']" -->
<el-button
type=
"text"
@
click=
"edit(scope.row, scope.index)"
>
编辑
</el-button>
<el-button
@
click=
"remove(scope.row.groupId)"
type=
"text"
>
删除
</el-button>
<!-- v-hasPermi="['customerManage:tag:remove']" -->
</
template
>
</el-table-column>
</el-table>
...
...
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