CheckRecord.js 1.7 KB
Newer Older
钟是志's avatar
钟是志 committed
1 2
import React from 'react';
import RenderForm from '@/webPublic/FormInsertDiy/RenderForm';
3
import { fetchTemplateById } from '@/webPublic/Services';
钟是志's avatar
钟是志 committed
4
import { useState, useEffect } from 'react';
5
import { Form, Modal } from 'antd';
钟是志's avatar
钟是志 committed
6
import { getOneStopConfig } from '@/webPublic/zyd_public/utils/utils';
7 8 9 10

// const id = '1234718972352397312';

// 考核汇总页面
钟是志's avatar
钟是志 committed
11
function OtherCheckRecord({ workId, ...otherProps }) {
钟是志's avatar
钟是志 committed
12
  const pathname = otherProps?.location?.pathname;
钟是志's avatar
钟是志 committed
13 14
  const [data, setData] = useState();
  const id = workId || getOneStopConfig(pathname);
15 16 17
  useEffect(() => {
    setData(undefined);
    fetchTemplateById(id).then(res => {
钟是志's avatar
钟是志 committed
18
      if (res) setData({ ...res, content: '{}' });
19
    });
钟是志's avatar
钟是志 committed
20
  }, [id]);
21

钟是志's avatar
钟是志 committed
22 23 24
  if (!data) {
    return null;

25 26 27 28 29 30 31 32 33 34 35
  }
  if (window.zdyTableTemplateWillMountProps?.showComponentType === 'ModalAndSmartForm') {
    // 25841 学生资助管理/勤工助学-用工部门/学生申请岗位审核,2020010375 发送面试邀请后 学生没有收到 邀请信息
    // 通过增加配置项 达到 弹窗中嵌入表单的效果.
    const { ModalAndSmartForm_ModalProps } = window.zdyTableTemplateWillMountProps;
    const FormNew = Form.create(window.zdyTableTemplateWillMountProps?.formCreateOptions || undefined)(RenderForm);
    const { ModalAndSmartFormProps } = otherProps;
    window.ModalAndSmartFormProps = ModalAndSmartFormProps;
    return <Modal {...ModalAndSmartForm_ModalProps}>
      <FormNew postData={data} style={{ padding: 0 }} />
    </Modal>;
钟是志's avatar
钟是志 committed
36 37 38 39
  } else {
    const FormNew = Form.create(window.zdyTableTemplateWillMountProps?.formCreateOptions || undefined)(RenderForm);
    return <FormNew postData={data} style={{ padding: 0 }} />;
  }
钟是志's avatar
钟是志 committed
40

41 42
}

钟是志's avatar
钟是志 committed
43
export default OtherCheckRecord;