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

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

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