|
@@ -1,12 +1,12 @@
|
|
-import React, {useEffect, useState, useRef} from 'react';
|
|
|
|
-import {Form} from '@ant-design/compatible';
|
|
|
|
|
|
+import React, { useEffect, useState, useRef, useMemo } from 'react';
|
|
|
|
+import { Form } from '@ant-design/compatible';
|
|
import '@ant-design/compatible/assets/index.css';
|
|
import '@ant-design/compatible/assets/index.css';
|
|
-import {connect} from 'dva';
|
|
|
|
-import {Steps, Button, Modal, Tooltip} from 'antd';
|
|
|
|
|
|
+import { connect } from 'dva';
|
|
|
|
+import { Steps, Button, Modal, Tooltip } from 'antd';
|
|
import styles from './Index.less';
|
|
import styles from './Index.less';
|
|
-import {getCurrentUser} from '@/utils/authority';
|
|
|
|
|
|
+import { getCurrentUser } from '@/utils/authority';
|
|
|
|
|
|
-const {Step} = Steps;
|
|
|
|
|
|
+const { Step } = Steps;
|
|
|
|
|
|
// 时间节点
|
|
// 时间节点
|
|
function TimeNode(props) {
|
|
function TimeNode(props) {
|
|
@@ -24,9 +24,15 @@ function TimeNode(props) {
|
|
stepDirection,
|
|
stepDirection,
|
|
currentUser,
|
|
currentUser,
|
|
} = props;
|
|
} = props;
|
|
- const {current, list, active} = flow;
|
|
|
|
- console.log(list.FlowNodes)
|
|
|
|
|
|
+ const { current, list, active } = flow;
|
|
|
|
+ const nodeId = version.template_node_id;
|
|
|
|
|
|
|
|
+ const showBackBtn = useMemo(() => {
|
|
|
|
+ if (!nodeId || flowDetail.nodes.length == 0) return false;
|
|
|
|
+ const node = flowDetail.nodes.find(item => item.Id == nodeId);
|
|
|
|
+ if (node.label == '三级审批1') return true;
|
|
|
|
+ return false;
|
|
|
|
+ }, [nodeId, flowDetail]);
|
|
|
|
|
|
function calculateHoursDifference(date1, date2) {
|
|
function calculateHoursDifference(date1, date2) {
|
|
const timestamp1 = date1.getTime(); // 获取第一个Date对象的时间戳(以毫秒为单位)
|
|
const timestamp1 = date1.getTime(); // 获取第一个Date对象的时间戳(以毫秒为单位)
|
|
@@ -42,23 +48,24 @@ function TimeNode(props) {
|
|
let str = node?.AuditRoleInfo
|
|
let str = node?.AuditRoleInfo
|
|
? `审批人:${node?.AuditRoleInfo.Name || '-'}`
|
|
? `审批人:${node?.AuditRoleInfo.Name || '-'}`
|
|
: `审批人:${node?.AuditorUser.CName || '-'}`;
|
|
: `审批人:${node?.AuditorUser.CName || '-'}`;
|
|
- const date = new Date(node.audit_time)
|
|
|
|
- const auditTime = node.audit_time === '0001-01-01T00:00:00Z' ? '-' : date.toLocaleDateString('zh-CN', {
|
|
|
|
- format: 'YYYY-MM-DD hh:mm:ss'
|
|
|
|
- })
|
|
|
|
|
|
+ const date = new Date(node.audit_time);
|
|
|
|
+ const auditTime =
|
|
|
|
+ node.audit_time === '0001-01-01T00:00:00Z'
|
|
|
|
+ ? '-'
|
|
|
|
+ : date.toLocaleDateString('zh-CN', {
|
|
|
|
+ format: 'YYYY-MM-DD hh:mm:ss',
|
|
|
|
+ });
|
|
// const residenceTime = auditTime === '-' ? '-' : calculateHoursDifference(date, new Date(prevNode.audit_time))
|
|
// const residenceTime = auditTime === '-' ? '-' : calculateHoursDifference(date, new Date(prevNode.audit_time))
|
|
return (
|
|
return (
|
|
<div>
|
|
<div>
|
|
{str}
|
|
{str}
|
|
<div>
|
|
<div>
|
|
- <span style={{color: '#1A73E8', textDecoration: 'undeline'}}>
|
|
|
|
|
|
+ <span style={{ color: '#1A73E8', textDecoration: 'undeline' }}>
|
|
审批意见:{node.desc || '-'}
|
|
审批意见:{node.desc || '-'}
|
|
</span>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div>
|
|
- <span>
|
|
|
|
- 审批时间:{auditTime}
|
|
|
|
- </span>
|
|
|
|
|
|
+ <span>审批时间:{auditTime}</span>
|
|
</div>
|
|
</div>
|
|
{/* <div> */}
|
|
{/* <div> */}
|
|
{/* <span> */}
|
|
{/* <span> */}
|
|
@@ -79,17 +86,18 @@ function TimeNode(props) {
|
|
current={current}
|
|
current={current}
|
|
status={active == 0 ? 'error' : 'process'}
|
|
status={active == 0 ? 'error' : 'process'}
|
|
>
|
|
>
|
|
- {list.FlowNodes.map(( item) => {
|
|
|
|
- return <Step key={item.id} title={item.node} description={getDescription(item)} />
|
|
|
|
|
|
+ {list.FlowNodes.map(item => {
|
|
|
|
+ return <Step key={item.id} title={item.node} description={getDescription(item)} />;
|
|
})}
|
|
})}
|
|
</Steps>
|
|
</Steps>
|
|
{isAuditor && active != 0 && (
|
|
{isAuditor && active != 0 && (
|
|
- <div className={styles.btns} style={{margin: '40px 0'}}>
|
|
|
|
|
|
+ <div className={styles.btns} style={{ margin: '40px 0' }}>
|
|
<Button type="primary" onClick={() => setAuditVisible(1)}>
|
|
<Button type="primary" onClick={() => setAuditVisible(1)}>
|
|
- 审批通过
|
|
|
|
|
|
+ 通过
|
|
</Button>
|
|
</Button>
|
|
|
|
+ <Button onClick={() => setAuditVisible(3)}>回退</Button>
|
|
<Button onClick={() => setAuditVisible(2)} danger>
|
|
<Button onClick={() => setAuditVisible(2)} danger>
|
|
- 审批拒绝
|
|
|
|
|
|
+ 拒绝
|
|
</Button>
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
)}
|
|
)}
|
|
@@ -104,7 +112,7 @@ function TimeNode(props) {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
-export default connect(({user, detail}) => ({
|
|
|
|
|
|
+export default connect(({ user, detail }) => ({
|
|
currentUser: user.currentUser,
|
|
currentUser: user.currentUser,
|
|
versionList: detail.versionList,
|
|
versionList: detail.versionList,
|
|
}))(TimeNode);
|
|
}))(TimeNode);
|