import PageContent from '@/components/PageContent';
import PageTitle from '@/components/PageTitle';
import { connect, useParams } from '@umijs/max';
import { useEffect } from 'react';
import Detail from './components/Detail';

const ReportDetail = (props) => {
  const { data, dispatch, loading } = props;

  const { projectId, routeId } = useParams();
  useEffect(() => {
    if (routeId) {
      dispatch({
        type: 'eqSelfInspection/getPatrolDataById',
        payload: {
          routeId,
        },
      });
    }
  }, []);

  return (
    <PageContent closeable={false}>
      <PageTitle returnable>自检报告</PageTitle>
      <div className="content-title" style={{ marginTop: 20 }}>
        <Detail data={data} projectId={projectId} loading={loading} />
      </div>
    </PageContent>
  );
};
export default connect(({ loading, eqSelfInspection }) => ({
  data: eqSelfInspection.autoReport,
  loading: loading.models.eqSelfInspection,
}))(ReportDetail);
