Browse Source

表格,弹框

dev
wenlele 2 years ago
parent
commit
4829f6841a
  1. BIN
      web/client/assets/images/problem/anomaly.png
  2. 2
      web/client/src/components/index.js
  3. 40
      web/client/src/components/outHidden.jsx
  4. 37
      web/client/src/sections/problem/actions/problem.jsx
  5. 69
      web/client/src/sections/problem/components/inspection.jsx
  6. 50
      web/client/src/sections/problem/components/tableData.jsx
  7. 162
      web/client/src/sections/problem/containers/dataAlarm.jsx
  8. 15
      web/client/src/utils/webapi.js

BIN
web/client/assets/images/problem/anomaly.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 693 B

2
web/client/src/components/index.js

@ -3,10 +3,12 @@ import SimpleFileDownButton from './simpleFileDownButton'
import ReminderBox from './reminderBox' import ReminderBox from './reminderBox'
import Setup from './setup' import Setup from './setup'
import { SkeletonScreen } from './skeletonScreen' import { SkeletonScreen } from './skeletonScreen'
import OutHidden from './outHidden'
export { export {
SimpleFileDownButton, SimpleFileDownButton,
ReminderBox, ReminderBox,
Setup, Setup,
SkeletonScreen, SkeletonScreen,
OutHidden,
}; };

40
web/client/src/components/outHidden.jsx

@ -0,0 +1,40 @@
import React, { useState, useEffect } from "react";
import { Tooltip } from "@douyinfe/semi-ui";
function OutHidden ({ name, width, height, color, background, numberHidden, number }) {
return <>
{numberHidden ?
<div style={{ display: 'inline-block' }}>
<Tooltip content={name}>
<div style={{
width: width,
height: height,
color: color,
background: background,
}}>
{name.length > number ? `${name.substr(0, number)}...` : name}
</div>
</Tooltip>
</div>
: <div style={{ display: 'inline-block' }}>
<Tooltip content={name}>
<div style={{
width: width,
height: height,
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
color: color,
background: background,
}}>
{name}
</div>
</Tooltip>
</div>}
</>
}
export default OutHidden;

37
web/client/src/sections/problem/actions/problem.jsx

@ -25,3 +25,40 @@ export function getAlarmLnspection (query) { //查询应用巡检信息
reducer: { name: '' } reducer: { name: '' }
}); });
} }
export function putAlarmApplicationNoted (data) { //
return dispatch => basicAction({
type: 'put',
dispatch: dispatch,
data,
actionType: 'PUT-AIARM-APPLICATIO-NNOTED',
url: `${ApiTable.putAlarmApplicationNoted}`,
msg: { error: '预览失败' },
reducer: { name: '' }
});
}
export function getAlarmLnspectionApi (query) { ///
return dispatch => basicAction({
type: 'get',
dispatch: dispatch,
query,
actionType: 'GET_ALARM_LNICSPECTION-API',
url: `${ApiTable.getAlarmLnspectionApi}`,
msg: { error: '查询应用接口/元素错误信息失败' },
reducer: { name: '' }
});
}
export function postApiConfirm (data) { ///
return dispatch => basicAction({
type: 'post',
dispatch: dispatch,
data,
actionType: 'POST-API-CONFIRM',
url: `${ApiTable.postApiConfirm}`,
msg: { error: '添加确认信息失败' },
reducer: { name: '' }
});
}

69
web/client/src/sections/problem/components/inspection.jsx

