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

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

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

Loading…
Cancel
Save