index.js 1.3 KB
Newer Older
王绍森's avatar
王绍森 committed
1
import React from 'react';
王绍森's avatar
王绍森 committed
2
import { Form } from 'antd';
王绍森's avatar
王绍森 committed
3
import router from 'umi/router';
王绍森's avatar
王绍森 committed
4
import Entrance from '../Entrance';
王绍森's avatar
王绍森 committed
5 6
import Shell from '@/baseComponent/Shell';
import SubmitButton from '@/webPublic/one_stop_public/AffairButton/SumbitButton';
王绍森's avatar
王绍森 committed
7 8
import { ModalInfo } from '@/baseComponent/Modal';
import withGoBack from '@/highOrderComponent/withGoBack';
王绍森's avatar
王绍森 committed
9

王绍森's avatar
王绍森 committed
10 11
let ApplyPage = ({ id, form }) => {
  function submitCb(res) {
王绍森's avatar
王绍森 committed
12
    ModalInfo(`提交${res ? '成功' : '失败'}!`, {onOk: () => router.goBack()});
王绍森's avatar
王绍森 committed
13
  }
王绍森's avatar
王绍森 committed
14 15 16 17
  function saveDraftCb(res) {
    ModalInfo(`提交${res ? '成功' : '失败'}!`, {onOk: () => router.goBack()});
  }

王绍森's avatar
王绍森 committed
18 19
  return (
    <Shell styleShell={{ marginTop: 0 }}>
王绍森's avatar
王绍森 committed
20
      <Entrance id={id} isCg="false" get="web" form={form} />
王绍森's avatar
王绍森 committed
21 22 23 24 25 26 27
      <div style={{ padding: 16, textAlign: 'center' }}>
        <SubmitButton
          form={form}
          appId={id}
          text="提交"
          openDraftButton
          DraftButtonText="暂存"
王绍森's avatar
王绍森 committed
28
          callback={submitCb}
王绍森's avatar
王绍森 committed
29
          draftCallback={saveDraftCb}
王绍森's avatar
王绍森 committed
30 31 32 33
        />
      </div>
    </Shell>
  );
王绍森's avatar
王绍森 committed
34 35 36 37 38 39 40 41
};

ApplyPage = Form.create()(ApplyPage);

export default ({ hasGoBack = true, ...rest }) => {
  const WithGoBack = withGoBack(ApplyPage);
  return hasGoBack ? <WithGoBack {...rest} /> : <ApplyPage {...rest} />;
};