Browse Source

人员及角色

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

17
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.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)
if(res.success){
close();
}
})
}
})
@ -79,6 +85,8 @@ function adminModal (props) {
labelAlign="right"
labelWidth="90px"
onValueChange={(values, field) => {
for (var key in field) {
if (key == 'department') {
if (values.department >= 0) {
let departmentList = []
for (let i = 0; i < pepList.length; i++) {
@ -88,13 +96,14 @@ function adminModal (props) {
}
setPeopleList(departmentList)
setDisablePeople(false)
// if(disablePeople){
// form.current.setValue(pepUserId, undefined);
// }
form.current.setValue('pepUserId', undefined);
}
else {
setPeopleList([])
setDisablePeople(true)
form.current.setValue('pepUserId', undefined);
}
}
}
}}
getFormApi={(formApi) => (form.current = formApi)}

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

@ -58,7 +58,9 @@ function memberModal (props) {
.validate()
.then((values) => {
dispatch(install.postOrganizationUser({ role: values.role, pepUserId: values.pepUserId })).then((res) => {//(PEP)
if(res.success){
close();
}
})
})
}
@ -91,12 +93,20 @@ function memberModal (props) {
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);
}
}
}
@ -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}
>
{

Loading…
Cancel
Save