|
@@ -1,80 +1,47 @@
|
|
|
import React, { useState } from 'react';
|
|
|
-import { PageContainer } from '@ant-design/pro-components';
|
|
|
+import { PageContainer, ProCard } from '@ant-design/pro-components';
|
|
|
import { Col, Empty, Row } from 'antd';
|
|
|
import ApprovalProcess from './components/ApprovalProcess';
|
|
|
import AuditDetailed from './components/AuditDetailed';
|
|
|
-import { queryGetBomForm } from '@/services/boom';
|
|
|
+import { queryGetBomForm, queryProcessFlows } from '@/services/boom';
|
|
|
+import { useParams, useRequest } from 'umi';
|
|
|
|
|
|
const OaDetail = () => {
|
|
|
const [approvalProcess, setApprovalProcess] = useState([]);
|
|
|
+ const { oaId } = useParams();
|
|
|
const items = [];
|
|
|
- const initFormList = async () => {
|
|
|
- const res = await queryGetBomForm({
|
|
|
- project_id: version.project_id,
|
|
|
- node_id: version.template_node_id,
|
|
|
- });
|
|
|
- if (res.data) {
|
|
|
- const formList = JSON.parse(res.data.json);
|
|
|
- setApprovalProcess(formList.approvalProcess || {});
|
|
|
- return formList.approvalProcess;
|
|
|
- }
|
|
|
- };
|
|
|
- //填写表单实时计算审批流程
|
|
|
- const advanceSubmit = async (fieldsValue) => {
|
|
|
- console.log('重重新计算审批流程');
|
|
|
- // var fieldsValue = await form.validateFields();
|
|
|
|
|
|
- let result = Object.values(fieldsValue)
|
|
|
- .map((item) => {
|
|
|
- if (item && Array.isArray(item)) return item;
|
|
|
- })
|
|
|
- .filter((item) => item);
|
|
|
- const formList = await getFromData(result);
|
|
|
- let params = {
|
|
|
- desc: fieldsValue.desc,
|
|
|
- // 审核流程id
|
|
|
- flow_id: 0,
|
|
|
- node_level_id: 0,
|
|
|
- id: version.id,
|
|
|
- project_id: version.project_id,
|
|
|
- cur_template_node_id: version.template_node_id * 1, // 当前节点
|
|
|
- next_template_node_id: 0, // 审核完成后的业务节点
|
|
|
- template_node_id: null, // 将要流转的节点审批节点
|
|
|
- flow_path: null, //审批节点数组
|
|
|
- // 模板id.一致就行
|
|
|
- template_id: version.template_id,
|
|
|
- cur_template_id: version.template_id,
|
|
|
- next_template_id: version.template_id,
|
|
|
- form_list: formList,
|
|
|
- };
|
|
|
- dispatch({
|
|
|
- type: 'detail/advanceSubmitNextNode',
|
|
|
- payload: params, //values,
|
|
|
- callback: (data) => {
|
|
|
- if (data) {
|
|
|
- setApprovalProcess(data);
|
|
|
- }
|
|
|
- },
|
|
|
- });
|
|
|
+ const { data, loading } = useRequest(queryProcessFlows, {
|
|
|
+ defaultParams: [{ ids: oaId }],
|
|
|
+ });
|
|
|
+
|
|
|
+ //填写表单实时计算审批流程
|
|
|
+ const advanceSubmit = async (changedFields, allFields) => {
|
|
|
+ console.log(changedFields, allFields);
|
|
|
};
|
|
|
|
|
|
return (
|
|
|
- <PageContainer>
|
|
|
- <Row>
|
|
|
- <Col span={17}>
|
|
|
- <AuditDetailed items={items} onFieldsChange={advanceSubmit} />
|
|
|
- </Col>
|
|
|
- <Col offset={1} span={6}>
|
|
|
- {approvalProcess.length == 0 ? ( //!formComponentValues[item.nodeId] ||
|
|
|
- <Empty description="请先填写表单" />
|
|
|
- ) : (
|
|
|
- <ApprovalProcess
|
|
|
- approvalProcess={approvalProcess}
|
|
|
- onChange={setApprovalProcess}
|
|
|
+ <PageContainer loading={loading}>
|
|
|
+ <ProCard style={{ minHeight: '80vh' }}>
|
|
|
+ <Row gutter={24}>
|
|
|
+ <Col span={12}>
|
|
|
+ <AuditDetailed
|
|
|
+ items={data?.formData}
|
|
|
+ onFieldsChange={advanceSubmit}
|
|
|
/>
|
|
|
- )}
|
|
|
- </Col>
|
|
|
- </Row>
|
|
|
+ </Col>
|
|
|
+ <Col span={12}>
|
|
|
+ {approvalProcess.length == 0 ? ( //!formComponentValues[item.nodeId] ||
|
|
|
+ <Empty description="请先填写表单" />
|
|
|
+ ) : (
|
|
|
+ <ApprovalProcess
|
|
|
+ approvalProcess={approvalProcess}
|
|
|
+ onChange={setApprovalProcess}
|
|
|
+ />
|
|
|
+ )}
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+ </ProCard>
|
|
|
</PageContainer>
|
|
|
);
|
|
|
};
|