|
|
@ -1,10 +1,12 @@ |
|
|
|
import React, { useEffect, useRef, useState } from 'react'; |
|
|
|
import { connect } from 'react-redux'; |
|
|
|
import { Skeleton, Button, Pagination, Table, Popconfirm, Tooltip } from '@douyinfe/semi-ui'; |
|
|
|
import { IconAlertTriangle } from "@douyinfe/semi-icons"; |
|
|
|
import { SkeletonScreen, } from "$components"; |
|
|
|
import moment from "moment"; |
|
|
|
import SystemModal from '../components/systemModal' |
|
|
|
import '../style.less' |
|
|
|
import { set } from 'nprogress'; |
|
|
|
|
|
|
|
const Example = (props) => { |
|
|
|
const { dispatch, actions, user, loading, socket } = props |
|
|
@ -17,10 +19,34 @@ const Example = (props) => { |
|
|
|
const [systemEdit, setSystemEdit] = useState(false) //是否是修改 |
|
|
|
const [anxincloudList, setAnxincloudList] = useState([]) //安心云列表 |
|
|
|
const [peplist, setPeplist] = useState([]) //PEP项目管理项目列表 |
|
|
|
const [pepProjectId,setPepProjectId]= useState() //修改时项企id |
|
|
|
|
|
|
|
|
|
|
|
const tableData = useRef([]); //表格数据 |
|
|
|
const [appList, setAppList] = useState([]) //应用列表 |
|
|
|
const [pepProjectId, setPepProjectId] = useState() //修改时项企id |
|
|
|
const [anxincloudArr, setAnxincloudArr] = useState([]) //修改时已经选择的安心云列表 |
|
|
|
const [pepname, setPepname] = useState() //修改时自定义项目名称 |
|
|
|
const [anxinDelete, setAnxinDelete] = useState([]) //修改时安心云项目有删除,显示提示信息 |
|
|
|
const [appArr, setAppArr] = useState([]) //修改时添加应用 |
|
|
|
const [bindId, setBindId] = useState() //修改时绑定的id |
|
|
|
const [tableKey, setTableKey] = useState([]) //修改时绑定的id |
|
|
|
const page = useRef(query.page);//哪一页 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function handleRow (record, index) {//斑马条纹 |
|
|
|
// 给偶数行设置斑马纹 |
|
|
|
if (index % 2 === 0) { |
|
|
|
return { |
|
|
|
style: { |
|
|
|
background: '#FAFCFF', |
|
|
|
} |
|
|
|
}; |
|
|
|
} else { |
|
|
|
return {}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const [tableData, setTableData] = useState([]) //表格数据 |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
dispatch(install.getProjectAnxincloud(query)).then((res) => {//获取安心云项目 |
|
|
|
setAnxincloudList(res.payload.data) |
|
|
@ -28,18 +54,26 @@ const Example = (props) => { |
|
|
|
dispatch(install.getProjectPmanage(query)).then((res) => {//获取PEP项目管理项目 |
|
|
|
setPeplist(res.payload.data) |
|
|
|
}) |
|
|
|
dispatch(install.getProjectAppList(query)).then((res) => {//获取应用列表 |
|
|
|
setAppList(res.payload.data) |
|
|
|
}) |
|
|
|
|
|
|
|
}, []) |
|
|
|
useEffect(() => { |
|
|
|
getProjectPomsList(); |
|
|
|
}, [query]); |
|
|
|
|
|
|
|
function getProjectPomsList () { |
|
|
|
dispatch(install.getProjectPoms(query)).then((res) => {//获取成员列表 |
|
|
|
if (res.success) { |
|
|
|
let mytableData = res.payload.data.rows; |
|
|
|
let mytableData = JSON.parse(JSON.stringify(res.payload.data.rows)); |
|
|
|
let mytableKey = [] |
|
|
|
for (let index = 0; index < mytableData.length; index++) { |
|
|
|
mytableData[index].key = mytableData[index].id |
|
|
|
mytableKey.push(mytableData[index].id) |
|
|
|
} |
|
|
|
tableData.current = mytableData; |
|
|
|
setTableKey(mytableKey) |
|
|
|
setTableData(mytableData) |
|
|
|
setLimits(res.payload.data.count) |
|
|
|
mylimits.current = res.payload.data.rows.length |
|
|
|
} |
|
|
@ -60,8 +94,24 @@ const Example = (props) => { |
|
|
|
key: 'anxinProject', |
|
|
|
width: 500, |
|
|
|
render: (_, row) => { |
|
|
|
let anxinerror = false |
|
|
|
let anxinerrorArr = [] |
|
|
|
for (let i = 0; i < row.anxinProject.length; i++) { |
|
|
|
if (row.anxinProject[i].projectState == -1) { |
|
|
|
anxinerror = true |
|
|
|
anxinerrorArr.push(row.anxinProject[i].name) |
|
|
|
} |
|
|
|
} |
|
|
|
return ( |
|
|
|
<div style={{ display: 'flex', alignItems: 'center' }}> |
|
|
|
{ |
|
|
|
anxinerror ? ( |
|
|
|
<Tooltip content={anxinerrorArr.join(',') + ',项目已在[安心云]中被删除'}> |
|
|
|
<div style={{ marginRight: 5 }}> |
|
|
|
<IconAlertTriangle size='small' style={{ color: '#FE9812' }} /> |
|
|
|
</div> |
|
|
|
</Tooltip>) : ('') |
|
|
|
} |
|
|
|
{ |
|
|
|
row.anxinProject.map((item, index) => { |
|
|
|
return ( |
|
|
@ -69,29 +119,50 @@ const Example = (props) => { |
|
|
|
{ |
|
|
|
row.anxinProject.length >= 3 ? ( |
|
|
|
<Tooltip content={item.name}> |
|
|
|
<div style={{ width: item.name.length > 7 ? '112px' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}> |
|
|
|
<div style={{ width: item.name.length > 7 ? '112px' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', display: index > 2 ? 'none' : '', color: item.projectState == -1 ? '#F93920' : '' }}> |
|
|
|
{item.name} |
|
|
|
</div> |
|
|
|
</Tooltip> |
|
|
|
) : row.anxinProject.length == 2 ? ( |
|
|
|
<Tooltip content={item.name}> |
|
|
|
<div style={{ width: item.name.length > 12 ? '173.5' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}> |
|
|
|
<div style={{ width: item.name.length > 12 ? '173.5px' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', color: item.projectState == -1 ? '#F93920' : '' }}> |
|
|
|
{item.name} |
|
|
|
</div> |
|
|
|
</Tooltip> |
|
|
|
) : ( |
|
|
|
<Tooltip content={item.name}> |
|
|
|
<div style={{ width: item.name.length > 25 ? '358' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}> |
|
|
|
<div style={{ width: item.name.length > 25 ? '358px' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', color: item.projectState == -1 ? '#F93920' : '' }}> |
|
|
|
{item.name} |
|
|
|
</div> |
|
|
|
</Tooltip> |
|
|
|
) |
|
|
|
} |
|
|
|
<div className='separator' style={{ width: 1, height: 12, border: '1px solid #DCDEE0', margin: '0px 10px' }}></div> |
|
|
|
<div className='separator' style={{ width: 1, height: 12, border: '1px solid #DCDEE0', margin: '0px 10px', display: index > 1 ? 'none' : '' }}></div> |
|
|
|
</div> |
|
|
|
) |
|
|
|
}) |
|
|
|
} |
|
|
|
{ |
|
|
|
row.anxinProject.length > 3 ? ( |
|
|
|
<Tooltip content={ |
|
|
|
<div style={{ display: 'flex', flexWrap: 'wrap' }}> |
|
|
|
{ |
|
|
|
row.anxinProject.map((item, index) => { |
|
|
|
return ( |
|
|
|
<div key={index} style={{ whiteSpace: 'nowrap', color: item.projectState == -1 ? '#F93920' : '' }}> |
|
|
|
{item.name}<span style={{ color: '#FFFFFF' }}>,</span> |
|
|
|
</div> |
|
|
|
) |
|
|
|
}) |
|
|
|
} |
|
|
|
</div> |
|
|
|
} trigger="click" style={{ lineHeight: 2 }}> |
|
|
|
<div style={{ fontSize: 14, color: '#005ABD', marginLeft: 8, cursor: "pointer", }}> |
|
|
|
+{row.anxinProject.length - 3} |
|
|
|
</div> |
|
|
|
</Tooltip> |
|
|
|
) : ('') |
|
|
|
} |
|
|
|
</div> |
|
|
|
) |
|
|
|
} |
|
|
@ -103,11 +174,37 @@ const Example = (props) => { |
|
|
|
render: (_, row) => { |
|
|
|
return ( |
|
|
|
<div style={{ display: 'flex', alignItems: 'center' }}> |
|
|
|
<Tooltip content={row.pepProjectName}> |
|
|
|
<div style={{ width: row.pepProjectName > 7 ? '112' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}> |
|
|
|
{row.pepProjectName} |
|
|
|
{ |
|
|
|
row.pepProjectIsDelete == 1 ? ( |
|
|
|
<Tooltip content={'失效,项目已在[项企PEP]中被删除!'}> |
|
|
|
<div style={{ marginRight: 5 }}> |
|
|
|
<IconAlertTriangle size='small' style={{ color: '#FE9812' }} /> |
|
|
|
</div> |
|
|
|
</Tooltip>) : ('') |
|
|
|
} |
|
|
|
<Tooltip content={row.pepProjectName || row.name}> |
|
|
|
<div style={{ width: row?.pepProjectName?.length > 7 || row?.name?.length > 7 ? '112px' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}> |
|
|
|
{row.pepProjectName || row.name} |
|
|
|
</div> |
|
|
|
</Tooltip> |
|
|
|
{ |
|
|
|
row.pepProjectName ? ( |
|
|
|
<div style={{ |
|
|
|
height: 18, marginLeft: 4, |
|
|
|
background: 'linear-gradient(180deg, #EBF5FF 0%, #EBF5FF 0%, #D3E8FF 100%)', |
|
|
|
borderRadius: 2, display: 'flex', alignItems: 'center' |
|
|
|
}}> |
|
|
|
<div> |
|
|
|
<img src="/assets/images/install/icon_zhengque.png" alt="" style={{ height: 10, width: 10, marginLeft: 4, marginRight: 9 }} /> |
|
|
|
</div> |
|
|
|
<div style={{ color: '#0F7EFB', fontSize: 11, marginRight: 12 }}> |
|
|
|
{row.constructionStatus} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
) : ( |
|
|
|
'' |
|
|
|
) |
|
|
|
} |
|
|
|
</div> |
|
|
|
) |
|
|
|
} |
|
|
@ -130,22 +227,48 @@ const Example = (props) => { |
|
|
|
<div style={{ display: "flex" }}> |
|
|
|
<Button |
|
|
|
theme="borderless" |
|
|
|
disabled={row.pepProjectIsDelete == 1} |
|
|
|
onClick={() => { |
|
|
|
setSystemModal(true); |
|
|
|
setPepProjectId(row.pepProjectId) |
|
|
|
// setEditObj(row) |
|
|
|
setPepname(row.name) |
|
|
|
if (!row.name) { |
|
|
|
setPepProjectId(row.pepProjectId) |
|
|
|
} |
|
|
|
else { |
|
|
|
setPepProjectId() |
|
|
|
} |
|
|
|
let myanxinArr = [] |
|
|
|
let anxinErrorList = [] |
|
|
|
for (let i = 0; i < row.anxinProject.length; i++) { |
|
|
|
if (row.anxinProject[i].projectState !== -1) { |
|
|
|
myanxinArr.push(row.anxinProject[i].id) |
|
|
|
} |
|
|
|
else { |
|
|
|
anxinErrorList.push(row.anxinProject[i].name) |
|
|
|
} |
|
|
|
} |
|
|
|
setAnxinDelete(anxinErrorList) |
|
|
|
let myapparr = [] |
|
|
|
let myarrarrList = JSON.parse(JSON.stringify(row.apps)) |
|
|
|
for (let j = 0; j < row.apps.length; j++) { |
|
|
|
delete myarrarrList[j].projectApp |
|
|
|
myapparr.push(JSON.stringify(myarrarrList[j])) |
|
|
|
} |
|
|
|
setAppArr(myapparr) |
|
|
|
setAnxincloudArr(myanxinArr) |
|
|
|
setBindId(row.id) |
|
|
|
setSystemEdit(true) |
|
|
|
}} |
|
|
|
> |
|
|
|
修改 |
|
|
|
</Button> |
|
|
|
<Popconfirm |
|
|
|
title="删除后,成员将无法登录。" |
|
|
|
title="删除后对应的项目全局将无法进入和显示,对应的信鸽服务也会被禁用" |
|
|
|
arrowPointAtCenter={false} |
|
|
|
showArrow={true} |
|
|
|
position="topRight" |
|
|
|
onConfirm={() => { |
|
|
|
dispatch(install.putOrganizationUser({ pomsUserId: row?.id, deleted: true, msg: '删除成员' })).then(() => { |
|
|
|
dispatch(install.deleteProjectBind({ bindId: row?.id, msg: '删除安心云、项目管理项目绑定关系' })).then(() => { |
|
|
|
if (page.current > 0 && mylimits.current < 2) { |
|
|
|
setQuery({ limit: 10, page: page.current - 1 }) |
|
|
|
} else { |
|
|
@ -163,15 +286,14 @@ const Example = (props) => { |
|
|
|
]) |
|
|
|
const rowSelection = { |
|
|
|
selectedRowKeys: selected, |
|
|
|
onSelect: (record, selected) => { |
|
|
|
console.log(`select row: ${selected}`, record); |
|
|
|
}, |
|
|
|
onSelectAll: (selected, selectedRows) => { |
|
|
|
console.log(`select all rows: ${selected}`, selectedRows); |
|
|
|
}, |
|
|
|
// onSelect: (record, selected) => { |
|
|
|
// // console.log(`select row: ${selected}`, record); |
|
|
|
// }, |
|
|
|
// onSelectAll: (selected, selectedRows) => { |
|
|
|
// // console.log(`select all rows: ${selected}`, selectedRows); |
|
|
|
// }, |
|
|
|
onChange: (selectedRowKeys, selectedRows) => { |
|
|
|
setSelected(selectedRows.map(v => v.key)) |
|
|
|
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows); |
|
|
|
}, |
|
|
|
} |
|
|
|
return ( |
|
|
@ -197,9 +319,11 @@ const Example = (props) => { |
|
|
|
setSystemModal(true); |
|
|
|
setSystemEdit(false) |
|
|
|
setPepProjectId() |
|
|
|
// setEditObj({}) |
|
|
|
// setMemberEdit(false) |
|
|
|
// setMemberModal(true); |
|
|
|
setPepname() |
|
|
|
setAnxinDelete([]) |
|
|
|
setAppArr([]) |
|
|
|
setAnxincloudArr() |
|
|
|
setBindId() |
|
|
|
}} |
|
|
|
> |
|
|
|
添加映射关系 |
|
|
@ -214,16 +338,12 @@ const Example = (props) => { |
|
|
|
> |
|
|
|
<Table |
|
|
|
columns={columns} |
|
|
|
dataSource={tableData.current} |
|
|
|
dataSource={tableData} |
|
|
|
bordered={false} |
|
|
|
empty="暂无数据" |
|
|
|
style={{ padding: "0px 20px", }} |
|
|
|
pagination={false} |
|
|
|
onRow={(record, index) => { |
|
|
|
if (index % 1 === 0) { |
|
|
|
return { style: { background: '#FAFCFF' } } |
|
|
|
} |
|
|
|
}} |
|
|
|
onRow={handleRow} |
|
|
|
rowSelection={rowSelection} |
|
|
|
/> |
|
|
|
</Skeleton> |
|
|
@ -235,13 +355,38 @@ const Example = (props) => { |
|
|
|
}} |
|
|
|
> |
|
|
|
<div> |
|
|
|
<div style={{ display: 'inline-block', lineHeight: '30px' }}>勾选<span style={{ fontWeight: 400, color: '#0F7EFB', }}>{selected.length}条</span>问题</div> |
|
|
|
<Button onClick={() => setSelected([])} style={{ width: 93, height: 24, borderRadius: '1px', border: '1px solid #0F7EFB', color: '#0F7EFB', fontWeight: 400, margin: '0 10px' }}>全选</Button> |
|
|
|
<Button type='primary' theme='solid' style={{ width: 93, height: 24, borderRadius: '1px', border: '1px solid #0F7EFB', color: '#FFFFFF', fontWeight: 400, }}>批量删除</Button> |
|
|
|
<div style={{ display: 'inline-block', lineHeight: '30px', fontSize: 13, }}>勾选<span style={{ fontWeight: 400, color: '#0F7EFB', }}>{selected.length}条</span>问题</div> |
|
|
|
<Button onClick={() => { |
|
|
|
if(selected.length==tableKey.length){ |
|
|
|
setSelected([]) |
|
|
|
} |
|
|
|
else{ |
|
|
|
setSelected(tableKey) |
|
|
|
} |
|
|
|
}} style={{ width: 93, height: 24, borderRadius: '1px', border: '1px solid #0F7EFB', color: '#0F7EFB', fontWeight: 400, margin: '0 10px' }}>全选</Button> |
|
|
|
<Popconfirm |
|
|
|
title="删除后对应的项目全局将无法进入和显示,对应的信鸽服务也会被禁用" |
|
|
|
arrowPointAtCenter={false} |
|
|
|
showArrow={true} |
|
|
|
position="topRight" |
|
|
|
onConfirm={() => { |
|
|
|
dispatch(install.deleteProjectBind({ bindId: selected.join(','), msg: '删除安心云、项目管理项目绑定关系' })).then(() => { |
|
|
|
if (page.current > 0 && mylimits.current == selected.length) { |
|
|
|
setQuery({ limit: 10, page: page.current - 1 }) |
|
|
|
} else { |
|
|
|
setQuery({ limit: 10, page: page.current }) |
|
|
|
} |
|
|
|
setSelected([]) |
|
|
|
}) |
|
|
|
}} |
|
|
|
> |
|
|
|
<Button type='primary' theme='solid' style={{ width: 93, height: 24, borderRadius: '1px', border: '1px solid #0F7EFB', color: '#FFFFFF', fontWeight: 400, }}>批量删除</Button> |
|
|
|
</Popconfirm> |
|
|
|
|
|
|
|
</div> |
|
|
|
<div style={{ display: 'flex', }}> |
|
|
|
<span style={{ lineHeight: "30px" }}> |
|
|
|
共{limits}个问题 |
|
|
|
<span style={{ lineHeight: "30px", fontSize: 13, color: 'rgba(0,90,189,0.8)' }}> |
|
|
|
共{limits}条信息 |
|
|
|
</span> |
|
|
|
<Pagination |
|
|
|
className="22" |
|
|
@ -260,18 +405,24 @@ const Example = (props) => { |
|
|
|
</div> |
|
|
|
{//映射关系弹框 |
|
|
|
systemModal ? |
|
|
|
<SystemModal |
|
|
|
visible={true} |
|
|
|
anxincloudList={anxincloudList} |
|
|
|
systemEdit={systemEdit} |
|
|
|
peplist={peplist} |
|
|
|
pepProjectId={pepProjectId} |
|
|
|
close={() => { |
|
|
|
setSystemModal(false); |
|
|
|
// getUserList() |
|
|
|
}} > |
|
|
|
</SystemModal> : '' |
|
|
|
} |
|
|
|
<SystemModal |
|
|
|
visible={true} |
|
|
|
anxincloudList={anxincloudList} |
|
|
|
systemEdit={systemEdit} |
|
|
|
peplist={peplist} |
|
|
|
appList={appList} |
|
|
|
pepname={pepname} |
|
|
|
anxincloudArr={anxincloudArr} |
|
|
|
pepProjectId={pepProjectId} |
|
|
|
anxinDelete={anxinDelete} |
|
|
|
appArr={appArr} |
|
|
|
bindId={bindId} |
|
|
|
close={() => { |
|
|
|
setSystemModal(false); |
|
|
|
getProjectPomsList() |
|
|
|
}} > |
|
|
|
</SystemModal> : '' |
|
|
|
} |
|
|
|
</> |
|
|
|
) |
|
|
|
} |
|
|
|