From b27216f27fbce2cdfea057bfd0c35996ed8d64f6 Mon Sep 17 00:00:00 2001 From: deartibers <947466799@qq.com> Date: Wed, 21 Sep 2022 16:24:33 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E9=89=B4=E6=9D=83=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../install/components/memberModal.jsx | 44 +++++-- .../install/components/systemModal.jsx | 12 -- .../src/sections/install/containers/roles.jsx | 111 +++++++++++++++--- .../sections/install/containers/system.jsx | 4 +- 4 files changed, 132 insertions(+), 39 deletions(-) diff --git a/web/client/src/sections/install/components/memberModal.jsx b/web/client/src/sections/install/components/memberModal.jsx index e020ff3..61c9bac 100644 --- a/web/client/src/sections/install/components/memberModal.jsx +++ b/web/client/src/sections/install/components/memberModal.jsx @@ -13,6 +13,9 @@ function memberModal (props) { actions, editObj, memberEdit, + pomsList, + anxinDelete, + anxincloudArr } = props; const { install } = actions; const form = useRef();//表单 @@ -40,6 +43,7 @@ function memberModal (props) { ]); //权限配置 //初始化 useEffect(() => { + console.log('editObj',editObj); if (editObj.id) { let departmentList = [] for (let i = 0; i < pepList.length; i++) { @@ -62,14 +66,14 @@ function memberModal (props) { roleArr.splice(roleArr.indexOf('admin'), 1) } if (memberEdit) { - dispatch(install.postOrganizationUser({ role: roleArr,pomsUserId: editObj.id, pepUserId: values.pepUserId, msg: '修改成员' })).then((res) => {//获取项企(PEP)全部部门及其下用户 + dispatch(install.postOrganizationUser({ role: roleArr, correlationProject: values.correlationProject, pomsUserId: editObj.id, pepUserId: values.pepUserId, msg: '修改成员' })).then((res) => {//获取项企(PEP)全部部门及其下用户 if (res.success) { close(); } }) } - else{ - dispatch(install.postOrganizationUser({ role: roleArr, pepUserId: values.pepUserId, msg: '新增成员' })).then((res) => {//获取项企(PEP)全部部门及其下用户 + else { + dispatch(install.postOrganizationUser({ role: roleArr, correlationProject: values.correlationProject, pepUserId: values.pepUserId, msg: '新增成员' })).then((res) => {//获取项企(PEP)全部部门及其下用户 if (res.success) { close(); } @@ -201,22 +205,40 @@ function memberModal (props) { label="关联项目:" field="correlationProject" multiple - // placeholder="请选择部门" + placeholder="请选择关联项目" + initValue={anxincloudArr} style={{ width: 417 }} - // rules={[{ required: true, message: "请选择部门" }]} showClear > - {/* { - pepList.map((item, index) => { + { + pomsList.map((item, index) => { return ( - - {item.name} - + item.pepProjectIsDelete !== 1 ? ( + + {item.pepProjectName || item.name} + + ) : ('') ) }) - } */} + } + { + anxinDelete.length > 0 ? ( +
+
+ +
+
+ 确定后“{anxinDelete.join('、')}”将被系统移除,原因是项目已在【项企】中被删除! +
+
+ ) : ('') + } diff --git a/web/client/src/sections/install/components/systemModal.jsx b/web/client/src/sections/install/components/systemModal.jsx index 0c71c8b..8065542 100644 --- a/web/client/src/sections/install/components/systemModal.jsx +++ b/web/client/src/sections/install/components/systemModal.jsx @@ -31,18 +31,6 @@ function adminModal (props) { setCustom(true) setMyprojectType('axy') } - // if (editObj.id) { - // let departmentList = [] - // for (let i = 0; i < pepList.length; i++) { - // if (pepList[i].id == editObj.departments[0].id) { - // departmentList = pepList[i].users - // } - // } - // setPeopleList(departmentList) - // setDepartmentId(editObj.departments[0].id) - // setPeopleId(editObj.pepUserId) - // setDisablePeople(false) - // } }, []); function handleOk () { diff --git a/web/client/src/sections/install/containers/roles.jsx b/web/client/src/sections/install/containers/roles.jsx index 714ae0e..e38e6ab 100644 --- a/web/client/src/sections/install/containers/roles.jsx +++ b/web/client/src/sections/install/containers/roles.jsx @@ -18,6 +18,8 @@ const Roles = (props) => { const [editObj, setEditObj] = useState({});//管理员弹框修改内容 const [memberModal, setMemberModal] = useState(false);//成员弹框 const [memberEdit, setMemberEdit] = useState(false);//成员弹框是否修改 + const [anxincloudArr, setAnxincloudArr] = useState([]) //修改时已经选择的安心云列表 + const [anxinDelete, setAnxinDelete] = useState([]) //修改时安心云项目有删除,显示提示信息 const [columns, setColumns] = useState([//表格属性 { @@ -33,11 +35,11 @@ const Roles = (props) => { {row.name}
- {row.departments[0].name} + {row?.departments[0]?.name || ''}
{ row.departments.length > 1 ? ( - +
+{row.departments.length - 1}
@@ -51,17 +53,75 @@ const Roles = (props) => { { title: '项目名称', render: (_, row) => { + let anxinerror = false + let anxinerrorArr = [] + for (let i = 0; i < row.correlationProject.length; i++) { + if (row.correlationProject[i].del == -1) { + anxinerror = true + anxinerrorArr.push(row.correlationProject[i].pepProjectName) + } + } return ( -
+
+ { + anxinerror ? ( + +
+ +
+
) : ('') + } { row.correlationProject.map((item, index) => { return ( -
- {item} +
+ { + row.correlationProject.length >= 3 ? ( + +
7 ? '112px' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', display: index > 2 ? 'none' : '', color: item.del ? '#F93920' : '' }}> + {item.pepProjectName} +
+
+ ) : row.correlationProject.length == 2 ? ( + +
12 ? '173.5px' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', color: item.del ? '#F93920' : '' }}> + {item.pepProjectName} +
+
+ ) : ( + +
25 ? '358px' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', color: item.del ? '#F93920' : '' }}> + {item.pepProjectName} +
+
+ ) + } +
1 ? 'none' : '' }}>
) }) } + { + row.correlationProject.length > 3 ? ( + + { + row.correlationProject.map((item, index) => { + return ( +
+ {item.pepProjectName}, +
+ ) + }) + } +
+ } trigger="click" style={{ lineHeight: 2 }}> +
+ +{row.correlationProject.length - 3} +
+ + ) : ('') + }
) } @@ -103,7 +163,7 @@ const Roles = (props) => { title: (
售后运维 - +
@@ -136,7 +196,7 @@ const Roles = (props) => { title: (
资源管理者 - +
@@ -169,7 +229,7 @@ const Roles = (props) => { title: (
客户服务 - +
@@ -211,7 +271,7 @@ const Roles = (props) => { theme="borderless" style={{ color: '#F31C1C' }} onClick={() => { - dispatch(install.putOrganizationUser({ pomsUserId: row?.id, disabled: !row?.disabled,msg:'更新成员状态' })).then(() => { + dispatch(install.putOrganizationUser({ pomsUserId: row?.id, disabled: !row?.disabled, msg: '更新成员状态' })).then(() => { setQuery({ limit: 10, page: page.current }) }) }} @@ -225,7 +285,7 @@ const Roles = (props) => { showArrow={true} position="topRight" onConfirm={() => { - dispatch(install.putOrganizationUser({ pomsUserId: row?.id, disabled: !row?.disabled,msg:'更新成员状态' })).then(() => { + dispatch(install.putOrganizationUser({ pomsUserId: row?.id, disabled: !row?.disabled, msg: '更新成员状态' })).then(() => { setQuery({ limit: 10, page: page.current }) }) }} @@ -236,6 +296,18 @@ const Roles = (props) => {