Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
merchant-manage-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
ui
merchant-manage-ui
Commits
eeb906ed
Commit
eeb906ed
authored
Sep 27, 2022
by
李腾
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 权限控制优化
parent
09d30b28
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
31 deletions
+37
-31
permission.config.js
config/permission.config.js
+4
-4
BasicLayout.jsx
src/layouts/BasicLayout.jsx
+6
-1
index.jsx
src/pages/GoodsManage/SearchForm/index.jsx
+3
-6
index.jsx
src/pages/GoodsManage/index.jsx
+24
-20
No files found.
config/permission.config.js
View file @
eeb906ed
/** @name 商品管理 */
/** @name 商品管理 */
// 商品库
// 商品库
export
const
GOOD_MANAGE
=
{
export
const
GOOD_MANAGE
=
{
LIST
:
'
020101
'
,
LIST
:
'
020101
'
,
// 商品列表
EDITABLE
:
'
020102
'
,
EDITABLE
:
'
020102
'
,
// 新增/修改
ADD_SERVICE_GOODS
:
'
020103
'
,
// 新增服务商品
ADD_NORMAL_GOODS
:
'
020104
'
,
// 新增实物商品
};
};
// 配送区域
// 配送区域
...
@@ -43,8 +45,6 @@ export const AFTER_SALE_ADDRESS = {
...
@@ -43,8 +45,6 @@ export const AFTER_SALE_ADDRESS = {
EDITABLE
:
'
030102
'
,
// 新增/修改
EDITABLE
:
'
030102
'
,
// 新增/修改
};
};
/** @name 货款结算 */
/** @name 售后管理 */
/** @name 售后管理 */
export
const
AFTER_SALE_ORDER
=
{
export
const
AFTER_SALE_ORDER
=
{
LIST
:
'
050101
'
,
// 售后订单列表
LIST
:
'
050101
'
,
// 售后订单列表
...
...
src/layouts/BasicLayout.jsx
View file @
eeb906ed
...
@@ -78,6 +78,11 @@ const BasicLayout = props => {
...
@@ -78,6 +78,11 @@ const BasicLayout = props => {
setSiderCollapsed
(
payload
);
setSiderCollapsed
(
payload
);
};
// get children authority
};
// get children authority
// 跳转到首页
const
toIndex
=
()
=>
{
props
.
history
.
push
(
'
/
'
);
};
const
authorized
=
getAuthorityFromRouter
(
props
.
route
.
routes
,
location
.
pathname
||
'
/
'
);
const
authorized
=
getAuthorityFromRouter
(
props
.
route
.
routes
,
location
.
pathname
||
'
/
'
);
const
_menu
=
param
=>
const
_menu
=
param
=>
param
.
map
(
v
=>
param
.
map
(
v
=>
...
@@ -154,7 +159,7 @@ const BasicLayout = props => {
...
@@ -154,7 +159,7 @@ const BasicLayout = props => {
rightContentRender=
{
rightProps
=>
<
RightContent
{
...
rightProps
}
/>
}
rightContentRender=
{
rightProps
=>
<
RightContent
{
...
rightProps
}
/>
}
pageTitleRender=
{
()
=>
''
}
pageTitleRender=
{
()
=>
''
}
menuHeaderRender=
{
()
=>
(
menuHeaderRender=
{
()
=>
(
<
div
className=
{
style
[
'
custom-title-box
'
]
}
>
<
div
className=
{
style
[
'
custom-title-box
'
]
}
onClick=
{
toIndex
}
>
<
div
className=
{
style
[
'
custom-title-box-logo
'
]
}
>
<
div
className=
{
style
[
'
custom-title-box-logo
'
]
}
>
<
div
>
<
div
>
<
img
className=
{
style
[
'
custom-title-box-logoImg
'
]
}
alt=
"量星球"
src=
{
logo
}
/>
<
img
className=
{
style
[
'
custom-title-box-logoImg
'
]
}
alt=
"量星球"
src=
{
logo
}
/>
...
...
src/pages/GoodsManage/SearchForm/index.jsx
View file @
eeb906ed
...
@@ -33,11 +33,7 @@ class goodsManage extends Component {
...
@@ -33,11 +33,7 @@ class goodsManage extends Component {
loading
:
false
,
loading
:
false
,
};
};
canEditable
=
false
;
componentDidMount
()
{
componentDidMount
()
{
this
.
canEditable
=
this
.
props
.
permissions
[
GOOD_MANAGE
.
EDITABLE
];
console
.
log
(
111
,
this
.
props
.
permissions
,
this
.
canEditable
);
this
.
props
.
onRef
(
this
);
this
.
props
.
onRef
(
this
);
this
.
handleSearch
();
this
.
handleSearch
();
}
}
...
@@ -101,10 +97,11 @@ class goodsManage extends Component {
...
@@ -101,10 +97,11 @@ class goodsManage extends Component {
};
};
render
()
{
render
()
{
const
{
treeData
}
=
this
.
props
;
const
{
treeData
,
permissions
}
=
this
.
props
;
const
selectW
=
{
width
:
250
};
const
selectW
=
{
width
:
250
};
const
iptNumWidth
=
{
width
:
118
};
const
iptNumWidth
=
{
width
:
118
};
const
that
=
this
;
const
that
=
this
;
const
canEditable
=
permissions
[
GOOD_MANAGE
.
EDITABLE
];
const
content
=
(
const
content
=
(
<
div
>
<
div
>
<
Button
style=
{
{
border
:
'
none
'
}
}
onClick=
{
()
=>
this
.
setArea
(
1
,
'
distribution
'
)
}
>
<
Button
style=
{
{
border
:
'
none
'
}
}
onClick=
{
()
=>
this
.
setArea
(
1
,
'
distribution
'
)
}
>
...
@@ -226,7 +223,7 @@ class goodsManage extends Component {
...
@@ -226,7 +223,7 @@ class goodsManage extends Component {
导出
导出
</
Button
>
</
Button
>
</
FormItem
>
</
FormItem
>
{
this
.
canEditable
?
(
{
canEditable
?
(
<
FormItem
style=
{
{
float
:
'
right
'
}
}
>
<
FormItem
style=
{
{
float
:
'
right
'
}
}
>
<
Popover
content=
{
content
}
onVisibleChange=
{
this
.
handleVisibleChange
}
>
<
Popover
content=
{
content
}
onVisibleChange=
{
this
.
handleVisibleChange
}
>
<
Button
type=
"primary"
className=
{
styles
.
button
}
>
<
Button
type=
"primary"
className=
{
styles
.
button
}
>
...
...
src/pages/GoodsManage/index.jsx
View file @
eeb906ed
...
@@ -66,11 +66,8 @@ class goodsManage extends Component {
...
@@ -66,11 +66,8 @@ class goodsManage extends Component {
shopList
=
[];
shopList
=
[];
canEditable
=
false
;
componentDidMount
()
{
componentDidMount
()
{
this
.
props
.
goodsManage
.
tableData
=
{};
this
.
props
.
goodsManage
.
tableData
=
{};
this
.
canEditable
=
this
.
props
.
permissions
[
GOOD_MANAGE
.
EDITABLE
];
this
.
categoryList
();
this
.
categoryList
();
this
.
getVirtualCategory
();
this
.
getVirtualCategory
();
this
.
specList
();
this
.
specList
();
...
@@ -391,35 +388,42 @@ class goodsManage extends Component {
...
@@ -391,35 +388,42 @@ class goodsManage extends Component {
render
()
{
render
()
{
const
{
const
{
goodsManage
:
{
tableData
=
{}
},
goodsManage
:
{
tableData
=
{}
},
permissions
,
}
=
this
.
props
;
}
=
this
.
props
;
const
rowSelection
=
{
const
rowSelection
=
{
selectedRowKeys
:
this
.
state
.
selectedRowKeys
,
selectedRowKeys
:
this
.
state
.
selectedRowKeys
,
onChange
:
this
.
onSelectChange
,
onChange
:
this
.
onSelectChange
,
};
};
const
{
pageNo
,
pageSize
,
selectedRowKeys
}
=
this
.
state
;
const
{
pageNo
,
pageSize
,
selectedRowKeys
}
=
this
.
state
;
const
canAddService
=
permissions
[
GOOD_MANAGE
.
ADD_SERVICE_GOODS
];
const
canAddNormal
=
permissions
[
GOOD_MANAGE
.
ADD_NORMAL_GOODS
];
return
(
return
(
<
PageHeaderWrapper
>
<
PageHeaderWrapper
>
<
Spin
spinning=
{
this
.
state
.
createloading
}
>
<
Spin
spinning=
{
this
.
state
.
createloading
}
>
{
this
.
canEditable
?
(
{
canAddNormal
?
(
<>
<
Button
<
Button
type=
"primary"
type=
"primary"
className=
{
styles
.
button
}
className=
{
styles
.
button
}
onClick=
{
()
=>
this
.
setState
({
createVisible
:
true
,
initData
:
{}
})
}
onClick=
{
()
=>
this
.
setState
({
createVisible
:
true
,
initData
:
{}
})
}
>
>
新增商品
新增商品
</
Button
>
</
Button
>
)
:
(
<
Button
''
type=
"primary"
)
}
className=
{
styles
.
button
}
{
canAddService
?
(
onClick=
{
()
=>
this
.
serviceVisbleClose
(
true
)
}
<
Button
>
type=
"primary"
新增服务类商品
className=
{
styles
.
button
}
</
Button
>
onClick=
{
()
=>
this
.
serviceVisbleClose
(
true
)
}
</>
>
新增服务类商品
</
Button
>
)
:
(
)
:
(
''
''
)
}
)
}
<
Card
>
<
Card
>
<
SearchForm
<
SearchForm
handleSearch=
{
this
.
handleSearch
}
handleSearch=
{
this
.
handleSearch
}
...
...
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