|
@@ -1,5 +1,5 @@
|
|
|
import React, { useRef, useState } from 'react';
|
|
|
-import { Button, Col, Empty, Row, message } from 'antd';
|
|
|
+import { Button, Col, Empty, Form, Row, message } from 'antd';
|
|
|
import ApprovalProcess from './components/ApprovalProcess';
|
|
|
import AuditDetailed from './components/AuditDetailed';
|
|
|
import PageContent from '@/components/PageContent';
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
import { useParams, useRequest, useNavigate } from 'umi';
|
|
|
|
|
|
const OaDetail = () => {
|
|
|
+ const [form] = Form.useForm();
|
|
|
const [approvalProcess, setApprovalProcess] = useState([]);
|
|
|
const { oaId } = useParams();
|
|
|
const formValueRef = useRef({
|
|
@@ -86,30 +87,32 @@ const OaDetail = () => {
|
|
|
};
|
|
|
|
|
|
const submit = () => {
|
|
|
- const { form } = formValueRef.current;
|
|
|
- let audit_list = [];
|
|
|
- approvalProcess?.forEach((item) => {
|
|
|
- if (item[0].type == 'role') audit_list.push(item[0].nowValue);
|
|
|
- else if (item[0].type == 'leader')
|
|
|
- audit_list.push(
|
|
|
- ...leaderData.slice(0, item[0].value).map((leader) => leader.ID),
|
|
|
- );
|
|
|
- else audit_list.push(item[0].value);
|
|
|
- });
|
|
|
- let files = [],
|
|
|
- formData = [];
|
|
|
- form.forEach((item) => {
|
|
|
- if (item.type == 'DDAttachment') {
|
|
|
- files = files.concat(item.value);
|
|
|
- } else {
|
|
|
- formData.push(item);
|
|
|
- }
|
|
|
- });
|
|
|
- createRun({
|
|
|
- flow_id: Number(oaId),
|
|
|
- form: JSON.stringify(formData),
|
|
|
- audit_list,
|
|
|
- files: files.join(','),
|
|
|
+ form.validateFields().then((values) => {
|
|
|
+ const { form: formCur } = formValueRef.current;
|
|
|
+ let audit_list = [];
|
|
|
+ approvalProcess?.forEach((item) => {
|
|
|
+ if (item[0].type == 'role') audit_list.push(item[0].nowValue);
|
|
|
+ else if (item[0].type == 'leader')
|
|
|
+ audit_list.push(
|
|
|
+ ...leaderData.slice(0, item[0].value).map((leader) => leader.ID),
|
|
|
+ );
|
|
|
+ else audit_list.push(item[0].value);
|
|
|
+ });
|
|
|
+ let files = [],
|
|
|
+ formData = [];
|
|
|
+ formCur.forEach((item) => {
|
|
|
+ if (item.type == 'DDAttachment') {
|
|
|
+ files = files.concat(item.value);
|
|
|
+ } else {
|
|
|
+ formData.push(item);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ createRun({
|
|
|
+ flow_id: Number(oaId),
|
|
|
+ form: JSON.stringify(formData),
|
|
|
+ audit_list,
|
|
|
+ files: files.join(','),
|
|
|
+ });
|
|
|
});
|
|
|
};
|
|
|
// const OnModelFileDone = (file) => {
|
|
@@ -138,6 +141,7 @@ const OaDetail = () => {
|
|
|
/>
|
|
|
)} */}
|
|
|
<AuditDetailed
|
|
|
+ form={form}
|
|
|
items={data?.formData}
|
|
|
onValuesChange={advanceSubmit}
|
|
|
/>
|