Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
scrm-micro-settings
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 df356030
authored
May 18, 2022
by
匡雅琴
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'huy_dev_v2.3.0' of
http://192.168.3.233:8090/saas/scrm-micro-setti…
…ngs into huy_dev_v2.3.0
2 parents
a1da1263
95d23b6c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
156 additions
and
19 deletions
src/api/modules/employee.js
src/views/employee/index.vue
src/api/modules/employee.js
View file @
df35603
...
...
@@ -124,4 +124,26 @@ const updateStatusApi = params => {
})
}
export
default
{
getListApi
,
getAllMerchantListApi
,
getRoleListApi
,
getAllDictApi
,
getMerchantTreeApi
,
getDetailInfoApi
,
getDetailLogApi
,
addEmployeeApi
,
updateEmployeeApi
,
deleteEmployeeApi
,
exportEmployeeApi
,
updateStatusApi
}
// 批量更新员工角色
const
addStaffRoleBatch
=
params
=>
{
params
.
method
=
`
${
defaultPath
}
staff.addStaffRoleBatch`
return
http
({
url
:
'rop-merchants/router'
,
method
:
'POST'
,
data
:
params
,
sign
:
true
})
}
// 批量更新员工状态
const
updateStatusBatch
=
params
=>
{
params
.
method
=
`
${
defaultPath
}
staff.updateStatusBatch`
return
http
({
url
:
'rop-merchants/router'
,
method
:
'POST'
,
data
:
params
,
sign
:
true
})
}
export
default
{
getListApi
,
getAllMerchantListApi
,
getRoleListApi
,
getAllDictApi
,
getMerchantTreeApi
,
getDetailInfoApi
,
getDetailLogApi
,
addEmployeeApi
,
updateEmployeeApi
,
deleteEmployeeApi
,
exportEmployeeApi
,
updateStatusApi
,
addStaffRoleBatch
,
updateStatusBatch
}
src/views/employee/index.vue
View file @
df35603
...
...
@@ -14,12 +14,12 @@
<div
class=
"table-btn"
>
<el-button
@
click=
"handleExport"
:size=
"size"
type=
"primary"
plain
mode=
"el-button"
>
导出
</el-button>
<GLButton
@
click=
"handleExport"
fn=
"导出"
:size=
"size"
type=
"primary"
plain
mode=
"el-button"
>
导出
</GLButton>
<el-button
:size=
"size"
plain
@
click=
"batch(1)"
>
批量分配角色
</el-button>
<el-button
:size=
"size"
plain
@
click=
"batch(2)"
>
批量启用
</el-button>
<el-button
v-if=
"userInfo.accountLevel == 4"
:size=
"size"
plain
@
click=
"batch(1)"
>
批量分配角色
</el-button>
<el-button
v-if=
"userInfo.accountLevel == 4"
:size=
"size"
plain
@
click=
"batch(2)"
>
批量启用
</el-button>
</div>
</div>
<!-- 表格区域 开始 -->
<GLTable
ref=
"employeeRef"
:getListApi=
"getListApi"
:searchForm=
"tableSearchForm"
:tableParams=
"tableParams"
:pageConf=
"pageConf"
:beforeSearchFn=
"beforeSearchFn"
@
setTableFinishFun=
"setTableFinishFun"
@
paginationlisteners=
"paginationlisteners"
>
<GLTable
ref=
"employeeRef"
:getListApi=
"getListApi"
:searchForm=
"tableSearchForm"
:tableParams=
"
$globalState.session.accountLevel == 4 ? tableParams1 :
tableParams"
:pageConf=
"pageConf"
:beforeSearchFn=
"beforeSearchFn"
@
setTableFinishFun=
"setTableFinishFun"
@
paginationlisteners=
"paginationlisteners"
>
<div
slot=
"optionBtns"
slot-scope=
"scope"
>
<GLTableButton
:buttonList=
"buttonList"
:buttonItem=
"scope.scope"
></GLTableButton>
<!--
<el-button
type=
"text"
@
click=
"handleDetail(scope.scope)"
>
查看
</el-button>
...
...
@@ -44,8 +44,8 @@
</div>
<GLDialog
:visible=
"roleVisible"
:width=
"'720px'"
@
close=
"handleClose"
title=
"批量分配账号角色"
:showClose=
"true"
>
<el-form
:model=
"roleForm"
:rules=
"roleFormRules"
ref=
"roleForm"
label-width=
"200px"
>
<el-form-item
label=
"角色权限:"
prop=
"role
Auth
"
>
<el-select
style=
"width: 415px;"
:size=
"size"
v-model=
"roleForm.role
Auth
"
placeholder=
"请选择角色权限"
>
<el-form-item
label=
"角色权限:"
prop=
"role
Id
"
>
<el-select
style=
"width: 415px;"
:size=
"size"
v-model=
"roleForm.role
Id
"
placeholder=
"请选择角色权限"
>
<el-option
v-for=
"item in baseData.roleList"
:key=
"item.id"
:label=
"item.roleName"
:value=
"item.id"
></el-option>
</el-select>
</el-form-item>
...
...
@@ -145,6 +145,83 @@ export default {
tableParams
:
{
listName
:
'data'
,
tableOption
:
false
,
// mutiSelectName: 'employeeList',
// mutiSelectUniqueKey: 'id',
otherOptions
:
{
label
:
'启用开关'
},
tableColumns
:
[
{
label
:
'员工姓名'
,
prop
:
'staffName'
,
width
:
'200'
,
line
:
1
},
{
label
:
'员工企微号'
,
prop
:
'entmicroName'
,
line
:
1
,
width
:
'200'
,
formatter
:
cellValue
=>
{
return
cellValue
.
entmicroName
||
'-'
}
},
{
label
:
'角色'
,
prop
:
'roleName'
,
width
:
'200'
,
line
:
1
,
formatter
:
cellValue
=>
{
return
cellValue
.
roleName
||
'-'
}
},
{
label
:
'登录手机号'
,
prop
:
'staffPhone'
,
width
:
'200'
},
{
label
:
'所属门店'
,
prop
:
'merchantName'
,
width
:
'350'
,
line
:
1
},
{
label
:
'所属企微'
,
prop
:
'belongingEntmicroName'
,
width
:
'200'
,
line
:
1
},
// {
// label: '状态',
// prop: 'statusName',
// width: '80px'
// },
{
label
:
'更新时间'
,
prop
:
'updatedTime'
,
line
:
1
,
minWidth
:
'200'
},
{
label
:
'启用开关'
,
prop
:
'otherOptions'
,
width
:
'120'
,
addHtml
:
'otherOptions'
,
fixed
:
'right'
},
{
label
:
'操作'
,
prop
:
'optionBtns'
,
width
:
'150'
,
addHtml
:
'optionBtns'
,
fixed
:
'right'
}
]
},
tableParams1
:
{
listName
:
'data'
,
tableOption
:
false
,
mutiSelectName
:
'employeeList'
,
mutiSelectUniqueKey
:
'id'
,
otherOptions
:
{
...
...
@@ -275,16 +352,14 @@ export default {
roleVisible
:
false
,
roleForm
:
{},
roleFormRules
:
{
role
Auth
:
[{
required
:
true
,
message
:
'请选择角色权限'
,
trigger
:
'change'
}]
role
Id
:
[{
required
:
true
,
message
:
'请选择角色权限'
,
trigger
:
'change'
}]
}
}
},
mounted
()
{
console
.
log
(
this
.
$refs
.
employeeRef
)
this
.
userInfo
=
this
.
$globalState
.
session
// 门店
if
(
this
.
userInfo
.
accountLevel
==
4
)
{
// this.searchFormData.splice(0, 1)
var
idx
=
this
.
tableParams
.
tableColumns
.
findIndex
(
item
=>
item
.
prop
==
'merchantName'
)
this
.
tableParams
.
tableColumns
.
splice
(
idx
,
1
)
this
.
searchFormData
[
0
].
isHide
=
true
...
...
@@ -455,9 +530,8 @@ export default {
})
},
batch
(
type
)
{
console
.
log
(
handleObj
[
type
]);
const
name
=
handleObj
[
type
]
const
selectArr
=
this
.
$refs
.
employeeRef
.
mutiSelectArr
[
this
.
tableParams
.
mutiSelectName
]
const
selectArr
=
this
.
$refs
.
employeeRef
.
mutiSelectArr
[
this
.
tableParams
1
.
mutiSelectName
]
if
(
!
selectArr
.
length
)
{
return
this
.
$message
.
error
(
'您未选中需要批量操作的员工。'
)
}
...
...
@@ -473,34 +547,75 @@ export default {
this
.
roleVisible
=
true
}
}
else
if
(
name
==
'启用'
)
{
this
.
$confirm
(
`是否将选中的账号批量进行启用?`
,
''
,
{
const
hasNoRole
=
selectArr
.
some
(
item
=>
!
item
.
roleName
)
if
(
hasNoRole
)
{
this
.
$message
.
error
(
'您选中的员工中包含未设置“角色”账号,请去除选中未设置“角色”员工账号。'
)
}
else
{
this
.
$confirm
(
`是否将选中的账号批量进行启用?`
,
''
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
}).
then
(()
=>
{
console
.
log
(
'点击了确定'
)
this
.
$refs
.
employeeRef
.
refreshTable
(
false
)
const
list
=
selectArr
.
map
(
item
=>
{
return
{
staffId
:
item
.
id
,
status
:
0
}
})
const
param
=
{
list
}
this
.
$apis
.
employee
.
updateStatusBatch
(
param
).
then
(
res
=>
{
if
(
res
)
{
this
.
$message
.
success
(
'操作成功'
)
this
.
$refs
.
employeeRef
.
refreshTable
(
false
)
}
else
{
this
.
$message
.
error
(
'操作失败'
)
}
})
}).
catch
(()
=>
{
console
.
log
(
'点击了取消'
)
})
}
}
},
// 批量分配角色,确定按钮
handleAssign
()
{
console
.
log
(
this
.
roleForm
)
this
.
$refs
.
roleForm
.
validate
((
valid
)
=>
{
if
(
valid
)
{
this
.
roleVisible
=
false
setTimeout
(()
=>
{
this
.
roleForm
=
{}
this
.
$refs
.
employeeRef
.
refreshTable
(
false
)
const
{
roleId
}
=
this
.
roleForm
let
staffIds
=
this
.
$refs
.
employeeRef
.
mutiSelectArr
[
this
.
tableParams1
.
mutiSelectName
]
staffIds
=
staffIds
.
map
(
item
=>
item
.
id
)
// list = list.map(item => {
// return {
// staffId: item.id
// roleId,
// }
// })
const
param
=
{
roleId
,
staffIds
}
console
.
log
(
param
)
this
.
$apis
.
employee
.
addStaffRoleBatch
(
param
).
then
(
res
=>
{
console
.
log
(
res
)
if
(
res
)
{
this
.
$message
.
success
(
'操作成功'
)
this
.
roleVisible
=
false
this
.
roleForm
=
{}
this
.
$refs
.
employeeRef
.
refreshTable
(
false
)
}
else
{
this
.
$message
.
error
(
'操作失败'
)
}
})
}
})
},
handleClose
()
{
this
.
roleVisible
=
false
this
.
roleForm
=
{}
this
.
$refs
.
roleForm
.
resetFields
()
},
// 表格分页穿透事件
paginationlisteners
(
val
)
{
...
...
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