|
@@ -2,7 +2,7 @@ import React, { useEffect, useState, useRef } from 'react';
|
|
import { Form } from '@ant-design/compatible';
|
|
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 { connect } from 'dva';
|
|
-import { Steps, Button, Modal } from 'antd';
|
|
|
|
|
|
+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';
|
|
|
|
|
|
@@ -25,129 +25,40 @@ function TimeNode(props) {
|
|
} = props;
|
|
} = props;
|
|
const { current, list, active } = flow;
|
|
const { current, list, active } = flow;
|
|
|
|
|
|
- const onApprove = flag => {
|
|
|
|
- if (!flag) {
|
|
|
|
- setAuditVisible(true);
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- let isSingle = false;
|
|
|
|
- let serviceNode;
|
|
|
|
- const flowNode = flow.currentNode;
|
|
|
|
- const getLastTemplateNodeId = data => {
|
|
|
|
- let result;
|
|
|
|
- const getFun = item => {
|
|
|
|
- if (item.flow_path?.length > 0) {
|
|
|
|
- getFun(item.flow_path[0]);
|
|
|
|
- } else {
|
|
|
|
- result = item.template_node_id;
|
|
|
|
- }
|
|
|
|
- };
|
|
|
|
- if (!data) return version.template_node_id;
|
|
|
|
- getFun(data[0]);
|
|
|
|
- return result;
|
|
|
|
- };
|
|
|
|
- let lastTemplateNodeId = version.template_node_id;
|
|
|
|
- if (version.flow_path) {
|
|
|
|
- //如果多节点审批 获取当前是否审批流程的最后一个审批节点
|
|
|
|
- let flowPathList = JSON.parse(version.flow_path);
|
|
|
|
- lastTemplateNodeId = getLastTemplateNodeId(flowPathList);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 判断是否为最后一个审批节点
|
|
|
|
- if (
|
|
|
|
- lastTemplateNodeId == version.template_node_id &&
|
|
|
|
- flow.current == flow.list.FlowNodes.length - 1
|
|
|
|
- ) {
|
|
|
|
- serviceNode = flowDetail.nodes.find?.(item => item.Id == version.next_template_node_id);
|
|
|
|
- if (!serviceNode.muti_version) {
|
|
|
|
- //audit_status=4 表示为清单推进后留存的副本.不计入多清单计算
|
|
|
|
- isSingle = versionList.find(
|
|
|
|
- item => item.audit_status != 4 && item.template_node_id == serviceNode.Id
|
|
|
|
- );
|
|
|
|
- }
|
|
|
|
|
|
+ const getDescription = node => {
|
|
|
|
+ let str = node?.AuditRoleInfo
|
|
|
|
+ ? `审批人:${node?.AuditRoleInfo.Name || '-'}`
|
|
|
|
+ : `审批人:${node?.AuditorUser.CName || '-'}`;
|
|
|
|
+ if (node.desc) {
|
|
|
|
+ return (
|
|
|
|
+ <div>
|
|
|
|
+ {str}
|
|
|
|
+ <div>
|
|
|
|
+ <Tooltip title={node.desc}>
|
|
|
|
+ <span style={{ color: '#1A73E8', textDecoration: 'undeline' }}>审批意见</span>
|
|
|
|
+ </Tooltip>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ );
|
|
}
|
|
}
|
|
- Modal.confirm({
|
|
|
|
- title: '提示',
|
|
|
|
- content: isSingle
|
|
|
|
- ? `节点【${serviceNode.label}】只能拥有一个清单,是否覆盖?`
|
|
|
|
- : `是否通过审批。`,
|
|
|
|
- okText: '确定',
|
|
|
|
- cancelText: '取消',
|
|
|
|
- onOk: () => {
|
|
|
|
- dispatch({
|
|
|
|
- type: 'detail/approve',
|
|
|
|
- payload: {
|
|
|
|
- id: flow.active_id,
|
|
|
|
- project_id: projectId,
|
|
|
|
- audit_status: 3,
|
|
|
|
- flow_id: flowNode.flow_id,
|
|
|
|
- node_id: flowNode.seq,
|
|
|
|
- },
|
|
|
|
- callback: newVersion => {
|
|
|
|
- // 更新flow流程图
|
|
|
|
- dispatch({
|
|
|
|
- type: 'xflow/queryBoomFlowDetail',
|
|
|
|
- payload: {
|
|
|
|
- id: templateId,
|
|
|
|
- },
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- // 更新审批流
|
|
|
|
- dispatch({
|
|
|
|
- type: 'detail/queryAuditList',
|
|
|
|
- payload: {
|
|
|
|
- template_id: version.template_id,
|
|
|
|
- template_node_id: version.template_node_id,
|
|
|
|
- flow_id: version.flow_id,
|
|
|
|
- version_id: version.version_id,
|
|
|
|
- audit_series: version.audit_series,
|
|
|
|
- },
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- //更新未审核列表
|
|
|
|
- dispatch({
|
|
|
|
- type: 'authList/queryAuthList',
|
|
|
|
- payload: { user_id: currentUser.ID },
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- if (flow.current == flow.list.FlowNodes.length - 1) {
|
|
|
|
- // 最后一个审核节点通过后 需要更新version id 不更不更,留在原地
|
|
|
|
- // localStorage.excelId = newVersion.id;
|
|
|
|
- // setVersion({
|
|
|
|
- // ...version,
|
|
|
|
- // flow_id: newVersion.flow_id,
|
|
|
|
- // id: newVersion.id,
|
|
|
|
- // });
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
- });
|
|
|
|
|
|
+ return str;
|
|
};
|
|
};
|
|
|
|
+
|
|
if (!list || list.FlowNodes?.length != 0) {
|
|
if (!list || list.FlowNodes?.length != 0) {
|
|
return (
|
|
return (
|
|
<div className={styles.top}>
|
|
<div className={styles.top}>
|
|
<Steps current={current} status={active == 0 ? 'error' : 'process'}>
|
|
<Steps current={current} status={active == 0 ? 'error' : 'process'}>
|
|
{list.FlowNodes.map(item => (
|
|
{list.FlowNodes.map(item => (
|
|
- <Step
|
|
|
|
- key={item.id}
|
|
|
|
- title={item.node}
|
|
|
|
- description={
|
|
|
|
- item?.AuditRoleInfo
|
|
|
|
- ? `审批人:${item?.AuditRoleInfo.Name || '-'}`
|
|
|
|
- : `审批人:${item?.AuditorUser.CName || '-'}`
|
|
|
|
- }
|
|
|
|
- />
|
|
|
|
|
|
+ <Step key={item.id} title={item.node} description={getDescription(item)} />
|
|
))}
|
|
))}
|
|
</Steps>
|
|
</Steps>
|
|
<div className={styles.btns} style={{ marginLeft: 80 }}>
|
|
<div className={styles.btns} style={{ marginLeft: 80 }}>
|
|
{isAuditor && active != 0 && (
|
|
{isAuditor && active != 0 && (
|
|
<>
|
|
<>
|
|
- <Button type="primary" onClick={() => onApprove(true)}>
|
|
|
|
|
|
+ <Button type="primary" onClick={() => setAuditVisible(1)}>
|
|
审批通过
|
|
审批通过
|
|
</Button>
|
|
</Button>
|
|
- <Button onClick={() => onApprove(false)} danger>
|
|
|
|
|
|
+ <Button onClick={() => setAuditVisible(2)} danger>
|
|
审批拒绝
|
|
审批拒绝
|
|
</Button>
|
|
</Button>
|
|
</>
|
|
</>
|