@ -9,7 +9,8 @@ import { log } from "ezuikit-js";
let projectScrollbar; let projectScrollbar;
const Inspection = ({ dispatch, actions, route, statistic }) => { let timer
const Inspection = ({ dispatch, actions, user, route, statistic }) => {
const { problem } = actions const { problem } = actions
const [selectProject, setSelectProject] = useState([]) // const [selectProject, setSelectProject] = useState([]) //
const [applyFilter, setApplyFilter] = useState([]) // const [applyFilter, setApplyFilter] = useState([]) //
@ -19,6 +20,7 @@ const Inspection = ({ dispatch, actions, route, statistic }) => {
const [picturePop, setPicturePop] = useState(false) // const [picturePop, setPicturePop] = useState(false) //
const [pictureId, setPictureId] = useState() //id const [pictureId, setPictureId] = useState() //id
const [pictureData, setPictureData] = useState({}) // const [pictureData, setPictureData] = useState({}) //
const [notRead, setNotRead] = useState(0) //
const api = useRef(); const api = useRef();
const unfoldApi = useRef(false); const unfoldApi = useRef(false);
@ -60,18 +62,30 @@ const Inspection = ({ dispatch, actions, route, statistic }) => {
useEffect(() => { useEffect(() => {
dispatch(problem.getAlarmLnspection(checkPatrol)).then((res) => { dispatch(problem.getAlarmLnspection(checkPatrol)).then((res) => {
console.log(res.payload.data); // console.log(res.payload.data);
if (res.success) { if (res.success) {
setPatrolAbnormal(res.payload.data) setPatrolAbnormal(res.payload.data)
setNotRead(res.payload.data.filter(v => !v.notedTime).length)
} }
}) })
}, [checkPatrol]); }, [checkPatrol]);
useEffect(() => { useEffect(() => {
if (patrolAbnormal && pictureId) { if (patrolAbnormal && pictureId >= 0) {
console.log(patrolAbnormal.find(v => v.id == pictureId)); if (timer) clearTimeout(timer)
setPictureData(patrolAbnormal.find(v => v.id == pictureId)) timer = setTimeout(() => {
if (!patrolAbnormal[pictureId]?.notedTime) {
patrolAbnormal[pictureId].notedPepUser = user.name
patrolAbnormal[pictureId].notedPepUserId = user.id
patrolAbnormal[pictureId].notedTime = new Date()
setPatrolAbnormal(patrolAbnormal)
setNotRead(notRead - 1)
setPictureData(patrolAbnormal[pictureId])
dispatch(problem.putAlarmApplicationNoted({ inspectionId: patrolAbnormal[pictureId].id }))
}
}, 2000)
setPictureData(patrolAbnormal[pictureId])
} }
}, [pictureId]); }, [pictureId]);
@ -83,7 +97,7 @@ const Inspection = ({ dispatch, actions, route, statistic }) => {
<span style={{ width: 3, height: 20, background: '#005ABD', display: 'inline-block', margin: "0 10px 0 20px" }}></span> <span style={{ width: 3, height: 20, background: '#005ABD', display: 'inline-block', margin: "0 10px 0 20px" }}></span>
<span style={{ fontSize: 24, fontFamily: 'YouSheBiaoTiHei', color: '#101531', marginRight: 10 }}>{statistic[route]}</span> <span style={{ fontSize: 24, fontFamily: 'YouSheBiaoTiHei', color: '#101531', marginRight: 10 }}>{statistic[route]}</span>
<span style={{ fontSize: 12 }}>APPLY SEMI-AUTOMATIC INSPECTION</span> <span style={{ fontSize: 12 }}>APPLY SEMI-AUTOMATIC INSPECTION</span>
<div style={{ fontSize: 12 }}>仅保留48小时内的图片数据,每小时覆盖执行一次 <span style={{ fontWeight: 500, color: '#005ABD', fontSize: 12 }}>03专项2期已阅共123</span></div> <div style={{ fontSize: 12 }}>仅保留48小时内的图片数据,每小时覆盖执行一次 <span style={{ fontWeight: 500, color: '#005ABD', fontSize: 12 }}>03专项2期已阅共{notRead}</span></div>
</div> </div>
<div style={{ flex: 1, position: 'relative' }}> <div style={{ flex: 1, position: 'relative' }}>
<Form <Form
@ -182,7 +196,7 @@ const Inspection = ({ dispatch, actions, route, statistic }) => {
onMouseMove={() => document.getElementById('unfold').style.display = 'none'} onMouseMove={() => document.getElementById('unfold').style.display = 'none'}
onMouseOut={() => document.getElementById('unfold').style.display = 'block'} onMouseOut={() => document.getElementById('unfold').style.display = 'block'}
id="inspection" style={{ width: 'calc(100% - 20px)', marginLeft: 10, height: unfold ? 280 : 600, whiteSpace: unfold ? 'nowrap' : '', position: "relative", }}> id="inspection" style={{ width: 'calc(100% - 20px)', marginLeft: 10, height: unfold ? 280 : 600, whiteSpace: unfold ? 'nowrap' : '', position: "relative", }}>
{patrolAbnormal?.map(v => {patrolAbnormal?.map((v, i) =>
<div key={'name' + v.id} <div key={'name' + v.id}
style={{ style={{
width: 400, height: 238, width: 400, height: 238,
@ -192,9 +206,8 @@ const Inspection = ({ dispatch, actions, route, statistic }) => {
borderRadius: 2, border: '1px solid rgba(220,222,224,0.2)' borderRadius: 2, border: '1px solid rgba(220,222,224,0.2)'
}} }}
onClick={() => { onClick={() => {
console.log(v.id);
setPicturePop(true) setPicturePop(true)
setPictureId(v.id); setPictureId(i);
}} }}
> >
<img src={`/_file-server/${v.screenshot}`} style={{ width: 400, height: 182 }} /> <img src={`/_file-server/${v.screenshot}`} style={{ width: 400, height: 182 }} />
@ -225,7 +238,7 @@ const Inspection = ({ dispatch, actions, route, statistic }) => {
}}>{unfold ? '展开更多' : '收起'}<img style={{ width: 20, height: 20, paddingTop: 8 }} src={`/assets/images/problem/${unfold ? "dropDown" : 'pullUp'}.png`} /> }}>{unfold ? '展开更多' : '收起'}<img style={{ width: 20, height: 20, paddingTop: 8 }} src={`/assets/images/problem/${unfold ? "dropDown" : 'pullUp'}.png`} />
</div> </div>
{picturePop ? <Modal {picturePop ? <Modal
title={<div>{pictureData.app?.name} title={<div style={{}}>{pictureData.app?.name}
<span style={{ <span style={{
width: 80, height: 20, display: 'inline-block', width: 80, height: 20, display: 'inline-block',
background: 'url(/assets/images/problem/preview.png)', background: 'url(/assets/images/problem/preview.png)',
@ -234,30 +247,46 @@ const Inspection = ({ dispatch, actions, route, statistic }) => {
color: '#FFFFFF', fontSize: 12, color: '#FFFFFF', fontSize: 12,
textAlign: 'center', lineHeight: '20px', marginLeft: 10, textAlign: 'center', lineHeight: '20px', marginLeft: 10,
}}> }}>
{ }/{patrolAbnormal.length} {notRead}/{patrolAbnormal.length}
</span> </span>
</div>} </div>}
hasCancel={false} hasCancel={false}
footer={<div> footer={<div style={{ width: 425, margin: 'auto', display: "flex", justifyContent: 'space-around', }}>
<Button style={{ borderRadius: 2 }}>上一张</Button> <Button style={{ width: 92, height: 32, border: '1px solid rgba(0,0,0,0.15)', borderRadius: 2 }}
<Button>下载地址</Button> onClick={() => {
<Button>进入系统</Button> if (!pictureId == 0) setPictureId(pictureId - 1)
<Button>下一张</Button> }}
>上一张</Button>
<a href={`/_file-server/${pictureData.screenshot + '?filename=' + encodeURIComponent(pictureData.app?.name)}.png`}>
<Button style={{ width: 92, height: 32, color: '#005ABD', border: '1px solid #005ABD', borderRadius: 2 }}>图片下载</Button>
</a>
<a href={pictureData.app?.url} target="_blank">
<Button style={{ width: 92, height: 32, color: '#FFFFFF', background: '#005ABD', border: '1px solid rgba(0,0,0,0.15)', borderRadius: 2 }}>进入系统</Button>
</a>
<Button style={{ width: 92, height: 32, border: '1px solid rgba(0,0,0,0.15)', borderRadius: 2 }}
onClick={() => {
if (pictureId < patrolAbnormal.length - 1) setPictureId(pictureId + 1)
}}
>下一张</Button>
</div>} </div>}
visible={true} visible={true}
onOk={() => { onOk={() => {
}} }}
width={837} width={837}
onCancel={() => setPicturePop(false)} onCancel={() => {
setPicturePop(false)
if (timer) clearTimeout(timer)
}}
> >
<div> <div style={{ marginBottom: 12 }}>
{pictureData.notedTime ? <span>核验信息:{pictureData.notedPepUser} {pictureData.notedTime}</span>:""} {pictureData.notedTime ? <span style={{ marginRight: 14 }}>核验信息{pictureData.notedPepUser}&nbsp;{moment(pictureData.notedTime).format("YYYY-MM-DD HH:MM:SS")}</span> : ""}
<span>截取时间:{moment(pictureData.createTime).format("YYYY-MM-DD HH:MM:SS")}</span> <span>截取时间:{moment(pictureData.createTime).format("YYYY-MM-DD HH:MM:SS")}</span>
</div> </div>
<img src={`/_file-server/${pictureData.screenshot}`} <img src={`/_file-server/${pictureData.screenshot}`}
style={{ width: 789, height: 359 }} style={{ width: 789, height: 359 }}
/> />
</Modal> </Modal>
: "" : ""
@ -270,7 +299,7 @@ const Inspection = ({ dispatch, actions, route, statistic }) => {
function mapStateToProps (state) { function mapStateToProps (state) {
const { auth, global, members } = state; const { auth, global, members } = state;
return { return {
// user: auth.user, user: auth.user,
actions: global.actions, actions: global.actions,
// global: global, // global: global,
// members: members.data, // members: members.data,

50
web/client/src/sections/problem/components/tableData.jsx

@ -2,15 +2,43 @@ import React, { useState, useEffect, useRef } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { Button, Form, Modal, Skeleton, Pagination, Table } from "@douyinfe/semi-ui"; import { Button, Form, Modal, Skeleton, Pagination, Table } from "@douyinfe/semi-ui";
import { SkeletonScreen, } from "$components"; import { SkeletonScreen, } from "$components";
import moment from "moment";
const TableData = ({ dispatch, actions, route, collectData, setSetup, exhibition }) => {
const TableData = ({ dispatch, actions, route, collectData, setSetup, exhibition, selected, setSelected, setIfBulk, setConfirm }) => {
const { problem } = actions
const [selected, setSelected] = useState([]) // const [tableData, setTableData] = useState([]) //
const api = useRef(); const api = useRef();
useEffect(() => { useEffect(() => {
switch (route) {
case 'useAbnormal':
dispatch(problem.getAlarmLnspectionApi({})).then((res) => {
console.log(res.payload.data);
let tableDatas = res.payload.data?.rows.map(v => ({
key: v.id,
serialNumber: v.serialNumber,
projectName: v.app?.projectCorrelations?.map(r => r.name)?.filter(c => c),
appName: v.app?.name,
url: v.app?.url,
createTime: v.createTime ? moment(v.createTime).format("YYYY-MM-DD HH:MM:SS") : "",
updateTime: v.updateTime ? moment(v.updateTime).format("YYYY-MM-DD HH:MM:SS") : "",
confirmTime: v.confirmTime ? moment(v.confirmTime).format("YYYY-MM-DD HH:MM:SS") : "",
alarmContent: v.alarmContent,
screenshot: v.screenshot,
type: v.type,
confirm: v.confirm,
}))
console.log(tableDatas);
setTableData(tableDatas)
})
break;
default:
break;
}
}, [route]) }, [route])
@ -20,7 +48,7 @@ const TableData = ({ dispatch, actions, route, collectData, setSetup, exhibition
<> <>
<div style={{ backgroundColor: '#FFFFFF' }}> <div style={{ backgroundColor: '#FFFFFF' }}>
<div style={{}}> <div style={{}}>
<div style={{ display: "flex", marginBottom: 16 }}> <div style={{ display: "flex", marginBottom: 16, marginLeft: 20 }}>
<Form <Form
onSubmit={(values) => console.log(values)} onSubmit={(values) => console.log(values)}
// onValueChange={values=>console.log(values)} // onValueChange={values=>console.log(values)}
@ -84,7 +112,7 @@ const TableData = ({ dispatch, actions, route, collectData, setSetup, exhibition
marginRight: 10 marginRight: 10
}} }}
> >
<img title='导出' src="/assets/images/problem/export.png" style={{ width: 24, height: 24 }} onClick /> <img title='导出' src="/assets/images/problem/export.png" style={{ width: 24, height: 24 }} />
<img title='设置' src="/assets/images/problem/setup.png" style={{ width: 24, height: 24 }} onClick={() => setSetup(true)} /> <img title='设置' src="/assets/images/problem/setup.png" style={{ width: 24, height: 24 }} onClick={() => setSetup(true)} />
<Button <Button
theme="solid" theme="solid"
@ -110,7 +138,7 @@ const TableData = ({ dispatch, actions, route, collectData, setSetup, exhibition
> >
<Table <Table
columns={exhibition} columns={exhibition}
dataSource={[{ key: "156468", 1: '1', }, { key: "257425", 2: '555', }]} dataSource={tableData}
bordered={false} bordered={false}
empty="暂无数据" empty="暂无数据"
style={{ padding: "0px 20px", }} style={{ padding: "0px 20px", }}
@ -143,9 +171,9 @@ const TableData = ({ dispatch, actions, route, collectData, setSetup, exhibition
}} }}
> >
<div> <div>
<div style={{ display: 'inline-block', lineHeight: '30px', fontSize: 13 }}>勾选<span style={{ fontWeight: 400, color: '#0F7EFB',margin:'0 6px' }}>{selected.length}</span>问题</div> <div style={{ display: 'inline-block', lineHeight: '30px', fontSize: 13 }}>勾选<span style={{ fontWeight: 400, color: '#0F7EFB', margin: '0 6px' }}>{selected.length}</span>问题</div>
<Button onClick={() => setSelected(["156468", "257425"])} style={{ width: 93, height: 24, borderRadius: '1px', border: '1px solid #0F7EFB', color: '#0F7EFB', fontWeight: 400, margin: '0 10px' }}>全选</Button> <Button onClick={() => setSelected(tableData?.map(v => v.key))} 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> <Button type='primary' theme='solid' onClick={() => (setIfBulk(true), setConfirm(true))} style={{ width: 93, height: 24, borderRadius: '1px', border: '1px solid #0F7EFB', color: '#FFFFFF', fontWeight: 400, }}>批量确认</Button>
</div> </div>
<div style={{ display: 'flex', }}> <div style={{ display: 'flex', }}>
<span style={{ lineHeight: "30px", fontSize: 13 }}> <span style={{ lineHeight: "30px", fontSize: 13 }}>
@ -176,9 +204,9 @@ function mapStateToProps (state) {
// console.log(auth.user); // console.log(auth.user);
return { return {
user: auth.user, user: auth.user,
// actions: global.actions, actions: global.actions,
// global: global, global: global,
// members: members.data, // members: members,
}; };
} }
export default connect(mapStateToProps)(TableData); export default connect(mapStateToProps)(TableData);

162
web/client/src/sections/problem/containers/dataAlarm.jsx

@ -1,11 +1,14 @@
import React, { useEffect, useState } from 'react' import React, { useEffect, useState } from 'react'
import { connect } from 'react-redux' import { connect } from 'react-redux'
import { IconAlertCircle } from '@douyinfe/semi-icons' import { IconAlertCircle } from '@douyinfe/semi-icons'
import { Button, Form, Modal, Skeleton, Pagination, TextArea } from "@douyinfe/semi-ui";
import Statistics from '../components/statistics' import Statistics from '../components/statistics'
import TableData from '../components/tableData' import TableData from '../components/tableData'
import { Setup } from "$components"; import { Setup, OutHidden } from "$components";
import moment from "moment";
import '../style.less' import '../style.less'
import { request } from 'screenfull';
const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => { const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
@ -14,7 +17,14 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
const [collect, setCollect] = useState([]) // const [collect, setCollect] = useState([]) //
const [setup, setSetup] = useState(false); // const [setup, setSetup] = useState(false); //
const [tableSetup, setTableSetup] = useState([]); // const [tableSetup, setTableSetup] = useState([]); //
const [exhibition, setExhibition] = useState([]); // const [exhibition, setExhibition] = useState([]); //
const [anomaly, setAnomaly] = useState(); //
const [pictures, setPictures] = useState(false); //
const [confirm, setConfirm] = useState(false); //
const [ifBulk, setIfBulk] = useState(false); //
const [content, setContent] = useState(false); //
const [selected, setSelected] = useState([]) //
const tableType = { dataLnterrupt: 'dataLnterrupt', dataAbnormal: 'dataAbnormal', strategyHit: 'strategyHit', videoAbnormal: 'videoAbnormal', useAbnormal: 'useAbnormal', deviceAbnormal: 'deviceAbnormal' } const tableType = { dataLnterrupt: 'dataLnterrupt', dataAbnormal: 'dataAbnormal', strategyHit: 'strategyHit', videoAbnormal: 'videoAbnormal', useAbnormal: 'useAbnormal', deviceAbnormal: 'deviceAbnormal' }
const statistic = { dataLnterrupt: '数据中断统计', dataAbnormal: '数据异常统计', strategyHit: '策略命中统计', videoAbnormal: '视频异常统计', useAbnormal: '应用异常统计', deviceAbnormal: '设备异常统计' } const statistic = { dataLnterrupt: '数据中断统计', dataAbnormal: '数据异常统计', strategyHit: '策略命中统计', videoAbnormal: '视频异常统计', useAbnormal: '应用异常统计', deviceAbnormal: '设备异常统计' }
@ -110,13 +120,13 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
{ name: '历史', value: '22' }] { name: '历史', value: '22' }]
}], }],
useAbnormal: [ // (useAbnormal) useAbnormal: [ // (useAbnormal)
{ name: '搜索', field: '1' }, { name: '搜索', field: 'errType' },
{ {
name: '异常类型', field: '2', name: '异常类型', field: '2',
data: [ data: [
{ name: '接口报错', value: '11' }, { name: '接口报错', value: 'apiError ' },
{ name: '加载超时', value: '22' }, { name: '加载超时', value: 'timeout' },
{ name: '元素异常', value: '33' }] { name: '元素异常', value: 'element' }]
}, },
{ {
name: '异常状态', field: '3', name: '异常状态', field: '3',
@ -152,40 +162,74 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
// //
const tableList = { const tableList = {
dataLnterrupt: ['1', '2', '3', '4', '6', '9', '7', '5', '10', '8', '11', '12', '13', '14'], dataLnterrupt: ['projectName', '2', '3', '4', '6', '9', 'createTime', '5', '10', 'updateTime', '11', 'confirm', 'confirmTime', '14'],
dataAbnormal: ['1', '2', '3', '4', '15', '16', '9', '7', '5', '10', '8', '11', '12', '13'], dataAbnormal: ['projectName', '2', '3', '4', 'alarmContent', '16', '9', 'createTime', '5', '10', 'updateTime', '11', 'confirm', 'confirmTime'],
strategyHit: ['1', '2', '3', '17', '18', '7', '5', '10', '8', '11', '12', '13'], strategyHit: ['projectName', '2', '3', '17', '18', 'createTime', '5', '10', 'updateTime', '11', 'confirm', 'confirmTime'],
videoAbnormal: ['1', '2', '3', '19', '20', '21', '22', '5', '6', '7', '8', '12', '13'], videoAbnormal: ['projectName', '2', '3', '19', '20', '21', '22', '5', '6', 'createTime', 'updateTime', 'confirm', 'confirmTime'],
useAbnormal: ['1', '23', '24', '15', '25', '7', '8', '12', '13'], useAbnormal: ['projectName', 'appName', 'url', 'type', 'alarmContent', 'createTime', 'updateTime', 'confirm', 'confirmTime'],
deviceAbnormal: ['1', '2', '3', '19', '15', '21', '5', '6', '7', '8', '12', '13'], deviceAbnormal: ['projectName', '2', '3', '19', 'alarmContent', '21', '5', '6', 'createTime', 'updateTime', 'confirm', 'confirmTime'],
} }
// //
const columns = { const columns = {
dataLnterrupt: ['0', '1', '2', '3', '4', '5', '6', '7', '8',], dataLnterrupt: ['serialNumber', 'projectName', '2', '3', '4', '5', '6', 'createTime', 'updateTime',],
dataAbnormal: ['0', '1', '2', '3', '15', '5', '6', '7', '8'], dataAbnormal: ['serialNumber', 'projectName', '2', '3', 'alarmContent', '5', '6', 'createTime', 'updateTime'],
strategyHit: ['0', '1', '2', '3', '17', '5', '10', '11', '8'], strategyHit: ['serialNumber', 'projectName', '2', '3', '17', '5', '10', '11', 'updateTime'],
videoAbnormal: ['0', '1', '2', '3', '21', '20', '5', '7', '8'], videoAbnormal: ['serialNumber', 'projectName', '2', '3', '21', '20', '5', 'createTime', 'updateTime'],
useAbnormal: ['0', '1', '23', '24', '15', '25', '7', '8'], useAbnormal: ['serialNumber', 'appName', 'projectName', 'url', 'type', 'alarmContent', 'createTime', 'updateTime'],
deviceAbnormal: ['0', '1', '2', '3', '15', '19', '5', '7', '8'], deviceAbnormal: ['serialNumber', 'projectName', '2', '3', 'alarmContent', '19', '5', 'createTime', 'updateTime'],
} }
// //
const columnAll = [ const columnAll = [
{ name: '问题编号', value: '0' }, { name: '问题编号', value: 'serialNumber', render: (_, r, index) => r.serialNumber },
{ name: '项目名称', value: '1' }, {
name: '项目名称', value: 'projectName', render: (_, r, index) => {
return <>
{r.projectName.map((v, index) => {
let width
let name = v
switch (r.projectName?.length) {
case 1:
if (v.length > 25) width = 358
break;
case 2:
if (v.length > 12) width = 173
break;
default:
if (v.length > 7) width = 112
break;
}
return (<div key={r.id + r.appName + index} style={{ display: 'inline-block', height: 20 }}>
{index > 0 ? <span style={{ width: 1, height: 12, border: '1px solid #DCDEE0', margin: '3px 8px', display: 'inline-block', }}></span> : ""}
{OutHidden({ width, name })}
</div>)
})}
</>
}
},
{ name: '结构物名称', value: '2' }, { name: '结构物名称', value: '2' },
{ name: '告警源', value: '3' }, { name: '告警源', value: '3' },
{ name: '中断类型', value: '4' }, { name: '中断类型', value: '4' },
{ name: '告警信息', value: '5' }, { name: '告警信息', value: '5' },
{ name: '常见原因', value: '6' }, { name: '常见原因', value: '6' },
{ name: '产生时间', value: '7' }, { name: '产生时间', value: 'createTime' },
{ name: '更新时间', value: '8' }, { name: '更新时间', value: 'updateTime' },
{ name: '服务器地址', value: '9' }, { name: '服务器地址', value: '9' },
{ name: '告警等级', value: '10' }, { name: '告警等级', value: '10' },
{ name: '产生次数', value: '11' }, { name: '产生次数', value: '11' },
{ name: '确认信息', value: '12' }, { name: '确认信息', value: 'confirm', render: (_, r, index) => r.confirm },
{ name: '确认/恢复时间', value: '13' }, { name: '确认/恢复时间', value: 'confirmTime', },
{ name: '项目阶段', value: '14' }, { name: '项目阶段', value: '14' },
{ name: '异常类型', value: '15' }, {
name: '异常信息', value: 'alarmContent', render: (_, r, index) => {
return <>{r.alarmContent}
{r.screenshot ? <img src="/assets/images/problem/anomaly.png" style={{ display: 'inline-block', width: 12 }} onClick={() => (setAnomaly(r.screenshot), setPictures(true))} /> : ""}
</>
}
},
{ name: '异常原因', value: '16' }, { name: '异常原因', value: '16' },
{ name: '策略类型', value: '17' }, { name: '策略类型', value: '17' },
{ name: '命中状态', value: '18' }, { name: '命中状态', value: '18' },
@ -193,9 +237,14 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
{ name: '设备类型', value: '20' }, { name: '设备类型', value: '20' },
{ name: '设备厂家', value: '21' }, { name: '设备厂家', value: '21' },
{ name: '接入方式', value: '22' }, { name: '接入方式', value: '22' },
{ name: '应用名称', value: '23' }, { name: '应用名称', value: 'appName' },
{ name: 'URL地址', value: '24' }, { name: 'URL地址', value: 'url' },
{ name: '异常信息', value: '25' }, {
name: '异常类型', value: 'type', render: (_, r, index) => {
let data = { element: '元素异常', apiError: '接口报错', timeout: '加载超时' }
return data[r.type]
}
},
] ]
@ -208,9 +257,9 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
if (route) { if (route) {
let setup = tableList[route].map(v => columnAll.find(vv => v == vv.value)) let setup = tableList[route].map(v => columnAll.find(vv => v == vv.value))
let data = ['0'] let data = ['serialNumber']
if (tableType[route] == 'dataAbnormal') { if (tableType[route] == 'dataAbnormal') {
data = ['0', '6'] data = ['serialNumber', '6']
data.splice(1, 0, ...arr) data.splice(1, 0, ...arr)
} else { } else {
data.splice(1, 0, ...arr) data.splice(1, 0, ...arr)
@ -222,12 +271,23 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
let TableDisplay = data.map(v => { let TableDisplay = data.map(v => {
let datas = columnAll.find(vv => v == vv.value) let datas = columnAll.find(vv => v == vv.value)
if (datas) { if (datas) {
return { title: datas.name, dataIndex: datas.value, rowKey: datas.value } return { title: datas.name, dataIndex: datas.value, rowKey: datas.value, render: datas.render }
} }
}) })
TableDisplay.push({
// console.log(TableDisplay); title: '操作',
dataIndex: 'text',
rowKey: 'text',
render: (_, r) => {
return <>
{r.confirmTime ? <Button theme='borderless' disabled>已确认</Button> :
<Button theme='borderless' onClick={() => (setConfirm(true), setSelected([r.id]))}>确认</Button>
}
</>
}
})
console.log(TableDisplay);
// console.log(setup); // console.log(setup);
setExhibition(TableDisplay) setExhibition(TableDisplay)
setTableSetup([{ list: setup }]) setTableSetup([{ list: setup }])
@ -262,7 +322,7 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
<div> <div>
{abnormalLenght > 0 ? <div style={{ height: 30, fontSize: 12, display: 'flex' }}><IconAlertCircle /><div>当前滞留5个工单即将超时请尽快处理</div></div> : ""} {abnormalLenght > 0 ? <div style={{ height: 30, fontSize: 12, display: 'flex' }}><IconAlertCircle /><div>当前滞留5个工单即将超时请尽快处理</div></div> : ""}
</div> </div>
{/* <Statistics <Statistics
route={route} route={route}
tableType={tableType} tableType={tableType}
statistic={statistic} statistic={statistic}
@ -272,7 +332,11 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
collectData={collectData} collectData={collectData}
setSetup={setSetup} setSetup={setSetup}
exhibition={exhibition} exhibition={exhibition}
/> */} setConfirm={setConfirm}
setIfBulk={setIfBulk}
selected={selected}
setSelected={setSelected}
/>
{setup ? ( {setup ? (
<Setup <Setup
tableType={tableType[route] || []} tableType={tableType[route] || []}
@ -286,6 +350,34 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket }) => {
) : ( ) : (
"" ""
)} )}
{pictures ? <Modal
hasCancel={false}
closable={false}
visible={true}
footer=''
width={837}
onCancel={() => setPictures(false)}
>
<img src={`/_file-server/${anomaly}`}
style={{ width: 789, height: 359, }}
/>
</Modal> : ""}
{confirm ? <Modal
title={ifBulk ? '批量确认' : "确认"}
visible={true}
width={600}
onCancel={() => setConfirm(false)}
onOk={() => {
dispatch(problem.postApiConfirm({ appAlarmId: selected, confirm: content }))
setConfirm(false)
}}
>
<div style={{ display: 'flex', paddingLeft: 20 }}>
<span style={{ display: 'inline-block', width: 78 }}>确认信息:</span>
<TextArea maxCount={500} showClear onChange={(e) => setContent(e)} />
</div>
</Modal> : ""}
</div> </div>
) )
} }

15
web/client/src/utils/webapi.js

@ -24,17 +24,20 @@ export const ApiTable = {
deteleOrganizationAdmin: 'organization/admin/{pomsUserId}',//删除管理员 deteleOrganizationAdmin: 'organization/admin/{pomsUserId}',//删除管理员
//设置-关系映射 //设置-关系映射
getProjectPoms:'project/poms',//获取已绑定项目列表 getProjectPoms: 'project/poms',//获取已绑定项目列表
getProjectAnxincloud:'project/anxincloud',//获取安心云项目 getProjectAnxincloud: 'project/anxincloud',//获取安心云项目
getProjectPmanage:'project/pmanage',//获取PEP项目管理项目 getProjectPmanage: 'project/pmanage',//获取PEP项目管理项目
postProjectBind:'project/bind',//绑定安心云、项目管理项目 postProjectBind: 'project/bind',//绑定安心云、项目管理项目
getProjectAppList:'project/app_list',//获取应用列表 getProjectAppList: 'project/app_list',//获取应用列表
deleteProjectBind:'project/bind/{bindId}',//删除安心云、项目管理项目绑定关系 deleteProjectBind: 'project/bind/{bindId}',//删除安心云、项目管理项目绑定关系
//告警 //告警
getProjectPoms: 'project/poms', //获取已绑定项目 getProjectPoms: 'project/poms', //获取已绑定项目
getAlarmLnspection: 'alarm/application/inspection', //查询应用巡检信息 getAlarmLnspection: 'alarm/application/inspection', //查询应用巡检信息
putAlarmApplicationNoted: 'alarm/application/noted', //预览状态
getAlarmLnspectionApi: 'alarm/application/api', //查询应用接口/元素错误信息
postApiConfirm:"alarm/application/api_confirm", //确认应用接口/元素错误信息
}; };
export const RouteTable = { export const RouteTable = {
apiRoot: "/api/root", apiRoot: "/api/root",

Loading…
Cancel
Save