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

解决一站式web端一直重复调接口的bug

上级 6409e148
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* 2019年9月19日 * 2019年9月19日
* 查看详情页面 * 查看详情页面
*/ */
import React, { Component, Fragment } from 'react'; import React, { Component, Fragment, useRef } from 'react';
import { import {
Row, Row,
Col, Col,
...@@ -36,7 +36,12 @@ import styles from './styles.less'; ...@@ -36,7 +36,12 @@ import styles from './styles.less';
import TrunToDetail from './trunToDetail'; import TrunToDetail from './trunToDetail';
import Countersign from './components/Countersign'; import Countersign from './components/Countersign';
import ChildTaskModel from './ChildTaskModel'; import ChildTaskModel from './ChildTaskModel';
import { checkNeedFormValidateFieldsAndScroll, must, submitValues, checkNeedWriteAuditInfo } from './splitDetailSplit'; import {
checkNeedFormValidateFieldsAndScroll,
must,
submitValues,
checkNeedWriteAuditInfo,
} from './splitDetailSplit';
import { queryApiVersion, queryApiActionPath } from '@/webPublic/one_stop_public/utils/queryConfig'; import { queryApiVersion, queryApiActionPath } from '@/webPublic/one_stop_public/utils/queryConfig';
import { isJSON } from '@/webPublic/zyd_public/utils/utils'; import { isJSON } from '@/webPublic/zyd_public/utils/utils';
import HistoryFormList from '@/webPublic/one_stop_public/DetailForAudit/HistoryFormList'; import HistoryFormList from '@/webPublic/one_stop_public/DetailForAudit/HistoryFormList';
...@@ -130,12 +135,15 @@ class DetailSplit extends Component { ...@@ -130,12 +135,15 @@ class DetailSplit extends Component {
componentDidMount() { componentDidMount() {
this.getInit(); this.getInit();
if (this.props.onRef) { if (this.props.onRef) {
this.props.onRef(this); this.props.onRef(this);
} }
} }
// getInit2 = () => {
// console.log('getInit2');
// }
/** /**
* @function 默认请求 * @function 默认请求
*/ */
...@@ -228,8 +236,6 @@ class DetailSplit extends Component { ...@@ -228,8 +236,6 @@ class DetailSplit extends Component {
}); });
} }
}, },
}); });
...@@ -246,7 +252,7 @@ class DetailSplit extends Component { ...@@ -246,7 +252,7 @@ class DetailSplit extends Component {
closeAutoSign, closeAutoSign,
}); });
if(!closeAutoSign){ if (!closeAutoSign) {
/** /**
* 获取设置的数据 * 获取设置的数据
*/ */
...@@ -573,163 +579,234 @@ class DetailSplit extends Component { ...@@ -573,163 +579,234 @@ class DetailSplit extends Component {
</div> </div>
{isLoading ? {isLoading ?
( (
<> <>
<Card style={{ width: '100%' }}> <Card style={{ width: '100%' }}>
{!isCloseUserDetail && ( {!isCloseUserDetail && (
<div className={styles.body_hea}> <div className={styles.body_hea}>
<h3>发起人信息</h3> <h3>发起人信息</h3>
{data && {data &&
(data.createTime || (data.createTime ||
data.code || data.code ||
data.userName || data.userName ||
data.userPosition || data.userPosition ||
data.userPhone || data.userPhone ||
data.userSchool) && ( data.userSchool) && (
<Row className={styles.row}> <Row className={styles.row}>
{data && data.code && ( {data && data.code && (
<Col <Col
style={{ style={{
marginBottom: 12, marginBottom: 12,
}} }}
span={8} span={8}
> >
<span className={styles.hea_title}>单号</span> <span className={styles.hea_title}>单号</span>
<span className={styles.hew_content}>{data.code}</span> <span className={styles.hew_content}>{data.code}</span>
</Col> </Col>
)} )}
{data && data.userName && ( {data && data.userName && (
<Col <Col
style={{ style={{
marginBottom: 12, marginBottom: 12,
}} }}
span={8} span={8}
> >
<span className={styles.hea_title}>用户姓名</span> <span className={styles.hea_title}>用户姓名</span>
<span className={styles.hew_content}>{data.userName}</span> <span className={styles.hew_content}>{data.userName}</span>
</Col> </Col>
)} )}
{data && data.userPosition && ( {data && data.userPosition && (
<Col <Col
style={{ style={{
marginBottom: 12, marginBottom: 12,
}} }}
span={8} span={8}
> >
<span className={styles.hea_title}>职位</span> <span className={styles.hea_title}>职位</span>
<span className={styles.hew_content}>{data.userPosition}</span> <span className={styles.hew_content}>{data.userPosition}</span>
</Col> </Col>
)} )}
{data && data.userSchool && ( {data && data.userSchool && (
<Col <Col
span={8} span={8}
style={{ style={{
marginBottom: 12, marginBottom: 12,
}} }}
> >
<span className={styles.hea_title}>学院/单位</span> <span className={styles.hea_title}>学院/单位</span>
<span className={styles.hew_content}>{data.userSchool}</span> <span className={styles.hew_content}>{data.userSchool}</span>
</Col> </Col>
)} )}
{data && data.userPhone && ( {data && data.userPhone && (
<Col <Col
span={8} span={8}
style={{ style={{
marginBottom: 12, marginBottom: 12,
}} }}
> >
<span className={styles.hea_title}>联系电话</span> <span className={styles.hea_title}>联系电话</span>
<span className={styles.hew_content}>{data.userPhone}</span> <span className={styles.hew_content}>{data.userPhone}</span>
</Col> </Col>
)} )}
{data && data.createTime && ( {data && data.createTime && (
<Col <Col
style={{ style={{
marginBottom: 12, marginBottom: 12,
}} }}
span={8} span={8}
> >
<span className={styles.hea_title}>申请时间</span> <span className={styles.hea_title}>申请时间</span>
<span className={styles.hew_content}> <span className={styles.hew_content}>
{moment(data.createTime) {moment(data.createTime)
.format('YYYY-MM-DD HH:mm')} .format('YYYY-MM-DD HH:mm')}
</span> </span>
</Col> </Col>
)} )}
</Row> </Row>
)}
</div>
)}
<div
className={styles.HistoryFormList}
id='card_table'
ref={el => (this.componentRef = el)}
style={{ padding: !isShowTitle ? '50px' : '' }}
>
<HistoryFormList data={data}
formKeys={hisTaskFormKeys?.formKeys}
isShowTitle={isShowTitle}
routerState={routerState}
formData={hisTaskFormKeys?.formData}
/>
{isHandle === true && !!data.taskFormKey && (
<>
{isShowTitle ? (
<h3
style={{
display: 'flex',
alignItems: 'center',
}}
>
<SVG name='vertical' color='#999999' height='24' />
当前流程
</h3>
) : (
''
)}
{isEmpty(data) === false ? (
<ZdyTable
key={data.taskFormKey}
postData={data}
get='web'
obj={hisTaskFormKeys.formData}
table='new'
form={this.props.form}
routerState={routerState}
/>
) : (
''
)} )}
</> </div>
)} )}
</div>
</Card>
<Card style={{ width: '100%' }}>
<div className={styles.body_content} style={{ minHeight: '300px' }}>
<div id={'btnsModalMountDiv'}></div>
<h3>
审批状态 <span onClick={this.examineFlow}>查看流程图</span>
</h3>
<div <div
ref={el => (this.componentTwoRef = el)} className={styles.HistoryFormList}
style={{ id='card_table'
padding: !isShowTitle ? '0 50px 50px 50px' : '', ref={el => (this.componentRef = el)}
}} style={{ padding: !isShowTitle ? '50px' : '' }}
> >
<Timeline> <HistoryFormList data={data}
{stepFlow !== '' && steps !== '' formKeys={hisTaskFormKeys?.formKeys}
? stepFlow.map((item, index) => { isShowTitle={isShowTitle}
if (index === stepFlow.length - 1) { routerState={routerState}
// 最后一步流程 formData={hisTaskFormKeys?.formData}
/>
{isHandle === true && !!data.taskFormKey && (
<>
{isShowTitle ? (
<h3
style={{
display: 'flex',
alignItems: 'center',
}}
>
<SVG name='vertical' color='#999999' height='24' />
当前流程
</h3>
) : (
''
)}
{isEmpty(data) === false ? (
<GetZdyTable
key={data.taskFormKey}
postData={data}
get='web'
obj={hisTaskFormKeys.formData}
table='new'
form={this.props.form}
routerState={routerState}
/>
) : (
''
)}
</>
)}
</div>
</Card>
<Card style={{ width: '100%' }}>
<div className={styles.body_content} style={{ minHeight: '300px' }}>
<div id={'btnsModalMountDiv'}></div>
<h3>
审批状态 <span onClick={this.examineFlow}>查看流程图</span>
</h3>
<div
ref={el => (this.componentTwoRef = el)}
style={{
padding: !isShowTitle ? '0 50px 50px 50px' : '',
}}
>
<Timeline>
{stepFlow !== '' && steps !== ''
? stepFlow.map((item, index) => {
if (index === stepFlow.length - 1) {
// 最后一步流程
return (
<Timeline.Item
color={['处理中', '待处理'].includes(item.status) ? 'red' : '#ccc'}
dot={
<Icon
type={
['处理中', '待处理'].includes(item.status) ? 'clock-circle-o' : 'check-circle'
}
style={{ fontSize: '16px' }}
/>
}
className={styles.steps_step}
key={item.id}
>
<p className={styles.steps_title}>
{item.assignee}
<span>
{item.endTime
? moment(item.endTime)
.format('YYYY-MM-DD HH:mm')
: '处理中'}
</span>
</p>
{
queryApiVersion() === '2.0' && ['处理中', '待处理'].includes(item.status) && !!data.nextUsers && (
<p>审批人员: {data.nextUsers}</p>
)
}
{queryApiVersion() !== '2.0' && ['处理中', '待处理'].includes(item.status) && !!item.nextUsers && (
<p>审批人员: {item.nextUsers}</p>
)}
<p>审批流程:{item.name}</p>
<p className={styles.steps_body}>审批状态:{item.status}</p>
{item.taskVariable?.reason ? (
<p>审批原因:{item.taskVariable?.reason}</p>
) : (
''
)}
{item.childTaskModel && item.childTaskModel.length > 0 && (
<ChildTaskModel data={item.childTaskModel} />
)}
{(isSign || item.taskVariable?.sign) && !closeAutoSign ? (
<img
style={{
position: 'absolute',
top: '50%',
left: 200,
height: 50,
marginTop: -25,
border: item.taskVariable?.sign ? '1px solid #ccc' : '',
}}
src={
item.taskVariable?.sign
? queryApiActionPath() + item.taskVariable?.sign
: ''
}
alt=''
/>
) : (
''
)}
{isTrunTo && +item.commentCount > 0 ? (
<TrunToDetail data={data} item={item} />
) : null}
</Timeline.Item>
);
}
return ( return (
<Timeline.Item <Timeline.Item
color={['处理中', '待处理'].includes(item.status) ? 'red' : '#ccc'} color={item.status === 0 ? 'gray' : 'green'}
dot={ dot={
<Icon item.status === 0 ? (
type={ ''
['处理中', '待处理'].includes(item.status) ? 'clock-circle-o' : 'check-circle' ) : (
} <Icon
style={{ fontSize: '16px' }} type='check-circle'
/> theme='twoTone'
twoToneColor='#52c41a'
/>
)
} }
className={styles.steps_step} className={styles.steps_step}
key={item.id} key={item.id}
...@@ -737,32 +814,23 @@ class DetailSplit extends Component { ...@@ -737,32 +814,23 @@ class DetailSplit extends Component {
<p className={styles.steps_title}> <p className={styles.steps_title}>
{item.assignee} {item.assignee}
<span> <span>
{item.endTime {item.endTime
? moment(item.endTime) ? moment(item.endTime)
.format('YYYY-MM-DD HH:mm') .format('YYYY-MM-DD HH:mm')
: '处理中'} : null}
</span> </span>
</p> </p>
{
queryApiVersion() === '2.0' && ['处理中', '待处理'].includes(item.status) && !!data.nextUsers && (
<p>审批人员: {data.nextUsers}</p>
)
}
{queryApiVersion() !== '2.0' && ['处理中', '待处理'].includes(item.status) && !!item.nextUsers && (
<p>审批人员: {item.nextUsers}</p>
)}
<p>审批流程:{item.name}</p> <p>审批流程:{item.name}</p>
<p className={styles.steps_body}>审批状态:{item.status}</p> <p className={styles.steps_body}>审批状态:{item.status}</p>
{item.taskVariable?.reason ? ( {item.taskVariable?.reason ? (
<p>审批原因:{item.taskVariable?.reason}</p> <p>审批原因:{item.taskVariable.reason}</p>
) : ( ) : (
'' ''
)} )}
{item.childTaskModel && item.childTaskModel.length > 0 && ( {item.childTaskModel && item.childTaskModel.length > 0 && (
<ChildTaskModel data={item.childTaskModel} /> <ChildTaskModel data={item.childTaskModel} />
)} )}
{item.taskVariable?.sign ? (
{(isSign || item.taskVariable?.sign) && !closeAutoSign ? (
<img <img
style={{ style={{
position: 'absolute', position: 'absolute',
...@@ -787,171 +855,109 @@ class DetailSplit extends Component { ...@@ -787,171 +855,109 @@ class DetailSplit extends Component {
) : null} ) : null}
</Timeline.Item> </Timeline.Item>
); );
} })
return ( : ''}
<Timeline.Item </Timeline>
color={item.status === 0 ? 'gray' : 'green'} </div>
dot={
item.status === 0 ? (
''
) : (
<Icon
type='check-circle'
theme='twoTone'
twoToneColor='#52c41a'
/>
)
}
className={styles.steps_step}
key={item.id}
>
<p className={styles.steps_title}>
{item.assignee}
<span>
{item.endTime
? moment(item.endTime)
.format('YYYY-MM-DD HH:mm')
: null}
</span>
</p>
<p>审批流程:{item.name}</p>
<p className={styles.steps_body}>审批状态:{item.status}</p>
{item.taskVariable?.reason ? (
<p>审批原因:{item.taskVariable.reason}</p>
) : (
''
)}
{item.childTaskModel && item.childTaskModel.length > 0 && (
<ChildTaskModel data={item.childTaskModel} />
)}
{item.taskVariable?.sign ? (
<img
style={{
position: 'absolute',
top: '50%',
left: 200,
height: 50,
marginTop: -25,
border: item.taskVariable?.sign ? '1px solid #ccc' : '',
}}
src={
item.taskVariable?.sign
? queryApiActionPath() + item.taskVariable?.sign
: ''
}
alt=''
/>
) : (
''
)}
{isTrunTo && +item.commentCount > 0 ? (
<TrunToDetail data={data} item={item} />
) : null}
</Timeline.Item>
);
})
: ''}
</Timeline>
</div> </div>
</div> </Card>
</Card> <div className={styles.buttonList}>
<div className={styles.buttonList}> {isHandle === true ? (
{isHandle === true ? ( <>
<> <BtnOk // 审批按钮和弹窗
<BtnOk // 审批按钮和弹窗 Sign={!!setData?.userSign}
Sign={!!setData?.userSign} isSumbitLoading={isSumbitLoading}
isSumbitLoading={isSumbitLoading} isSecond={isSecond}
isSecond={isSecond} affairOk={this.affairOk}
affairOk={this.affairOk} form={this.props.form}
form={this.props.form} btns={btns}
btns={btns} addition={
addition={ <>
<> {isTrunTo && data.isSecond !== true && isHandle ? (
{isTrunTo && data.isSecond !== true && isHandle ? ( <Button
<Button style={{
style={{ marginLeft: 16,
marginLeft: 16, minHeight: 32,
minHeight: 32, minWidth: 90,
minWidth: 90, }}
}} onClick={() => {
onClick={() => { this.showTrunToModel(
this.showTrunToModel( data.isHandle && data.isOwner
data.isHandle && data.isOwner ? '转办'
? '转办' : !data.isHandle && data.isOwner
: !data.isHandle && data.isOwner ? '撤回'
? '撤回' : '回退',
: '回退', data,
data, );
); }}
}} type='primary'
type='primary' >
> {data.isHandle && data.isOwner
{data.isHandle && data.isOwner ? '转办'
? '转办' : !data.isHandle && data.isOwner
: !data.isHandle && data.isOwner ? '撤回'
? '撤回' : data.isHandle && !data.isOwner
: data.isHandle && !data.isOwner ? '回退'
? '回退' : null}
: null} </Button>
</Button> ) : null}
) : null} {data.isCanSign && (
{data.isCanSign && ( <Button
<Button style={{
style={{ marginLeft: 16,
marginLeft: 16, minHeight: 32,
minHeight: 32, minWidth: 90,
minWidth: 90, }}
}} onClick={this.onClickCountersign}
onClick={this.onClickCountersign} type='primary'
type='primary' >
> 加签
加签 </Button>
</Button> )}
)} </>
</> }
} />
/> </>
</> ) : (
) : ( ''
'' )}
)} {isTrunTo && data.isSecond !== true && !data.isHandle && data.isOwner && (
{isTrunTo && data.isSecond !== true && !data.isHandle && data.isOwner && ( <div
<div
style={{
width: '100%',
textAlign: 'center',
}}
>
<Button
style={{ style={{
minHeight: 32, width: '100%',
minWidth: 90, textAlign: 'center',
margin: '0 auto',
}}
onClick={() => {
this.showTrunToModel('撤回', data);
}} }}
type='primary'
> >
撤回 <Button
</Button> style={{
</div> minHeight: 32,
)} minWidth: 90,
margin: '0 auto',
}}
onClick={() => {
this.showTrunToModel('撤回', data);
}}
type='primary'
>
撤回
</Button>
</div>
)}
</div>
</>
) : (
<div
style={{
width: '100%',
height: 200,
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
}}
>
<Spin size='large' spinning={true} />
</div> </div>
</> )}
) : (
<div
style={{
width: '100%',
height: 200,
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
}}
>
<Spin size='large' spinning={true} />
</div>
)}
<PortalFlowExamineModal // 流程图 <PortalFlowExamineModal // 流程图
ref={node => (this.flowExamineModal = node)} ref={node => (this.flowExamineModal = node)}
affairId={id} affairId={id}
...@@ -978,10 +984,13 @@ class DetailSplit extends Component { ...@@ -978,10 +984,13 @@ class DetailSplit extends Component {
} }
} }
export default function Index(props){ export default function Index(props) {
console.log(window.zdyTableTemplateWillMountProps?.formCreateOptions); return <DetailSplit {...props} />;
const DetailSplitFormNew = Form.create( }
function GetZdyTable(props) {
const ZdyTableFormNew = Form.create(
window.zdyTableTemplateWillMountProps?.formCreateOptions || undefined, window.zdyTableTemplateWillMountProps?.formCreateOptions || undefined,
)(DetailSplit); )(ZdyTable);
return <DetailSplitFormNew {...props}/>; return <ZdyTableFormNew {...props}/>
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论