import React from 'react';
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({ workId, ...otherProps }) {
  const pathname = otherProps?.location?.pathname;
  const [data, setData] = useState();
  const id = workId || getOneStopConfig(pathname);
  useEffect(() => {
    setData(undefined);
    fetchTemplateById(id).then(res => {
      if (res) setData({ ...res, content: '{}' });
    });
  }, [id]);

  // console.log(data);
  if (!data) {
    return null;

  } else {
    const FormNew = Form.create(window.zdyTableTemplateWillMountProps?.formCreateOptions || undefined)(RenderForm);
    return <FormNew postData={data} style={{ padding: 0 }} />;
  }

}

export default OtherCheckRecord;
