|
@@ -1,5 +1,5 @@
|
|
|
import React, { useMemo, useEffect, useState, useRef } from 'react';
|
|
|
-import { Steps, Popover, Alert, Button } from 'antd';
|
|
|
+import { Steps, Popover, Alert, Button, Spin } from 'antd';
|
|
|
import styles from './Index.less';
|
|
|
import { queryDDProcessesForecast } from '@/services/boom';
|
|
|
import { connect } from 'dva';
|
|
@@ -21,7 +21,7 @@ function AuditFlow(props) {
|
|
|
onApprove,
|
|
|
} = props;
|
|
|
const [flow, setFlow] = useState({ workflowActivityRules: [] });
|
|
|
- // const [showAduit, setShowAduit] = useState(false);
|
|
|
+ const [loading, setLoading] = useState(false);
|
|
|
const timerRef = useRef({
|
|
|
id: '',
|
|
|
status: false,
|
|
@@ -34,12 +34,15 @@ function AuditFlow(props) {
|
|
|
let current = 0;
|
|
|
const activityId = tasks[tasks.length - 1].activity_id;
|
|
|
flow.workflowActivityRules.forEach((item, index) => {
|
|
|
- if (tasks.find(task => task.activity_id == item.activityId)) {
|
|
|
- current = index;
|
|
|
- }
|
|
|
- // 判断是否只剩抄送节点未被选中
|
|
|
- if (item.activityName == '抄送人' && current == index - 1) {
|
|
|
- current = index;
|
|
|
+ let task = tasks.find(task => task.activity_id == item.activityId);
|
|
|
+ if (task) {
|
|
|
+ if (task.task_status == 'COMPLETED') {
|
|
|
+ // 完成时节点为下一级
|
|
|
+ current = index + 1;
|
|
|
+ } else {
|
|
|
+ // 未完成则为当前节点
|
|
|
+ current = index;
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
return current;
|
|
@@ -61,7 +64,7 @@ function AuditFlow(props) {
|
|
|
|
|
|
const getDesc = item => {
|
|
|
const { activityId } = item;
|
|
|
- if (!tasks || tasks.length == 0) return;
|
|
|
+ if (!tasks || tasks.length == 0) return '';
|
|
|
if (item.activityName == '抄送人') {
|
|
|
let names = cc_userids
|
|
|
.map(userId => {
|
|
@@ -79,7 +82,7 @@ function AuditFlow(props) {
|
|
|
result = (
|
|
|
<>
|
|
|
<br />
|
|
|
- 结果: {TASK_RESULT[task.task_result]}
|
|
|
+ 审批结果: {TASK_RESULT[task.task_result]}
|
|
|
<br />
|
|
|
</>
|
|
|
);
|
|
@@ -136,12 +139,13 @@ function AuditFlow(props) {
|
|
|
|
|
|
const getDetail = async () => {
|
|
|
if (!deptId || !userId) {
|
|
|
- console.error('depId或userId不存在!');
|
|
|
+ console.log('depId或userId不存在!');
|
|
|
return;
|
|
|
}
|
|
|
if (!timerRef.current.status) {
|
|
|
// 上锁
|
|
|
timerRef.current.status = true;
|
|
|
+ setLoading(true);
|
|
|
try {
|
|
|
let flow = await queryDDProcessesForecast({
|
|
|
processCode,
|
|
@@ -152,6 +156,7 @@ function AuditFlow(props) {
|
|
|
setFlow(flow);
|
|
|
console.log(flow);
|
|
|
} catch (error) {}
|
|
|
+ setLoading(false);
|
|
|
setTimeout(() => {
|
|
|
// 延时解锁
|
|
|
timerRef.current.status = false;
|
|
@@ -171,7 +176,7 @@ function AuditFlow(props) {
|
|
|
}, [processCode, formComponentValues]);
|
|
|
|
|
|
return (
|
|
|
- <>
|
|
|
+ <Spin spinning={loading}>
|
|
|
<div className={styles.top}>
|
|
|
<Steps current={current} progressDot={customDot} direction={direction}>
|
|
|
{flow.workflowActivityRules.map(item => (
|
|
@@ -193,7 +198,7 @@ function AuditFlow(props) {
|
|
|
</div>
|
|
|
</div>
|
|
|
{status !== undefined && renderAlert()}
|
|
|
- </>
|
|
|
+ </Spin>
|
|
|
);
|
|
|
}
|
|
|
|