import { getUploadInvolvedTravelList, postUploadRecognition } from '@/services/realTime/involved'; import { CloseCircleOutlined, EllipsisOutlined } from '@ant-design/icons'; import { ModalForm } from '@ant-design/pro-components'; import { useIntl } from '@umijs/max'; import { Button, Form, Image, List, Popover, message } from 'antd'; import moment from 'moment'; import VirtualList from 'rc-virtual-list'; import React, { useEffect, useState } from 'react'; import trajectoryBottom from '../../../../../public/images/involved/trajectoryBottom.png'; import './InvolvedDetails.less'; import styles from './InvolvedDetails.less'; export type FormValueType = { target?: string; template?: string; type?: string; time?: string; frequency?: string; } & Partial; export type UpdateFormProps = { updateModalOpen: boolean; handleModal: () => void; values: Partial; reload: any; }; const InvolvedDetails: React.FC = (props) => { const intl = useIntl(); const [form] = Form.useForm(); const [dataFlag, setDataFlag] = useState(false); const [open, setOpen] = useState(false); const [trajectoryData, setTrajectoryData] = useState([]); // 动态设置每页数量 const [currentPageSize, setCurrentPageSize] = useState(10); const [currentPage, setCurrentPage] = useState(1); const [total, setTotal] = useState(0); const ContainerHeight = 630; const content = (
{/*
选项1
选项2
*/}
); const handleOpenChange = (value: boolean) => { setOpen(value); }; const appendData = (page: any, pageSize: any) => { const reqParams = { page: page, pageSize: pageSize, // desc: false, person_id: props.values.person_id, // ...rest, }; getUploadInvolvedTravelList(reqParams) .then((res) => { console.log(res); if (res.data.results) { setTrajectoryData(trajectoryData.concat(res.data.results)); setTotal(res.data.count); if (res.data.next) { setDataFlag(true); } else { setDataFlag(false); // setTrajectoryData([]); // 重置trajectoryData数据为空数组 } } }) .catch(() => { // setLoading(false); setDataFlag(false); // setTrajectoryData([]); // 重置trajectoryData数据为空数组 }); }; const onScroll = (e: React.UIEvent) => { // Refer to: https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight#problems_and_solutions console.log(e.currentTarget.scrollHeight - e.currentTarget.scrollTop - ContainerHeight); if (Math.abs(e.currentTarget.scrollHeight - e.currentTarget.scrollTop - ContainerHeight) <= 1) { if (dataFlag) { const nextPage = currentPage + 1; setCurrentPage(nextPage); appendData(nextPage, 10); } } }; useEffect(() => { if (props.updateModalOpen) { // 调用接口获取数据 setTrajectoryData([]); // 重置trajectoryData数据为空数组 setCurrentPage(1); setCurrentPageSize(10); appendData(currentPage, currentPageSize); } }, [props.updateModalOpen]); return ( width={615} title={
关注时间:{' '} {moment(props?.values?.classify_time).format('YYYY-MM-DD hh:mm:ss')}
最近发现:{' '} {moment(props?.values?.appear_time).format('YYYY-MM-DD hh:mm:ss')}
{/*
来源设备:{' '} {props?.values?.device_name}
*/}
} open={props.updateModalOpen} form={form} autoFocusFirstInput modalProps={{ destroyOnClose: true, onCancel: () => { setTrajectoryData([]); setCurrentPage(1); setCurrentPageSize(10); props.handleModal(); }, wrapClassName: 'involvedModalForm', }} 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: '失败' })); // }); setTrajectoryData([]); setCurrentPage(1); setCurrentPageSize(10); props.handleModal(); return true; }} > {/* */} {/*
告警名称: 单人徘徊告警来源设备: 北广场检票口1#摄像头触发时间: 2023-01-15 22:00:03
*/}
{(item: any, index: any) => (
{index + 1 !== total && }
} title={
时间定位:{' '} {moment(item.create_time).format('YYYY-MM-DD hh:mm:ss')} {' '} 来源视频: {item.video_name}
} />
{index === total - 1 && (
已无更多数据~
)}
)} {/*
*/} ); }; export default InvolvedDetails;