Browse Source

人员及角色

dev
deartibers 2 years ago
parent
commit
452b2af3f1
  1. 47
      web/client/src/sections/install/components/adminModal.jsx
  2. 28
      web/client/src/sections/install/components/memberModal.jsx

47
web/client/src/sections/install/components/adminModal.jsx

@ -31,7 +31,7 @@ function adminModal (props) {
}
setPeopleList(departmentList)
setDepartmentId(editObj.departments[0].id)
setPeopleId(editObj.id)
setPeopleId(editObj.pepUserId)
setDisablePeople(false)
}
}, []);
@ -42,13 +42,19 @@ function adminModal (props) {
.validate()
.then((values) => {
if (adminEdit) {
dispatch(install.postOrganizationUser({ role: ['admin'], pepUserId: values.pepUserId })).then((res) => {//(PEP)
close();
})
dispatch(install.deteleOrganizationAdmin(editObj.id)).then(
dispatch(install.postOrganizationUser({ role: ['admin'], pepUserId: values.pepUserId })).then((res) => {//(PEP)
if(res.success){
close();
}
})
)
}
else {
dispatch(install.postOrganizationUser({ role: ['admin'], pepUserId: values.pepUserId })).then((res) => {//(PEP)
close();
if(res.success){
close();
}
})
}
})
@ -79,22 +85,25 @@ function adminModal (props) {
labelAlign="right"
labelWidth="90px"
onValueChange={(values, field) => {
if (values.department >= 0) {
let departmentList = []
for (let i = 0; i < pepList.length; i++) {
if (pepList[i].id == values.department) {
departmentList = pepList[i].users
for (var key in field) {
if (key == 'department') {
if (values.department >= 0) {
let departmentList = []
for (let i = 0; i < pepList.length; i++) {
if (pepList[i].id == values.department) {
departmentList = pepList[i].users
}
}
setPeopleList(departmentList)
setDisablePeople(false)
form.current.setValue('pepUserId', undefined);
}
else {
setPeopleList([])
setDisablePeople(true)
form.current.setValue('pepUserId', undefined);
}
}
setPeopleList(departmentList)
setDisablePeople(false)
// if(disablePeople){
// form.current.setValue(pepUserId, undefined);
// }
}
else {
setPeopleList([])
setDisablePeople(true)
}
}}
getFormApi={(formApi) => (form.current = formApi)}

28
web/client/src/sections/install/components/memberModal.jsx

@ -40,7 +40,7 @@ function memberModal (props) {
]); //
//
useEffect(() => {
if(editObj.id){
if (editObj.id) {
let departmentList = []
for (let i = 0; i < pepList.length; i++) {
if (pepList[i].id == editObj.departments[0].id) {
@ -58,7 +58,9 @@ function memberModal (props) {
.validate()
.then((values) => {
dispatch(install.postOrganizationUser({ role: values.role, pepUserId: values.pepUserId })).then((res) => {//(PEP)
close();
if(res.success){
close();
}
})
})
}
@ -88,19 +90,27 @@ function memberModal (props) {
labelAlign="right"
labelWidth="90px"
onValueChange={(values, field) => {
for(var key in field){
if(key=='department'){
for (var key in field) {
if (key == 'department') {
if (values.department >= 0) {
let departmentList = []
for (let i = 0; i < pepList.length; i++) {
if (pepList[i].id == values.department) {
departmentList = pepList[i].users
}
}
setPeopleList(departmentList)
setDisablePeople(false)
setPeopleList(pepList[values.department].users)
form.current.setValue('pepUserId', undefined);
}
else {
setPeopleList([])
setDisablePeople(true)
form.current.setValue('pepUserId', undefined);
}
}
}
}}
getFormApi={(formApi) => (form.current = formApi)}
>
@ -118,7 +128,7 @@ function memberModal (props) {
{
pepList.map((item, index) => {
return (
<Form.Select.Option key={item.id} value={index}>
<Form.Select.Option key={item.id} value={item.id}>
{item.name}
</Form.Select.Option>
)
@ -134,7 +144,7 @@ function memberModal (props) {
style={{ width: 417 }}
rules={[{ required: true, message: "请选择人员" }]}
showClear
initValue={editObj.id || ""}
initValue={editObj.pepUserId || ""}
disabled={disablePeople}
>
{
@ -153,7 +163,7 @@ function memberModal (props) {
field="role"
label='权限配置:'
showClear
initValue={editObj.role||[]}
initValue={editObj.role || []}
>
{
jurisdiction.map((item, index) => {

Loading…
Cancel
Save