From cafc7ba065fa2312ad3675658153a7734d0e8c07 Mon Sep 17 00:00:00 2001
From: deartibers <947466799@qq.com>
Date: Sat, 17 Sep 2022 16:59:59 +0800
Subject: [PATCH] =?UTF-8?q?=E5=85=B3=E7=B3=BB=E6=98=A0=E5=B0=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/sections/install/actions/roles.js | 57 ++++--
.../install/components/systemModal.jsx | 170 ++++++++++++++++
.../src/sections/install/containers/roles.jsx | 2 +-
.../sections/install/containers/system.jsx | 192 +++++++++++++++++-
web/client/src/utils/webapi.js | 7 +
5 files changed, 406 insertions(+), 22 deletions(-)
create mode 100644 web/client/src/sections/install/components/systemModal.jsx
diff --git a/web/client/src/sections/install/actions/roles.js b/web/client/src/sections/install/actions/roles.js
index 6081910..ff4b638 100644
--- a/web/client/src/sections/install/actions/roles.js
+++ b/web/client/src/sections/install/actions/roles.js
@@ -30,7 +30,7 @@ export function putOrganizationUser (data) {//更新成员状态
let msg = ''
if (data) {
pomsUserId = data.pomsUserId
- msg=data.msg
+ msg = data.msg
}
return (dispatch) =>
basicAction({
@@ -47,7 +47,7 @@ export function putOrganizationUser (data) {//更新成员状态
export function postOrganizationUser (data) {//添加/编辑成员
let msg = ''
if (data) {
- msg=data.msg
+ msg = data.msg
}
return (dispatch) =>
basicAction({
@@ -60,20 +60,53 @@ export function postOrganizationUser (data) {//添加/编辑成员
reducer: { name: "" },
});
}
-export function deteleOrganizationAdmin(data) {
+export function deteleOrganizationAdmin (data) {//删除管理员
let pomsUserId = ''
let msg = ''
if (data) {
pomsUserId = data.id
- msg=data.msg
+ msg = data.msg
}
return (dispatch) =>
- basicAction({
- type: "del",
+ basicAction({
+ type: "del",
+ dispatch: dispatch,
+ actionType: "DEL_ORGANIZATION_ADMIN",
+ url: `${ApiTable.deteleOrganizationAdmin.replace("{pomsUserId}", pomsUserId)}`,
+ msg: { option: msg }, //删除管理员
+ reducer: {},
+ });
+}
+export function getProjectPoms (query) {//获取已绑定项目
+ return (dispatch) => basicAction({
+ type: "get",
+ dispatch: dispatch,
+ actionType: "GET_PROJECT_POMS",
+ query: query,
+ url: `${ApiTable.getProjectPoms}`,
+ msg: { option: "获取已绑定项目" },
+ reducer: { name: "ProjectPoms", params: { noClear: true } },
+ });
+}
+export function getProjectAnxincloud (query) {//获取安心云项目
+ return (dispatch) => basicAction({
+ type: "get",
dispatch: dispatch,
- actionType: "DEL_ORGANIZATION_ADMIN",
- url: `${ApiTable.deteleOrganizationAdmin.replace("{pomsUserId}", pomsUserId)}`,
- msg: { option: msg }, //删除管理员
- reducer: {},
- });
- }
\ No newline at end of file
+ actionType: "GET_PROJECT_ANXINCLOUD",
+ query: query,
+ url: `${ApiTable.getProjectAnxincloud}`,
+ msg: { option: "获取安心云项目" },
+ reducer: { name: "ProjectPoms", params: { noClear: true } },
+ });
+}
+export function getProjectPmanage (query) {//获取PEP项目管理项目
+ return (dispatch) => basicAction({
+ type: "get",
+ dispatch: dispatch,
+ actionType: "GET_PROJECT_PMANAGE",
+ query: query,
+ url: `${ApiTable.getProjectPmanage}`,
+ msg: { option: "获取PEP项目管理项目" },
+ reducer: { name: "ProjectPoms", params: { noClear: true } },
+ });
+}
diff --git a/web/client/src/sections/install/components/systemModal.jsx b/web/client/src/sections/install/components/systemModal.jsx
new file mode 100644
index 0000000..6a03bf5
--- /dev/null
+++ b/web/client/src/sections/install/components/systemModal.jsx
@@ -0,0 +1,170 @@
+import React, { useState, useRef, useEffect } from "react";
+import { connect } from "react-redux";
+import { Modal, Form } from "@douyinfe/semi-ui";
+import { IconAlertCircle } from '@douyinfe/semi-icons';
+
+
+function adminModal (props) {
+ const {
+ close,
+ visible,
+ dispatch,
+ pepList,
+ actions,
+ adminEdit,//是否是编辑
+ editObj,
+ } = props;
+ const { install } = actions;
+ const form = useRef();//表单
+ const [disablePeople, setDisablePeople] = useState(true); //页码信息
+ const [peopleList, setPeopleList] = useState([]); //人员List
+ const [departmentId, setDepartmentId] = useState(); //部门id
+ const [peopleId, setPeopleId] = useState(); //人员id
+ //初始化
+ 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
+ }
+ }
+ setPeopleList(departmentList)
+ setDepartmentId(editObj.departments[0].id)
+ setPeopleId(editObj.pepUserId)
+ setDisablePeople(false)
+ }
+ }, []);
+
+ function handleOk () {
+ //点击弹框确定 右边按钮
+ form.current
+ .validate()
+ .then((values) => {
+ if (adminEdit) {
+ dispatch(install.deteleOrganizationAdmin({id:editObj.id,msg:''})).then(
+ dispatch(install.postOrganizationUser({ role: ['admin'], pepUserId: values.pepUserId, msg: '修改管理员' })).then((res) => {//获取项企(PEP)全部部门及其下用户
+ if (res.success) {
+ close();
+ }
+ })
+ )
+ }
+ else {
+ dispatch(install.postOrganizationUser({ role: ['admin'], pepUserId: values.pepUserId, msg: '新增管理员' })).then((res) => {//获取项企(PEP)全部部门及其下用户
+ if (res.success) {
+ close();
+ }
+ })
+ }
+ })
+ }
+ function handleCancel () {
+ close();
+ //点击弹框取消 左边按钮
+ }
+ return (
+ <>
+