From 452b2af3f18dbfa36088fcd5ae28cb64847d58cc Mon Sep 17 00:00:00 2001 From: deartibers <947466799@qq.com> Date: Thu, 15 Sep 2022 10:09:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=BA=E5=91=98=E5=8F=8A=E8=A7=92=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../install/components/adminModal.jsx | 47 +++++++++++-------- .../install/components/memberModal.jsx | 28 +++++++---- 2 files changed, 47 insertions(+), 28 deletions(-) diff --git a/web/client/src/sections/install/components/adminModal.jsx b/web/client/src/sections/install/components/adminModal.jsx index cb1219a..98a7b8c 100644 --- a/web/client/src/sections/install/components/adminModal.jsx +++ b/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)} diff --git a/web/client/src/sections/install/components/memberModal.jsx b/web/client/src/sections/install/components/memberModal.jsx index 6e04ab7..dc4c55e 100644 --- a/web/client/src/sections/install/components/memberModal.jsx +++ b/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 ( - + {item.name} ) @@ -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) => {