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
d80e9769
Commit
d80e9769
authored
Sep 19, 2022
by
李腾
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 新增权限控制配置文件
parent
b18d88a7
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
135 additions
and
70 deletions
+135
-70
env.config.js
config/env.config.js
+7
-7
permission.config.js
config/permission.config.js
+13
-0
index.jsx
src/pages/GoodsManage/index.jsx
+18
-8
index.jsx
src/pages/systemManage/Account/UserInfo/index.jsx
+45
-30
data.js
src/pages/systemManage/Account/data.js
+11
-6
index.jsx
src/pages/systemManage/Account/index.jsx
+0
-2
index.jsx
src/pages/systemManage/Role/RoleInfo/index.jsx
+1
-1
data.js
src/pages/systemManage/Role/data.js
+17
-13
index.jsx
src/pages/systemManage/Role/index.jsx
+13
-3
service.js
src/pages/systemManage/service.js
+10
-0
No files found.
config/env.config.js
View file @
d80e9769
...
...
@@ -2,19 +2,19 @@ const isProduction = process.env.NODE_ENV === 'production';
const
isPre
=
process
.
env
.
PRE_ENV
===
'
pre
'
;
const
envAPi
=
{
api
:
'
https://security-
xyqb
.liangkebang.net
'
,
kdspOpApi
:
'
https://sc-merchant-api-
xyqb
.liangkebang.net
'
,
kdspApi
:
'
https://sc-merchant-api-
xyqb
.liangkebang.net
'
,
goodsApi
:
'
https://sc-merchant-api-
xyqb
.liangkebang.net
'
,
api
:
'
https://security-
sc
.liangkebang.net
'
,
kdspOpApi
:
'
https://sc-merchant-api-
sc
.liangkebang.net
'
,
kdspApi
:
'
https://sc-merchant-api-
sc
.liangkebang.net
'
,
goodsApi
:
'
https://sc-merchant-api-
sc
.liangkebang.net
'
,
// kdspOpApi: 'https://kdsp-operation-xyqb.liangkebang.net',
// kdspApi: 'https://sc-op-api-xyqb.liangkebang.net',
// goodsApi: 'https://sc-op-api-xyqb.liangkebang.net',
querysApi
:
'
https://sc-settlement-api-
xyqb
.liangkebang.net
'
,
querysApi
:
'
https://sc-settlement-api-
sc
.liangkebang.net
'
,
// goodsApi: '//192.168.188.111:7000',
prologueDomain
:
'
https://mall-
xyqb
.liangkebang.net
'
,
prologueDomain
:
'
https://mall-
sc
.liangkebang.net
'
,
// qiniuHost: 'https://appsync.lkbang.net',
qiniuHost
:
'
https://kdspstatic.q-gp.com/
'
,
opapiHost
:
'
https://opapi-
xyqb
.liangkebang.net
'
,
opapiHost
:
'
https://opapi-
sc
.liangkebang.net
'
,
};
const
prodApi
=
{
...
...
config/permission.config.js
View file @
d80e9769
...
...
@@ -25,6 +25,19 @@ export const ROLE_MANAGE = {
export
const
LOG_MANAGE
=
{};
/** @name 商品管理 */
// 商品库
export
const
GOOD_MANAGE
=
{
LIST
:
{
name
:
'
商品列表
'
,
id
:
'
020101
'
,
},
EDITABLE
:
{
name
:
'
新增/修改
'
,
id
:
'
020101
'
,
},
};
// 配送区域
/** @name 订单管理 */
...
...
src/pages/GoodsManage/index.jsx
View file @
d80e9769
...
...
@@ -28,8 +28,11 @@ import SearchForm from './SearchForm';
import
TempleatModal
from
'
./TempleatModal
'
;
import
ServiceGoods
from
'
../ServiceGoods
'
;
@
connect
(({
goodsManage
})
=>
({
import
{
GOOD_MANAGE
}
from
'
@/../config/permission.config
'
;
@
connect
(({
goodsManage
,
menu
})
=>
({
goodsManage
,
permissions
:
menu
.
permissions
,
}))
class
goodsManage
extends
Component
{
state
=
{
...
...
@@ -63,8 +66,11 @@ class goodsManage extends Component {
shopList
=
[];
canEditable
=
false
;
componentDidMount
()
{
this
.
props
.
goodsManage
.
tableData
=
{};
this
.
canEditable
=
this
.
props
.
permissions
[
GOOD_MANAGE
.
EDITABLE
.
id
];
this
.
categoryList
();
this
.
getVirtualCategory
();
this
.
specList
();
...
...
@@ -394,13 +400,17 @@ class goodsManage extends Component {
return
(
<
PageHeaderWrapper
>
<
Spin
spinning=
{
this
.
state
.
createloading
}
>
<
Button
type=
"primary"
className=
{
styles
.
button
}
onClick=
{
()
=>
this
.
setState
({
createVisible
:
true
,
initData
:
{}
})
}
>
新增商品
</
Button
>
{
this
.
canEditable
?
(
<
Button
type=
"primary"
className=
{
styles
.
button
}
onClick=
{
()
=>
this
.
setState
({
createVisible
:
true
,
initData
:
{}
})
}
>
新增商品
</
Button
>
)
:
(
''
)
}
<
Button
type=
"primary"
className=
{
styles
.
button
}
...
...
src/pages/systemManage/Account/UserInfo/index.jsx
View file @
d80e9769
...
...
@@ -3,7 +3,7 @@ import { Input, Checkbox, Radio, Button, notification, Spin } from 'antd';
import
{
Form
}
from
'
@ant-design/compatible
'
;
import
{
PageHeaderWrapper
}
from
'
@ant-design/pro-layout
'
;
import
RolePermissionsModal
from
'
../components/RolePermissionsModal
'
;
import
{
getRoleList
,
addUser
,
getUserDetail
}
from
'
../../service
'
;
import
{
getRoleList
,
addUser
,
getUserDetail
,
updateUser
}
from
'
../../service
'
;
import
{
shopGetBySupplierId
}
from
'
@/pages/ServiceGoods/service
'
;
import
UUID
from
'
@/utils/uuid
'
;
...
...
@@ -94,13 +94,12 @@ const AddUser = props => {
}
console
.
log
(
res
);
setDetailInfo
(
res
.
data
);
const
{
account
,
name
,
password
}
=
res
.
data
;
const
{
account
,
name
,
roleId
,
organization
}
=
res
.
data
;
setFieldsValue
({
account
,
name
,
password
,
confirmPassword
:
password
,
roleId
:
[],
organizationId
:
organization
.
id
,
roleId
,
});
};
...
...
@@ -120,8 +119,14 @@ const AddUser = props => {
));
// 选择门店多选框
const
selectSupplierCheckbox
=
()
=>
supplierList
.
map
(
item
=>
<
Radio
value=
{
item
.
orgId
}
>
{
item
.
name
}
</
Radio
>);
const
selectSupplierCheckbox
=
()
=>
{
let
list
=
supplierList
;
const
filterData
=
supplierList
.
filter
(
item
=>
item
.
orgId
===
userInfo
.
orgId
);
if
(
filterData
.
length
)
{
list
=
filterData
;
}
return
list
.
map
(
item
=>
<
Radio
value=
{
item
.
orgId
}
>
{
item
.
name
}
</
Radio
>);
};
// 表单验证辅助函数
const
rulesHandler
=
(
field
,
initialValue
=
''
)
=>
({
...
...
@@ -138,19 +143,25 @@ const AddUser = props => {
}
// 提交
console
.
log
(
fieldsValue
);
const
{
organizationId
}
=
fieldsValue
;
const
{
organizationId
,
email
}
=
fieldsValue
;
const
{
orgId
}
=
userInfo
;
const
code
=
UUID
.
createUUID
();
const
params
=
{
...
fieldsValue
,
code
,
email
:
`
${
code
}
@stms.quantgroup.cn`
,
email
:
email
||
`
${
code
}
@stms.quantgroup.cn`
,
organization
:
{
id
:
organizationId
||
orgId
,
},
};
delete
params
.
organizationId
;
const
res
=
await
addUser
(
params
);
let
api
=
addUser
;
if
(
id
)
{
console
.
log
(
id
,
222444
);
params
.
id
=
id
;
api
=
updateUser
;
}
const
res
=
await
api
(
params
);
if
(
res
.
code
!==
2000
)
{
notification
.
warning
({
message
:
res
.
detail
||
res
.
msg
,
...
...
@@ -215,26 +226,30 @@ const AddUser = props => {
<
Input
placeholder=
"请输入用户姓名"
/>,
)
}
</
Form
.
Item
>
<
Form
.
Item
label=
"初始密码"
extra=
"限13-18字符,包含大小写字母、数字和特殊字符"
>
{
getFieldDecorator
(
'
password
'
,
rulesHandler
(
'
password
'
))(
<
Input
disabled=
{
!!
id
}
type=
{
inputType
}
onChange=
{
e
=>
handlePasswordChange
(
e
,
setInputType
)
}
placeholder=
"请设置登录密码"
/>,
)
}
</
Form
.
Item
>
<
Form
.
Item
label=
"确认密码"
>
{
getFieldDecorator
(
'
confirmPassword
'
,
rulesHandler
(
'
confirmPassword
'
))(
<
Input
disabled=
{
!!
id
}
type=
{
confirmInputType
}
onChange=
{
e
=>
handlePasswordChange
(
e
,
setConfirmInputType
)
}
placeholder=
"请确认登录密码"
/>,
)
}
</
Form
.
Item
>
{
id
?
(
''
)
:
(
<>
<
Form
.
Item
label=
"初始密码"
extra=
"限13-18字符,包含大小写字母、数字和特殊字符"
>
{
getFieldDecorator
(
'
password
'
,
rulesHandler
(
'
password
'
))(
<
Input
type=
{
inputType
}
onChange=
{
e
=>
handlePasswordChange
(
e
,
setInputType
)
}
placeholder=
"请设置登录密码"
/>,
)
}
</
Form
.
Item
>
<
Form
.
Item
label=
"确认密码"
>
{
getFieldDecorator
(
'
confirmPassword
'
,
rulesHandler
(
'
confirmPassword
'
))(
<
Input
type=
{
confirmInputType
}
onChange=
{
e
=>
handlePasswordChange
(
e
,
setConfirmInputType
)
}
placeholder=
"请确认登录密码"
/>,
)
}
</
Form
.
Item
>
</>
)
}
<
Form
.
Item
label=
"选择门店"
extra=
"仅限POP商家设置"
>
{
getFieldDecorator
(
'
organizationId
'
,
rulesHandler
(
'
organizationId
'
,
[]))(
supplierList
.
length
?
(
...
...
src/pages/systemManage/Account/data.js
View file @
d80e9769
...
...
@@ -10,10 +10,6 @@ export const getColumns = props => {
canAddEdit
,
}
=
props
;
return
[
{
title
:
'
用户ID
'
,
dataIndex
:
'
id
'
,
},
{
title
:
'
用户名
'
,
dataIndex
:
'
account
'
,
...
...
@@ -29,13 +25,22 @@ export const getColumns = props => {
},
{
title
:
'
最后一次登录时间
'
,
dataIndex
:
'
updateTime
'
,
dataIndex
:
'
lastLogin
'
,
hideInSearch
:
true
,
},
{
title
:
'
角色
'
,
dataIndex
:
'
creator
'
,
render
:
(
value
,
record
)
=>
<
a
onClick
=
{()
=>
openRolePermissionsModal
(
record
)}
>
{
value
}
<
/a>
,
render
:
(
value
,
record
)
=>
{
const
{
roles
}
=
record
;
const
roleElement
=
roles
.
map
((
role
,
index
)
=>
(
<>
<
a
onClick
=
{()
=>
openRolePermissionsModal
(
role
)}
>
{
role
.
name
}
<
/a
>
{
roles
.
length
-
1
!==
index
?
'
,
'
:
''
}
<
/
>
));
return
roleElement
;
},
},
{
title
:
'
状态
'
,
...
...
src/pages/systemManage/Account/index.jsx
View file @
d80e9769
...
...
@@ -123,8 +123,6 @@ const Account = props => {
);
};
// export default Account;
export
default
connect
(({
menu
})
=>
({
permissions
:
menu
.
permissions
,
}))(
Account
);
src/pages/systemManage/Role/RoleInfo/index.jsx
View file @
d80e9769
...
...
@@ -90,7 +90,7 @@ const RoleInfo = props => {
console
.
log
(
'
params :>>
'
,
params
);
const
res
=
await
addResource
(
params
);
console
.
log
(
res
);
if
(
res
.
code
!==
2000
)
{
notification
.
warning
({
message
:
`
${
res
.
msg
}
:
${
res
.
detail
}
`
,
...
...
src/pages/systemManage/Role/data.js
View file @
d80e9769
...
...
@@ -2,7 +2,7 @@ import React from 'react';
import
{
Divider
,
Popconfirm
}
from
'
antd
'
;
export
const
getColumns
=
props
=>
{
const
{
onDeleteRole
,
toRoleInfo
}
=
props
;
const
{
onDeleteRole
,
toRoleInfo
,
canAddEdit
}
=
props
;
return
[
{
title
:
'
角色ID
'
,
...
...
@@ -25,7 +25,7 @@ export const getColumns = props => {
},
{
title
:
'
关联账号
'
,
dataIndex
:
'
acc
ount
'
,
dataIndex
:
'
userC
ount
'
,
hideInSearch
:
true
,
},
{
...
...
@@ -43,17 +43,21 @@ export const getColumns = props => {
key
:
'
action
'
,
render
:
(
value
,
record
)
=>
(
<>
<
a
onClick
=
{()
=>
toRoleInfo
(
record
)}
>
编辑
<
/a
>
<
Divider
type
=
"
vertical
"
/>
<
Popconfirm
placement
=
"
top
"
title
=
"
确定删除该角色吗?
"
onConfirm
=
{()
=>
onDeleteRole
(
record
)}
okText
=
"
确定
"
cancelText
=
"
取消
"
>
<
a
>
删除
<
/a
>
<
/Popconfirm
>
{
canAddEdit
?
<
a
onClick
=
{()
=>
toRoleInfo
(
record
)}
>
编辑
<
/a> : ''
}
{
canAddEdit
&&
record
.
userCount
!==
0
?
<
Divider
type
=
"
vertical
"
/>
:
''
}
{
record
.
userCount
===
0
?
(
<
Popconfirm
placement
=
"
top
"
title
=
"
确定删除该角色吗?
"
onConfirm
=
{()
=>
onDeleteRole
(
record
)}
okText
=
"
确定
"
cancelText
=
"
取消
"
>
<
a
>
删除
<
/a
>
<
/Popconfirm
>
)
:
(
''
)}
<
/
>
),
},
...
...
src/pages/systemManage/Role/index.jsx
View file @
d80e9769
...
...
@@ -4,16 +4,21 @@ import { Button, notification } from 'antd';
import
{
PageHeaderWrapper
}
from
'
@ant-design/pro-layout
'
;
import
ProTable
from
'
@ant-design/pro-table
'
;
import
{
connect
}
from
'
umi
'
;
import
{
ROLE_MANAGE
}
from
'
@/../config/permission.config
'
;
import
{
deleteRole
,
getRoleList
}
from
'
../service
'
;
// data
import
{
getColumns
}
from
'
./data
'
;
const
Role
=
props
=>
{
const
{
permissions
}
=
props
;
const
actionRef
=
useRef
();
const
formRef
=
useRef
();
const
history
=
useHistory
();
// 权限控制
const
canAddEdit
=
permissions
[
ROLE_MANAGE
.
EDITABLE
.
id
];
const
toRoleInfo
=
({
id
=
null
}
=
{})
=>
{
const
query
=
id
?
{
id
}
:
{};
history
.
push
({
...
...
@@ -39,6 +44,7 @@ const Role = props => {
const
columns
=
getColumns
({
onDeleteRole
,
toRoleInfo
,
canAddEdit
,
});
// 表格属性
...
...
@@ -57,9 +63,13 @@ const Role = props => {
};
},
toolBarRender
:
()
=>
[
<
Button
type=
"primary"
onClick=
{
()
=>
toRoleInfo
()
}
>
新增角色
</
Button
>,
canAddEdit
?
(
<
Button
type=
"primary"
onClick=
{
()
=>
toRoleInfo
()
}
>
新增角色
</
Button
>
)
:
(
<></>
),
],
};
// 搜索属性
...
...
src/pages/systemManage/service.js
View file @
d80e9769
...
...
@@ -37,6 +37,16 @@ export function addUser(params) {
});
}
/**
* @name 修改子账号
* @see http://yapi.quantgroups.com/project/509/interface/api/43344
*/
export
function
updateUser
(
params
)
{
return
request
.
post
(
'
/v2/user/update
'
,
{
data
:
params
,
});
}
/**
* @name 用户禁用
* @param {Object} params
...
...
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