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 f09a265e
authored
Jun 17, 2022
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
新建员工创建角色交互修改
1 parent
f37e5094
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
207 additions
and
7 deletions
src/assets/css/demo.scss
src/views/employee/components/createRole.vue
src/views/employee/components/selectProduct.vue
src/views/employee/editEmployee.vue
src/assets/css/demo.scss
View file @
f09a265
...
@@ -34,4 +34,8 @@
...
@@ -34,4 +34,8 @@
img
{
img
{
width
:
64px
;
width
:
64px
;
}
}
}
.message-z
{
z-index
:
9999
!
important
;
}
}
\ No newline at end of file
\ No newline at end of file
src/views/employee/components/createRole.vue
0 → 100644
View file @
f09a265
<!--
* @Description:
* @Author: huyue
* @Date: 2022-06-10 15:36:06
* @LastEditors: huyue
* @LastEditTime: 2022-06-17 16:39:38
-->
<
template
>
<div>
<GLDialog
:width=
"'1080px'"
:visible=
"roleVisible"
:close-on-click-modal=
"false"
@
close=
"handleClose"
title=
"创建角色"
:showClose=
"true"
>
<el-form
:model=
"ruleForm"
:rules=
"rules"
ref=
"ruleForm"
label-width=
"100px"
class=
"demo-ruleForm"
>
<el-form-item
class=
"aa"
v-if=
"$globalState.session.accountLevel != 4"
label=
"所属商户"
prop=
"merchantId"
>
<el-select
size=
"small"
style=
"width: 40%"
v-model=
"ruleForm.merchantId"
clearable
filterable
placeholder=
"请选择"
@
change=
"merchantChange"
>
<el-option
v-for=
"item in merchantList"
:key=
"item.id"
:label=
"item.merchantName"
:value=
"item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label=
"所属商户"
prop=
"merchantName"
v-else
>
<span>
{{
$globalState
.
session
.
merchantName
}}
</span>
</el-form-item>
<el-form-item
label=
"角色名称"
prop=
"roleName"
>
<el-input
size=
"small"
maxlength=
"20"
style=
"width: 40%; padding-right: 50px"
@
input=
"changeInput"
v-model=
"ruleForm.roleName"
placeholder=
"请输入角色名称"
></el-input>
</el-form-item>
<el-form-item
label=
"角色说明"
prop=
"roleDesc"
>
<el-input
size=
"small"
maxlength=
"50"
style=
"width: 40%; padding-right: 50px"
@
input=
"changeInput"
v-model=
"ruleForm.roleDesc"
placeholder=
"请输入角色说明"
></el-input>
</el-form-item>
<el-form-item
label=
"角色权限"
prop=
"roleAuth"
>
<el-checkbox-group
v-model=
"ruleForm.roleAuth"
>
<el-checkbox
v-for=
"(itm, idx) in accountListSelect"
:label=
"itm.accounttypeName"
@
change=
"selectCurAccount(itm, idx)"
:key=
"idx"
>
{{
itm
.
accounttypeName
}}
</el-checkbox>
</el-checkbox-group>
<SelectProduct
ref=
"productFrom"
:roleType=
"true"
title=
"角色权限"
></SelectProduct>
</el-form-item>
</el-form>
<div
slot=
"footer"
>
<el-button
:size=
"size"
@
click=
"handleClose"
>
取消
</el-button>
<el-button
:size=
"size"
type=
"primary"
@
click=
"toCreateRole"
>
提交
</el-button>
</div>
</GLDialog>
</div>
</
template
>
<
script
>
import
SelectProduct
from
'./selectProduct'
export
default
{
name
:
'CreateRole'
,
components
:
{
SelectProduct
},
data
()
{
return
{
roleVisible
:
false
,
ruleForm
:
{
merchantId
:
''
,
roleName
:
''
,
roleDesc
:
''
,
roleAuth
:
''
},
rules
:
{
roleName
:
[{
required
:
true
,
message
:
'请输入角色名称'
,
trigger
:
'blur'
}],
merchantId
:
[{
required
:
true
,
message
:
'请选择所属商户'
,
trigger
:
'change'
}],
roleAuth
:
[{
required
:
true
,
message
:
'请选择角色权限'
,
trigger
:
'change'
}]
},
//商户下拉框
merchantList
:
[],
accountListSelect
:
[],
rootList
:
[]
}
},
methods
:
{
init
()
{
this
.
roleVisible
=
true
this
.
getMerchantName
()
},
handleClose
()
{
this
.
roleVisible
=
false
},
getMerchantName
()
{
this
.
$apis
.
role
.
merchantDataList
({
source
:
'glsx'
}).
then
(
res
=>
{
this
.
merchantList
=
res
if
(
this
.
$globalState
.
session
.
accountLevel
==
4
)
{
this
.
ruleForm
.
merchantId
=
this
.
merchantList
[
0
].
id
this
.
selectMerchant
(
this
.
merchantList
[
0
].
id
)
}
// this.filterList()
})
},
// 选择商户----获取权限
async
selectMerchant
(
id
,
list
)
{
let
res
=
await
this
.
$refs
.
productFrom
.
findMenuFunTreeByMerId
({
id
})
console
.
log
(
res
)
this
.
accountListSelect
=
res
.
map
(
item
=>
{
item
.
select
=
false
return
item
})
},
// 选择商户权限
selectCurAccount
(
item
,
index
)
{
console
.
log
(
item
,
index
)
this
.
isChangeEdit
=
true
this
.
roleRootRules
=
false
this
.
accountListSelect
[
index
].
select
=
!
item
.
select
this
.
curRootIndex
=
0
if
(
this
.
accountListSelect
[
index
].
select
)
{
this
.
rootList
.
push
(
item
)
}
else
{
let
arr
=
this
.
rootList
.
filter
(
el
=>
{
return
item
.
accounttypeId
!=
el
.
accounttypeId
})
this
.
rootList
=
arr
}
let
accounttypeId
=
[]
this
.
rootList
.
forEach
(
item
=>
{
accounttypeId
.
push
(
item
.
accounttypeId
)
})
console
.
log
(
this
.
rootList
,
accounttypeId
,
'99999'
)
this
.
accounttypeIds
=
accounttypeId
this
.
$refs
.
productFrom
.
findMenuFunTree
(
item
.
accounttypeId
,
item
.
select
)
},
toCreateRole
()
{
console
.
log
(
this
.
ruleForm
,
this
.
$refs
.
productFrom
.
getSelectInfo
())
this
.
$refs
.
ruleForm
.
validate
(
valid
=>
{
if
(
valid
)
{
let
{
merchantId
,
roleDesc
,
roleName
}
=
this
.
ruleForm
let
product
=
this
.
$refs
.
productFrom
.
getSelectInfo
()
if
(
product
&&
product
.
every
(
item
=>
item
.
productList
.
length
==
0
))
{
this
.
$message
({
type
:
'error'
,
message
:
'请至少选择一个产品'
,
customClass
:
'message-z'
})
return
}
let
accountTypes
=
JSON
.
stringify
(
this
.
$refs
.
productFrom
.
getSelectInfo
())
let
para
=
{
merchantId
:
merchantId
,
roleName
:
roleName
,
roleDescription
:
roleDesc
,
delFlag
:
0
,
requestList
:
accountTypes
}
console
.
log
(
para
)
this
.
$apis
.
role
.
createRole
(
para
).
then
(
res
=>
{
res
?
this
.
$message
.
success
(
'操作成功'
)
:
this
.
$message
.
error
(
'操作失败'
)
this
.
$emit
(
'updataRole'
,
true
)
this
.
roleVisible
=
!
res
})
}
else
{
return
false
}
})
}
}
}
</
script
>
<
style
scoped
lang=
"scss"
>
/
deep
/
{
.el-dialog__body
{
padding
:
20px
;
}
.el-form-item
{
display
:
inline-block
;
width
:
50%
;
vertical-align
:
text-top
;
margin-bottom
:
0
!important
;
.el-input
{
width
:
360px
!important
;
}
&
:last-child
{
width
:
100%
;
}
}
}
</
style
>
src/views/employee/components/selectProduct.vue
0 → 100644
View file @
f09a265
This diff is collapsed.
Click to expand it.
src/views/employee/editEmployee.vue
View file @
f09a265
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
</
template
>
</
template
>
<
template
v-if=
"userInfo.accountLevel == 4 && routeInfo.addOrEdit == 1"
slot=
"roleIdsSlot"
>
<
template
v-if=
"userInfo.accountLevel == 4 && routeInfo.addOrEdit == 1"
slot=
"roleIdsSlot"
>
<el-button
class=
"m-l-10"
type=
"primary"
@
click=
"handleJumpRole"
>
创建角色
</el-button>
<el-button
class=
"m-l-10"
type=
"primary"
@
click=
"handleJumpRole"
>
创建角色
</el-button>
<
el-button
class=
"m-l-10 el-icon-refresh"
type=
"primary"
@
click=
"handleRefresh"
>
刷新
</el-button
>
<
!--
<el-button
class=
"m-l-10 el-icon-refresh"
type=
"primary"
@
click=
"handleRefresh"
>
刷新
</el-button>
--
>
</
template
>
</
template
>
<
template
slot=
"visibleInferiorMer"
slot-scope=
"item"
>
<
template
slot=
"visibleInferiorMer"
slot-scope=
"item"
>
<el-input
:style=
"
{ width: item.width || '320px' }" placeholder="可见商户" v-model="filterText">
</el-input>
<el-input
:style=
"
{ width: item.width || '320px' }" placeholder="可见商户" v-model="filterText">
</el-input>
...
@@ -27,6 +27,8 @@
...
@@ -27,6 +27,8 @@
</
template
>
</
template
>
</glsx-combi-form>
</glsx-combi-form>
</div>
</div>
<CreateRole
ref=
"createRole"
@
updataRole=
"updataRole"
></CreateRole>
<GLFooter>
<GLFooter>
<el-button
type=
"primary"
@
click=
"handleConfirm"
>
确定
</el-button>
<el-button
type=
"primary"
@
click=
"handleConfirm"
>
确定
</el-button>
<el-button
type=
"default"
@
click=
"handleCancel"
>
取消
</el-button>
<el-button
type=
"default"
@
click=
"handleCancel"
>
取消
</el-button>
...
@@ -35,6 +37,7 @@
...
@@ -35,6 +37,7 @@
</template>
</template>
<
script
>
<
script
>
import
CreateRole
from
'./components/createRole'
import
{
utils
}
from
'glsx-common'
import
{
utils
}
from
'glsx-common'
// import selectPage from './components/selectPage'
// import selectPage from './components/selectPage'
import
glsxCombiForm
from
'./glsx-combi-form'
import
glsxCombiForm
from
'./glsx-combi-form'
...
@@ -42,7 +45,8 @@ export default {
...
@@ -42,7 +45,8 @@ export default {
name
:
'editEmployee'
,
name
:
'editEmployee'
,
components
:
{
components
:
{
glsxCombiForm
glsxCombiForm
,
CreateRole
// selectPage
// selectPage
},
},
...
@@ -103,8 +107,22 @@ export default {
...
@@ -103,8 +107,22 @@ export default {
}
}
],
],
visibleInferiorMer
:
[{
required
:
true
,
message
:
'请选择可见商户'
,
trigger
:
'change'
}],
visibleInferiorMer
:
[{
required
:
true
,
message
:
'请选择可见商户'
,
trigger
:
'change'
}],
roleIds
:
[{
required
:
true
,
message
:
'请选择角色权限'
,
trigger
:
'change'
}]
roleIds
:
[{
required
:
true
,
message
:
'请选择角色权限'
,
trigger
:
'change'
}],
// staffEmail: [{ required: false, validator: (rule, value, callback) => {}, trigger: 'change' }]
staffEmail
:
[
{
required
:
false
,
validator
:
(
rule
,
value
,
callback
)
=>
{
var
reg
=
/^
[
a-zA-Z0-9_-
]
+@
[
a-zA-Z0-9_-
]
+
(\.[
a-zA-Z0-9_-
]
+
)
+$/
console
.
log
(
reg
.
test
(
value
))
if
(
!
reg
.
test
(
value
))
{
return
callback
(
new
Error
(
'请输入正确格式的邮箱'
))
}
else
{
return
callback
()
}
},
trigger
:
'change'
}
]
},
},
isBlock
:
true
,
isBlock
:
true
,
editFormData
:
[
editFormData
:
[
...
@@ -321,8 +339,10 @@ export default {
...
@@ -321,8 +339,10 @@ export default {
this
.
editForm
.
password
=
''
this
.
editForm
.
password
=
''
},
},
handleJumpRole
()
{
handleJumpRole
()
{
let
path
=
document
.
location
.
pathname
.
split
(
'/'
)[
1
]
console
.
log
(
'创建角色'
,
this
.
$refs
.
createRole
)
this
.
$history
.
push
(
'/'
+
path
+
'/role/create'
)
// let path = document.location.pathname.split('/')[1]
// this.$history.push('/' + path + '/role/create')
this
.
$refs
.
createRole
.
init
()
},
},
handleRefresh
()
{
handleRefresh
()
{
this
.
editForm
.
merchantId
this
.
editForm
.
merchantId
...
@@ -404,6 +424,9 @@ export default {
...
@@ -404,6 +424,9 @@ export default {
this
.
$refs
.
tree
.
setCheckedKeys
(
allId
)
this
.
$refs
.
tree
.
setCheckedKeys
(
allId
)
}
}
this
.
isCheckAll
=
!
this
.
isCheckAll
this
.
isCheckAll
=
!
this
.
isCheckAll
},
updataRole
()
{
this
.
getRoleList
(
this
.
editForm
.
merchantId
)
}
}
},
},
...
@@ -418,7 +441,7 @@ export default {
...
@@ -418,7 +441,7 @@ export default {
this
.
routeInfo
.
addOrEdit
!=
1
?
this
.
getInfo
()
:
''
this
.
routeInfo
.
addOrEdit
!=
1
?
this
.
getInfo
()
:
''
}
}
}
}
</
script
>
</
script
>
<
style
>
<
style
>
.config-employee
{
.config-employee
{
...
...
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