From e563249b8b3d2376e617fdfc1982624acc3cd99d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com> Date: Fri, 2 Feb 2024 09:26:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E9=80=9A=E4=BC=81=E4=B8=9A=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Team/Setting/enterprise.jsx | 181 ++++++++++++++++++++++++++ 1 file changed, 181 insertions(+) create mode 100644 src/forge/Team/Setting/enterprise.jsx diff --git a/src/forge/Team/Setting/enterprise.jsx b/src/forge/Team/Setting/enterprise.jsx new file mode 100644 index 00000000..9972c1b9 --- /dev/null +++ b/src/forge/Team/Setting/enterprise.jsx @@ -0,0 +1,181 @@ +import React, { useEffect, useState } from 'react'; +import { WhiteBack , FlexAJ } from '../../Component/layout'; +import { Table , Pagination , Popconfirm, Button, message, Tooltip, Select, Spin } from 'antd'; +import Title from '../../Component/Title'; +import Search from '../../Component/Search'; +import styled from 'styled-components'; +import { getImageUrl } from 'educoder'; +import axios from 'axios'; +import { Link } from 'react-router-dom'; +import './teamSetting.scss'; +import { createEnterpriseByGitlinkOrgId, getRoleList, getUserList, checkOpenedEnterprise } from '../../Information/api'; + +const Img = styled.img`{ + width:30px; + height:30px; + border-radius:50%; +}` +const limit = 15; +export default (({organizeDetail,history,match, current_user})=>{ + const OIdentifier = match.params.OIdentifier; + const {login} = current_user + const [ page , setPage ] = useState(1); + const [ total , setTotal ] = useState(0); + const [ data , setData ] = useState(undefined); + const [ roleList, setRoleList] = useState([]); + const [loading, setLoading] = useState(false); + // 定时器 + let intervalId = null; + + useEffect(()=>{ + getRoleList().then(res=>{ + const {code, rows} = res && res.data + if(code === 200){ + setRoleList(rows); + } + }) + }, []) + + useEffect(()=>{ + if(organizeDetail){ + const {nickname} = organizeDetail; + document.title = `开通组织工作台-${nickname}`; + pollData() + } + }, [organizeDetail]) + + useEffect(()=>{ + if(organizeDetail && organizeDetail.id){ + getData(organizeDetail.id); + } + },[organizeDetail,page]) + + // 轮询函数 + const pollData = () => { + checkOpenedEnterprise(organizeDetail.id).then(res=>{ + if(res && res.data.code === 200){ + const {data} = res.data; + if(data.isOpen && !data.url){ + setLoading(true) + }else if(data.isOpen){ + clearInterval(intervalId); + window.location = data.url + } + } + }) + }; + + function getData(id){ + getUserList(id).then(res=>{ + const {code, rows, total} = res && res.data + if(code === 200){ + setData(rows); + setTotal(total); + } + }) + } + + // 切换分页 + function ChangePage(page){ + setPage(page); + } + + const columns = [ + { + title: '头像', + dataIndex: 'imageUrl', + render:(value)=>{ + return( + + ) + } + }, + { + title: '用户名', + dataIndex: 'nickname', + }, + { + title: '邮箱', + dataIndex: 'email', + }, + { + title: '所属团队', + dataIndex: ['role', 'roleKey'], + width:"20%", + render:(value,record)=>{ + return + } + }, + { + title: '操作', + dataIndex: 'username', + key: "action", + render:(value)=>{ + return ( + + ) + } + } + ] + + function createEnterprise(){ + const users = data.map(item=>{return {userId: item.userId, roleKey: item.role.roleKey}}) + createEnterpriseByGitlinkOrgId(organizeDetail.id, users).then(res=>{ + if(res && res.data.code === 200){ + message.success('开通成功'); + intervalId = setInterval(pollData, 1000); + }else{ + message.error(res && res.data.msg) + } + }) + } + return( + + +
+ 首次创建组织工作台时,系统将根据组织团队用户在组织工作台中根据不同团队初始化成不同角色。请您知悉以下角色权限,再次确认组织成员的角色分配。
+ 组织管理员:原owner团队成员,对组织内所有代码库均具有管理员权限,在组织工作台中拥有最高管理权限
+ 项目管理员:原管理员团队成员,对组织内所有代码库均具有管理员权限,在组织工作台中拥有项目管理权限
+ 普通成员:原开发者及报告者团队成员,对组织内所有代码库均具有开发者权限,在组织工作台中拥有项目基础使用权限及查看权限 +
+ +
+ {/* {setSearch(value)}}/> */} +
+ {/* + 角色筛选 + */} +
+
+
+ { + total > limit ? +
+ +
+ :"" + } +
+
+ + +
+
+
+ ) +}) \ No newline at end of file