Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
newShopFront
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
newshop
newShopFront
Commits
68462395
Commit
68462395
authored
Dec 23, 2019
by
Your Name
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
权限节点列表
parent
26d5144f
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
697 additions
and
95 deletions
+697
-95
authority.js
src/api/authority.js
+1
-1
menu.js
src/api/menu.js
+57
-0
Manage_editor.vue
src/views/authority/details/Manage_editor.vue
+73
-35
menuList.vue
src/views/authority/menuList.vue
+74
-59
test.vue
src/views/authority/test.vue
+492
-0
No files found.
src/api/authority.js
View file @
68462395
...
...
@@ -98,7 +98,7 @@ export function searchUser (parameter) {
return
axios
({
url
:
'authority/manage-lists/search-user'
,
method
:
'get'
,
data
:
parameter
params
:
parameter
})
}
// 添加管理员
...
...
src/api/menu.js
0 → 100644
View file @
68462395
import
{
axios
}
from
'@/utils/request'
// export function getMenuList (params) {
// return axios({
// url: '/sys/menu/list',
// method: 'post',
// data: params
// })
// }
// 获取权限节点列表
export
function
getMenuList
(
parameter
)
{
console
.
log
(
parameter
)
return
axios
({
url
:
'authority/authority-nodes/node-list'
,
method
:
'get'
,
params
:
parameter
})
}
export
const
addMenu
=
(
params
)
=>
{
return
axios
({
url
:
'/sys/menu/add'
,
data
:
{
...
params
},
method
:
'post'
})
}
export
const
updateMenu
=
(
params
)
=>
{
return
axios
.
request
({
url
:
'/sys/menu/update'
,
data
:
{
...
params
},
method
:
'post'
})
}
export
const
deleteMenu
=
(
id
)
=>
{
return
axios
.
request
({
url
:
'/sys/menu/delete'
,
data
:
{
id
},
method
:
'post'
})
}
export
const
getMenuWithRoleStatus
=
(
params
)
=>
{
return
axios
.
request
({
url
:
'/sys/menu/listRole'
,
data
:
{
...
params
},
method
:
'post'
})
}
\ No newline at end of file
src/views/authority/details/Manage_editor.vue
View file @
68462395
<
template
>
<a-card
:body-style=
"
{ padding: '24px 32px' }" :bordered="false">
<a-form
:form=
"form"
>
<a-form-item
:labelCol=
"labelCol"
:wrapperCol=
"wrapperCol"
label=
"管理员账号"
>
<a-form-item
v-show=
"false"
>
<a-input
type=
"hidden"
v-decorator=
"['USER_GUID']"
name=
"USER_GUID"
/>
</a-form-item>
<a-form-item
v-show=
"false"
>
<a-input
type=
"hidden"
v-decorator=
"['USER_ID']"
name=
"USER_ID"
/>
</a-form-item>
<a-form-item
v-show=
"false"
>
<a-input
type=
"hidden"
v-decorator=
"['CODE']"
name=
"CODE"
/>
</a-form-item>
<a-form-item
v-show=
"false"
>
<a-input
type=
"hidden"
v-decorator=
"['BRANCH_GUID']"
name=
"BRANCH_GUID"
/>
<!-- 先写个GUID 这个需要获取门店接口-->
</a-form-item>
<a-form-item
:labelCol=
"labelCol"
:wrapperCol=
"wrapperCol"
label=
"管理员账号"
v-if=
"!GUID"
>
<!--
<a-input
v-decorator=
"['GUID',
{ rules: [{ required: true, message: '请输入姓名' }] }]"
name="GUID"
...
...
@@ -10,34 +22,34 @@
<a-row>
<a-col
:span=
"24"
>
<a-input-group>
<!--
<a-input
v-decorator=
"['CODE']"
name=
"CODE"
placeholder=
"请输入员工邮箱/手机号"
/>
-->
<a-input
style=
"width:50%"
v-model=
"
NAM
E"
placeholder=
"请输入管理员账号"
/>
<a-button
@
click=
'searchUser'
type=
"primary"
>
查找用户信息
</a-button>
<!--
<a-input
v-decorator=
"['CODE']"
name=
"CODE"
placeholder=
"请输入员工邮箱/手机号"
disabled
/>
-->
<a-input
style=
"width:50%"
v-model=
"
COD
E"
placeholder=
"请输入管理员账号"
/>
<a-button
@
click=
'searchUser'
type=
"primary"
>
查找用户信息
{{
userinfo
.
length
}}
</a-button>
</a-input-group>
</a-col>
</a-row>
</a-form-item>
<a-form-item
:labelCol=
"labelCol"
:wrapperCol=
"wrapperCol"
label=
"姓名"
>
<a-form-item
:labelCol=
"labelCol"
:wrapperCol=
"wrapperCol"
label=
"姓名"
v-if=
"userinfo"
>
<a-input
v-decorator=
"['NAME',
{ rules: [{ required: true, message: '请输入姓名' }] }]"
name="NAME"
placeholder="请输入姓名"
/>
</a-form-item>
<a-form-item
:labelCol=
"labelCol"
:wrapperCol=
"wrapperCol"
label=
"员工手机号"
>
<a-input
v-decorator=
"['MOBILE
_PHONE']"
name=
"MOBILE_
PHONE"
/>
<a-form-item
:labelCol=
"labelCol"
:wrapperCol=
"wrapperCol"
label=
"员工手机号"
v-if=
"userinfo && !GUID"
>
<a-input
v-decorator=
"['MOBILE
PHONE']"
name=
"MOBILE
PHONE"
/>
</a-form-item>
<a-form-item
:labelCol=
"labelCol"
:wrapperCol=
"wrapperCol"
label=
"性别"
>
<a-input
v-decorator=
"['CONTACT_SEX']"
name=
"
CONTACT_SEX"
/>
<a-form-item
:labelCol=
"labelCol"
:wrapperCol=
"wrapperCol"
label=
"性别"
v-if=
"userinfo && !GUID"
>
<a-input
name=
"CONTACT_SEX"
:value=
"userinfo.
CONTACT_SEX"
/>
</a-form-item>
<a-form-item
:labelCol=
"labelCol"
:wrapperCol=
"wrapperCol"
label=
"年龄"
>
<a-input
v-decorator=
"['AGET']"
name=
"AGET"
/>
<a-form-item
:labelCol=
"labelCol"
:wrapperCol=
"wrapperCol"
label=
"年龄"
v-if=
"userinfo && !GUID"
>
<a-input
name=
"AGE"
:value=
"userinfo.AGE"
/>
</a-form-item>
<!--
<a-form-item
:labelCol=
"labelCol"
:wrapperCol=
"wrapperCol"
label=
"员工所属门店GUID"
>
<a-input
v-decorator=
"['BRANCH_GUID']"
name=
"BRANCH_GUID"
/>
</a-form-item>
-->
<a-form-item
:labelCol=
"labelCol"
:wrapperCol=
"wrapperCol"
label=
"员工所属门店名称"
>
<a-input
v-decorator=
"['BRANCH_NAME']"
name=
"BRANCH_
NAME"
/>
<a-form-item
:labelCol=
"labelCol"
:wrapperCol=
"wrapperCol"
label=
"员工所属门店名称"
v-if=
"userinfo"
>
<a-input
name=
"BRANCH_NAME"
:value=
"userinfo.BRANCH
NAME"
/>
</a-form-item>
<a-form-item
:labelCol=
"labelCol"
:wrapperCol=
"wrapperCol"
label=
"拥有权限"
>
...
...
@@ -64,7 +76,8 @@ export default {
name
:
'authority'
,
data
()
{
return
{
NAME
:
''
,
userinfo
:
''
,
CODE
:
''
,
labelCol
:
{
xs
:
{
span
:
24
},
sm
:
{
span
:
7
}
...
...
@@ -91,38 +104,64 @@ export default {
// this.goId = gooId
this
.
GUID
=
id
if
(
id
)
{
// getManageGroupList().then(res => {
// this.grouplist = res.info;
// return getManageUserInfo(id)
// }).then(res => {
// this.form.setFieldsValue(res)
// this.res = res
// }).catch(err => {
getManageGroupList
().
then
(
res
=>
{
//先把拥有权限循环出来 保证渲染值时不出错
this
.
grouplist
=
res
.
info
;
return
getManageUserInfo
(
id
)
}).
then
(
res
=>
{
var
formValue
=
{
'NAME'
:
res
.
NAME
,
'ROLE_ID'
:
res
.
ROLE_ID
,
'USER_ID'
:
res
.
USER_ID
,
// 'USER_GUID':'123',
// 'CODE':'456',
// 'BRANCH_GUID':'',
}
res
.
BRANCHNAME
=
res
.
BRANCH_NAME
this
.
userinfo
=
res
this
.
$nextTick
(()
=>
{
this
.
form
.
setFieldsValue
(
formValue
);})
console
.
log
(
formValue
)
}).
catch
(
err
=>
{
//
})
})
// loadData: parameter => {
// return getPermissions(Object.assign(parameter, this.queryParam)).then(res => {
getManageUserInfo
(
id
).
then
(
res
=>
{
this
.
form
.
setFieldsValue
(
res
)
this
.
res
=
res
}).
catch
(
err
=>
{})
// getManageUserInfo(id).then(res => {
// var formValue = {
// 'NAME':res.NAME,
// 'ROLE_ID':res.ROLE_ID,
// }
// this.userinfo = res.info
// this.$nextTick(() => {this.form.setFieldsValue(formValue);})
// this.userinfo = res
// }).catch(err => {})
}
else
{
//获取所有权限
getManageGroupList
().
then
(
res
=>
{
console
.
log
(
res
)
this
.
grouplist
=
res
.
info
}).
catch
(
err
=>
{})
}
//获取所有权限
getManageGroupList
().
then
(
res
=>
{
console
.
log
(
res
)
this
.
grouplist
=
res
.
info
}).
catch
(
err
=>
{})
},
methods
:
{
//查找用户信息
searchUser
(){
var
searchobj
=
{
'MOBILE_PHONE'
:
this
.
NAM
E
'MOBILE_PHONE'
:
this
.
COD
E
}
searchUser
(
searchobj
).
then
(
res
=>
{
console
.
log
(
res
)
this
.
grouplist
=
res
.
info
var
formValue
=
{
'NAME'
:
res
.
info
.
USERNAME
,
'MOBILEPHONE'
:
res
.
info
.
MOBILE_PHONE
,
'USER_GUID'
:
res
.
info
.
GUID
,
'CODE'
:
res
.
info
.
CODE
,
'ROLE_ID'
:
''
,
'BRANCH_GUID'
:
''
,
}
this
.
userinfo
=
res
.
info
this
.
$nextTick
(()
=>
{
this
.
form
.
setFieldsValue
(
formValue
);})
}).
catch
(
err
=>
{})
},
// checkboxGroup处理
...
...
@@ -165,13 +204,12 @@ export default {
},
updateSubmit
()
{
let
user_id
=
this
.
res
.
USER_ID
;
const
{
form
:
{
validateFields
}
}
=
this
validateFields
({
force
:
true
},
(
err
,
values
)
=>
{
if
(
!
err
)
{
const
ManageInfoModify
=
Object
.
assign
({
...
values
}
,
{
USER_ID
:
user_id
}
)
const
ManageInfoModify
=
Object
.
assign
({
...
values
})
if
(
ManageInfoModify
.
ROLE_ID
)
{
ManageInfoModify
.
ROLE_ID
=
ManageInfoModify
.
ROLE_ID
.
toString
()
//ManageInfoModify.CONTACTBIRTH_DATE = ManageInfoModify.CONTACTBIRTH_DATE.format('YYYY-MM-DD')
...
...
src/views/authority/menuList.vue
View file @
68462395
...
...
@@ -30,16 +30,18 @@
ref=
"table"
size=
"default"
rowKey=
"ID"
childrenColumnName =
"son"
:columns=
"columns"
:data=
"loadData"
:scroll=
"
{ x: 1200, y: 300 }"
:showPagination="pagination"
:rowSelection="rowSelection"
>
<span
slot=
"TITLE"
slot-scope=
""
>
<
!--
<
span
slot=
"TITLE"
slot-scope=
""
>
<template>
<div>
<div>
-->
<!--
<a-input-search
style=
"margin-bottom: 8px"
placeholder=
"Search"
@
change=
"onChange"
/>
-->
<a-tree
<
!--
<
a-tree
@
expand=
"onExpand"
:expandedKeys=
"expandedKeys"
:autoExpandParent=
"autoExpandParent"
...
...
@@ -56,7 +58,7 @@
</a-tree>
</div>
</template>
</span>
</span>
-->
<span
slot=
"action"
slot-scope=
"text, record"
>
<
template
>
<a
@
click=
"handleEdit(record)"
>
编辑
</a>
...
...
@@ -148,60 +150,71 @@
import
moment
from
'moment'
import
{
STable
}
from
'@/components'
import
{
getMenuList
}
from
'@/api/authority'
const
x
=
3
;
const
y
=
2
;
const
z
=
1
;
const
gData
=
[];
//
const x = 3;
//
const y = 2;
//
const z = 1;
//
const gData = [];
const
generateData
=
(
_level
,
_preKey
,
_tns
)
=>
{
const
preKey
=
_preKey
||
'0'
;
const
tns
=
_tns
||
gData
;
//
const generateData = (_level, _preKey, _tns) => {
//
const preKey = _preKey || '0';
//
const tns = _tns || gData;
const
children
=
[];
for
(
let
i
=
0
;
i
<
x
;
i
++
)
{
const
key
=
`
${
preKey
}
-
${
i
}
`
;
tns
.
push
({
title
:
key
,
key
,
scopedSlots
:
{
title
:
'title'
}
});
if
(
i
<
y
)
{
children
.
push
(
key
);
}
}
if
(
_level
<
0
)
{
return
tns
;
}
const
level
=
_level
-
1
;
children
.
forEach
((
key
,
index
)
=>
{
tns
[
index
].
children
=
[];
return
generateData
(
level
,
key
,
tns
[
index
].
children
);
});
};
generateData
(
z
);
//
const children = [];
//
for (let i = 0; i
<
x
;
i
++
)
{
//
const key = `${preKey}-${i}`;
//
tns.push({ title: key, key, scopedSlots: { title: 'title' } });
//
if (i
<
y
)
{
//
children.push(key);
//
}
//
}
//
if (_level
<
0
)
{
//
return tns;
//
}
//
const level = _level - 1;
//
children.forEach((key, index) => {
//
tns[index].children = [];
//
return generateData(level, key, tns[index].children);
//
});
//
};
//
generateData(z);
const
dataList
=
[];
const
generateList
=
data
=>
{
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
const
node
=
data
[
i
];
const
key
=
node
.
key
;
dataList
.
push
({
key
,
title
:
key
});
if
(
node
.
children
)
{
generateList
(
node
.
children
,
node
.
key
);
}
}
};
generateList
(
gData
);
//
const dataList = [];
//
const generateList = data => {
//
for (let i = 0; i
<
data
.
length
;
i
++
)
{
//
const node = data[i];
//
const key = node.key;
//
dataList.push({ key, title: key });
//
if (node.children) {
//
generateList(node.children, node.key);
//
}
//
}
//
};
//
generateList(gData);
const
getParentKey
=
(
key
,
tree
)
=>
{
let
parentKey
;
for
(
let
i
=
0
;
i
<
tree
.
length
;
i
++
)
{
const
node
=
tree
[
i
];
if
(
node
.
children
)
{
if
(
node
.
children
.
some
(
item
=>
item
.
key
===
key
))
{
parentKey
=
node
.
key
;
}
else
if
(
getParentKey
(
key
,
node
.
children
))
{
parentKey
=
getParentKey
(
key
,
node
.
children
);
}
}
}
return
parentKey
;
// const getParentKey = (key, tree) => {
// let parentKey;
// for (let i = 0; i
<
tree
.
length
;
i
++
)
{
// const node = tree[i];
// if (node.children) {
// if (node.children.some(item => item.key === key)) {
// parentKey = node.key;
// } else if (getParentKey(key, node.children)) {
// parentKey = getParentKey(key, node.children);
// }
// }
// }
// return parentKey;
// };
const
rowSelection
=
{
onChange
:
(
selectedRowKeys
,
selectedRows
)
=>
{
console
.
log
(
`selectedRowKeys:
${
selectedRowKeys
}
`
,
'selectedRows: '
,
selectedRows
);
},
onSelect
:
(
record
,
selected
,
selectedRows
)
=>
{
console
.
log
(
record
,
selected
,
selectedRows
);
},
onSelectAll
:
(
selected
,
selectedRows
,
changeRows
)
=>
{
console
.
log
(
selected
,
selectedRows
,
changeRows
);
},
};
export
default
{
name
:
'authority'
,
...
...
@@ -210,11 +223,13 @@ export default {
},
data
()
{
return
{
rowSelection
,
expandedKeys
:
[],
searchValue
:
''
,
autoExpandParent
:
true
,
gData
,
//
expandedKeys: [],
//
searchValue: '',
//
autoExpandParent: true,
//
gData,
// loading: false,
// parentTreeSelected: {},
labelCol
:
{
...
...
@@ -233,7 +248,7 @@ export default {
columns
:
[
{
title
:
'菜单名称'
,
//
dataIndex: 'TITLE',
dataIndex
:
'TITLE'
,
fixed
:
'left'
,
width
:
200
,
scopedSlots
:
{
customRender
:
'TITLE'
}
...
...
src/views/authority/test.vue
0 → 100644
View file @
68462395
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment