feat: 完成告警提示功能

master
JINGYJ 12 months ago
parent 7d413768ef
commit 2f42c42d36

@ -73,9 +73,11 @@
justify-content: center; justify-content: center;
box-sizing: border-box; box-sizing: border-box;
width: 784px; width: 784px;
// height: 172px;
max-height: 760px;
margin-bottom: 24px; margin-bottom: 24px;
padding: 16px 0 16px 16px; padding: 16px 0 16px 16px;
// height: 172px; overflow: scroll;
background: #fbfcff; background: #fbfcff;
border: 1px dashed #dcdcdc; border: 1px dashed #dcdcdc;
border-radius: 4px; border-radius: 4px;

@ -5,7 +5,11 @@ import React, { useEffect, useState } from 'react';
import { proTablePaginationOptions } from '../../../../config/defaultTable'; import { proTablePaginationOptions } from '../../../../config/defaultTable';
// import DeviceStatusCard from './components/DeviceStatusCard'; // import DeviceStatusCard from './components/DeviceStatusCard';
// import CreateForm from './components/CreateForm'; // import CreateForm from './components/CreateForm';
import { postUploadAlarmList, postUploadAlarmListIschecked } from '@/services/realTime/alarmlist'; import {
postUploadAlarmList,
postUploadAlarmListIschecked,
postUploadWarningStatistics,
} from '@/services/realTime/alarmlist';
import type { DatePickerProps } from 'antd'; import type { DatePickerProps } from 'antd';
import locale from 'antd/es/date-picker/locale/zh_CN'; import locale from 'antd/es/date-picker/locale/zh_CN';
import moment from 'moment'; import moment from 'moment';
@ -68,7 +72,22 @@ const OfflineAlarmList: React.FC = () => {
// // } // // }
// setTabs(alarmVideoAnalysis); // setTabs(alarmVideoAnalysis);
// }; // };
const [tabFlag, settabFlag] = useState<any>([]);
const pollServer = () => {
postUploadWarningStatistics({})
.then((res) => {
if (res && res.data.total_results) {
// 使用 state.totalResults 来设置 selectOptions
const newOptions = res.data.total_results[0].warning_type;
settabFlag(newOptions);
}
setTimeout(pollServer, 50000);
})
.catch(() => {});
};
useEffect(() => {
pollServer();
}, []);
const handleUpdateModal = () => { const handleUpdateModal = () => {
if (updateModalOpen) { if (updateModalOpen) {
setUpdateModalOpen(false); setUpdateModalOpen(false);
@ -116,7 +135,7 @@ const OfflineAlarmList: React.FC = () => {
style={{ style={{
marginLeft: 16, marginLeft: 16,
height: 110, height: 110,
position: 'relative', // position: 'relative',
display: 'flex', display: 'flex',
flexDirection: 'column', flexDirection: 'column',
justifyContent: 'space-between', justifyContent: 'space-between',
@ -177,8 +196,8 @@ const OfflineAlarmList: React.FC = () => {
style={{ style={{
display: 'inline-block', display: 'inline-block',
position: 'absolute', position: 'absolute',
top: '0px', top: '10px',
right: '-80px', right: '10px',
width: '10px', width: '10px',
height: '10px', height: '10px',
background: '#E80D0D', background: '#E80D0D',
@ -297,6 +316,20 @@ const OfflineAlarmList: React.FC = () => {
}} }}
> >
{tabFlag[0] && (
<span
style={{
display: 'inline-block',
position: 'absolute',
top: '-5px',
right: '5px',
width: '10px',
height: '10px',
background: '#E80D0D',
borderRadius: '50%',
}}
/>
)}
</Button> </Button>
<Button <Button
style={{ height: 32, borderRadius: 20, margin: '0 16px' }} style={{ height: 32, borderRadius: 20, margin: '0 16px' }}
@ -306,6 +339,20 @@ const OfflineAlarmList: React.FC = () => {
}} }}
> >
{tabFlag[1] && (
<span
style={{
display: 'inline-block',
position: 'absolute',
top: '-5px',
right: '5px',
width: '10px',
height: '10px',
background: '#E80D0D',
borderRadius: '50%',
}}
/>
)}
</Button> </Button>
<Button <Button
style={{ height: 32, borderRadius: 20 }} style={{ height: 32, borderRadius: 20 }}
@ -315,6 +362,20 @@ const OfflineAlarmList: React.FC = () => {
}} }}
> >
{tabFlag[2] && (
<span
style={{
display: 'inline-block',
position: 'absolute',
top: '-5px',
right: '5px',
width: '10px',
height: '10px',
background: '#E80D0D',
borderRadius: '50%',
}}
/>
)}
</Button> </Button>
</div> </div>
<div style={{ padding: '16px 0' }}> <div style={{ padding: '16px 0' }}>

@ -68,12 +68,15 @@
} }
.alarmImgContent { .alarmImgContent {
display: flex; display: flex;
flex-wrap: wrap;
justify-content: center; justify-content: center;
box-sizing: border-box; box-sizing: border-box;
width: 784px; width: 784px;
margin-bottom: 24px;
padding: 16px;
// height: 172px; // height: 172px;
max-height: 760px;
margin-bottom: 24px;
padding: 16px 0 16px 16px;
overflow: scroll;
background: #fbfcff; background: #fbfcff;
border: 1px dashed #dcdcdc; border: 1px dashed #dcdcdc;
border-radius: 4px; border-radius: 4px;

@ -29,6 +29,7 @@ export type UpdateFormProps = {
handleModal: () => void; handleModal: () => void;
values: Partial<API.AlarmDetailsParams>; values: Partial<API.AlarmDetailsParams>;
reload: any; reload: any;
warning_type: any;
}; };
const UpdateForm: React.FC<UpdateFormProps> = (props) => { const UpdateForm: React.FC<UpdateFormProps> = (props) => {
const intl = useIntl(); const intl = useIntl();
@ -39,17 +40,29 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => {
const [involved, setInvolved] = useState(0); const [involved, setInvolved] = useState(0);
// const [involvedInfo, setInvolvedInfo] = useState([...(props?.values?.person_list || [])]); // const [involvedInfo, setInvolvedInfo] = useState([...(props?.values?.person_list || [])]);
const [involvedInfo, setInvolvedInfo] = useState<any[]>([]); 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);
// console.log(involved);
// }
// }, [props.values?.person_classify]);
useEffect(() => { useEffect(() => {
if (props.values?.person_list) { // console.log(Array.isArray(props.values?.person_id),'Array.isArray(props.values?.person_id)');
if (props.updateModalOpen) {
if (props.warning_type === '1') {
console.log('props.values?.warning_type1', props.values.person_list[0][2]);
setInvolved(props.values.person_list[0][2]);
} else {
console.log('props.values?.warning_type2');
setInvolvedInfo([...props.values.person_list]); setInvolvedInfo([...props.values.person_list]);
} }
}, [props.values?.person_list]);
useEffect(() => {
if (props.values?.person_classify) {
setInvolved(props.values.person_classify);
console.log(involved);
} }
}, [props.values?.person_classify]); }, [props.updateModalOpen]);
const handlePostRecognition = (person_id: any, classify: any) => { const handlePostRecognition = (person_id: any, classify: any) => {
postRecognition({ postRecognition({
person_id: person_id, person_id: person_id,
@ -184,7 +197,7 @@ const UpdateForm: React.FC<UpdateFormProps> = (props) => {
: <span className={styles.alarmSpan}>{props.values.device_address}</span> : <span className={styles.alarmSpan}>{props.values.device_address}</span>
</div> </div>
<div className={styles.alarmImgContent}> <div className={styles.alarmImgContent}>
{Array.isArray(props.values?.person_id) {props.warning_type === '2'
? Array.isArray(involvedInfo) && involvedInfo.length ? Array.isArray(involvedInfo) && involvedInfo.length
? involvedInfo.map((item: any, index: any) => { ? involvedInfo.map((item: any, index: any) => {
return ( return (

@ -78,7 +78,7 @@ const ImageSinglePopover: React.FC<ImageSinglePopoverProps> = ({ src, involved,
position: 'relative', position: 'relative',
boxSizing: 'border-box', boxSizing: 'border-box',
width: 140, width: 140,
height: 160, height: 170,
marginRight: 12, marginRight: 12,
}} }}
> >

@ -100,7 +100,7 @@ const ImageWithPopover: React.FC<ImageWithPopoverProps> = ({
position: 'relative', position: 'relative',
boxSizing: 'border-box', boxSizing: 'border-box',
width: 140, width: 140,
height: 160, height: 170,
marginRight: 12, marginRight: 12,
}} }}
> >
@ -130,7 +130,7 @@ const ImageWithPopover: React.FC<ImageWithPopoverProps> = ({
onOpenChange={handleOpenChange} onOpenChange={handleOpenChange}
> >
<Button <Button
style={{ position: 'absolute', bottom: 20, right: 0 }} style={{ position: 'absolute', bottom: 30, right: 0, display: 'none' }}
type="text" type="text"
icon={ icon={
<EllipsisOutlined style={{ color: '#fff', fontSize: 24, transform: 'rotate(90deg)' }} /> <EllipsisOutlined style={{ color: '#fff', fontSize: 24, transform: 'rotate(90deg)' }} />

@ -76,6 +76,7 @@ const AlarmList: React.FC = () => {
// const { state } = location; // const { state } = location;
const [selectOptions, setSelectOptions] = useState<any>([]); const [selectOptions, setSelectOptions] = useState<any>([]);
const [selectValue, setSelectValue] = useState<number>(); const [selectValue, setSelectValue] = useState<number>();
const [tabFlag, settabFlag] = useState<any>([]);
const pollServer = () => { const pollServer = () => {
postWarningStatistics({}) postWarningStatistics({})
.then((res) => { .then((res) => {
@ -103,9 +104,9 @@ const AlarmList: React.FC = () => {
})); }));
setSelectValue(res.data.total_results[0].id); setSelectValue(res.data.total_results[0].id);
setSelectOptions(newOptions); setSelectOptions(newOptions);
settabFlag(res.data.total_results[0].warning_type);
} }
console.log(selectValue, 'selectValue'); setTimeout(pollServer, 50000);
// setTimeout(pollServer, 5000);
}) })
.catch(() => {}); .catch(() => {});
}; };
@ -334,6 +335,7 @@ const AlarmList: React.FC = () => {
className="select_Bg" className="select_Bg"
style={{ width: 280, borderRadius: 4 }} style={{ width: 280, borderRadius: 4 }}
onChange={handleChange} onChange={handleChange}
value={selectValue}
options={selectOptions} options={selectOptions}
/> />
<Button <Button
@ -369,6 +371,20 @@ const AlarmList: React.FC = () => {
}} }}
> >
{tabFlag?.[0] && (
<span
style={{
display: 'inline-block',
position: 'absolute',
top: '-5px',
right: '5px',
width: '10px',
height: '10px',
background: '#E80D0D',
borderRadius: '50%',
}}
/>
)}
</Button> </Button>
<Button <Button
style={{ height: 32, borderRadius: 20, margin: '0 16px' }} style={{ height: 32, borderRadius: 20, margin: '0 16px' }}
@ -378,6 +394,20 @@ const AlarmList: React.FC = () => {
}} }}
> >
{tabFlag?.[1] && (
<span
style={{
display: 'inline-block',
position: 'absolute',
top: '-5px',
right: '5px',
width: '10px',
height: '10px',
background: '#E80D0D',
borderRadius: '50%',
}}
/>
)}
</Button> </Button>
<Button <Button
style={{ height: 32, borderRadius: 20 }} style={{ height: 32, borderRadius: 20 }}
@ -387,6 +417,20 @@ const AlarmList: React.FC = () => {
}} }}
> >
{tabFlag?.[2] && (
<span
style={{
display: 'inline-block',
position: 'absolute',
top: '-5px',
right: '5px',
width: '10px',
height: '10px',
background: '#E80D0D',
borderRadius: '50%',
}}
/>
)}
</Button> </Button>
</div> </div>
<ProList<any> <ProList<any>
@ -489,6 +533,7 @@ const AlarmList: React.FC = () => {
values={currentRow || {}} values={currentRow || {}}
handleModal={handleUpdateModal} handleModal={handleUpdateModal}
reload={initList} reload={initList}
warning_type={tab}
/> />
</PageContainer> </PageContainer>
); );

@ -98,6 +98,7 @@ const DeviceList: React.FC = () => {
), ),
dataIndex: 'device_name', dataIndex: 'device_name',
hideInSearch: true, hideInSearch: true,
width: 240,
// width: 240, // width: 240,
}, },
{ {
@ -196,7 +197,7 @@ const DeviceList: React.FC = () => {
/> />
), ),
dataIndex: 'platform_name', dataIndex: 'platform_name',
// width: 240, width: 240,
hideInSearch: true, hideInSearch: true,
}, },
{ {

@ -404,6 +404,7 @@ const InvolvedList: React.FC = () => {
className="select_Bg" className="select_Bg"
style={{ width: 280, borderRadius: 4, marginRight: 12 }} style={{ width: 280, borderRadius: 4, marginRight: 12 }}
onChange={handleChange} onChange={handleChange}
value={selectValue}
options={selectOptions} options={selectOptions}
/> />
<DatePicker <DatePicker
@ -430,6 +431,7 @@ const InvolvedList: React.FC = () => {
// setCreateModalOpen(true); // setCreateModalOpen(true);
setImportDate(null); setImportDate(null);
setInnerDate(null); setInnerDate(null);
// setSelectValue(1);
initList(classify, null); initList(classify, null);
}} }}
> >

Loading…
Cancel
Save