import RenderForm from "@/webPublic/FormInsertDiy/RenderForm";
import { fetchTemplateById } from '@/webPublic/Services';
import { useState, useEffect } from "react";
import { Form } from 'antd';
import { getOneStopConfig } from '@/webPublic/zyd_public/utils/utils';

// const id = '1234718972352397312';

// 考核汇总页面
function OtherCheckRecord({ form, location: { pathname }, workId }) {
  const [data, setData]  = useState();

  useEffect(() => {
    const id = workId || getOneStopConfig(pathname);
    setData(undefined);
    fetchTemplateById(id).then(res => {
      if (res) setData({...res, content: "{}"});
    });
  }, [pathname]);

  // console.log(data);

  return !!data && <RenderForm form={form} postData={data} style={{ padding: 0 }} />;
}

export default  Form.create()(OtherCheckRecord)
