|
|
@ -2,9 +2,9 @@ |
|
|
|
|
|
|
|
import React from 'react'; |
|
|
|
import { connect } from 'react-redux'; |
|
|
|
import { Modal, Spin, Notification, Row } from '@douyinfe/semi-ui'; |
|
|
|
import { Modal, Spin, Notification, Row, Space, Button } from '@douyinfe/semi-ui'; |
|
|
|
import { RouteTable } from '../../utils/webapi'; |
|
|
|
import { RouteRequest } from '@peace/utils'; |
|
|
|
import { EmisRequest, EmisApiTable } from '$utils'; |
|
|
|
import { useState } from 'react'; |
|
|
|
import { useEffect } from 'react'; |
|
|
|
import { IconClose } from '@douyinfe/semi-icons'; |
|
|
@ -14,10 +14,9 @@ import './index.less' |
|
|
|
const { confirm } = Modal; |
|
|
|
|
|
|
|
const WorkFlowModal = (props) => { |
|
|
|
const { successCallBack = () => { }, title, visible, clientHeight, postData, processId, user, dispatch, webEmis } = props; |
|
|
|
const { successCallBack = () => { }, title, visible, clientHeight, postData, processId, user, dispatch, webEmis, webOa, onCancel } = props; |
|
|
|
const [loading, setLoading] = useState(true); |
|
|
|
const [ifShowMessage, setIfShowMessage] = useState(true); |
|
|
|
const [webUrl, setWebUrl] = useState(null); |
|
|
|
const [customVisible, setCustomVisible] = useState(false); |
|
|
|
const [draftId, setDraftId] = useState(); |
|
|
|
const iframeRef = React.createRef(); |
|
|
@ -26,7 +25,6 @@ const WorkFlowModal = (props) => { |
|
|
|
if (draftId) { |
|
|
|
setCustomVisible(false); |
|
|
|
} else { |
|
|
|
const { onCancel } = props; |
|
|
|
onCancel && onCancel(); |
|
|
|
setLoading(false); |
|
|
|
} |
|
|
@ -47,11 +45,9 @@ const WorkFlowModal = (props) => { |
|
|
|
} |
|
|
|
|
|
|
|
const handelApprovalCenter = (activeKey) => { |
|
|
|
RouteRequest.get(RouteTable.getWebUrl + `?sys=emisWebUrl`).then(res => { |
|
|
|
if (res.url) { |
|
|
|
window.open(res.url + "/approval/center?activeKey=" + activeKey); |
|
|
|
} |
|
|
|
}); |
|
|
|
if (webOa) { |
|
|
|
window.open(webOa + "/approval/center?activeKey=" + activeKey); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const handelOk = () => { |
|
|
@ -63,18 +59,13 @@ const WorkFlowModal = (props) => { |
|
|
|
} |
|
|
|
|
|
|
|
const handelDeny = () => { |
|
|
|
// dispatch(delDraft(draftId)).then(res => { |
|
|
|
// if (res.success) { |
|
|
|
// Notification.success({title:'删除草稿成功'}); |
|
|
|
// const { onCancel } = props; |
|
|
|
// onCancel && onCancel(); |
|
|
|
// setLoading(false); |
|
|
|
// setCustomVisible(false); |
|
|
|
// setDraftId(null); |
|
|
|
// } else { |
|
|
|
// Notification.error({title:'删除草稿失败,请联系管理员'}); |
|
|
|
// } |
|
|
|
// }) |
|
|
|
EmisRequest.delete(EmisApiTable.delDraftUrl.replace('{draftId}', draftId)).then(res => { |
|
|
|
Notification.success({ title: '删除草稿成功' }); |
|
|
|
onCancel && onCancel(); |
|
|
|
setLoading(false); |
|
|
|
setCustomVisible(false); |
|
|
|
setDraftId(null); |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
const cancel = () => { |
|
|
@ -87,6 +78,7 @@ const WorkFlowModal = (props) => { |
|
|
|
let data = JSON.parse(event.data); |
|
|
|
const { type, isSaveDraft, setIntervalSave, draftId, msg } = data; |
|
|
|
if (msg) { |
|
|
|
console.log(msg); |
|
|
|
Notification.success({ title: msg }) |
|
|
|
} |
|
|
|
setDraftId(draftId); |
|
|
@ -112,31 +104,21 @@ const WorkFlowModal = (props) => { |
|
|
|
} |
|
|
|
//监听message事件 |
|
|
|
window.addEventListener('message', receiveMessageFromIndex, false); |
|
|
|
//获取企业统一认证管理平台web的URL |
|
|
|
if (!webUrl) { |
|
|
|
RouteRequest.get(RouteTable.getEmisWebUrl).then(res => { |
|
|
|
if (res.url) { |
|
|
|
setWebUrl(res.url); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
}, []) |
|
|
|
|
|
|
|
console.log(webEmis, processId); |
|
|
|
return ( |
|
|
|
<div> |
|
|
|
<Modal |
|
|
|
fullScreen |
|
|
|
visible={visible} |
|
|
|
width={'100%'} |
|
|
|
// style={{ top: 0, left: 0, padding: 0, maxWidth: '100%' }} |
|
|
|
// bodyStyle={{ paddingLeft: 32, paddingRight: 32, margin: 0, backgroundColor: '#FAFAFA', height: '100%', overflowY: 'auto' }} |
|
|
|
title={''} |
|
|
|
closable={false} |
|
|
|
hasCancel={false} |
|
|
|
footer={null} |
|
|
|
wrapClassName='process_modal_wrap' |
|
|
|
onCancel={showConfirm} |
|
|
|
destroyOnClose |
|
|
|
// onCancel={showConfirm} |
|
|
|
> |
|
|
|
<Row> |
|
|
|
<div className='workflow-body'> |
|
|
@ -152,7 +134,7 @@ const WorkFlowModal = (props) => { |
|
|
|
<Spin |
|
|
|
spinning={loading} |
|
|
|
> |
|
|
|
{webUrl && processId ? <iframe |
|
|
|
{webEmis && processId ? <iframe |
|
|
|
id='workflowFrame' |
|
|
|
onLoad={() => { |
|
|
|
let frameWin = document.getElementById('workflowFrame'); |
|
|
@ -161,7 +143,7 @@ const WorkFlowModal = (props) => { |
|
|
|
}} |
|
|
|
allowTransparency="true" |
|
|
|
ref={iframeRef} |
|
|
|
src={`${webUrl}/process/${processId}/apply?token=${user.token}`} |
|
|
|
src={`${webEmis}/process/${processId}/apply?token=${user.token}`} |
|
|
|
width={'100%'} |
|
|
|
style={{ height: '100vh' }} |
|
|
|
frameBorder="0" |
|
|
@ -170,16 +152,27 @@ const WorkFlowModal = (props) => { |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{ |
|
|
|
customVisible ? <div className='modalBox'> |
|
|
|
<div className='modal'> |
|
|
|
<p className='content'>此表单已保存为草稿,是否需要保留</p> |
|
|
|
<ul className='btn'> |
|
|
|
<li className='confirm' onClick={() => handelOk()}>是</li> |
|
|
|
<li className='deny' onClick={() => handelDeny()}>否</li> |
|
|
|
<li className='cancel' onClick={() => cancel()}>取消</li> |
|
|
|
</ul> |
|
|
|
</div> |
|
|
|
</div> : '' |
|
|
|
customVisible ? |
|
|
|
<Modal |
|
|
|
title="此表单已保存为草稿,是否需要保留" |
|
|
|
visible={customVisible} |
|
|
|
footer={ |
|
|
|
<Space> |
|
|
|
<Button type="primary" onClick={() => handelOk()}> |
|
|
|
是 |
|
|
|
</Button> |
|
|
|
<Button type="primary" onClick={() => handelDeny()}> |
|
|
|
否 |
|
|
|
</Button> |
|
|
|
<Button type="primary" onClick={() => cancel()}> |
|
|
|
取消 |
|
|
|
</Button> |
|
|
|
</Space> |
|
|
|
|
|
|
|
} |
|
|
|
> |
|
|
|
</Modal> |
|
|
|
: '' |
|
|
|
} |
|
|
|
</Row> |
|
|
|
</Modal > |
|
|
@ -189,11 +182,11 @@ const WorkFlowModal = (props) => { |
|
|
|
|
|
|
|
function mapStateToProps (state) { |
|
|
|
const { auth, global } = state; |
|
|
|
console.log(global); |
|
|
|
return { |
|
|
|
user: auth.user, |
|
|
|
clientHeight: global.clientHeight, |
|
|
|
webEmis: global.webEmis |
|
|
|
webEmis: global.webEmis, |
|
|
|
webOa: global.webOa |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|