|
@@ -27,6 +27,7 @@ import { Form as Form3x } from '@ant-design/compatible';
|
|
import { getCurrentUser } from '@/utils/authority';
|
|
import { getCurrentUser } from '@/utils/authority';
|
|
import DDCode from '@/components/DDComponents/DDCode';
|
|
import DDCode from '@/components/DDComponents/DDCode';
|
|
import { uploadFile, queryUserListByRoleID } from '@/services/boom';
|
|
import { uploadFile, queryUserListByRoleID } from '@/services/boom';
|
|
|
|
+import ApprovalProcess from './ApprovalProcess';
|
|
|
|
|
|
const { TextArea } = Input;
|
|
const { TextArea } = Input;
|
|
const { Option } = Select;
|
|
const { Option } = Select;
|
|
@@ -310,11 +311,15 @@ function CommitAuditModal(props) {
|
|
firstList.forEach(id => {
|
|
firstList.forEach(id => {
|
|
let approvalNode = flowDetail.nodes.find?.(item => item.Id == id);
|
|
let approvalNode = flowDetail.nodes.find?.(item => item.Id == id);
|
|
let values = data[approvalNode.Id] || [];
|
|
let values = data[approvalNode.Id] || [];
|
|
|
|
+ const audit_list = approvalProcess[approvalNode.Id]?.map(item => {
|
|
|
|
+ if (item[0].type == 'role') return item[0].nowValue;
|
|
|
|
+ return item[0].value;
|
|
|
|
+ });
|
|
const formItem = {
|
|
const formItem = {
|
|
flow_id: approvalNode.flow_id,
|
|
flow_id: approvalNode.flow_id,
|
|
template_node_id: approvalNode.Id,
|
|
template_node_id: approvalNode.Id,
|
|
formComponentValues: [...values], //{ name: '附件', value: JSON.stringify(attachment) }
|
|
formComponentValues: [...values], //{ name: '附件', value: JSON.stringify(attachment) }
|
|
- audit_list: approvalProcess[approvalNode.Id]?.map(item => item[0].value) || [],
|
|
|
|
|
|
+ audit_list: audit_list || [],
|
|
};
|
|
};
|
|
result.push(JSON.stringify(formItem));
|
|
result.push(JSON.stringify(formItem));
|
|
});
|
|
});
|
|
@@ -350,6 +355,17 @@ function CommitAuditModal(props) {
|
|
|
|
|
|
const onFinish = async () => {
|
|
const onFinish = async () => {
|
|
console.log(approvalProcess);
|
|
console.log(approvalProcess);
|
|
|
|
+ const isOk = Object.values(approvalProcess).every(item => {
|
|
|
|
+ console.log(item);
|
|
|
|
+ return item.every(cur => {
|
|
|
|
+ if (cur[0].type == 'role') return cur[0].nowValue;
|
|
|
|
+ return true;
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ if (!isOk) {
|
|
|
|
+ message.error('请选择审批人。');
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
var fieldsValue = await form.validateFields();
|
|
var fieldsValue = await form.validateFields();
|
|
let hasFlowId = true; //是否都绑定审批节点
|
|
let hasFlowId = true; //是否都绑定审批节点
|
|
const getFlowPath = node => {
|
|
const getFlowPath = node => {
|
|
@@ -433,7 +449,6 @@ function CommitAuditModal(props) {
|
|
message.error('当前存在审批节点未绑定审批流程!请联系管理员。');
|
|
message.error('当前存在审批节点未绑定审批流程!请联系管理员。');
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- console.log(params);
|
|
|
|
onOk(params);
|
|
onOk(params);
|
|
};
|
|
};
|
|
const CascaderNode = index => {
|
|
const CascaderNode = index => {
|
|
@@ -472,74 +487,6 @@ function CommitAuditModal(props) {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
- const renderSteps = id => {
|
|
|
|
- const list = approvalProcess[id];
|
|
|
|
- list?.forEach(item => {
|
|
|
|
- if (item.length > 1 && item[0].type == 'user') {
|
|
|
|
- item.forEach(curUser => {
|
|
|
|
- curUser.name = userList.find(user => user.ID == curUser.value)?.CName || '-';
|
|
|
|
- });
|
|
|
|
- } else if (item.length == 1 && item[0].type == 'user') {
|
|
|
|
- item[0].name = userList.find(user => user.ID == item[0].value)?.CName || '-';
|
|
|
|
- } else {
|
|
|
|
- item[0].name = null;
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- console.log(list);
|
|
|
|
-
|
|
|
|
- const onStepsChange = async (current, list) => {
|
|
|
|
- const itemNode = list[current][0];
|
|
|
|
- if (itemNode.type !== 'role') return;
|
|
|
|
- const data = await queryUserListByRoleID({ role_id: itemNode.value });
|
|
|
|
- console.log(data);
|
|
|
|
- setCurNodeIdx(current);
|
|
|
|
- setSelectUserList(data);
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- const selectedUserId = userId => {
|
|
|
|
- const name = userList.find(user => user.ID == userId)?.CName || '-';
|
|
|
|
- const data = { type: 'user', value: Number(userId), name };
|
|
|
|
- list[curNodeIdx][0] = data;
|
|
|
|
- console.log(list);
|
|
|
|
- setApprovalProcess({ ...approvalProcess, [id]: list });
|
|
|
|
- // const newData = userIdData[id] || [];
|
|
|
|
- // newData[curNodeIdx] = userId;
|
|
|
|
- // setUserIdData({ ...userIdData, [id]: newData });
|
|
|
|
- // console.log(userId, curNodeIdx, { ...userIdData, [id]: newData });
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- return (
|
|
|
|
- <>
|
|
|
|
- <Steps current={-1} direction="vertical" onChange={value => onStepsChange(value, list)}>
|
|
|
|
- {list?.map(item => (
|
|
|
|
- <Step
|
|
|
|
- key={item[0]?.value}
|
|
|
|
- icon={
|
|
|
|
- item[0]?.name ? null : (
|
|
|
|
- // <Popover
|
|
|
|
- // placement="rightTop"
|
|
|
|
- // title={'选择审批人'}
|
|
|
|
- // content={selectUserList.map(item => {
|
|
|
|
- // <div>{item.c_name}</div>;
|
|
|
|
- // })}
|
|
|
|
- // trigger="click"
|
|
|
|
- // >
|
|
|
|
- // <PlusOutlined />
|
|
|
|
- // </Popover>
|
|
|
|
- <PlusOutlined />
|
|
|
|
- )
|
|
|
|
- }
|
|
|
|
- title={item[0]?.name}
|
|
|
|
- />
|
|
|
|
- ))}
|
|
|
|
- </Steps>
|
|
|
|
- {selectUserList.map(item => (
|
|
|
|
- <Button onClick={() => selectedUserId(item.user_id)}>{item.c_name}</Button>
|
|
|
|
- ))}
|
|
|
|
- </>
|
|
|
|
- );
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
return (
|
|
return (
|
|
<Modal
|
|
<Modal
|
|
confirmLoading={loading}
|
|
confirmLoading={loading}
|
|
@@ -584,9 +531,12 @@ function CommitAuditModal(props) {
|
|
{!formComponentValues[item.nodeId] || !approvalProcess[item.nodeId] ? (
|
|
{!formComponentValues[item.nodeId] || !approvalProcess[item.nodeId] ? (
|
|
<Empty description="请先填写表单" />
|
|
<Empty description="请先填写表单" />
|
|
) : (
|
|
) : (
|
|
- renderSteps(item.nodeId)
|
|
|
|
|
|
+ <ApprovalProcess
|
|
|
|
+ id={item.nodeId}
|
|
|
|
+ approvalProcess={approvalProcess}
|
|
|
|
+ onChange={setApprovalProcess}
|
|
|
|
+ />
|
|
)
|
|
)
|
|
- // ({renderSteps(item.nodeId)})
|
|
|
|
// <AuditFlow
|
|
// <AuditFlow
|
|
// processCode={item.formCode}
|
|
// processCode={item.formCode}
|
|
// formComponentValues={formComponentValues[item.nodeId]}
|
|
// formComponentValues={formComponentValues[item.nodeId]}
|