From 09d3121f02a7bf9bd5d1ad2afafe6aa5263a1b54 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Wed, 16 Nov 2022 17:55:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=90=E5=91=98=E8=AE=BE=E7=BD=AE=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E5=8F=96=E6=B6=88=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../install/components/memberModal.jsx | 504 +++++++++--------- 1 file changed, 254 insertions(+), 250 deletions(-) diff --git a/web/client/src/sections/install/components/memberModal.jsx b/web/client/src/sections/install/components/memberModal.jsx index eeab3a4..ded1a1b 100644 --- a/web/client/src/sections/install/components/memberModal.jsx +++ b/web/client/src/sections/install/components/memberModal.jsx @@ -1,268 +1,272 @@ import React, { useState, useRef, useEffect } from "react"; import { connect } from "react-redux"; -import { Modal, Form, CheckboxGroup, Checkbox,Button } from "@douyinfe/semi-ui"; +import { Modal, Form, CheckboxGroup, Checkbox, Button } from "@douyinfe/semi-ui"; import { IconAlertCircle } from '@douyinfe/semi-icons'; function memberModal (props) { - const { - close, - cancel, - visible, - dispatch, - pepList, - actions, - editObj, - memberEdit, - pomsList, - anxinDelete, - anxincloudArr - } = props; - const { install } = actions; - const form = useRef();//表单 - const [disablePeople, setDisablePeople] = useState(true); //页码信息 - const [peopleList, setPeopleList] = useState([]); //人员List - const [departmentId, setDepartmentId] = useState(); //部门id - const [jurisdiction, setJurisdiction] = useState([ - { - label: '数据分析师', - value: 'data_analyst', - text: '拥有数据、分析、工单、资料相关的权限' - }, { - label: '售后运维', - value: 'after_sale', - text: '拥有设备、问题、工单、资料相关的权限' - }, { - label: '资源管理者', - value: 'resource_manage', - text: '拥有资料、设备、工单相关的权限' - }, { - label: '客户服务', - value: 'customer_service', - text: '拥有服务、工单、资料相关的权限' - }, - ]); //权限配置 - const [pomsList_, setPomsList_] = useState([]) - //初始化 - useEffect(() => { - 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 - } + const { + close, + cancel, + visible, + dispatch, + pepList, + actions, + editObj, + memberEdit, + pomsList, + anxinDelete, + anxincloudArr + } = props; + const { install } = actions; + const form = useRef();//表单 + const [disablePeople, setDisablePeople] = useState(true); //页码信息 + const [peopleList, setPeopleList] = useState([]); //人员List + const [departmentId, setDepartmentId] = useState(); //部门id + const [jurisdiction, setJurisdiction] = useState([ + { + label: '数据分析师', + value: 'data_analyst', + text: '拥有数据、分析、工单、资料相关的权限' + }, { + label: '售后运维', + value: 'after_sale', + text: '拥有设备、问题、工单、资料相关的权限' + }, { + label: '资源管理者', + value: 'resource_manage', + text: '拥有资料、设备、工单相关的权限' + }, { + label: '客户服务', + value: 'customer_service', + text: '拥有服务、工单、资料相关的权限' + }, + ]); //权限配置 + const [pomsList_, setPomsList_] = useState([]) + //初始化 + useEffect(() => { + 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 } - setDepartmentId(editObj.departments[0].id) - setPeopleList(departmentList) - } - setPomsList_(pomsList.filter(p=>p.pepProjectIsDelete != -1)) - }, []); + } + setDepartmentId(editObj.departments[0].id) + setPeopleList(departmentList) + } + setPomsList_(pomsList.filter(p => p.pepProjectIsDelete != -1)) + }, []); - function handleOk () { - //点击弹框确定 右边按钮 - form.current - .validate() - .then((values) => { - let roleArr = JSON.parse(JSON.stringify(values.role)) - if (roleArr.indexOf('admin') != -1) { - roleArr.splice(roleArr.indexOf('admin'), 1) - } - if (memberEdit) { - 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, correlationProject: values.correlationProject, pepUserId: values.pepUserId, msg: '新增成员' })).then((res) => {//获取项企(PEP)全部部门及其下用户 - if (res.success) { - close(); + function handleOk () { + //点击弹框确定 右边按钮 + form.current + .validate() + .then((values) => { + let roleArr = JSON.parse(JSON.stringify(values.role)) + if (roleArr.indexOf('admin') != -1) { + roleArr.splice(roleArr.indexOf('admin'), 1) + } + if (memberEdit) { + 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, correlationProject: values.correlationProject, pepUserId: values.pepUserId, msg: '新增成员' })).then((res) => {//获取项企(PEP)全部部门及其下用户 + if (res.success) { + close(); + } + }) + } + }) + } + function handleCancel () { + cancel(); + //点击弹框取消 左边按钮 + } + return ( + <> + +
+
+
+
成员成为管理员后,拥有平台所有权限和项目,成员的普通角色会被禁用。
+
+
{ + 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); + } } - }) - } - }) - } - function handleCancel () { - cancel(); - //点击弹框取消 左边按钮 - } - return ( - <> - -
-
-
-
成员成为管理员后,拥有平台所有权限和项目,成员的普通角色会被禁用。
-
- { - 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); - } - } - } + } - }} - getFormApi={(formApi) => (form.current = formApi)} - > -
- - { - pepList.map((item, index) => { - return ( - - {item.name} - - ) - }) - } - -
-
- - { - peopleList.map((item, index) => { - return ( - - {item.name} - - ) - }) - } - -
-
- - { - jurisdiction.map((item, index) => { - return ( - -
-
- {item.label} -
-
- {item.text} -
-
-
- ) - }) - } -
-
-
- - -

- } - > - { - pomsList_.map((item, index) => { - return ( - - {item.pepProjectName || item.name} - - ) - }) - } -
-
+ }} + getFormApi={(formApi) => (form.current = formApi)} + > +
+ { - anxinDelete?.length > 0 ? ( -
-
- -
-
- 确定后“{anxinDelete.join('、')}”将被系统移除,原因是项目已在【项企】或【映射关系】中被删除! + pepList.map((item, index) => { + return ( + + {item.name} + + ) + }) + } + +
+
+ + { + peopleList.map((item, index) => { + return ( + + {item.name} + + ) + }) + } + +
+
+ + { + jurisdiction.map((item, index) => { + return ( + +
+
+ {item.label} +
+
+ {item.text} +
-
- ) : ('') + + ) + }) } - -
- - - ); + +
+
+ + + +

+ } + > + { + pomsList_.map((item, index) => { + return ( + + {item.pepProjectName || item.name} + + ) + }) + } +
+
+ { + anxinDelete?.length > 0 ? ( +
+
+ +
+
+ 确定后“{anxinDelete.join('、')}”将被系统移除,原因是项目已在【项企】或【映射关系】中被删除! +
+
+ ) : ('') + } + +
+
+ + ); } function mapStateToProps (state) { - const { auth, global, members } = state; - return { - // loading: members.isRequesting, - user: auth.user, - actions: global.actions, - // members: members.data, - }; + const { auth, global, members } = state; + return { + // loading: members.isRequesting, + user: auth.user, + actions: global.actions, + // members: members.data, + }; } export default connect(mapStateToProps)(memberModal);