Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
CivManage
Project
Project
Details
Activity
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
ReactWeb5
CivManage
Commits
b8e5f5a6
Commit
b8e5f5a6
authored
Nov 03, 2020
by
张烨
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://g.civnet.cn:8443/test/maintenance
parents
20da8a93
7166fe46
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
161 additions
and
52 deletions
+161
-52
UserManage.js
src/pages/userCenter/UserManage.js
+161
-52
No files found.
src/pages/userCenter/UserManage.js
View file @
b8e5f5a6
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
{
Tree
,
Table
,
Space
,
message
,
Modal
,
Form
,
Input
}
from
'antd'
;
import
{
UserAddOutlined
,
UsergroupAddOutlined
,
FileAddTwoTone
,
FolderAddTwoTone
,
...
...
@@ -10,57 +9,21 @@ import {
}
from
'@ant-design/icons'
;
import
{
PageContainer
}
from
'@ant-design/pro-layout'
;
// import classnames from 'classnames';
import
{
get
,
post
}
from
'../../services'
;
import
{
get
}
from
'../../services'
;
import
styles
from
'./UserManage.less'
;
const
columns
=
[
{
title
:
'登录名'
,
dataIndex
:
'loginName'
,
key
:
'loginName'
,
},
{
title
:
'用户姓名'
,
dataIndex
:
'userName'
,
key
:
'userName'
,
},
{
title
:
'手机号码'
,
dataIndex
:
'phone'
,
key
:
'phone'
,
},
{
title
:
'钉钉账户'
,
dataIndex
:
'ddid'
,
key
:
'ddid'
,
},
{
title
:
'微信账户'
,
dataIndex
:
'wxid'
,
key
:
'wxid'
,
},
{
title
:
'操作'
,
key
:
'action'
,
render
:
(
text
,
record
)
=>
(
<
Space
size
=
"middle"
>
<
a
>
关联角色
{
record
.
name
}
<
/a
>
<
a
>
更改机构
<
/a
>
<
a
>
编辑
<
/a
>
<
a
>
冻结
<
/a
>
<
a
>
删除
<
/a
>
<
/Space
>
),
},
];
const
UserManage
=
()
=>
{
const
time
=
new
Date
();
const
[
tableLoading
,
setTableLoading
]
=
useState
(
false
);
const
[
treeData
,
setTreeData
]
=
useState
([]);
// 用户机构树
const
[
tableData
,
setTableData
]
=
useState
([]);
// 用户表
const
[
userVisible
,
setUserVisible
]
=
useState
(
false
);
const
[
deleteUserVisible
,
setDeleteUserVisible
]
=
useState
(
false
);
const
[
orgTitle
,
setOrgTitle
]
=
useState
(
'机构'
);
const
[
orgID
,
setOrgID
]
=
useState
(
'机构'
);
const
[
orgID
,
setOrgID
]
=
useState
();
const
[
userID
,
setUserID
]
=
useState
(
'机构'
);
const
[
addUserForm
]
=
Form
.
useForm
();
// 渲染机构目录树
const
mapTree
=
org
=>
{
const
haveChildren
=
Array
.
isArray
(
org
.
children
)
&&
org
.
children
.
length
>
0
;
return
{
...
...
@@ -71,9 +34,9 @@ const UserManage = () => {
onClick
=
{
e
=>
addUser
(
e
,
org
.
text
,
org
.
id
)}
title
=
"添加用户"
/>
<
FolderAddTwoTone
onClick
=
{
add
User
}
title
=
"添加下级机构"
/>
<
EditTwoTone
onClick
=
{
addUser
}
title
=
"编辑"
/>
<
DeleteTwoTone
onClick
=
{
addUser
}
title
=
"删除"
/>
<
FolderAddTwoTone
onClick
=
{
add
SubOrg
}
title
=
"添加下级机构"
/>
<
EditTwoTone
onClick
=
{
editOrg
}
title
=
"编辑"
/>
<
DeleteTwoTone
onClick
=
{
deleteOrg
}
title
=
"删除"
/>
<
/div
>
),
key
:
org
.
id
,
...
...
@@ -82,12 +45,54 @@ const UserManage = () => {
children
:
haveChildren
?
org
.
children
.
map
(
i
=>
mapTree
(
i
))
:
[],
};
};
// 用户表列名
const
columns
=
[
{
title
:
'登录名'
,
dataIndex
:
'loginName'
,
key
:
'loginName'
,
},
{
title
:
'用户姓名'
,
dataIndex
:
'userName'
,
key
:
'userName'
,
},
{
title
:
'手机号码'
,
dataIndex
:
'phone'
,
key
:
'phone'
,
},
{
title
:
'钉钉账户'
,
dataIndex
:
'ddid'
,
key
:
'ddid'
,
},
{
title
:
'微信账户'
,
dataIndex
:
'wxid'
,
key
:
'wxid'
,
},
{
title
:
'操作'
,
key
:
'action'
,
render
:
(
text
,
record
)
=>
(
<
Space
size
=
"middle"
>
<
a
>
关联角色
{
record
.
name
}
<
/a
>
<
a
>
更改机构
<
/a
>
<
a
>
编辑
<
/a
>
<
a
>
冻结
<
/a
>
<
a
onClick
=
{()
=>
deleteUser
(
record
)}
>
删除
<
/a
>
<
/Space
>
),
},
];
// 获取用户机构列表
useEffect
(()
=>
{
setTableLoading
(
true
);
get
(
`/Cityinterface/rest/services/OMS.svc/U_GetOUTree`
,
{
_version
:
9999
,
_dc
:
time
.
getTime
(),
node
:
-
1
,
})
.
then
(
res
=>
{
...
...
@@ -108,12 +113,17 @@ const UserManage = () => {
setTableLoading
(
true
);
get
(
`/Cityinterface/rest/services/OMS.svc/U_GetOneOUUserListNew`
,
{
_version
:
9999
,
_dc
:
time
.
getTime
(),
OUID
:
props
[
0
],
})
.
then
(
res
=>
{
setTableLoading
(
false
);
if
(
res
.
root
.
length
>
0
)
{
setTableData
(
res
.
root
);
const
table
=
res
.
root
.
map
((
item
,
index
)
=>
{
item
.
key
=
index
;
return
item
;
});
setTableData
(
table
);
}
})
.
catch
(
err
=>
{
...
...
@@ -128,8 +138,87 @@ const UserManage = () => {
setOrgTitle
(
`在
${
title
}
下添加用户`
);
setOrgID
(
id
);
};
const
submitAddUser
=
props
=>
{
setUserVisible
(
false
);
const
addSubOrg
=
(
e
,
title
,
id
)
=>
{
e
.
stopPropagation
();
// setUserVisible(true);
// setOrgTitle(`在${title}下添加机构`);
setOrgID
(
id
);
};
const
editOrg
=
(
e
,
title
,
id
)
=>
{
e
.
stopPropagation
();
// setUserVisible(true);
// setOrgTitle(`在${title}下添加用户`);
setOrgID
(
id
);
};
const
deleteOrg
=
(
e
,
title
,
id
)
=>
{
e
.
stopPropagation
();
// setUserVisible(true);
// setOrgTitle(`在${title}下添加用户`);
setOrgID
(
id
);
};
// 提交-添加用户
const
submitAddUser
=
()
=>
{
get
(
`/Cityinterface/rest/services/OMS.svc/U_AddUser`
,
{
_version
:
9999
,
_dc
:
time
.
getTime
(),
OUID
:
orgID
,
loginName
:
addUserForm
.
getFieldValue
(
'loginName'
),
password
:
addUserForm
.
getFieldValue
(
'password'
),
userName
:
addUserForm
.
getFieldValue
(
'userName'
),
phone
:
addUserForm
.
getFieldValue
(
'phone'
)
||
''
,
email
:
addUserForm
.
getFieldValue
(
'email'
)
||
''
,
ddid
:
addUserForm
.
getFieldValue
(
'ddid'
)
||
''
,
wxid
:
addUserForm
.
getFieldValue
(
'wxid'
)
||
''
,
})
.
then
(
res
=>
{
if
(
res
.
message
===
''
)
{
Modal
.
success
({
content
:
'添加成功'
,
});
setUserVisible
(
false
);
// 重新获取用户表
onSelect
([
orgID
]);
}
else
{
Modal
.
error
({
title
:
'添加失败'
,
content
:
res
.
message
,
});
}
})
.
catch
(
err
=>
{
message
.
error
(
err
);
});
};
const
deleteUser
=
record
=>
{
setDeleteUserVisible
(
true
);
setUserID
(
record
.
userID
);
};
const
submitDeleteUser
=
()
=>
{
get
(
`/Cityinterface/rest/services/OMS.svc/U_DeleteUser`
,
{
_version
:
9999
,
_dc
:
time
.
getTime
(),
userID
,
})
.
then
(
res
=>
{
if
(
res
.
message
===
''
)
{
Modal
.
success
({
content
:
'删除成功'
,
});
setDeleteUserVisible
(
false
);
// 重新获取用户表
onSelect
([
orgID
]);
}
else
{
Modal
.
error
({
title
:
'删除失败'
,
content
:
res
.
message
,
});
}
})
.
catch
(
err
=>
{
setTableLoading
(
false
);
message
.
error
(
err
);
});
};
return
(
...
...
@@ -140,6 +229,7 @@ const UserManage = () => {
height
:
'calc(100vh - 194px)'
,
background
:
'white'
,
float
:
'left'
,
padding
:
'10px'
,
}}
>
<
div
style
=
{{
padding
:
'8px'
}}
>
...
...
@@ -160,6 +250,7 @@ const UserManage = () => {
height
:
'calc(100vh - 194px)'
,
background
:
'white'
,
float
:
'right'
,
padding
:
'20px'
,
}}
>
<
Table
...
...
@@ -180,7 +271,7 @@ const UserManage = () => {
<UserAddOutlined style={{ color: 'blue', width: '40px' }} />
</div> */
}
{
/* <div style={{ width: '80%', float: 'right' }}> */
}
<
Form
>
<
Form
form
=
{
addUserForm
}
>
<
Form
.
Item
name
=
"loginName"
label
=
"登录名称"
...
...
@@ -203,7 +294,15 @@ const UserManage = () => {
>
<
Input
/>
<
/Form.Item
>
<
Form
.
Item
name
=
"userName"
label
=
"用 户 姓 名"
>
<
Form
.
Item
name
=
"userName"
label
=
"用户名称"
rules
=
{[
{
required
:
true
,
},
]}
>
<
Input
/>
<
/Form.Item
>
<
Form
.
Item
name
=
"phone"
label
=
"手 机 号 码"
>
...
...
@@ -221,6 +320,16 @@ const UserManage = () => {
<
/Form
>
{
/* </div> */
}
<
/Modal
>
<
Modal
title
=
"删除用户"
visible
=
{
deleteUserVisible
}
onOk
=
{
submitDeleteUser
}
onCancel
=
{()
=>
setDeleteUserVisible
(
false
)}
okText
=
"确认"
cancelText
=
"取消"
>
<
p
>
即将关联删除
主站点
用户关系,是否确认删除?
<
/p
>
<
/Modal
>
<
/PageContainer
>
);
};
...
...
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