|
@@ -14,8 +14,10 @@ import {
|
|
|
Spin,
|
|
|
Steps,
|
|
|
Timeline,
|
|
|
+ Checkbox,
|
|
|
} from 'antd';
|
|
|
import { useModel, useRequest } from '@umijs/max';
|
|
|
+import { CheckboxValueType } from 'antd/es/checkbox/Group';
|
|
|
|
|
|
const { Step } = Steps;
|
|
|
|
|
@@ -43,7 +45,7 @@ const ApprovalProcess = (props: any) => {
|
|
|
roleList = [],
|
|
|
} = props;
|
|
|
const { userList, run } = useModel('userList');
|
|
|
- const [checkValue, setCheckValue] = useState<number[]>([]);
|
|
|
+ const [checkValue, setCheckValue] = useState<number[][]>([]);
|
|
|
|
|
|
const { auditList, ccList } = useMemo<{
|
|
|
auditList: AuditNode[];
|
|
@@ -71,7 +73,7 @@ const ApprovalProcess = (props: any) => {
|
|
|
return { auditList, ccList };
|
|
|
}, [approvalProcess]);
|
|
|
|
|
|
- const onCheckValue = (value: number, index: number) => {
|
|
|
+ const onCheckValue = (value: number[], index: number) => {
|
|
|
let values = [...checkValue];
|
|
|
values[index] = value;
|
|
|
setCheckValue(values);
|
|
@@ -101,7 +103,7 @@ const ApprovalProcess = (props: any) => {
|
|
|
roleList={roleList}
|
|
|
userList={userList}
|
|
|
value={checkValue[item.seq]}
|
|
|
- onChange={(value: number) => onCheckValue(value, item.seq)}
|
|
|
+ onChange={(value: number[]) => onCheckValue(value, item.seq)}
|
|
|
/>
|
|
|
),
|
|
|
};
|
|
@@ -122,8 +124,8 @@ interface AuditNodeStepProps {
|
|
|
leaderData: any;
|
|
|
roleList: any;
|
|
|
userList: any;
|
|
|
- value: number;
|
|
|
- onChange: (value: number) => void;
|
|
|
+ value: number[];
|
|
|
+ onChange: (value: number[]) => void;
|
|
|
}
|
|
|
|
|
|
const AuditNodeStep = (props: AuditNodeStepProps) => {
|
|
@@ -158,19 +160,30 @@ const AuditNodeStep = (props: AuditNodeStepProps) => {
|
|
|
setLoading(false);
|
|
|
};
|
|
|
|
|
|
- const selectedUserId = ({ target: { value } }: RadioChangeEvent) => {
|
|
|
- onChange(Number(value));
|
|
|
+ const selectedUserId = (list: CheckboxValueType[]) => {
|
|
|
+ console.log(list as number[]);
|
|
|
+ onChange(list as number[]);
|
|
|
};
|
|
|
|
|
|
const content = (
|
|
|
<Spin spinning={loading}>
|
|
|
- <Radio.Group onChange={selectedUserId} value={value}>
|
|
|
- {selectUserList.map((item: any) => (
|
|
|
- <Radio.Button value={Number(item.user_id)}>
|
|
|
- {item.c_name}
|
|
|
- </Radio.Button>
|
|
|
- ))}
|
|
|
- </Radio.Group>
|
|
|
+ <Checkbox.Group
|
|
|
+ style={{ display: 'block' }}
|
|
|
+ onChange={selectedUserId}
|
|
|
+ value={value as any}
|
|
|
+ >
|
|
|
+ {selectUserList
|
|
|
+ .filter((item: any) => item.c_name)
|
|
|
+ .map((item: any) => (
|
|
|
+ <Checkbox
|
|
|
+ style={{ whiteSpace: 'nowrap' }}
|
|
|
+ key={item.user_id}
|
|
|
+ value={Number(item.user_id)}
|
|
|
+ >
|
|
|
+ {item.c_name}
|
|
|
+ </Checkbox>
|
|
|
+ ))}
|
|
|
+ </Checkbox.Group>
|
|
|
</Spin>
|
|
|
);
|
|
|
|
|
@@ -191,14 +204,16 @@ const AuditNodeStep = (props: AuditNodeStepProps) => {
|
|
|
}
|
|
|
if (item.type == TYPE.ROLE) {
|
|
|
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) {
|
|
|
- userName = userList.find((cur: any) => cur.ID == value)?.CName;
|
|
|
+ let userNames = [];
|
|
|
+ if (value?.length > 0) {
|
|
|
+ userNames = value.map(
|
|
|
+ (id: number) => userList.find((cur: any) => cur.ID == id)?.CName,
|
|
|
+ );
|
|
|
}
|
|
|
return (
|
|
|
<div
|
|
@@ -220,10 +235,10 @@ const AuditNodeStep = (props: AuditNodeStepProps) => {
|
|
|
trigger="click"
|
|
|
overlayStyle={{ width: '300px' }}
|
|
|
onOpenChange={handleOpen}
|
|
|
- style={{ marginBottom: 20 }}
|
|
|
+ style={{ marginBottom: 20, overflow: 'auto' }}
|
|
|
>
|
|
|
<Space>
|
|
|
- {userName}
|
|
|
+ {userNames.join('、')}
|
|
|
<PlusSquareOutlined style={{ fontSize: '36px', color: 'gray' }} />
|
|
|
</Space>
|
|
|
</Popover>
|
|
@@ -233,7 +248,9 @@ const AuditNodeStep = (props: AuditNodeStepProps) => {
|
|
|
|
|
|
let label = item.label || '';
|
|
|
|
|
|
- let title = item.is_cc ? '抄送1人' : '1人审批';
|
|
|
+ let title = item.is_cc
|
|
|
+ ? `抄送${item.value.length}人`
|
|
|
+ : `${item.value.length}人审批`;
|
|
|
const names = item.value.map((id) => {
|
|
|
const user = userList.find((cur: any) => cur.ID == id);
|
|
|
return user?.CName;
|