feat: 重点关注列表

develop
JINGYJ 1 year ago
parent cd4590525c
commit 634ff34962

@ -364,4 +364,9 @@ export default [
component: 'System/UserList',
access: 'canReadMenu',
},
{
name: 'involved-list',
path: '/involved-list',
component: 'Alarm/InvolvedList',
},
];

@ -36,6 +36,16 @@ const getMenus = (req: Request, res: Response) => {
"title": "告警规则",
"routes": []
},
{
"path": "involved-list",
"key": "",
"name": "involved-list",
"icon": "FileSearchOutlined",
"access": "",
"component": "Hidden",
"title": "重点关注",
"routes": []
},
{
"path": "interfaceManage",
"key": "",

@ -81,6 +81,16 @@ export async function getInitialState(): Promise<{
"title": "告警规则",
"routes": []
},
{
"path": "involved-list",
"key": "",
"name": "involved-list",
"icon": "FileSearchOutlined",
"access": "",
"component": "Hidden",
"title": "重点关注",
"routes": []
},
{
"path": "interfaceManage",
"key": "",

@ -1,6 +1,6 @@
.alarmImgBox {
display: flex;
justify-content: flex-start;
// display: flex;
// justify-content: flex-start;
.alarmImgLeft {
position: relative;
margin-right: 32px;
@ -57,6 +57,28 @@
}
}
}
.alarmImgDescribe {
margin-bottom: 12px;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 16px;
color: #666;
span {
color: #333;
}
}
.alarmImgContent {
box-sizing: border-box;
padding: 16px;
width: 784px;
// height: 172px;
background: #F7F7F7;
border-radius: 4px;
border: 2px dashed #DCDCDC;
display: flex;
justify-content: center;
}
}
.myButtonDisabled{
visibility: hidden;

@ -1,23 +1,20 @@
import { putDeviceCategoryUpdateDeviceCategory } from '@/services/device/DeviceCategory';
import { postDeviceGroupGetDeviceGroupFkSelect } from '@/services/device/DeviceGroup';
import { ModalForm, ProForm, ProFormFieldSet, ProFormSelect, ProFormSwitch, ProFormText } from '@ant-design/pro-components';
import { FormattedMessage, useIntl } from '@umijs/max';
import { Form, message,Image } from 'antd';
import { Form, message,Image, Button, Popover } from 'antd';
import React, { useEffect, useState } from 'react';
import {
proFormSmallItemStyleProps,
proFormSmallModelWidth,
} from '../../../../../config/defaultForm';
import { postIgnoringvents } from '@/services/alarm/Alarmlist';
// Import Swiper React components
import { Swiper, SwiperSlide } from 'swiper/react';
import { Navigation, Pagination, Mousewheel } from 'swiper/modules';
// import { Swiper, SwiperSlide } from 'swiper/react';
// import { Navigation, Pagination, Mousewheel } from 'swiper/modules';
// Import Swiper styles
import 'swiper/css';
import 'swiper/css/navigation';
import 'swiper/css/pagination';
import styles from './AlarmDetails.less'
import moment from 'moment';
import ImageWithPopover from './ImageWithPopover';
import ImageSinglePopover from './ImageSinglePopover';
export type FormValueType = {
target?: string;
template?: string;
@ -35,9 +32,38 @@ export type UpdateFormProps = {
const UpdateForm: React.FC<UpdateFormProps> = (props) => {
const intl = useIntl();
const [form] = Form.useForm<API.AlarmDetailsParams>();
const [isActive, setIsActive] = useState(0);
// const [isActive, setIsActive] = useState(0);
const [imageSrc, setImageSrc] = useState('');
// const [visible, setVisible] = useState(false);
const [involved, setInvolved] = useState(0);
// const [involvedInfo, setInvolvedInfo] = useState([...(props?.values?.person_list || [])]);
const [involvedInfo, setInvolvedInfo] = useState<any[]>([]);
useEffect(() => {
if (props.values?.person_list) {
setInvolvedInfo([...props.values.person_list]);
}
}, [props.values?.person_list]);
useEffect(() => {
if (props.values?.person_classify) {
setInvolved(props.values.person_classify);
}
}, [props.values?.person_classify]);
const handleInvolved = (value: any, index: any) => {
const updatedInvolvedInfo = [...involvedInfo];
updatedInvolvedInfo[index][2] = value;
setInvolvedInfo(updatedInvolvedInfo);
};
const handleSingleInvolved = () => {
if (involved) {
setInvolved(0);
} else {
setInvolved(1);
}
}
// const [open, setOpen] = useState(false);
useEffect(() => {
console.log(Array.isArray(props.values?.person_id),'Array.isArray(props.values?.person_id)');
setImageSrc(props?.values?.picture_path?.[0])
}, [props.updateModalOpen])
return (
@ -58,13 +84,26 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => {
}}
submitter={{
resetButtonProps: {
style: {
display: 'none',
},
},
searchConfig: {
submitText: '忽略此事件',
// resetButtonProps: {
// style: {
// display: 'none',
// },
// },
// searchConfig: {
// submitText: '忽略此事件',
// },
render: (props) => {
return [
<Button
key="ok"
style={{ backgroundColor: '#E80D0D',color: '#FFF',borderBlockColor: '#E80D0D' }}
onClick={() => {
props.submit();
}}
>
</Button>
];
},
}}
submitTimeout={2000}
@ -90,7 +129,87 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => {
: <span className={styles.alarmSpan}></span>: <span className={styles.alarmSpan}>广1#</span>: <span className={styles.alarmSpan}>2023-01-15 22:00:03</span>
</div> */}
<div className={styles.alarmImgBox}>
<div className={styles.alarmImgLeft}>
<div className={styles.alarmImgDescribe}>: <span>{props.values.device_name}</span></div>
<div className={styles.alarmImgDescribe}>: <span className={styles.alarmSpan}>{moment(props.values.trigger_time).format('YYYY-MM-DD hh:mm:ss')}</span></div>
<div className={styles.alarmImgContent}>
{/* {Array.isArray(props.values?.person_id) && (
Array.isArray(involvedInfo) && involvedInfo.length ? (
involvedInfo.map((item: any, index: any) => {
console.log(involvedInfo, 'item');
return (
<ImageWithPopover
src={item?.[1]}
involved={involvedInfo[index][2]}
key={index}
indexId={index}
handleInvolved={handleInvolved}
></ImageWithPopover>
);
})
) : (
Array.isArray(props?.values?.picture_path) && props?.values?.picture_path.length && props?.values?.picture_path.map((item: any, index: any) => {
console.log(item,'dan');
return (
<ImageWithPopover
src={item}
involved={props?.values?.person_classify}
key={index}
indexId={index}
handleInvolved={handleInvolved}
></ImageWithPopover>
);
})
)
)} */}
{Array.isArray(props.values?.person_id) ? (
Array.isArray(involvedInfo) && involvedInfo.length ? (
involvedInfo.map((item: any, index: any) => {
return (
<ImageWithPopover
src={item?.[1]}
involved={involvedInfo[index][2]}
key={index}
indexId={index}
handleInvolved={handleInvolved}
></ImageWithPopover>
);
})
) : (
Array.isArray(props?.values?.picture_path) && props?.values?.picture_path.length ? (
props.values.picture_path.map((item: any, index: any) => {
return (
<ImageSinglePopover
src={item}
involved={involved}
key={index}
handleInvolved={handleSingleInvolved}
reload={props.reload} // 将reload方法作为prop传递给ImageSinglePopover组件
></ImageSinglePopover>
);
})
) : null
)
) : (
Array.isArray(props?.values?.picture_path) && props?.values?.picture_path.length ? (
props.values.picture_path.map((item: any, index: any) => {
return (
<ImageSinglePopover
src={item}
involved={involved}
key={index}
handleInvolved={handleSingleInvolved}
reload={props.reload} // 将reload方法作为prop传递给ImageSinglePopover组件
></ImageSinglePopover>
);
})
) : null
)}
{/* { Array.isArray(involvedInfo) && involvedInfo.length && involvedInfo.map((item: any, index: any) => {
console.log(involvedInfo,'item');
return(<ImageWithPopover src={item?.[1]} involved={involvedInfo[index][2]} key={index} indexId={index} handleInvolved={handleInvolved}></ImageWithPopover>)
})} */}
</div>
{/* <div className={styles.alarmImgLeft}>
<Swiper
style={{height:660}}
slidesPerView={5}
@ -126,65 +245,6 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => {
</div>
</SwiperSlide>)
})}
{/* {props?.values?.picture_path.length && props?.values?.picture_path.map((slideContent:any, index:any) => (
return (<SwiperSlide key={slideContent} virtualIndex={index}>
<div className={styles.alarmImgLeftBox}>
<Image
preview={false}
src={slideContent}
/>
</div>
</SwiperSlide>)
))} */}
{/* <SwiperSlide>
<div className={styles.alarmImgLeftBox}>
<Image
preview={false}
src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
/>
</div>
</SwiperSlide>
<SwiperSlide>
<div className={styles.alarmImgLeftBox}>
<Image
preview={false}
src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
/>
</div>
</SwiperSlide>
<SwiperSlide>
<div className={styles.alarmImgLeftBox}>
<Image
preview={false}
src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
/>
</div>
</SwiperSlide>
<SwiperSlide>
<div className={styles.alarmImgLeftBox}>
<Image
preview={false}
src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
/>
</div>
</SwiperSlide>
<SwiperSlide>
<div className={styles.alarmImgLeftBox}>
<Image
preview={false}
src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
/>
</div>
</SwiperSlide>
<SwiperSlide>
<div className={styles.alarmImgLeftBox}>
<Image
preview={false}
src="https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
/>
</div>
</SwiperSlide> */}
</Swiper>
<div className={styles.shadowBox}></div>
</div>
@ -200,7 +260,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => {
<div className={styles.alarmDetails}>
: <span className={styles.alarmSpan}>{props.values.device_name}</span>: <span className={styles.alarmSpan}>{moment(props.values.trigger_time).format('YYYY-MM-DD hh:mm:ss')}</span>
</div>
</div>
</div> */}
</div>
{/* </ProForm.Group> */}

@ -0,0 +1,114 @@
import React, { useState } from 'react';
import { Image, Popover, Button } from 'antd';
import { CloseCircleOutlined, EllipsisOutlined, EyeOutlined, InfoCircleOutlined } from '@ant-design/icons';
interface ImageSinglePopoverProps {
src: string;
involved: any;
handleInvolved: () => void;
reload: any;
}
const ImageSinglePopover: React.FC<ImageSinglePopoverProps> = ({ src, involved, handleInvolved, reload}) => {
const [visible, setVisible] = useState(false);
const [open, setOpen] = useState(false);
// 定义一个方法,用于生成自定义的遮罩层
const generateMask = (text:any) => (
<div style={{ position: 'absolute', top: 0, left: 0, width: '100%', height: '100%', display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#fff' }}>
<div style={{ display: 'flex', alignItems: 'center', fontSize: 12 }}>
<EyeOutlined style={{ marginRight: 8, fontSize: 12 }} />
<div>{text}</div>
</div>
</div>
);
const content = (
<div style={{ display: 'flex', flexDirection: 'column', justifyContent: 'center',alignItems: 'center', height: 56}}>
{/* <div>1</div>
<div>2</div> */}
<Button
type="text"
style={{ height:22, padding: 0,fontSize: 12,color: '#FFF' }}
icon={<InfoCircleOutlined style={{ color: '#FAAD14',fontSize: 12}} />}
onClick={()=>{
// setInvolved(true)
handleInvolved();
reload()
setOpen(false)
}}
></Button>
<Button
type="text"
style={{ height:22, padding: 0,fontSize: 12,color: '#FFF' }}
icon={<CloseCircleOutlined style={{ color: '#E80D0D',fontSize: 12}} />}
onClick={()=>{
// setInvolved(false)
handleInvolved();
reload()
setOpen(false)
}}
></Button>
</div>
);
const handleVisibleChange = (value: boolean) => {
setVisible(value);
};
const handleOpenChange = (value: boolean) => {
setOpen(value);
};
return (
<div style={{ position: 'relative', boxSizing: 'border-box', width: 140, height: 140, marginRight: 12 }}>
<Image
style={{ borderRadius: 4 }}
width={140}
height={140}
preview={{
visible,
src,
onVisibleChange: handleVisibleChange,
mask: generateMask("点击可预览大图"),
}}
src={src}
/>
<Popover
placement="right"
content={content}
trigger="click"
style={{ width: 104, height: 64 }}
color="rgba(0, 0, 0, 0.6)"
overlayInnerStyle={{ width: 104, height: 64, padding: 4, borderRadius: 2 }}
open={open}
onOpenChange={handleOpenChange}
>
<Button
style={{ position: 'absolute', bottom: 8, right: 0 }}
type="text"
icon={<EllipsisOutlined style={{ color: '#fff', fontSize: 24, transform: 'rotate(90deg)' }} />}
/>
</Popover>
{involved === 1 && (
<div
style={{
position: 'absolute',
top: 0,
right: 0,
width: 64,
height: 24,
background: '#FAAD14',
borderRadius: '0px 4px 0px 4px',
color: '#FFF',
fontSize: 12,
textAlign: 'center',
lineHeight: '24px'
}}
>
</div>
)}
</div>
);
};
export default ImageSinglePopover;

@ -0,0 +1,112 @@
import React, { useState } from 'react';
import { Image, Popover, Button } from 'antd';
import { CloseCircleOutlined, EllipsisOutlined, EyeOutlined, InfoCircleOutlined } from '@ant-design/icons';
interface ImageWithPopoverProps {
src: string;
involved: any;
indexId: any;
handleInvolved: (value: any,index: any) => void;
}
const ImageWithPopover: React.FC<ImageWithPopoverProps> = ({ src, involved, indexId, handleInvolved }) => {
const [visible, setVisible] = useState(false);
const [open, setOpen] = useState(false);
// 定义一个方法,用于生成自定义的遮罩层
const generateMask = (text:any) => (
<div style={{ position: 'absolute', top: 0, left: 0, width: '100%', height: '100%', display: 'flex', alignItems: 'center', justifyContent: 'center', color: '#fff' }}>
<div style={{ display: 'flex', alignItems: 'center', fontSize: 12 }}>
<EyeOutlined style={{ marginRight: 8, fontSize: 12 }} />
<div>{text}</div>
</div>
</div>
);
const content = (
<div style={{ display: 'flex', flexDirection: 'column', justifyContent: 'center',alignItems: 'center', height: 56}}>
{/* <div>1</div>
<div>2</div> */}
<Button
type="text"
style={{ height:22, padding: 0,fontSize: 12,color: '#FFF' }}
icon={<InfoCircleOutlined style={{ color: '#FAAD14',fontSize: 12}} />}
onClick={()=>{
// setInvolved(true)
handleInvolved(1, indexId);
setOpen(false)
}}
></Button>
<Button
type="text"
style={{ height:22, padding: 0,fontSize: 12,color: '#FFF' }}
icon={<CloseCircleOutlined style={{ color: '#E80D0D',fontSize: 12}} />}
onClick={()=>{
// setInvolved(false)
handleInvolved(0, indexId);
setOpen(false)
}}
></Button>
</div>
);
const handleVisibleChange = (value: boolean) => {
setVisible(value);
};
const handleOpenChange = (value: boolean) => {
setOpen(value);
};
return (
<div style={{ position: 'relative', boxSizing: 'border-box', width: 140, height: 140, marginRight: 12 }}>
<Image
style={{ borderRadius: 4 }}
width={140}
height={140}
preview={{
visible,
src,
onVisibleChange: handleVisibleChange,
mask: generateMask("点击可预览大图"),
}}
src={src}
/>
<Popover
placement="right"
content={content}
trigger="click"
style={{ width: 104, height: 64 }}
color="rgba(0, 0, 0, 0.6)"
overlayInnerStyle={{ width: 104, height: 64, padding: 4, borderRadius: 2 }}
open={open}
onOpenChange={handleOpenChange}
>
<Button
style={{ position: 'absolute', bottom: 8, right: 0 }}
type="text"
icon={<EllipsisOutlined style={{ color: '#fff', fontSize: 24, transform: 'rotate(90deg)' }} />}
/>
</Popover>
{involved === 1 && (
<div
style={{
position: 'absolute',
top: 0,
right: 0,
width: 64,
height: 24,
background: '#FAAD14',
borderRadius: '0px 4px 0px 4px',
color: '#FFF',
fontSize: 12,
textAlign: 'center',
lineHeight: '24px'
}}
>
</div>
)}
</div>
);
};
export default ImageWithPopover;

@ -0,0 +1,85 @@
.alarmImgBox {
// display: flex;
// justify-content: flex-start;
.alarmImgLeft {
position: relative;
margin-right: 32px;
width: 120px;
// height: 600px;
.alarmImgLeftBox{
width: 112px;
height: 112px;
border-radius: 4px;
// background: skyblue;
}
.alarmImgLeftBoxActive {
width: 112px;
height: 112px;
border-radius: 4px;
border: 1.5px solid #081FA8;
}
.shadowBox {
position: absolute;
left: 0;
bottom: 0px;
width: 112px;
height: 20px;
background: #FFF;
z-index: 999;
}
}
.alarmImgRight{
flex: 1;
position: relative;
.alarmImgRightTopBox {
width: 640px;
height: 640px;
background: skyblue;
}
.alarmDetails {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 38px;
padding-left: 24px;
line-height: 38px;
margin-bottom: 16px;
font-family: PingFang SC;
font-size: 16px;
font-weight: 400;
color: #FFFFFF;
background: rgba(0, 0, 0, 0.6);
.alarmSpan {
// color: #333;
margin-right: 24px;
}
}
}
.alarmImgDescribe {
margin-bottom: 12px;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 16px;
color: #666;
span {
color: #333;
}
}
.alarmImgContent {
box-sizing: border-box;
padding: 16px;
width: 100%;
// height: 172px;
background: #F7F7F7;
border-radius: 4px;
border: 2px dashed #DCDCDC;
display: flex;
justify-content: center;
}
}
.myButtonDisabled{
visibility: hidden;
}

@ -0,0 +1,143 @@
import { putDeviceCategoryUpdateDeviceCategory } from '@/services/device/DeviceCategory';
import { postDeviceGroupGetDeviceGroupFkSelect } from '@/services/device/DeviceGroup';
import { ModalForm, ProForm, ProFormFieldSet, ProFormSelect, ProFormSwitch, ProFormText } from '@ant-design/pro-components';
import { FormattedMessage, useIntl } from '@umijs/max';
import { Form, message,Image, Button, Popover } from 'antd';
import React, { useEffect, useState } from 'react';
import { postIgnoringvents } from '@/services/alarm/Alarmlist';
import styles from './AlarmDetails.less'
import moment from 'moment';
export type FormValueType = {
target?: string;
template?: string;
type?: string;
time?: string;
frequency?: string;
} & Partial<API.AlarmDetailsParams>;
export type UpdateFormProps = {
updateModalOpen: boolean;
handleModal: () => void;
values: Partial<API.AlarmDetailsParams>;
reload: any;
};
const UpdateForm: React.FC<UpdateFormProps> = (props) => {
const intl = useIntl();
const [form] = Form.useForm<API.AlarmDetailsParams>();
// const [isActive, setIsActive] = useState(0);
const [imageSrc, setImageSrc] = useState('');
// const [visible, setVisible] = useState(false);
const [involved, setInvolved] = useState(false);
const handleInvolved = () => {
if (involved) {
setInvolved(false);
} else {
setInvolved(true);
}
};
// const [open, setOpen] = useState(false);
useEffect(() => {
setImageSrc(props?.values?.picture_path?.[0])
}, [props.updateModalOpen])
return (
<ModalForm<any>
width={615}
title={intl.formatMessage({
id: 'alarm.list.table.form.title',
defaultMessage: `编辑${props.values.warning_name}`,
})}
open={props.updateModalOpen}
form={form}
autoFocusFirstInput
modalProps={{
destroyOnClose: true,
onCancel: () => props.handleModal(),
}}
submitter={false}
submitTimeout={2000}
onFinish={async (values) => {
values.is_ignore = true
values.person_id = props.values.person_id
// console.log(values);
postIgnoringvents(values)
.then(() => {
message.success(intl.formatMessage({ id: 'common.success', defaultMessage: '成功' }));
props.reload();
})
.catch(() => {
message.error(intl.formatMessage({ id: 'common.failure', defaultMessage: '失败' }));
});
props.handleModal();
return true;
}}
>
{/* <ProForm.Group> */}
{/* <div className={styles.alarmDetails}>
: <span className={styles.alarmSpan}></span>: <span className={styles.alarmSpan}>广1#</span>: <span className={styles.alarmSpan}>2023-01-15 22:00:03</span>
</div> */}
<div className={styles.alarmImgBox}>
<div className={styles.alarmImgDescribe}>: <span>{props.values.device_name}</span></div>
<div className={styles.alarmImgDescribe}>: <span className={styles.alarmSpan}>{moment(props.values.trigger_time).format('YYYY-MM-DD hh:mm:ss')}</span></div>
<div className={styles.alarmImgContent}>
</div>
{/* <div className={styles.alarmImgLeft}>
<Swiper
style={{height:660}}
slidesPerView={5}
spaceBetween={20}
direction='vertical'
mousewheel={true}
modules={[Mousewheel]}
onSlideChange={() => {
console.log(111);
}}
// pagination={{
// clickable: true,
// }}
// modules={[Pagination]}
>
{ Array.isArray(props?.values?.picture_path) && props?.values?.picture_path.length && props?.values?.picture_path.map((item: any, index: any) => {
return (<SwiperSlide key={index} virtualIndex={index} onClick={() => {
console.log(index);
setIsActive(index)
setImageSrc(item)
}}>
<div className={ styles.alarmImgLeftBox }>
<Image
style={{
width: 112,
height: 112,
borderRadius: 4
}}
className={ index === isActive ? styles.alarmImgLeftBoxActive : '' }
preview={false}
src={item}
/>
</div>
</SwiperSlide>)
})}
</Swiper>
<div className={styles.shadowBox}></div>
</div>
<div className={styles.alarmImgRight}>
<div className={styles.alarmImgRightTopBox}>
<Image
width={640}
height={640}
preview={false}
src={imageSrc}
/>
</div>
<div className={styles.alarmDetails}>
: <span className={styles.alarmSpan}>{props.values.device_name}</span>: <span className={styles.alarmSpan}>{moment(props.values.trigger_time).format('YYYY-MM-DD hh:mm:ss')}</span>
</div>
</div> */}
</div>
{/* </ProForm.Group> */}
</ModalForm>
);
};
export default UpdateForm;

@ -0,0 +1,96 @@
import React, { useState } from 'react';
import { Image, Popover, Button } from 'antd';
import { CloseCircleOutlined, EllipsisOutlined, EyeOutlined, InfoCircleOutlined } from '@ant-design/icons';
interface ImageWithPopoverProps {
src: string;
}
const ImageWithPopover: React.FC<ImageWithPopoverProps> = ({ src }) => {
const [visible, setVisible] = useState(false);
const [open, setOpen] = useState(false);
const content = (
<div style={{ display: 'flex', justifyContent: 'center',alignItems: 'center', height: '100%'}}>
{/* <div>1</div>
<div>2</div> */}
<Button
type="text"
style={{ height:22, padding: 0,fontSize: 12,color: '#FFF' }}
icon={<CloseCircleOutlined style={{ color: '#E80D0D',fontSize: 12}} />}
onClick={(event)=>{
// setInvolved(false)
// handleInvolved();
event.stopPropagation();
setOpen(false)
}}
></Button>
</div>
);
const handleVisibleChange = (value: boolean) => {
setVisible(value);
};
const handleOpenChange = (value: boolean) => {
setOpen(value);
};
const handleButtonClick = (event: React.MouseEvent<HTMLButtonElement>) => {
event.stopPropagation(); // 阻止事件冒泡到父组件并阻止默认事件触发
};
return (
<div style={{ position: 'relative', boxSizing: 'border-box', width: 96, height: 96, marginRight: 12 }}>
<Image
style={{ borderRadius: 4 }}
width={96}
height={96}
// preview={{
// visible,
// src,
// onVisibleChange: handleVisibleChange,
// mask: generateMask("点击可预览大图"),
// }}
preview={false}
src={src}
/>
<Popover
placement="right"
content={content}
trigger="click"
style={{ width: 104, height: 32 }}
color="rgba(0, 0, 0, 0.6)"
overlayInnerStyle={{ width: 104, height: 32, padding: 4, borderRadius: 2 }}
open={open}
onOpenChange={handleOpenChange}
>
<Button
style={{ position: 'absolute', bottom: 0, right: -4 }}
type="text"
icon={<EllipsisOutlined style={{ color: '#fff', fontSize: 24, transform: 'rotate(90deg)' }} />}
onClick={handleButtonClick}
/>
</Popover>
{/* {involved.state && (
<div
style={{
position: 'absolute',
top: 0,
right: 0,
width: 64,
height: 24,
background: '#FAAD14',
borderRadius: '0px 4px 0px 4px',
color: '#FFF',
fontSize: 12,
textAlign: 'center',
lineHeight: '24px'
}}
>
</div>
)} */}
</div>
);
};
export default ImageWithPopover;

@ -0,0 +1,433 @@
import { alarmRulesEnums } from '@/enums/status';
import { ActionType, PageContainer, ProCard, ProList, useIntl } from '@ant-design/pro-components';
import { Image, Modal, Tabs } from 'antd';
import React, { useEffect, useRef, useState } from 'react';
import { proTablePaginationOptions } from '../../../../config/defaultTable';
// import DeviceStatusCard from './components/DeviceStatusCard';
// import CreateForm from './components/CreateForm';
import { postAlarmList } from '@/services/alarm/Alarmlist';
import { QuestionCircleFilled } from '@ant-design/icons';
import AlarmDetails from './components/AlarmDetails';
import moment from 'moment';
import ImageWithPopover from './components/ImageWithPopover';
/**
* @
* 1
*/
const tabOptions: Record<string, any> = {
singlePersonHoveringAlarm: 90,
multiplePersonGatheringAlarm: 20,
sensitiveTimePeriodAlarm: 20,
ignored: 2,
// processingStatus: 10,
// errorStatus: 20,
};
export type DeleteBoxProps = {
modalOpen: boolean;
handleModal: () => void;
values: any;
reload: any;
};
const InvolvedList: React.FC = () => {
const [cardActionProps, setCardActionProps] = useState<'actions' | 'extra'>('extra');
/**
* @en-US Pop-up window of new window
* @zh-CN
* */
const [createModalOpen, setCreateModalOpen] = useState<boolean>(false);
/**
* @en-US The pop-up window of the distribution update window
* @zh-CN
* */
const [updateModalOpen, setUpdateModalOpen] = useState<boolean>(false);
/**
* @en-US The pop-up window of the distribution update window
* @zh-CN
* */
const [modalOpen, setModalOpen] = useState(false);
const [currentRow, setCurrentRow] = useState<Record<string, any>>({});
/**
* @en-US International configuration
* @zh-CN
* */
// const access = useAccess();
// const intl = useIntl();
const actionRef = useRef<ActionType>();
// 动态设置每页数量
const [currentPageSize, setCurrentPageSize] = useState<number>(10);
const [currentPage, setCurrentPage] = useState<number>(1);
const [total, setTotal] = useState<number>(0);
const [activeTabIndex, setActiveTabIndex] = useState<number>(0);
const [dataTestList, setdataTestList] = useState<any>([]);
const [tab, setTab] = useState<string>(alarmRulesEnums[0].key);
const [tabs, setTabs] = useState<any>([]);
// const changeProjectTab = (key: string) => {
// setTab(key);
// console.log(key);
// // eslint-disable-next-line @typescript-eslint/no-use-before-define
// initList(key)
// };
const getTabs = () => {
// if (alarmRulesEnums.length) {
// setTab(alarmRulesEnums[0].key);
// }
setTabs(alarmRulesEnums);
};
// useEffect(() => {
// getTabs();
// }, []);
const handleCreateModal = () => {
if (createModalOpen) {
setCreateModalOpen(false);
setCurrentRow(undefined);
} else {
setCreateModalOpen(true);
}
};
const handleUpdateModal = () => {
if (updateModalOpen) {
setUpdateModalOpen(false);
setCurrentRow(undefined);
} else {
setUpdateModalOpen(true);
}
};
const handleDestroy = async () => {
if (modalOpen) {
setModalOpen(false);
setCurrentRow(undefined);
} else {
setModalOpen(true);
}
// deleteBusinessImageDeleteBusinessImage({ id: selectedRow.id })
// .then(() => {
// message.success(intl.formatMessage({ id: 'common.success', defaultMessage: '$$$' }));
// actionRef.current?.reload();
// })
// .catch(() => {
// message.error(intl.formatMessage({ id: 'common.failure', defaultMessage: '$$$' }));
// });
};
const { confirm } = Modal;
const showConfirm = (record: any) => {
confirm({
title: `确定删除${record.name}`,
icon: <QuestionCircleFilled />,
content: '确定删除服务器1吗删除后将找不到此服务器请谨慎操作.',
okText: '确认',
cancelText: '取消',
width: 560,
onOk() {
console.log('OK');
},
onCancel() {
console.log('Cancel');
},
});
};
// 处理初始值
function initDataTestList(dataList: Record<string, any>[]) {
console.log(dataList, 'initDataTestList');
let finalList: { content: React.JSX.Element; }[] = []
if (Array.isArray(dataList) && dataList.length) {
finalList = dataList.map((record, index) => {
return {
content: (
<ProCard
className="gn"
style={{ backgroundColor: '#F5F6FF', margin: 0, padding: 0, borderRadius: 4 }}
bodyStyle={{ margin: 0, padding: 0 }}
>
<div
style={{
display: 'flex',
alignItems: 'center',
padding: 20,
justifyContent: 'flex-start',
}}
onClick={() => {
console.log(index, 'index');
setUpdateModalOpen(true);
setCurrentRow(record);
}}
>
{/* <Image
width={96}
preview={false}
src={record.picture_path[0]}
/> */}
<ImageWithPopover
src={record.picture_path[0]}
// handleInvolved={handleInvolved}
></ImageWithPopover>
<div
style={{
marginLeft: 16,
height: 90,
display: 'flex',
flexDirection: 'column',
justifyContent: 'space-between',
color: '#666',
}}
>
<div>
:{' '}
<span
style={{
color: '#333',
}}
>
{record.warning_name}
</span>
</div>
<div>
:{' '}
<span
style={{
color: '#333',
}}
>
{record.device_name}
</span>
</div>
<div>
:{' '}
<span
style={{
color: '#333',
}}
>
{moment(record.trigger_time).format('YYYY-MM-DD hh:mm:ss')}
</span>
</div>
</div>
</div>
</ProCard>
),
};
});
}
setdataTestList(() => [...finalList]);
}
// 初始化加载
async function initList(tabId:string = tab) {
const reqParams = {
page: currentPage,
pageSize: currentPageSize,
// desc: false,
warning_type: tabId,
// ...rest,
};
const resp = await postAlarmList({ ...reqParams });
// console.log(resp,'resp');
// setCurrentPageSize(resp?.data?.count)
setTotal(resp?.data?.count)
initDataTestList(resp?.data?.results);
// request={async (params = {}, sort) => {
// const { current, ...rest } = params;
// const reqParams = {
// page: current,
// desc: false,
// warning_type: tab,
// ...rest,
// };
// if (sort && Object.keys(sort).length) {
// reqParams.orderKey = Object.keys(sort)[0];
// let sort_select = sort[reqParams.orderKey];
// reqParams.desc = sort_select === 'descend';
// }
// // TODO 联调查询设备状态接口
// console.log(reqParams, 'reqParams');
// let resp = await postAlarmList({ ...reqParams });
// console.log(resp, 'postAlarmList_result');
// initDataTestList(resp.result);
// // return {
// // data: resp.result,
// // success: resp.success,
// // total: resp.count,
// // current: resp.count,
// // pageSize: resp.count,
// // };
// }}
}
useEffect(() => {
getTabs();
initList();
}, []);
useEffect(() => {
// 模拟异步请求数据
initList();
}, [currentPage, currentPageSize]);
return (
<PageContainer
// title={false}
// content={
// <div style={{
// display: 'flex',
// justifyContent: 'space-between'
// }}>
// <div style={{
// fontWeight: 600,
// fontSize: 20,
// color: '#333'
// }}></div>
// </div>
// }
>
<ProCard
className="gn"
bodyStyle={{ padding: 10, margin: 0 }}
style={{ padding: 0, margin: 0 }}
>
{/* <Tabs
activeKey={tab}
items={tabs}
onChange={(key) => {
changeProjectTab(key);
}}
></Tabs> */}
<ProList<any>
className="gn"
ghost={true}
itemCardProps={{
ghost: true,
bodyStyle: { padding: 0, margin: 0 },
style: {
width: '100%',
border: 0,
// minHeight: 700
// padding: 0, margin: 0
},
}}
// search={{
// labelWidth: proTableCommonOptions.searchLabelWidth,
// }}
// headerTitle={
// <>
// <div>
// {Object.keys(tabOptions).map((item, index) => {
// // eslint-disable-next-line react/jsx-key
// return (
// <Button
// style={{ marginRight: 12,border: 'none' }}
// // type={activeTabIndex === index ? 'primary' : 'default'}
// key={index}
// onClick={() => {
// setActiveTabIndex(index);
// }}
// >
// {Object.keys(alarmRulesEnums).includes(item)
// ? alarmRulesEnums[item].miniName
// : ''}
// {"("+tabOptions[item]+ ')'}
// </Button>
// );
// })}
// </div>
// </>
// }
cardProps={{
bodyStyle: {
padding: '8px 16px 16px',
borderRadius: 8,
},
}}
pagination={{
...proTablePaginationOptions,
total: total,
current: currentPage,
pageSize: currentPageSize,
showSizeChanger: true,
onChange: (page, pageSize) => {
console.log(page, pageSize);
setCurrentPage(page)
setCurrentPageSize(pageSize)
},
}}
showActions="hover"
rowSelection={false}
grid={{ gutter: 16, xs: 1, md: 2, lg: 2, xl: 3, xxl: 3 }}
metas={{
type: {
// 不展示在筛选项
hideInSearch: true,
},
content: {
hideInSearch: true,
},
actions: {
cardActionProps,
},
// status1: {
// // 自己扩展的字段,主要用于筛选,不在列表中显示
// title: '设备组',
// valueType: 'select',
// valueEnum: {
// '0': { text: '全部设备分组', status: '0' },
// '1': {
// text: '设备分组1',
// status: '1',
// },
// '2': {
// text: '设备分组2',
// status: '2',
// },
// '3': {
// text: '设备分组3',
// status: '3',
// },
// },
// },
// status2: {
// // 自己扩展的字段,主要用于筛选,不在列表中显示
// title: '分类',
// valueType: 'select',
// valueEnum: {
// '0': { text: '全部分类', status: '0' },
// '1': {
// text: '外围监控',
// status: '1',
// },
// '2': {
// text: '室内监控',
// status: '2',
// },
// '3': {
// text: '违规监控',
// status: '3',
// },
// },
// },
}}
dataSource={dataTestList}
/>
</ProCard>
{/* <CreateForm
createModalOpen={createModalOpen}
values={currentRow || {}}
handleModal={handleCreateModal}
reload={actionRef.current?.reload}
/> */}
<AlarmDetails
updateModalOpen={updateModalOpen}
values={currentRow || {}}
handleModal={handleUpdateModal}
reload={initList}
/>
</PageContainer>
);
};
export default InvolvedList;

@ -165,6 +165,16 @@ const Login: React.FC = () => {
"title": "告警规则",
"routes": []
},
{
"path": "involved-list",
"key": "",
"name": "involved-list",
"icon": "FileSearchOutlined",
"access": "",
"component": "Hidden",
"title": "重点关注",
"routes": []
},
{
"path": "interfaceManage",
"key": "",

@ -87,7 +87,9 @@ declare namespace API {
picture_path?: any; // 设备代码
device_name?: string; // 是否启用
person_id?: string;
trigger_time?: string;
trigger_time?: string;
person_list?: any;
person_classify?: any;
}
type IgnoringventsParams = {
is_ignore?: any; // 设备代码 // 是否启用

@ -13,7 +13,8 @@ import {CarOutlined, UserOutlined, TableOutlined,
ThunderboltOutlined, BugOutlined, AreaChartOutlined,ContactsOutlined, GatewayOutlined, BellOutlined,
PictureOutlined,
OrderedListOutlined,
BranchesOutlined
BranchesOutlined,
FileSearchOutlined
} from '@ant-design/icons';
const iconMap:any = {
@ -41,7 +42,8 @@ const iconMap:any = {
'BellOutlined': <BellOutlined/>,
'PictureOutlined': <PictureOutlined/>,
'OrderedListOutlined':<OrderedListOutlined />,
'BranchesOutlined': <BranchesOutlined />
'BranchesOutlined': <BranchesOutlined />,
'FileSearchOutlined': <FileSearchOutlined />
}
// FIX从接口获取菜单时icon为string类型
const fixMenuItemIcon = (menus: MenuDataItem[], iconType = 'Outlined'): MenuDataItem[] => {

Loading…
Cancel
Save