feat: 重点关注列表
parent
cd4590525c
commit
634ff34962
@ -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;
|
Loading…
Reference in New Issue