提交 c9768baf authored 作者: 钟是志's avatar 钟是志

19711 流程发起页面支持url传表单参数

上级 6b259bfb
/**
* 只包含一站式流程的申请页面 会带部分字段参数到申请表单
* 返回也是返回到上一个路由
* */
import { message } from "antd";
import React, { Fragment } from "react";
import { getToken } from "@/utils/authority";
import PageHeaderWrapper from "@/components/PageHeaderWrapper";
import ButtonDiy from "@/baseComponent/ButtonDiy";
import Shell from "@/baseComponent/Shell";
import config from "@/config/config";
import router from "umi/router";
export default class AffairPage extends React.Component {
constructor(props) {
super(props);
let state = this.props.location.state;
if(!state || !state.id){
console.error('无法获取流程id', 'JustApply.js');
}
this.state = {
workId: state.id,
init: {...state},
};
};
componentDidMount() {
if (!getToken()) {
message.error("您的数据未同步,请联系管理员!");
return false;
}
window.addEventListener("message", (event) => { // 和Iframe页进行通迅
if (event.data === "returnList") {
this.returnList(true);
}
if (event && event.data && event.data.indexOf && event.data.indexOf("iframeHeight") > -1) {
let height = Number(event.data.split("-")[1]);
const iframe = document.getElementById("applyIframeId");
if (iframe) {
iframe.height = height;
}
}
}, false);
return true;
}
returnList = () => {
router.goBack();
};
render() {
const { workId, init} = this.state;
if (!workId) {
return null;
}
const url = config.onestopPC.split("/#/");
let iframeUrl = `${url[0]}/#/IFrameForApply?id=${workId}&token=${getToken()}&init=${encodeURIComponent(JSON.stringify(init))}`;
console.log(iframeUrl);
// iframeUrl = `http://localhost:8000/onestop/IFrameForApply?id=${workId}&token=${getToken()}`;
return (
<PageHeaderWrapper title="">
<div style={{
visibility: "visible",
backgroundColor: "#fff",
paddingLeft: "24px"
}}>
<Shell>
<div style={{
height: "54px",
padding: "12px 0 12px 12px",
display: "block",
}}>
<ButtonDiy name="返回"
className="defaultBlue"
handleClick={this.returnList}
icon="arrow-left"
/>
</div>
</Shell>
<iframe src={iframeUrl}
frameBorder={0}
id="applyIframeId"
name="applyIframe"
marginWidth="0"
marginHeight="0"
allowtransparency="yes"
seamless
scrolling={"auto"}
style={{
width: "100%",
minHeight: "800px",
overflowY: "hidden",
backgroundColor: "#fff"
}}
/>
: null
</div>
</PageHeaderWrapper>
);
}
}
...@@ -12,7 +12,7 @@ import * as destructionFunc from '../destruction'; ...@@ -12,7 +12,7 @@ import * as destructionFunc from '../destruction';
import { Link } from 'dva/router'; import { Link } from 'dva/router';
import { getApplyPage } from '../publicApiService'; import { getApplyPage } from '../publicApiService';
import { getToken } from '@/utils/authority'; import { getToken } from '@/utils/authority';
import JustApply from './JustApply';
import PageHeaderWrapper from '@/components/PageHeaderWrapper'; import PageHeaderWrapper from '@/components/PageHeaderWrapper';
import List from './List'; import List from './List';
import pageSetting from './pageSetting'; import pageSetting from './pageSetting';
...@@ -20,7 +20,17 @@ import ButtonDiy from '@/baseComponent/ButtonDiy'; ...@@ -20,7 +20,17 @@ import ButtonDiy from '@/baseComponent/ButtonDiy';
import Shell from '@/baseComponent/Shell'; import Shell from '@/baseComponent/Shell';
import config from '@/config/config'; import config from '@/config/config';
export default class AffairPage extends React.Component { export default function index(props){
const { state } = props.location.state;
if(state.justApply){
return <JustApply {...props}/>;
}else{
return <AffairPage {...props}/>;
}
}
class AffairPage extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
let pathname = this.props.location.pathname; let pathname = this.props.location.pathname;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论