提交 ef958eb6 authored 作者: 王绍森's avatar 王绍森

我的申报增加详情和编辑页面

上级 49bed1bc
......@@ -5,6 +5,7 @@ import HistoryForm from '@/webPublic/one_stop_public/Entrance/historyForm';
import { getHistoryFormDetail } from '../../Services';
import withGoBack from '@/highOrderComponent/withGoBack';
// 查看详情, 传申报数据的code
let DetailPage = ({ form, code }) => {
const [data, setData] = useState(null);
const [loading, setLoading] = useState(false);
......
import React, { useState, useEffect } from 'react';
import { Form, Spin } from 'antd';
import Shell from '@/baseComponent/Shell';
import { getHistoryFormDetail } from '../../Services';
import withGoBack from '@/highOrderComponent/withGoBack';
import SubmitButton from '@/webPublic/one_stop_public/AffairButton/SumbitButton';
import { ModalInfo } from '@/baseComponent/Modal';
import RenderForm from '../RenderForm';
function submitCb(res) {
ModalInfo(`提交${res ? '成功' : '失败'}!`);
}
// 编辑草稿,传入应用id和草稿id
let EditPage = ({ form, appId, draftId }) => {
const [data, setData] = useState(null);
const [loading, setLoading] = useState(false);
useEffect(() => {
if (typeof draftId === 'undefined') return;
setLoading(true);
getHistoryFormDetail({ id: draftId }).then(res => {
setLoading(false);
if (res && !res.errMsg) {
setData(res);
}
});
}, []);
return (
<Shell styleShell={{ marginTop: 0 }}>
<Spin spinning={loading}>
{data && (
<>
<RenderForm postData={data} form={form} isCg="yes" />
<div style={{ padding: 16, textAlign: 'center' }}>
<SubmitButton
form={form}
appId={appId}
draftId={draftId}
text="提交"
openDraftButton
DraftButtonText="暂存"
callback={submitCb}
/>
</div>
</>
)}
</Spin>
</Shell>
);
};
EditPage = Form.create()(EditPage);
export default ({ hasGoBack = true, ...rest }) => {
const WithGoBack = withGoBack(EditPage);
return hasGoBack ? <WithGoBack {...rest} /> : <EditPage {...rest} />;
};
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论