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
850ed712
Commit
850ed712
authored
Sep 16, 2022
by
李腾
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 完成新建账户业务逻辑
parent
9a9fadc9
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
114 additions
and
42 deletions
+114
-42
env.config.js
config/env.config.js
+7
-7
permission.config.js
config/permission.config.js
+37
-0
menu.js
src/models/menu.js
+5
-3
index.jsx
src/pages/systemManage/Account/UserInfo/index.jsx
+39
-10
data.js
src/pages/systemManage/Account/data.js
+15
-8
index.jsx
src/pages/systemManage/Account/index.jsx
+11
-3
account.js
src/pages/systemManage/mock/account.js
+0
-11
No files found.
config/env.config.js
View file @
850ed712
...
...
@@ -2,19 +2,19 @@ const isProduction = process.env.NODE_ENV === 'production';
const
isPre
=
process
.
env
.
PRE_ENV
===
'
pre
'
;
const
envAPi
=
{
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
'
,
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
'
,
// 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-
sc
.liangkebang.net
'
,
querysApi
:
'
https://sc-settlement-api-
xyqb
.liangkebang.net
'
,
// goodsApi: '//192.168.188.111:7000',
prologueDomain
:
'
https://mall-
sc
.liangkebang.net
'
,
prologueDomain
:
'
https://mall-
xyqb
.liangkebang.net
'
,
// qiniuHost: 'https://appsync.lkbang.net',
qiniuHost
:
'
https://kdspstatic.q-gp.com/
'
,
opapiHost
:
'
https://opapi-
sc
.liangkebang.net
'
,
opapiHost
:
'
https://opapi-
xyqb
.liangkebang.net
'
,
};
const
prodApi
=
{
...
...
config/permission.config.js
0 → 100644
View file @
850ed712
/** @name 系统管理 */
// 账号管理
export
const
ACCOUNT_MANAGE
=
{
LIST
:
{
name
:
'
账号列表
'
,
id
:
'
010101
'
,
},
EDITABLE
:
{
name
:
'
新增/修改
'
,
id
:
'
010102
'
,
},
};
// 角色管理
export
const
ROLE_MANAGE
=
{
LIST
:
{
name
:
'
角色列表
'
,
id
:
'
010201
'
,
},
EDITABLE
:
{
name
:
'
新增/修改
'
,
id
:
'
010202
'
,
},
};
// 日志管理
export
const
LOG_MANAGE
=
{};
/** @name 商品管理 */
/** @name 订单管理 */
/** @name 售后地址设置 */
/** @name 售后管理 */
/** @name 供应商对账结算管理 */
/** @name 系统管理 */
src/models/menu.js
View file @
850ed712
...
...
@@ -32,7 +32,7 @@ const MenuModel = {
*
getMenuData
({
payload
},
{
put
,
call
})
{
const
response
=
yield
call
(
getMenuData
,
payload
);
if
(
response
.
code
===
2000
)
{
window
.
localStorage
.
setItem
(
'
permissions
'
,
JSON
.
stringify
(
response
.
data
));
//
window.localStorage.setItem('permissions', JSON.stringify(response.data));
// 拿到数据后response.data后组装成新的数据复制给menuData
yield
put
({
type
:
'
save
'
,
...
...
@@ -70,14 +70,16 @@ const MenuModel = {
};
const
menuData
=
initializationData
(
payload
);
// console.log('payload', payload, JSON.parse(localStorage.getItem('permissions')))
// 设置全局权限数据rules
let
{
permissions
}
=
state
;
if
(
JSON
.
stringify
(
permissions
)
===
'
{}
'
)
{
const
currentPermissions
=
localStorage
.
getItem
(
'
permissions
'
)
;
const
currentPermissions
=
payload
;
if
(
currentPermissions
)
{
const
arr
=
JSON
.
parse
(
currentPermissions
)
;
const
arr
=
currentPermissions
;
permissions
=
filterPermission
(
arr
);
}
window
.
localStorage
.
setItem
(
'
permissions
'
,
JSON
.
stringify
(
permissions
));
}
return
{
...
state
,
menuData
,
permissions
};
},
...
...
src/pages/systemManage/Account/UserInfo/index.jsx
View file @
850ed712
import
React
,
{
useRef
,
useState
,
useEffect
}
from
'
react
'
;
import
{
Input
,
Checkbox
,
Button
,
notification
,
Spin
}
from
'
antd
'
;
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
style
from
'
./index.less
'
;
import
{
getRoleList
,
addUser
,
getUserDetail
}
from
'
../../service
'
;
import
{
shopGetBySupplierId
}
from
'
@/pages/ServiceGoods/service
'
;
import
UUID
from
'
@/utils/uuid
'
;
import
style
from
'
./index.less
'
;
const
AddUser
=
props
=>
{
const
{
getFieldDecorator
,
validateFields
,
getFieldValue
,
setFieldsValue
}
=
props
.
form
;
...
...
@@ -20,6 +20,8 @@ const AddUser = props => {
const
[
detailInfo
,
setDetailInfo
]
=
useState
({});
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
userInfo
=
JSON
.
parse
(
localStorage
.
getItem
(
'
user
'
)
||
'
{}
'
);
const
rolePermissionsModalRef
=
useRef
();
// 表单布局
...
...
@@ -117,6 +119,10 @@ const AddUser = props => {
</
Checkbox
>
));
// 选择门店多选框
const
selectSupplierCheckbox
=
()
=>
supplierList
.
map
(
item
=>
<
Radio
value=
{
item
.
orgId
}
>
{
item
.
name
}
</
Radio
>);
// 表单验证辅助函数
const
rulesHandler
=
(
field
,
initialValue
=
''
)
=>
({
rules
:
formRules
[
field
]
||
[],
...
...
@@ -132,10 +138,30 @@ const AddUser = props => {
}
// 提交
console
.
log
(
fieldsValue
);
const
{
organizationId
}
=
fieldsValue
;
const
{
orgId
}
=
userInfo
;
const
params
=
{
...
fieldsValue
,
code
:
UUID
.
createUUID
(),
email
:
`
${
orgId
.
substring
(
0
,
8
)}
@stms.quantgroup.cn`
,
organization
:
{
id
:
organizationId
||
orgId
,
},
};
delete
params
.
organizationId
;
const
res
=
await
addUser
(
params
);
if
(
res
.
code
!==
2000
)
{
notification
.
warning
({
message
:
res
.
detail
||
res
.
msg
,
});
return
;
}
notification
.
success
({
message
:
'
保存成功
'
,
});
setTimeout
(()
=>
{
window
.
history
.
back
();
},
1000
);
});
};
...
...
@@ -209,12 +235,11 @@ const AddUser = props => {
)
}
</
Form
.
Item
>
<
Form
.
Item
label=
"选择门店"
extra=
"仅限POP商家设置"
>
{
getFieldDecorator
(
'
store
'
,
rulesHandler
(
'
store
'
,
[]))(
{
getFieldDecorator
(
'
organizationId
'
,
rulesHandler
(
'
organizationId
'
,
[]))(
supplierList
.
length
?
(
<
Checkbox
.
Group
disabled=
{
!!
id
}
style=
{
{
width
:
'
100%
'
}
}
>
<
Checkbox
value=
"1"
>
门店1
</
Checkbox
>
<
Checkbox
value=
"2"
>
门店2
</
Checkbox
>
</
Checkbox
.
Group
>
<
Radio
.
Group
disabled=
{
!!
id
}
style=
{
{
width
:
'
100%
'
}
}
>
{
selectSupplierCheckbox
()
}
</
Radio
.
Group
>
)
:
(
<
div
>
暂无门店信息
</
div
>
),
...
...
@@ -222,7 +247,11 @@ const AddUser = props => {
</
Form
.
Item
>
<
Form
.
Item
label=
"用户角色"
>
{
getFieldDecorator
(
'
roleId
'
,
rulesHandler
(
'
roleId
'
))(
<
Checkbox
.
Group
style=
{
{
width
:
'
100%
'
}
}
>
{
userRoleCheckbox
()
}
</
Checkbox
.
Group
>,
roleList
.
length
?
(
<
Checkbox
.
Group
style=
{
{
width
:
'
100%
'
}
}
>
{
userRoleCheckbox
()
}
</
Checkbox
.
Group
>
)
:
(
<
div
>
暂无角色信息
</
div
>
),
)
}
</
Form
.
Item
>
...
...
src/pages/systemManage/Account/data.js
View file @
850ed712
...
...
@@ -7,6 +7,7 @@ export const getColumns = props => {
openRolePermissionsModal
,
openUpdateStatusModal
,
openResetPasswordModal
,
canAddEdit
,
}
=
props
;
return
[
{
...
...
@@ -55,14 +56,20 @@ export const getColumns = props => {
hideInSearch
:
true
,
render
:
(
value
,
record
)
=>
(
<>
<
a
onClick
=
{()
=>
{
toUserInfo
(
record
);
}}
>
编辑
<
/a
>
<
Divider
type
=
"
vertical
"
/>
{
canAddEdit
?
(
<>
<
a
onClick
=
{()
=>
{
toUserInfo
(
record
);
}}
>
编辑
<
/a
>
<
Divider
type
=
"
vertical
"
/>
<
/
>
)
:
(
''
)}
<
a
onClick
=
{()
=>
{
openUpdateStatusModal
(
record
);
...
...
src/pages/systemManage/Account/index.jsx
View file @
850ed712
import
React
,
{
useRef
,
useState
}
from
'
react
'
;
import
React
,
{
useRef
,
useState
,
useEffect
}
from
'
react
'
;
import
{
useHistory
}
from
'
react-router-dom
'
;
import
{
Button
,
Divider
}
from
'
antd
'
;
import
{
PageHeaderWrapper
}
from
'
@ant-design/pro-layout
'
;
...
...
@@ -6,6 +6,7 @@ import ProTable from '@ant-design/pro-table';
import
{
connect
}
from
'
umi
'
;
// data
import
{
ACCOUNT_MANAGE
}
from
'
@/../config/permission.config
'
;
import
{
getColumns
}
from
'
./data
'
;
// compoents
import
RolePermissionsModal
from
'
./components/RolePermissionsModal
'
;
...
...
@@ -14,7 +15,6 @@ import ResetPasswordModal from './components/ResetPasswordModal';
// mock
import
{
getUserList
}
from
'
../service
'
;
import
{
accountList
}
from
'
../mock/account
'
;
const
Account
=
props
=>
{
const
{
permissions
}
=
props
;
...
...
@@ -26,6 +26,12 @@ const Account = props => {
const
updateStatusModalRef
=
useRef
();
const
resetPasswordModal
=
useRef
();
// 权限控制-新增/修改
const
canAddEdit
=
permissions
[
ACCOUNT_MANAGE
.
EDITABLE
.
id
];
// 获取当前用户组织信息
const
userInfo
=
JSON
.
parse
(
localStorage
.
getItem
(
'
user
'
)
||
'
{}
'
);
// 新增编辑
const
toUserInfo
=
({
id
}
=
{})
=>
{
const
query
=
id
?
{
id
}
:
{};
...
...
@@ -60,6 +66,7 @@ const Account = props => {
openRolePermissionsModal
,
openUpdateStatusModal
,
openResetPasswordModal
,
canAddEdit
,
});
// 表格属性
...
...
@@ -72,6 +79,7 @@ const Account = props => {
const
res
=
await
getUserList
({
page
,
size
,
id
:
userInfo
,
});
const
{
content
=
[],
totalElements
}
=
res
.
data
;
return
{
...
...
@@ -82,7 +90,7 @@ const Account = props => {
},
toolBarRender
:
()
=>
{
// TODO: 权限控制
if
(
permissions
[
'
010102
'
]
)
{
if
(
canAddEdit
)
{
return
[
<
Button
type=
"primary"
onClick=
{
()
=>
toUserInfo
()
}
>
新增用户
...
...
src/pages/systemManage/mock/account.js
deleted
100644 → 0
View file @
9a9fadc9
export
const
accountList
=
[
{
id
:
1
,
username
:
'
liteng
'
,
name
:
'
李腾
'
,
createAt
:
'
2017-01-01
'
,
lastAt
:
'
2020-01-01
'
,
role
:
'
超级管理员
'
,
status
:
'
启用
'
,
},
];
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