Commit 8e3007d0 authored by 涂伟's avatar 涂伟

fix: '子流程配置新增子流程自动提交配置'

parent bf722798
import React, { useState, useEffect, forwardRef, useImperativeHandle, useRef } from 'react'; import React, { useState, useEffect, forwardRef, useImperativeHandle, useRef } from 'react';
import { Drawer, Form, Space, Button, Input, Select, Divider, Tooltip, message } from 'antd'; import { Drawer, Form, Space, Button, Input, Select, Divider, Tooltip, message, Radio } from 'antd';
import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons'; import { MinusCircleOutlined, PlusOutlined, QuestionCircleOutlined } from '@ant-design/icons';
import { GetSubEventFlows, GetFlowMapFields } from '@/services/workflow/workflow'; import { GetSubEventFlows, GetFlowMapFields } from '@/services/workflow/workflow';
import lodash from 'lodash'; import lodash from 'lodash';
...@@ -39,7 +39,7 @@ const ConfigSubprocess = (props, ref) => { ...@@ -39,7 +39,7 @@ const ConfigSubprocess = (props, ref) => {
}, []); }, []);
useEffect(() => { useEffect(() => {
console.log(editMsg, 'editMsg'); console.log(editMsg, 'editMsg');
form.setFieldsValue({ flowKey: '', MapFields: [] }); form.setFieldsValue({ flowKey: '', MapFields: [], IsHandoverFirstNode: 1 });
if (editMsg.SubFlowInfo) { if (editMsg.SubFlowInfo) {
GetFlowMapFields({ GetFlowMapFields({
flowID, flowID,
...@@ -55,8 +55,7 @@ const ConfigSubprocess = (props, ref) => { ...@@ -55,8 +55,7 @@ const ConfigSubprocess = (props, ref) => {
}); });
res.data.SubFlowMapInfo.TableFieldNames = res.data.SubFlowMapInfo.TableFieldNames.map( res.data.SubFlowMapInfo.TableFieldNames = res.data.SubFlowMapInfo.TableFieldNames.map(
item => ({ item => ({
value: `${res.data.SubFlowMapInfo.TableName}-${item}-${ value: `${res.data.SubFlowMapInfo.TableName}-${item}-${res.data.SubFlowMapInfo.TableType
res.data.SubFlowMapInfo.TableType
}`, }`,
label: item, label: item,
}), }),
...@@ -81,15 +80,16 @@ const ConfigSubprocess = (props, ref) => { ...@@ -81,15 +80,16 @@ const ConfigSubprocess = (props, ref) => {
? `${item.SubFlowMapTableName}-${item.SubFlowMapFieldName}-${item.SubFlowMapTableType}` ? `${item.SubFlowMapTableName}-${item.SubFlowMapFieldName}-${item.SubFlowMapTableType}`
: '', : '',
})), })),
IsHandoverFirstNode: editMsg.SubFlowInfo?.IsHandoverFirstNode,
}); });
} }
}, [editMsg]); }, [editMsg]);
const getParmar = () => ({ SubFlowInfo: SubFlowInfo.current }); const getParmar = () => ({ SubFlowInfo: SubFlowInfo.current });
const changeValue = (changedFields, allFields) => { const changeValue = (changedFields, allFields) => {
console.log(changedFields, 'changedFields'); console.log(changedFields, allFields, 'changedFields');
let MapFields = []; let MapFields = [];
if (changedFields[0].name[0] === 'MapFields') { if (changedFields[0].name[0] === 'MapFields') {
MapFields = allFields[1]?.value?.map(item => ({ MapFields = allFields[2]?.value?.map(item => ({
ParentFlowMapTableName: item?.nodeField?.split('-')[0], ParentFlowMapTableName: item?.nodeField?.split('-')[0],
ParentFlowMapFieldName: item?.nodeField?.split('-')[1], ParentFlowMapFieldName: item?.nodeField?.split('-')[1],
SubFlowMapTableType: item?.subNodeField?.split('-')[2], SubFlowMapTableType: item?.subNodeField?.split('-')[2],
...@@ -101,6 +101,7 @@ const ConfigSubprocess = (props, ref) => { ...@@ -101,6 +101,7 @@ const ConfigSubprocess = (props, ref) => {
SubFlowEventConfigID: Number(allFields[0]?.value?.split('-')[0]), SubFlowEventConfigID: Number(allFields[0]?.value?.split('-')[0]),
SubFlowID: Number(allFields[0]?.value?.split('-')[1]), SubFlowID: Number(allFields[0]?.value?.split('-')[1]),
MapFields: MapFields, MapFields: MapFields,
IsHandoverFirstNode: allFields[1]?.value
}; };
SubFlowInfo.current = msg; SubFlowInfo.current = msg;
nodeChage('SubFlowInfo', SubFlowInfo.current); nodeChage('SubFlowInfo', SubFlowInfo.current);
...@@ -122,8 +123,7 @@ const ConfigSubprocess = (props, ref) => { ...@@ -122,8 +123,7 @@ const ConfigSubprocess = (props, ref) => {
}); });
res.data.SubFlowMapInfo.TableFieldNames = res.data.SubFlowMapInfo.TableFieldNames.map( res.data.SubFlowMapInfo.TableFieldNames = res.data.SubFlowMapInfo.TableFieldNames.map(
item => ({ item => ({
value: `${res.data.SubFlowMapInfo.TableName}-${item}-${ value: `${res.data.SubFlowMapInfo.TableName}-${item}-${res.data.SubFlowMapInfo.TableType
res.data.SubFlowMapInfo.TableType
}`, }`,
label: item, label: item,
}), }),
...@@ -179,11 +179,42 @@ const ConfigSubprocess = (props, ref) => { ...@@ -179,11 +179,42 @@ const ConfigSubprocess = (props, ref) => {
))} ))}
</Select> </Select>
</Form.Item> </Form.Item>
<Form.Item label={(<div>子流程自动提交<Tooltip title='选择"否",系统仅创建子流程表单;选择"是",系统创建子流程表单并自动提交,进入子流程下一节点' >
<QuestionCircleOutlined />
</Tooltip></div>)} name="IsHandoverFirstNode"
labelCol={{
span: 12,
}}
wrapperCol={{
span: 12,
}}>
<Radio.Group
style={{ 'display': 'flex' }}
options={[
{
value: 1,
label: (
<div>是<Tooltip title='子流程发起后,当前流程立即进入下一节点' >
<QuestionCircleOutlined />
</Tooltip></div>
),
},
{
value: 0,
label: (
<div>否<Tooltip title='子流程结束后,当前流程才进入下一节点' >
<QuestionCircleOutlined />
</Tooltip></div>
),
}
]}
/>
</Form.Item>
<Form.Item wrapperCol={{ span: 24 }}> <Form.Item wrapperCol={{ span: 24 }}>
<Form.List name="MapFields"> <Form.List name="MapFields">
{(fields, { add, remove }) => ( {(fields, { add, remove }) => (
<> <>
<div style={{marginBottom: '20px'}}> <div style={{ marginBottom: '20px' }}>
<span style={{ fontSize: '12px', color: '#bfbcbc' }}> <span style={{ fontSize: '12px', color: '#bfbcbc' }}>
当选择子流程后,可配置字段映射规则 当选择子流程后,可配置字段映射规则
</span> </span>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment