Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
杨明
/
scrm-micro-config
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 72c66bbb
authored
Nov 04, 2021
by
李长胜
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
角色修改
1 parent
63d9111f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
120 additions
and
53 deletions
src/views/role/create.vue
src/views/role/index.vue
src/views/role/look.vue
src/views/role/create.vue
View file @
72c66bb
<
template
>
<div
class=
"role-panel"
>
<div
class=
"role-create-page scrm-box-f"
>
<div
class=
"top_title_widget"
>
<span
class=
"title"
>
{{
pageName
}}
</span>
</div>
<div
class=
"main_widget"
>
<el-form
:model=
"ruleForm"
:rules=
"rules"
ref=
"ruleForm"
label-width=
"100px"
class=
"demo-ruleForm"
>
<el-form-item
v-if=
"pageType == 'create'"
label=
"所属商户"
prop=
"merchantId"
>
<el-select
size=
"small"
style=
"width: 40%"
v-model=
"ruleForm.merchantId"
:filter-method=
"filterList"
clearable
filterable
placeholder=
"请选择"
@
change=
"selectMerchant"
>
<el-option
v-for=
"item in list"
:key=
"item.id"
:label=
"item.merchantName"
:value=
"item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label=
"所属商户"
prop=
"merchantName"
v-if=
"pageType == 'edit'"
>
<el-input
size=
"small"
disabled
style=
"width: 40%"
v-model=
"ruleForm.merchantName"
></el-input>
</el-form-item>
<el-form-item
label=
"角色名称"
prop=
"roleName"
>
<el-input
size=
"small"
style=
"width: 40%"
v-model=
"ruleForm.roleName"
placeholder=
"请输入角色名称"
></el-input>
</el-form-item>
<el-form-item
label=
"角色说明"
prop=
"roleDesc"
>
<el-input
size=
"small"
style=
"width: 40%"
v-model=
"ruleForm.roleDesc"
placeholder=
"请输入角色说明"
></el-input>
</el-form-item>
<el-form-item
label=
"角色权限"
prop=
"roleRoot"
>
<div
class=
"role-create-page scrm-box-f"
>
<div
class=
"top_title_widget"
>
<span
class=
"title"
>
{{
pageName
}}
</span>
</div>
<div
class=
"main_widget"
>
<el-form
:model=
"ruleForm"
:rules=
"rules"
ref=
"ruleForm"
label-width=
"100px"
class=
"demo-ruleForm"
>
<el-form-item
v-if=
"pageType == 'create'"
label=
"所属商户"
prop=
"merchantId"
>
<el-select
size=
"small"
style=
"width: 40%"
v-model=
"ruleForm.merchantId"
:filter-method=
"filterList"
clearable
filterable
placeholder=
"请选择"
@
change=
"selectMerchant"
>
<el-option
v-for=
"item in list"
:key=
"item.id"
:label=
"item.merchantName"
:value=
"item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label=
"所属商户"
prop=
"merchantName"
v-if=
"pageType == 'edit'"
>
<el-input
size=
"small"
disabled
style=
"width: 40%"
v-model=
"ruleForm.merchantName"
></el-input>
</el-form-item>
<el-form-item
label=
"角色名称"
prop=
"roleName"
>
<el-input
size=
"small"
style=
"width: 40%"
v-model=
"ruleForm.roleName"
placeholder=
"请输入角色名称"
></el-input>
</el-form-item>
<el-form-item
label=
"角色说明"
prop=
"roleDesc"
>
<el-input
size=
"small"
style=
"width: 40%"
v-model=
"ruleForm.roleDesc"
placeholder=
"请输入角色说明"
></el-input>
</el-form-item>
<!--
<el-form-item
label=
"角色权限"
prop=
"roleRoot"
>
<div
class=
"custom_element"
>
<template
v-for=
"(item, index) in accountList"
>
<div
:key=
"index"
class=
"wrap"
>
...
...
@@ -28,28 +28,50 @@
</div>
</
template
>
</div>
</el-form-item>
</el-form>
</el-form-item>
-->
<el-row>
<el-col
:span=
"16"
>
<div
data-v-995a4ff0=
""
class=
"el-form-item is-required"
>
<label
for=
"roleName"
class=
"el-form-item__label"
style=
"width: 100px"
>
角色权限
</label>
<div
class=
"el-form-item__content"
style=
"margin-left: 100px"
>
<!-- <div data-v-995a4ff0="" class="el-input el-input--small">
<auto-button v-for="(item, index) in accountDetail.accountTypes" :key="index" :btnLabel="item.accounttypeName" :btnValue="item.accounttypeId" :stopClick="nextStatus" @getBtnStatus="getBtnStatus"></auto-button>
</div> -->
<div
class=
"custom_element"
>
<
template
v-for=
"(item, index) in accountList"
>
<div
:key=
"index"
class=
"wrap"
>
<AutoButton
@
getBtnStatus=
"selectCurAccount(item, index)"
:typeStatus=
"item.select"
:btnLabel=
"item.accounttypeName"
></AutoButton>
</div>
</
template
>
</div>
<div
class=
"el-form-item__error"
v-if=
"roleRootRules"
>
请选择角色权限
</div>
</div>
</div>
</el-col>
</el-row>
</el-form>
</div>
</div>
<div
class=
"scrm-box-f"
style=
"margin-top: 10px"
>
<SelectProduct
ref=
"productFrom"
:roleType=
"true"
title=
"角色权限"
></SelectProduct>
<div
style=
"height: 84px"
></div>
<div
class=
"fixed_bottom"
:style=
"{
left: footerLeft + 'px',
width: footerWidth + 'px'
}"
>
<el-button
v-if=
"pageType == 'create'"
type=
"primary"
@
click=
"toCreateRole(1)"
>
草稿
</el-button>
<div
class=
"wrap_driver"
>
<el-button
type=
"primary"
@
click=
"toCreateRole(0)"
>
确定
</el-button>
<div
style=
"height: 84px"
></div>
<div
class=
"fixed_bottom"
:style=
"{
left: footerLeft + 'px',
width: footerWidth + 'px'
}"
>
<el-button
v-if=
"pageType == 'create'"
type=
"primary"
@
click=
"toCreateRole(1)"
>
草稿
</el-button>
<div
class=
"wrap_driver"
>
<el-button
type=
"primary"
@
click=
"toCreateRole(0)"
>
确定
</el-button>
</div>
<el-button
type=
"primary"
@
click=
"toBack"
>
取消
</el-button>
</div>
<el-button
type=
"primary"
@
click=
"toBack"
>
取消
</el-button>
</div>
</div>
</div>
</template>
<
script
>
...
...
@@ -65,6 +87,8 @@ export default {
data
()
{
return
{
roleRootRules
:
false
,
accounttypeIds
:
[],
ruleForm
:
{
merchantId
:
''
,
roleName
:
''
,
...
...
@@ -100,7 +124,7 @@ export default {
merchantId
:
res
.
merchantId
}
this
.
getMerchantTree
(
id
,
res
.
responseList
)
this
.
$refs
.
productFrom
.
accountTypeSearchRequest
({
id
:
res
.
merchantId
},
this
.
roleInfo
.
responseList
)
this
.
$refs
.
productFrom
.
accountTypeSearchRequest
({
id
:
res
.
merchantId
},
this
.
roleInfo
.
responseList
)
})
},
// 获取商户树
...
...
@@ -144,6 +168,7 @@ export default {
},
// 选择商户权限
selectCurAccount
(
item
,
index
)
{
this
.
roleRootRules
=
false
this
.
accountList
[
index
].
select
=
!
item
.
select
this
.
curRootIndex
=
0
if
(
this
.
accountList
[
index
].
select
)
{
...
...
@@ -154,10 +179,13 @@ export default {
})
this
.
rootList
=
arr
}
let
accounttypeId
=
[];
this
.
rootList
.
forEach
(
item
=>
{
let
accounttypeId
=
[]
this
.
rootList
.
forEach
(
item
=>
{
accounttypeId
.
push
(
item
.
accounttypeId
)
})
this
.
accounttypeIds
=
accounttypeId
this
.
$refs
.
productFrom
.
findMenuFunTree
(
accounttypeId
)
},
...
...
@@ -169,10 +197,16 @@ export default {
this
.
$refs
.
ruleForm
.
validateField
(
'merchantId'
)
return
}
if
(
!
roleName
||
this
.
$refs
.
productFrom
.
getSelectInfo
().
length
==
0
)
{
this
.
$message
.
error
(
'角色和权限至少选择一项'
)
return
}
this
.
roleRootRules
=
false
if
(
this
.
accounttypeIds
.
length
==
0
)
{
this
.
roleRootRules
=
true
return
}
let
accountTypes
=
JSON
.
stringify
(
this
.
$refs
.
productFrom
.
getSelectInfo
())
let
para
=
{
merchantId
:
merchantId
,
...
...
@@ -191,6 +225,12 @@ export default {
this
.
$refs
.
ruleForm
.
validate
(
valid
=>
{
if
(
valid
)
{
let
accountTypes
=
JSON
.
stringify
(
this
.
$refs
.
productFrom
.
getSelectInfo
())
this
.
roleRootRules
=
false
if
(
this
.
$refs
.
productFrom
.
getSelectInfo
().
length
==
0
)
{
this
.
roleRootRules
=
true
return
}
let
para
=
{
merchantId
:
merchantId
,
roleName
:
roleName
,
...
...
@@ -247,8 +287,8 @@ export default {
this
.
footerLeft
=
document
.
querySelector
(
'.base-container-right'
).
offsetLeft
this
.
footerWidth
=
document
.
documentElement
.
clientWidth
-
this
.
footerLeft
}
}
;
</
script
>
}
</
script
>
<
style
lang=
"scss"
scoped
>
.role-create-page
{
...
...
@@ -298,4 +338,4 @@ export default {
margin-right
:
15px
;
}
}
</
style
>
\ No newline at end of file
</
style
>
src/views/role/index.vue
View file @
72c66bb
...
...
@@ -160,15 +160,15 @@ export default {
},
// 去创建角色页面
toCreatePage
()
{
this
.
$router
.
push
(
"/role/create/"
+
0
);
this
.
$router
.
push
(
'/role/create/'
+
0
)
},
// 去查看角色页面
toLookPage
(
row
)
{
this
.
$router
.
push
(
"/role/look/"
+
row
.
id
);
this
.
$router
.
push
(
'/role/look/'
+
row
.
id
)
},
// 去修改角色页面
toEditPage
(
row
)
{
this
.
$router
.
push
(
"/role/create/"
+
row
.
id
);
this
.
$router
.
push
(
'/role/create/'
+
row
.
id
)
},
// 去删除草稿
todelete
(
row
)
{
...
...
@@ -188,8 +188,7 @@ export default {
}
})
})
.
catch
(()
=>
{
})
.
catch
(()
=>
{})
}
},
...
...
@@ -206,8 +205,8 @@ export default {
mounted
()
{
this
.
getTableData
()
}
}
;
</
script
>
}
</
script
>
<
style
lang=
"scss"
scoped
>
.role-home-page
{
...
...
@@ -252,4 +251,4 @@ export default {
}
}
}
</
style
>
\ No newline at end of file
</
style
>
src/views/role/look.vue
View file @
72c66bb
...
...
@@ -31,7 +31,7 @@
<div
v-for=
"(item, index) in productList"
:key=
"index"
class=
"line_element_two"
:class=
"curProductIndex == index ? 'line_element_two_active' : ''"
@
click=
"selectProductItem(index)"
>
{{
item
.
productName
}}
</div>
</div>
<div
class=
"tree_widget"
>
<el-tree
v-if=
"productList.length"
:data=
"productList[curProductIndex].merchantProTreeResponses"
:props=
"defaultProps"
></el-tree>
<el-tree
v-if=
"productList.length"
default-expand-all
:data=
"productList[curProductIndex].merchantProTreeResponses"
:props=
"defaultProps"
></el-tree>
<div
v-if=
"productList.length == 0"
class=
"no_data_icon"
>
<div
class=
"nodata_wrap"
>
<img
class=
"icon"
src=
"../../assets/img/empty.png"
/>
...
...
@@ -43,7 +43,16 @@
</div>
</div>
<div
style=
"height: 84px"
></div>
<div
class=
"fixed_bottom"
>
<!--
<div
class=
"fixed_bottom"
>
<el-button
type=
"primary"
@
click=
"toBack"
>
关闭
</el-button>
</div>
-->
<div
class=
"footer-panel"
:style=
"
{
left: footerLeft + 'px',
width: footerWidth + 'px'
}"
>
<el-button
type=
"primary"
@
click=
"toBack"
>
关闭
</el-button>
</div>
</div>
...
...
@@ -68,10 +77,14 @@ export default {
}
},
created
()
{
let
id
=
this
.
$route
.
params
.
id
;
let
id
=
this
.
$route
.
params
.
id
this
.
getRoleData
(
id
)
this
.
getMerchantTree
(
id
)
},
mounted
()
{
this
.
footerLeft
=
document
.
querySelector
(
'.base-container-right'
).
offsetLeft
this
.
footerWidth
=
document
.
documentElement
.
clientWidth
-
this
.
footerLeft
},
methods
:
{
// 获取角色信息
getRoleData
(
id
)
{
...
...
@@ -166,6 +179,7 @@ export default {
.wrapper
{
box-sizing
:
border-box
;
padding
:
0
20px
;
padding-bottom
:
20px
;
.menu_line_one
{
width
:
100%
;
height
:
36px
;
...
...
@@ -223,6 +237,8 @@ export default {
//
height
:
calc
(
100%
-
40px
);
background
:
#ffffff
;
border-radius
:
0px
4px
4px
4px
;
//
height
:
200px
;
//
overflow
:
auto
;
}
.tree_widget
/
deep
/
.el-tree-node__expand-icon
{
//
content
:
"\e6d9"
;
...
...
@@ -272,4 +288,16 @@ export default {
margin
:
0
40px
;
}
}
.footer-panel
{
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
position
:
fixed
;
width
:
100%
;
bottom
:
0px
;
height
:
64px
;
background
:
#ffffff
;
z-index
:
999
;
box-shadow
:
0px
-1px
1px
0px
rgba
(
88
,
80
,
255
,
0.1
);
}
</
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