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 1cd0a5ee
authored
Nov 16, 2020
by
xinlaa
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
新建群发页面各弹窗组件抽离等
1 parent
46db8d18
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
496 additions
and
67 deletions
linkwe-ui/src/components/SelectMaterial/index.vue
linkwe-ui/src/components/SelectMaterial/list.vue
linkwe-ui/src/components/SelectTag.vue
linkwe-ui/src/components/SelectUser.vue
linkwe-ui/src/utils/request.js
linkwe-ui/src/views/groupMessage/add.vue
linkwe-ui/src/components/SelectMaterial/index.vue
0 → 100644
View file @
1cd0a5e
<
script
>
import
{
getList
}
from
'@/api/customer/tag'
import
list
from
'./list'
export
default
{
components
:
{
list
},
props
:
{
// 添加标签显隐
visible
:
{
type
:
Boolean
,
default
:
false
,
},
title
:
{
type
:
String
,
default
:
''
,
},
type
:
{
type
:
String
,
default
:
'0'
,
},
},
data
()
{
return
{
typeText
:
[
'文本'
,
'图片'
],
}
},
watch
:
{
type
(
val
)
{
val
===
'remove'
&&
(
this
.
removeTag
=
this
.
selected
.
slice
())
},
},
computed
:
{
Pvisible
:
{
get
()
{
// this.getTree();
return
this
.
visible
},
set
(
val
)
{
this
.
$emit
(
'update:visible'
,
val
)
},
},
Ptype
:
{
get
()
{
// this.getTree();
return
this
.
type
},
set
(
val
)
{
this
.
$emit
(
'update:type'
,
val
)
},
},
},
created
()
{},
mounted
()
{},
methods
:
{
submit
()
{
this
.
Pvisible
=
false
this
.
$emit
(
'success'
,
this
.
Pselected
)
},
},
}
</
script
>
<
template
>
<el-dialog
:title=
"`选择$
{typeText[Ptype]}素材`"
:visible.sync="Pvisible"
width="650px"
>
<div>
<el-tabs
v-model=
"Ptype"
>
<el-tab-pane
name=
"0"
>
<span
slot=
"label"
>
<i
class=
"el-icon-date"
></i>
文本
</span>
<list
type=
"4"
>
</list>
</el-tab-pane>
<el-tab-pane
name=
"1"
>
<span
slot=
"label"
>
<i
class=
"el-icon-date"
></i>
图片
</span>
<list
type=
"0"
>
</list>
</el-tab-pane>
<!--
<el-tab-pane
name=
"2"
>
<span
slot=
"label"
>
<i
class=
"el-icon-date"
></i>
文件
</span>
<list>
<el-table
:data=
"list"
style=
"width: 100%"
>
<el-table-column
width=
"50"
>
<template
slot-scope=
"scope"
>
<el-radio
v-model=
"radio"
:label=
"scope.row.id"
></el-radio>
</
template
>
</el-table-column>
<el-table-column
prop=
"content"
>
</el-table-column>
</el-table>
</list>
</el-tab-pane>
-->
</el-tabs>
</div>
<div
slot=
"footer"
>
<el-button
@
click=
"Pvisible = false"
>
取 消
</el-button>
<el-button
type=
"primary"
@
click=
"submit"
>
确 定
</el-button>
</div>
</el-dialog>
</template>
<
style
lang=
"scss"
scoped
>
.user-list
{
.el-row
{
line-height
:
26px
;
}
}
.mr30
{
margin-right
:
30px
;
}
</
style
>
linkwe-ui/src/components/SelectMaterial/list.vue
0 → 100644
View file @
1cd0a5e
<
script
>
import
{
getTree
,
getList
}
from
'@/api/material'
export
default
{
components
:
{},
props
:
{
type
:
{
type
:
String
,
default
:
'4'
,
},
},
data
()
{
return
{
loading
:
true
,
// 遮罩层
// 查询条件
query
:
{
pageNum
:
1
,
pageSize
:
10
,
categoryId
:
''
,
search
:
''
,
mediaType
:
'4'
,
},
list
:
[],
// 列表
total
:
0
,
// 总条数
treeData
:
[],
// 树
// 树props
treeProps
:
{
children
:
'children'
,
label
:
'name'
,
},
// 分组props
groupProps
:
{
// expandTrigger: 'hover',
checkStrictly
:
true
,
children
:
'children'
,
label
:
'name'
,
value
:
'id'
,
emitPath
:
false
,
},
radio
:
''
,
}
},
watch
:
{},
computed
:
{},
created
()
{
this
.
query
.
mediaType
=
this
.
type
this
.
getTree
()
this
.
getList
()
},
mounted
()
{},
methods
:
{
// 获取类目树
getTree
()
{
getTree
(
this
.
type
).
then
(({
data
})
=>
{
this
.
treeData
=
data
})
},
// 获取素材列表
getList
(
page
)
{
page
&&
(
this
.
query
.
pageNum
=
page
)
this
.
loading
=
true
getList
(
this
.
query
)
.
then
(({
rows
,
total
})
=>
{
this
.
list
=
rows
this
.
total
=
+
total
this
.
loading
=
false
this
.
$emit
(
'listChange'
,
this
.
list
)
})
.
catch
(()
=>
{
this
.
loading
=
false
})
},
},
}
</
script
>
<
template
>
<div>
<el-form
ref=
"form"
:model=
"query"
label-width=
"80px"
>
<el-form-item
label=
"选择分组"
>
<el-cascader
v-model=
"query.categoryId"
:options=
"treeData"
:props=
"groupProps"
></el-cascader>
<el-input
v-model=
"query.search"
class=
"ml10 mr10"
style=
"width: 150px;"
@
keydown
.
enter=
"getList(1)"
></el-input>
<el-button
v-hasPermi=
"['contacts:organization:query']"
icon=
"el-icon-search"
circle
@
click=
"getList(1)"
></el-button>
<el-pagination
class=
"fr"
@
current-change=
"getList"
:current-page=
"query.pageNum"
:page-size=
"query.pageSize"
layout=
"prev, pager, next"
:total=
"total"
></el-pagination>
</el-form-item>
</el-form>
<!--
<slot
:list=
"list"
></slot>
-->
<!-- 文本 -->
<el-table
v-if=
"type == 4"
:data=
"list"
:show-header=
"false"
>
<el-table-column
width=
"30"
>
<template
slot-scope=
"scope"
>
<el-radio
v-model=
"radio"
:label=
"scope.row.id"
>
'
</el-radio>
</
template
>
</el-table-column>
<el-table-column
prop=
"content"
>
</el-table-column>
</el-table>
<!-- 图片 -->
<el-radio-group
v-if=
"type == 0"
class=
"img-wrap"
v-model=
"radio"
>
<el-radio
v-for=
"(item, index) in list"
:label=
"item.id"
:key=
"index"
>
<img
class=
"img-li"
:src=
"item.materialUrl"
alt
/>
</el-radio>
</el-radio-group>
</div>
</template>
<
style
lang=
"scss"
scoped
>
.img-wrap
{
/deep/.el-radio__input
{
position
:
absolute
;
left
:
50%
;
top
:
50%
;
transform
:
translate
(
-50%
,
-50%
);
}
}
//
.img-li
{
//
width
:
115px
;
//
height
:
160px
;
//
}
</
style
>
linkwe-ui/src/components/SelectTag.vue
View file @
1cd0a5e
...
...
@@ -90,7 +90,7 @@ export default {
<el-checkbox-group
v-model=
"Pselected"
v-if=
"type !== 'remove'"
>
<template
v-for=
"(item, index) in list"
>
<div
class=
"bfc-d"
class=
"bfc-d
mr30
"
v-show=
"item.groupId === selectedGroup || !selectedGroup"
:key=
"index"
>
...
...
@@ -129,4 +129,7 @@ export default {
line-height
:
26px
;
}
}
.mr30
{
margin-right
:
30px
;
}
</
style
>
linkwe-ui/src/components/SelectUser.vue
View file @
1cd0a5e
<
script
>
import
*
as
api
from
"@/api/organization"
;
import
{
getTree
,
getList
}
from
'@/api/organization'
import
{
createUniqueString
}
from
'@/utils'
export
default
{
name
:
"SelectUser"
,
name
:
'SelectUser'
,
components
:
{},
props
:
{
// 添加标签显隐
...
...
@@ -12,34 +12,40 @@ export default {
},
title
:
{
type
:
String
,
default
:
"选择成员"
,
default
:
'选择成员'
,
},
// 是否 只选择叶子节点(人员节点)/禁止选择父节点(部门节点)
isOnlyLeaf
:
{
type
:
Boolean
,
default
:
true
,
},
},
data
()
{
let
isOnlyLeaf
=
this
.
isOnlyLeaf
return
{
treeData
:
[],
userList
:
[],
defaultProps
:
{
label
:
"name"
,
children
:
"children"
,
label
:
'name'
,
children
:
'children'
,
disabled
(
data
,
node
)
{
return
!
data
.
userId
;
return
isOnlyLeaf
&&
!
data
.
userId
},
isLeaf
(
data
,
node
)
{
return
!!
data
.
userId
;
return
!!
data
.
userId
},
},
}
;
}
},
watch
:
{},
computed
:
{
Pvisible
:
{
get
()
{
// this.getTree();
return
this
.
visible
;
return
this
.
visible
},
set
(
val
)
{
this
.
$emit
(
"update:visible"
,
val
);
this
.
$emit
(
'update:visible'
,
val
)
},
},
},
...
...
@@ -48,36 +54,46 @@ export default {
methods
:
{
loadNode
(
node
,
resolve
)
{
if
(
node
.
level
===
0
)
{
this
.
userList
=
[];
api
.
getTree
().
then
(({
data
})
=>
{
let
_data
=
this
.
handleTree
(
data
);
resolve
(
_data
);
this
.
userList
=
[]
getTree
().
then
(({
data
})
=>
{
data
.
forEach
((
element
)
=>
{
element
.
key
=
createUniqueString
()
})
let
_data
=
this
.
handleTree
(
data
)
console
.
log
(
'd'
,
data
)
resolve
(
_data
)
// api.getList({ department: _data[0].id }).then(({ rows, total }) => {
// _data && rows.unshift(..._data);
// resolve(rows);
// });
})
;
})
}
else
{
api
.
getList
({
department
:
node
.
data
.
id
}).
then
(({
rows
,
total
})
=>
{
node
.
data
.
children
&&
rows
.
push
(...
node
.
data
.
children
);
resolve
(
rows
);
});
getList
({
department
:
node
.
data
.
id
}).
then
(({
rows
})
=>
{
rows
.
forEach
((
element
)
=>
{
element
.
key
=
createUniqueString
()
})
node
.
data
.
children
&&
rows
.
push
(...
node
.
data
.
children
)
resolve
(
rows
)
})
}
},
handleCheckChange
(
data
,
checked
,
indeterminate
)
{
checked
?
this
.
userList
.
push
(
data
)
:
this
.
userList
.
splice
(
this
.
userList
.
indexOf
(
data
),
1
)
;
:
this
.
userList
.
splice
(
this
.
userList
.
indexOf
(
data
),
1
)
// console.log(data, checked, indeterminate);
},
submit
()
{
this
.
Pvisible
=
false
;
this
.
$emit
(
"success"
,
this
.
userList
);
this
.
Pvisible
=
false
this
.
$emit
(
'success'
,
this
.
userList
)
},
cancle
(
key
)
{
this
.
$refs
.
tree
.
setChecked
(
key
,
false
)
},
};
},
}
</
script
>
setChecked
<
template
>
<el-dialog
:title=
"title"
:visible
.
sync=
"Pvisible"
>
<el-row
:gutter=
"20"
>
...
...
@@ -87,14 +103,16 @@ export default {
<!--
<div>
部门架构
</div>
-->
<!-- :filter-node-method="filterNode" -->
<el-tree
v-if=
"Pvisible
"
node-key=
"key
"
ref=
"tree"
lazy
accordion
show-checkbox
check-on-click-node
:expand-on-click-node=
"true"
:load=
"loadNode"
:props=
"defaultProps"
:check-strictly=
"!isOnlyLeaf"
@
check-change=
"handleCheckChange"
></el-tree>
</div>
...
...
@@ -104,7 +122,12 @@ export default {
<el-row
:gutter=
"10"
>
选择人员列表
</el-row>
<el-row
v-for=
"(item, index) in userList"
:key=
"index"
>
<i
class=
"el-icon-user-solid"
></i>
{{
item
.
name
}}
{{
item
.
name
}}
<i
class=
"el-icon-minus fr cp"
title=
"取消选择"
@
click=
"cancle(item.key)"
></i>
</el-row>
</el-col>
</el-row>
...
...
linkwe-ui/src/utils/request.js
View file @
1cd0a5e
...
...
@@ -38,16 +38,19 @@ service.interceptors.response.use(
if
(
code
===
200
)
{
return
res
.
data
}
else
if
(
code
===
401
)
{
// MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', {
// confirmButtonText: '重新登录',
// cancelButtonText: '取消',
// type: 'warning'
// }
// ).then(() => {
// store.dispatch('LogOut').then(() => {
// location.href = '/index';
// })
// })
MessageBox
.
confirm
(
'登录状态已过期,您可以继续留在该页面,或者重新登录'
,
'系统提示'
,
{
confirmButtonText
:
'重新登录'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
,
}
).
then
(()
=>
{
store
.
dispatch
(
'LogOut'
).
then
(()
=>
{
location
.
href
=
'/'
})
})
}
else
if
(
code
===
500
)
{
Message
({
message
:
msg
,
...
...
linkwe-ui/src/views/groupMessage/add.vue
View file @
1cd0a5e
<
script
>
import
{
add
}
from
'@/api/groupMessage'
import
PhoneDialog
from
'@/components/PhoneDialog'
import
SelectUser
from
'@/components/SelectUser'
import
SelectTag
from
'@/components/SelectTag'
import
SelectMaterial
from
'@/components/SelectMaterial/index'
export
default
{
components
:
{
PhoneDialog
},
components
:
{
PhoneDialog
,
SelectTag
,
SelectUser
,
SelectMaterial
},
props
:
{},
data
()
{
return
{
// 表单参数
form
:
{},
statusOptions
:
[
form
:
{
pushType
:
'0'
,
pushRange
:
'0'
,
toUser
:
[],
toParty
:
[],
toTag
:
[],
},
userParty
:
[],
rules
:
{},
statusOptions
:
Object
.
freeze
([
{
label
:
'发送给客户'
,
value
:
'0'
},
{
label
:
'发送给客户群'
,
value
:
'1'
},
],
activeName
:
'second'
,
]),
activeName
:
'0'
,
dialogVisibleSelectCustomer
:
false
,
dialogVisibleSelectUser
:
false
,
dialogVisibleSelectTag
:
false
,
dialogVisibleSelectMaterial
:
false
,
}
},
watch
:
{},
computed
:
{},
computed
:
{
selectedText
()
{
return
`将发送消息给
${
this
.
userParty
[
0
]
?
this
.
userParty
[
0
]
+
'等部门或成员'
:
''
}
的
$
{
this
.
form
.
toTag
[
0
]
&&
this
.
form
.
pushType
==
0
?
'满足'
+
this
.
form
.
toTag
[
0
]
+
'等标签的'
:
''
}
$
{
this
.
form
.
pushType
==
0
?
'客户'
:
'客户群'
}
`
},
},
created
()
{},
mounted
()
{},
methods
:
{
handleClick
(
tab
,
event
)
{
console
.
log
(
tab
,
event
)
// 显示选择客户范围弹窗
showRangeDialog
()
{
this
[
this
.
form
.
pushType
==
0
?
'dialogVisibleSelectCustomer'
:
'dialogVisibleSelectUser'
]
=
true
},
// 选择添加人确认按钮
selectedUser
(
data
)
{
this
.
userParty
=
data
},
// 选择标签确认按钮
submitSelectTag
(
data
)
{
this
.
form
.
toTag
=
data
},
// 新建素材按钮
goRoute
()
{
let
contentType
=
[
'text'
,
'image'
,
'file'
]
window
.
open
(
'#/material/'
+
contentType
[
this
.
activeName
])
},
// 选择素材确认按钮
submitSelectMaterial
()
{},
},
}
</
script
>
<
template
>
<div
class=
"app-container"
>
<el-card
shadow=
"never"
:body-style=
"
{ padding: '40px 20px 20px' }">
<div>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
label-width=
"80px"
>
<el-form-item
label=
"群发类型"
prop=
"postNam
e"
>
<el-form-item
label=
"群发类型"
prop=
"pushTyp
e"
>
<el-radio-group
v-model=
"form.pushType"
>
<el-radio
v-for=
"dict in statusOptions"
...
...
@@ -42,10 +86,13 @@ export default {
>
</el-radio-group>
</el-form-item>
<el-form-item
label=
"发送范围"
prop=
"postCode"
>
<el-button
type=
"primary"
size=
"mini"
>
选择发送客户
</el-button>
<el-form-item
label=
"发送范围"
prop=
"pushRange"
>
<el-button
type=
"text"
@
click=
"showRangeDialog()"
>
{{
form
.
pushType
==
0
?
'选择发送客户'
:
'按群主选择客户群'
}}
</el-button>
<span
v-show=
"userParty[0] || form.toTag[0]"
>
{{
selectedText
}}
</span>
</el-form-item>
<el-form-item
label=
"发送时间"
prop=
"postSort
"
>
<el-form-item
label=
"发送时间"
prop=
"settingTime
"
>
<el-date-picker
v-model=
"form.settingTime"
style=
"width: 240px"
...
...
@@ -53,31 +100,36 @@ export default {
type=
"datetime"
placeholder=
"选择日期时间"
></el-date-picker>
<span
>
设置时间定时发送,不设置立即发送
</span>
<span
class=
"small-tip"
>
设置时间定时发送,不设置立即发送
</span>
</el-form-item>
<el-form-item
label=
" "
>
<div
class=
"flex content-wrap"
>
<div
class=
"content-left"
>
<el-button
class=
"create"
size=
"mini
"
>
新建素材
</el-button>
<el-tabs
v-model=
"activeName"
@
tab-click=
"handleClick
"
>
<el-tab-pane
name=
"first
"
>
<el-button
class=
"create"
@
click=
"goRoute
"
>
新建素材
</el-button>
<el-tabs
v-model=
"activeName
"
>
<el-tab-pane
name=
"0
"
>
<span
slot=
"label"
>
<i
class=
"el-icon-date"
></i>
文本
</span>
<el-input
v-model=
"form.messageJson"
type=
"textarea"
:autosize=
"
{ minRows: 2, maxRows: 50 }"
maxlength=
"220"
show-word-limit
:autosize=
"
{ minRows: 10, maxRows: 50 }"
placeholder="请输入"
>
</el-input>
</el-tab-pane>
<el-tab-pane
label=
"角色管理"
name=
"third
"
>
<el-tab-pane
name=
"1
"
>
<span
slot=
"label"
>
<i
class=
"el-icon-date"
></i>
图片
</span>
角色管理
</el-tab-pane>
<el-tab-pane
label=
"定时任务补偿"
name=
"fourth
"
>
<el-tab-pane
name=
"2
"
>
<span
slot=
"label"
>
<i
class=
"el-icon-date"
></i>
文件
</span>
定时任务补偿
</el-tab-pane>
<el-button
type=
"primary"
class=
"mt20"
>
从素材库选择
</el-button>
<el-button
type=
"primary"
class=
"mt20"
@
click=
"dialogVisibleSelectMaterial = true"
>
从素材库选择
</el-button
>
<!--
<el-tab-pane
label=
"配置管理"
name=
"second"
>
<span
slot=
"label"
>
<i
class=
"el-icon-date"
></i>
网页
</span>
配置管理
...
...
@@ -88,21 +140,102 @@ export default {
定时任务补偿
</el-tab-pane>
-->
</el-tabs>
<div
class=
"mt15"
>
<el-button
type=
"primary"
>
通知成员发送
</el-button>
<span>
通知成员,向选中的客户发送以上企业消息
</span>
<span
class=
"small-tip"
>
通知成员,向选中的客户发送以上企业消息
</span
>
<i
class=
"el-icon-edit"
></i>
</div>
</div>
<!-- 预览 -->
<PhoneDialog
:message=
"form.messageJson || '请输入欢迎语'"
></PhoneDialog>
</div>
</el-form-item>
</el-form>
<PhoneDialog
:message=
"form.messageJson"
></PhoneDialog>
<!-- 选择发送客户弹窗 -->
<el-dialog
title=
"选择发送客户"
:visible
.
sync=
"dialogVisibleSelectCustomer"
>
<el-form
:model=
"form"
label-width=
"80px"
>
<el-form-item
label=
"发送消息"
>
<el-radio-group
v-model=
"form.pushRange"
>
<el-radio
label=
"0"
>
全部客户
</el-radio>
<el-radio
label=
"1"
>
按条件筛选客户
</el-radio>
</el-radio-group>
</el-form-item>
<div
v-show=
"form.pushRange == 1"
>
<el-form-item
label=
"添加人"
>
<div
class=
"input-wrap"
@
click=
"dialogVisibleSelectUser = true"
>
<span
class=
"placeholder"
v-if=
"!userParty.length"
>
请选择
</span>
<template
v-else
>
<el-tag
type=
"info"
v-for=
"(unit, unique) in userParty"
:key=
"unique"
>
{{
unit
.
name
}}
</el-tag
>
</
template
>
</div>
</el-form-item>
<el-form-item
label=
"标签"
>
<div
class=
"input-wrap"
@
click=
"dialogVisibleSelectTag = true"
>
<span
class=
"placeholder"
v-if=
"!form.toTag.length"
>
请选择
</span>
<
template
v-else
>
<el-tag
type=
"info"
v-for=
"(unit, unique) in form.toTag"
:key=
"unique"
>
{{
unit
.
name
}}
</el-tag
>
</
template
>
</div>
</el-form-item>
</div>
</el-form>
</el-card>
<div
slot=
"footer"
>
<el-button
@
click=
"dialogVisibleSelectCustomer = false"
>
取 消
</el-button
>
<el-button
type=
"primary"
@
click=
"dialogVisibleSelectCustomer = false"
>
确 定
</el-button
>
</div>
</el-dialog>
<!-- 选择添加人弹窗 -->
<SelectUser
:visible
.
sync=
"dialogVisibleSelectUser"
title=
"选择添加人"
:isOnlyLeaf=
"false"
@
success=
"selectedUser"
></SelectUser>
<!-- 选择标签弹窗 -->
<SelectTag
:visible
.
sync=
"dialogVisibleSelectTag"
title=
"选择标签"
:selected=
"form.toTag"
@
success=
"submitSelectTag"
>
</SelectTag>
<SelectMaterial
:visible
.
sync=
"dialogVisibleSelectMaterial"
:type=
"activeName"
@
success=
"submitSelectMaterial"
></SelectMaterial>
</div>
</template>
<
style
lang=
"scss"
scoped
>
.small-tip
{
font-size
:
12px
;
color
:
#999
;
margin-left
:
12px
;
}
.content-wrap
{
height
:
500px
;
align-items
:
stretch
;
...
...
@@ -114,7 +247,8 @@ export default {
.create
{
position
:
absolute
;
right
:
10px
;
top
:
16px
;
top
:
14px
;
z-index
:
1
;
}
}
...
...
@@ -127,4 +261,18 @@ export default {
.select
{
}
}
.input-wrap
{
width
:
240px
;
display
:
inline-flex
;
border-radius
:
4px
;
border
:
1px
solid
#dcdfe6
;
align-items
:
center
;
padding
:
0
15px
;
overflow
:
hidden
;
height
:
32px
;
.placeholder
{
color
:
#bbb
;
font-size
:
14px
;
}
}
</
style
>
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