|
@@ -1,8 +1,20 @@
|
|
|
import React, { CSSProperties, useEffect, useMemo, useState } from 'react';
|
|
|
import { queryUserListByRoleID, queryLeader } from '@/services/boom';
|
|
|
import { connect } from 'umi';
|
|
|
-import { CheckOutlined, PlusOutlined } from '@ant-design/icons';
|
|
|
-import { Popover, Radio, RadioChangeEvent, Spin, Steps } from 'antd';
|
|
|
+import {
|
|
|
+ CheckOutlined,
|
|
|
+ PlusOutlined,
|
|
|
+ PlusSquareOutlined,
|
|
|
+} from '@ant-design/icons';
|
|
|
+import {
|
|
|
+ Popover,
|
|
|
+ Radio,
|
|
|
+ RadioChangeEvent,
|
|
|
+ Space,
|
|
|
+ Spin,
|
|
|
+ Steps,
|
|
|
+ Timeline,
|
|
|
+} from 'antd';
|
|
|
import { useModel, useRequest } from '@umijs/max';
|
|
|
|
|
|
const { Step } = Steps;
|
|
@@ -19,6 +31,7 @@ interface AuditNode {
|
|
|
type: (typeof TYPE)[keyof typeof TYPE];
|
|
|
value: number[];
|
|
|
checkValue: [];
|
|
|
+ label: string;
|
|
|
}
|
|
|
|
|
|
const ApprovalProcess = (props: any) => {
|
|
@@ -45,6 +58,7 @@ const ApprovalProcess = (props: any) => {
|
|
|
type: item[0].type,
|
|
|
checkValue: [],
|
|
|
seq: index,
|
|
|
+ label: item[0].label,
|
|
|
value: item.map((node: any) => node.value),
|
|
|
};
|
|
|
|
|
@@ -76,10 +90,10 @@ const ApprovalProcess = (props: any) => {
|
|
|
fontSize: 16,
|
|
|
};
|
|
|
|
|
|
- return (
|
|
|
- <div>
|
|
|
- <div style={rowStyle}>
|
|
|
- {auditList.map((item: AuditNode, index: number) => (
|
|
|
+ const renderAudits = (list: AuditNode[]) => {
|
|
|
+ return list.map((item: AuditNode, index: number) => {
|
|
|
+ return {
|
|
|
+ children: (
|
|
|
<AuditNodeStep
|
|
|
key={`${item.type}-${item.value.join('.')}-${index}`}
|
|
|
leaderData={leaderData}
|
|
@@ -89,24 +103,16 @@ const ApprovalProcess = (props: any) => {
|
|
|
value={checkValue[item.seq]}
|
|
|
onChange={(value: number) => onCheckValue(value, item.seq)}
|
|
|
/>
|
|
|
- ))}
|
|
|
- </div>
|
|
|
- {ccList.length > 0 && (
|
|
|
- <div style={rowStyle}>
|
|
|
- <h3 style={{ margin: "20px 0", fontWeight: 'bold' }}>抄送人</h3>
|
|
|
- {ccList.map((item: AuditNode, index: number) => (
|
|
|
- <AuditNodeStep
|
|
|
- key={`${item.type}-${item.value.join('.')}-${index}`}
|
|
|
- leaderData={leaderData}
|
|
|
- item={item}
|
|
|
- roleList={roleList}
|
|
|
- userList={userList}
|
|
|
- value={checkValue[item.seq]}
|
|
|
- onChange={(value: number) => onCheckValue(value, item.seq)}
|
|
|
- />
|
|
|
- ))}
|
|
|
- </div>
|
|
|
- )}
|
|
|
+ ),
|
|
|
+ };
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ return (
|
|
|
+ <div>
|
|
|
+ <Timeline items={renderAudits(auditList)}></Timeline>
|
|
|
+
|
|
|
+ {ccList.length > 0 && <Timeline items={renderAudits(ccList)}></Timeline>}
|
|
|
</div>
|
|
|
);
|
|
|
};
|
|
@@ -184,18 +190,29 @@ const AuditNodeStep = (props: AuditNodeStepProps) => {
|
|
|
);
|
|
|
}
|
|
|
if (item.type == TYPE.ROLE) {
|
|
|
- let title = '';
|
|
|
+ let label = item.label || '';
|
|
|
+ let userName = '';
|
|
|
+ const names = item.value.map((id) => {
|
|
|
+ const role = roleList.find((cur: any) => cur.ID == id);
|
|
|
+ return role?.Name;
|
|
|
+ });
|
|
|
+ let title = `从${names.join('、')}选择`;
|
|
|
if (value) {
|
|
|
- title = userList.find((cur: any) => cur.ID == value)?.CName;
|
|
|
- } else {
|
|
|
- const names = item.value.map((id) => {
|
|
|
- const role = roleList.find((cur: any) => cur.ID == id);
|
|
|
- return role?.Name;
|
|
|
- });
|
|
|
- title = `从${names.join('、')}选择`;
|
|
|
+ userName = userList.find((cur: any) => cur.ID == value)?.CName;
|
|
|
}
|
|
|
return (
|
|
|
- <div style={{ marginBottom: 20, cursor: 'pointer' }}>
|
|
|
+ <div
|
|
|
+ style={{
|
|
|
+ marginBottom: 20,
|
|
|
+ cursor: 'pointer',
|
|
|
+ display: 'flex',
|
|
|
+ justifyContent: 'space-between',
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <div>
|
|
|
+ <div style={{ fontSize: '18px' }}>{label}</div>
|
|
|
+ <div style={{ fontSize: '14px', color: 'gray' }}>{title}</div>
|
|
|
+ </div>
|
|
|
<Popover
|
|
|
placement="bottomLeft"
|
|
|
title={'选择审批人'}
|
|
@@ -205,19 +222,36 @@ const AuditNodeStep = (props: AuditNodeStepProps) => {
|
|
|
onOpenChange={handleOpen}
|
|
|
style={{ marginBottom: 20 }}
|
|
|
>
|
|
|
- <PlusOutlined style={{ marginRight: 20 }} /> {title}
|
|
|
+ <Space>
|
|
|
+ {userName}
|
|
|
+ <PlusSquareOutlined style={{ fontSize: '36px', color: 'gray' }} />
|
|
|
+ </Space>
|
|
|
</Popover>
|
|
|
</div>
|
|
|
);
|
|
|
}
|
|
|
+
|
|
|
+ let label = item.label || '';
|
|
|
+
|
|
|
+ let title = item.is_cc ? '抄送1人' : '1人审批';
|
|
|
const names = item.value.map((id) => {
|
|
|
const user = userList.find((cur: any) => cur.ID == id);
|
|
|
return user?.CName;
|
|
|
});
|
|
|
|
|
|
return (
|
|
|
- <div style={{ marginBottom: 20 }}>
|
|
|
- <CheckOutlined style={{ marginRight: 20 }} /> {names.join('、')}
|
|
|
+ <div
|
|
|
+ style={{
|
|
|
+ marginBottom: 20,
|
|
|
+ display: 'flex',
|
|
|
+ justifyContent: 'space-between',
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ <div>
|
|
|
+ <div style={{ fontSize: '18px' }}>{label}</div>
|
|
|
+ <div style={{ fontSize: '14px', color: 'gray' }}>{title}</div>
|
|
|
+ </div>
|
|
|
+ {names.join('、')}
|
|
|
</div>
|
|
|
);
|
|
|
};
|