import React, { useEffect, useRef, useState } from 'react'; import { connect } from 'react-redux'; import { Skeleton, Button, Pagination, Table, Popconfirm, Tooltip } from '@douyinfe/semi-ui'; 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 const { install } = actions; const [query, setQuery] = useState({ limit: 10, page: 0 }); //页码信息 const [limits, setLimits] = useState()//每页实际条数 const mylimits = useRef(); //每页实际条数 const [selected, setSelected] = useState([]) //表格被勾选项 const [systemModal, setSystemModal] = useState(false) //映射关系弹框 const [systemEdit, setSystemEdit] = useState(false) //是否是修改 const [anxincloudList, setAnxincloudList] = useState([]) //安心云列表 const [peplist, setPeplist] = useState([]) //PEP项目管理项目列表 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) }) 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 = 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) } setTableKey(mytableKey) setTableData(mytableData) setLimits(res.payload.data.count) mylimits.current = res.payload.data.rows.length } }) } const [columns, setColumns] = useState([//表格属性 { title: "序号", dataIndex: "index", key: 'index', render: (text, r, index) => { return index + 1; }, }, { title: 'PEP项企项目名称', dataIndex: "pepProjectName", key: 'pepProjectName', render: (_, row) => { return (
{ row.pepProjectIsDelete == 1 ? (
) : ('') }
7 || row?.name?.length > 7 ? '112px' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}> {row.pepProjectName || row.name}
{ row.pepProjectName ? (
{row.constructionStatus}
) : (
POMS
) }
) } }, { title: '安心云项目名称', dataIndex: "anxinProject", 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 (
{ anxinerror ? (
) : ('') } { row.anxinProject.map((item, index) => { return (
{ row.anxinProject.length >= 3 ? (
7 ? '112px' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', display: index > 2 ? 'none' : '', color: item.projectState == -1 ? '#F93920' : '' }}> {item.name}
) : row.anxinProject.length == 2 ? (
12 ? '173.5px' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', color: item.projectState == -1 ? '#F93920' : '' }}> {item.name}
) : (
25 ? '358px' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', color: item.projectState == -1 ? '#F93920' : '' }}> {item.name}
) }
1 ? 'none' : '' }}>
) }) } { row.anxinProject.length > 3 ? ( { row.anxinProject.map((item, index) => { return (
{item.name},
) }) }
} trigger="click" style={{ lineHeight: 2 }}>
+{row.anxinProject.length - 3}
) : ('') } ) } }, { title: '关联时间', dataIndex: "createTime", key: 'time', render: (_, row) => { return moment(row.createTime).format("YYYY-MM-DD HH:mm:ss"); } }, { title: "管理", width: "20%", dataIndex: "text", key: 'text', render: (_, row) => { return (
{ dispatch(install.deleteProjectBind({ bindId: row?.id, msg: '删除安心云、项目管理项目绑定关系' })).then(() => { if (page.current > 0 && mylimits.current < 2) { setQuery({ limit: 10, page: page.current - 1 }) } else { setQuery({ limit: 10, page: page.current }) } }) }} >
); }, }, ]) const rowSelection = { selectedRowKeys: selected, // 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)) }, } return ( <>
系统映射
ASSOCIATION & MAPPING
平台通过映射能力将多个系统的结构化、非结构化、半结构化数据按照平台算法进行分类关联,形成整体项目信息结构,以项企PEP的项目名称进行规范。
勾选 {selected.length}条 信息
{ 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([]) }) }} >
共{limits}条信息 { setQuery({ limit: pageSize, page: currentPage - 1 }); page.current = currentPage - 1 setSelected([]) }} />
{//映射关系弹框 systemModal ? { setSystemModal(false); }} close={() => { setSystemModal(false); getProjectPomsList() }} > : '' } ) } function mapStateToProps (state) { const { auth, global, ProjectPoms } = state; return { loading: ProjectPoms.isRequesting, user: auth.user, actions: global.actions, // members: members.data, }; } export default connect(mapStateToProps)(Example);