diff --git a/web/client/src/sections/control/containers/control.jsx b/web/client/src/sections/control/containers/control.jsx index 19fa77c..c4857d2 100644 --- a/web/client/src/sections/control/containers/control.jsx +++ b/web/client/src/sections/control/containers/control.jsx @@ -155,13 +155,7 @@ const Control = ({ dispatch, actions, user, history, loading, socket, pepProject }) } else { if (ProblemAlarm?.length > 0) { - ProblemAlarm.sort((a, b) => { - if (moment(a.StartTime).isBefore(b.StartTime)) { - return 1 - } else { - return -1 - } - }) + ProblemAlarm.sort((a, b) => (moment(a.StartTime).isBefore(b.StartTime) ? 1 : -1)) setProblemsList([...ProblemAlarm, ...problemsList]) } } @@ -187,19 +181,12 @@ const Control = ({ dispatch, actions, user, history, loading, socket, pepProject } }) } - newest.sort((a, b) => { - if (moment(a.time).isBefore(b.time)) { - return 1 - } else { - return -1 - } - }) + newest.sort((a, b) => (moment(a.time).isBefore(b.time) ? 1 : -1)) querydata.current = [...newest, ...querydata.current] setQueryData1([...querydata.current]) } }, [socketData]) - console.log(querydata.current); useEffect(() => { consoleToollink() @@ -423,13 +410,7 @@ const Control = ({ dispatch, actions, user, history, loading, socket, pepProject id: v.id, })) } - data.sort((a, b) => { - if (moment(a.time).isBefore(b.time)) { - return 1 - } else { - return -1 - } - }) + data.sort((a, b) => (moment(a.time).isBefore(b.time) ? 1 : -1)) // console.log(data) querydata.current = data setQueryData1(data) @@ -505,13 +486,7 @@ const Control = ({ dispatch, actions, user, history, loading, socket, pepProject id: v.id, })) } - data.sort((a, b) => { - if (moment(a.time).isBefore(b.time)) { - return 1 - } else { - return -1 - } - }) + data.sort((a, b) => (moment(a.time).isBefore(b.time) ? 1 : -1)) querydata.current = data setQueryData1(data) } diff --git a/web/client/src/sections/install/components/systemModal.jsx b/web/client/src/sections/install/components/systemModal.jsx index 48943f9..011109c 100644 --- a/web/client/src/sections/install/components/systemModal.jsx +++ b/web/client/src/sections/install/components/systemModal.jsx @@ -20,7 +20,8 @@ function adminModal (props) { anxincloudArr,//修改时已经选择的安心云列表 anxinDelete,//修改时安心云项目有删除,显示提示信息 appArr,//修改时添加应用 - bindId + bindId, + mapping //修改时的映射类型 } = props; const { install } = actions; const form = useRef();//表单 @@ -236,16 +237,14 @@ function adminModal (props) { } + > { [ { name: '智慧类', value: 'wisdom' }, diff --git a/web/client/src/sections/install/containers/system.jsx b/web/client/src/sections/install/containers/system.jsx index d0c83fe..b192fbe 100644 --- a/web/client/src/sections/install/containers/system.jsx +++ b/web/client/src/sections/install/containers/system.jsx @@ -8,472 +8,477 @@ 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);//哪一页 + 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);//哪一页 + const [mapping, setMapping] = useState() //修改时的映射类型 - function handleRow (record, index) {//斑马条纹 - // 给偶数行设置斑马纹 - if (index % 2 === 0) { - return { - style: { - background: '#FAFCFF', - } - }; - } else { - return {}; - } - } + function handleRow (record, index) {//斑马条纹 + // 给偶数行设置斑马纹 + if (index % 2 === 0) { + return { + style: { + background: '#FAFCFF', + } + }; + } else { + return {}; + } + } - const [tableData, setTableData] = useState([]) //表格数据 + const [tableData, setTableData] = useState([]) //表格数据 - const getPepProject = ()=>{ + const getPepProject = () => { dispatch(install.getProjectPmanage(query)).then((res) => {//获取PEP项目管理项目 setPeplist(res.payload.data) - }) - } + }) + } - useEffect(() => { - dispatch(install.getProjectAnxincloud(query)).then((res) => {//获取安心云项目 - setAnxincloudList(res.payload.data) - }) - getPepProject() - dispatch(install.getProjectAppList(query)).then((res) => {//获取应用列表 - setAppList(res.payload.data) - }) - console.log('user',user); - }, []) - useEffect(() => { - getProjectPomsList(); - }, [query]); + useEffect(() => { + dispatch(install.getProjectAnxincloud(query)).then((res) => {//获取安心云项目 + setAnxincloudList(res.payload.data) + }) + getPepProject() + dispatch(install.getProjectAppList(query)).then((res) => {//获取应用列表 + setAppList(res.payload.data) + }) + console.log('user', user); + }, []) + 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 + 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) } - }) - } - 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} -
+ 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} +
- { - row.pepProjectName ? ( -
-
- -
-
- {row.constructionStatus} -
-
- ) : ( -
-
- -
-
- POMS -
-
- ) + ) : ('') + } +
+ ) + } + }, + { + title: '关联时间', + dataIndex: "createTime", + key: 'time', + render: (_, row) => { + return moment(row.createTime).format("YYYY-MM-DD HH:mm:ss") + } + }, + { + title: '修改时间', + dataIndex: "updateTime", + key: 'updateTime', + render: (_, row) => { + return moment(row.updateTime).format("YYYY-MM-DD HH:mm:ss") + } + }, + { + title: '添加人员', + dataIndex: "pepUserName", + key: 'pepUserName', + render: (_, row) => { + return row.pepUserName + } + }, + { + title: "管理", + width: "20%", + dataIndex: "text", + key: 'text', + render: (_, row) => { + return ( +
+
- ) - } - }, - { - 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 ? ( - -
- -
-
) : ('') + else { + setPepProjectId() } - { - 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' : '' }}>
-
- ) - }) + 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) + } } - { - row.anxinProject.length > 3 ? ( - - { - row.anxinProject.map((item, index) => { - return ( -
- {item.name}, -
- ) - }) - } -
- } trigger="click" style={{ lineHeight: 2 }}> -
- +{row.anxinProject.length - 3} -
- - ) : ('') + 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])) } - - ) - } - }, - { - title: '关联时间', - dataIndex: "createTime", - key: 'time', - render: (_, row) => { - return moment(row.createTime).format("YYYY-MM-DD HH:mm:ss"); - } - }, - { - title: '修改时间', - dataIndex: "updateTime", - key: 'updateTime', - render: (_, row) => { - return moment(row.updateTime).format("YYYY-MM-DD HH:mm:ss"); - } - }, - { - title: '添加人员', - dataIndex: "pepUserName", - key: 'pepUserName', - render: (_, row) => { - return row.pepUserName - } - }, - { - title: "管理", - width: "20%", - dataIndex: "text", - key: 'text', - render: (_, row) => { - return ( -
- - { - dispatch(install.deleteProjectBind({ bindId: row?.id, msg: '删除安心云、项目管理项目绑定关系' })).then(() => { - getPepProject() - 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([]) - }} - /> -
-
- + + setAppArr(myapparr) + setAnxincloudArr(myanxinArr) + setBindId(row.id) + setMapping(row?.mappingClass) + setSystemEdit(true) + }} + > + 修改 + + { + dispatch(install.deleteProjectBind({ bindId: row?.id, msg: '删除安心云、项目管理项目绑定关系' })).then(() => { + getPepProject() + 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的项目名称进行规范。
- {//映射关系弹框 - systemModal ? - { - setSystemModal(false); +
+ +
+ +
+
+
勾选 {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([]) + }) }} - close={() => { - setSystemModal(false); - getProjectPomsList() - getPepProject() - }} > - : '' - } - - ) + > + + +
+
+ + 共{limits}条信息 + + { + setQuery({ limit: pageSize, page: currentPage - 1 }); + page.current = currentPage - 1 + setSelected([]) + }} + /> +
+
+ + + {//映射关系弹框 + systemModal ? + { + setSystemModal(false); + }} + close={() => { + setSystemModal(false); + getProjectPomsList() + getPepProject() + }} > + : '' + } + + ) } function mapStateToProps (state) { - const { auth, global, ProjectPoms } = state; - return { - loading: ProjectPoms.isRequesting, - user: auth.user, - actions: global.actions, - // members: members.data, - }; + const { auth, global, ProjectPoms } = state; + return { + loading: ProjectPoms.isRequesting, + user: auth.user, + actions: global.actions, + // members: members.data, + }; } export default connect(mapStateToProps)(Example); diff --git a/web/client/src/sections/problem/components/sideSheet.jsx b/web/client/src/sections/problem/components/sideSheet.jsx index 1d7740c..19efa7c 100644 --- a/web/client/src/sections/problem/components/sideSheet.jsx +++ b/web/client/src/sections/problem/components/sideSheet.jsx @@ -32,13 +32,7 @@ function SideSheets ({ dispatch, actions, close, alarmId }) { dispatch(problem.getAlarmDataDetailAgg({ alarmId: alarmId })).then((res) => { if (res?.success) { let dataSort = res.payload.data || [] - dataSort.sort((a, b) => { - if (moment(a.hours).isBefore(b.hours)) { - return -1 - } else { - return 1 - } - }) + dataSort.sort((a, b) => (moment(a.hours).isBefore(b.hours) ? -1 : 1)) let data = { grid: { left: '5%',