From c1d6dff8bf8340fe030d3089cf5dff0e9cffcf58 Mon Sep 17 00:00:00 2001 From: zhangyongtian <1181606322@qq.com> Date: Thu, 29 Aug 2024 10:24:12 +0800 Subject: [PATCH] Revert "更改命名" --- gz-customerSystem/src/views/register/visit/component/agentDialog.jsx | 57 +++++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 47 insertions(+), 10 deletions(-) diff --git a/gz-customerSystem/src/views/register/visit/component/agentDialog.jsx b/gz-customerSystem/src/views/register/visit/component/agentDialog.jsx index 0f92863..bea0658 100644 --- a/gz-customerSystem/src/views/register/visit/component/agentDialog.jsx +++ b/gz-customerSystem/src/views/register/visit/component/agentDialog.jsx @@ -14,21 +14,57 @@ export default function AgentDialog(props) { const formRef = useRef(); + const [visitList, setVisitList] = useState([]) + + useEffect(() => { + if (props.editData) { + //编辑 + formRef.current.setFieldsValue({ + ...props.editData + }) + //过滤代理人 + setVisitList(props.fakeData.filter(item => { + if (props.editData.dialogType === 2) { + return item.partyType === 0 + } else { + return item.partyType === 1 + } + })) + } else { + //过滤代理人 + setVisitList(props.fakeData.filter(item => { + if (props.dialogType === 2) { + return item.partyType === 0 + } else { + return item.partyType === 1 + } + })) + } + }, []) //保存信息 const handleSave = () => { if (formRef.current) { formRef.current.validate(undefined, (errors, values) => { - props.handleAddParty({ - ...values, - // partyType: props.dialogType, - // perClass: perClass, - // perClassName: props.dialogType === 0 ? '申请方代理人' : '被申请方当事人' - }) - props.onClose() + if (!errors) { + if (props.editData) { + props.handleAddParty({ + ...props.editData, + ...values, + }) + } else { + props.handleAddParty({ + ...values, + partyType: props.dialogType, + perClassName: props.dialogType === 2 ? '申请方代理人' : '被申请方代理人', + }) + } + props.onClose() + } }); } } + return ( <div className="applyDialog"> <div style={{ height: '590px', overflowY: 'scroll' }}> @@ -40,6 +76,7 @@ requiredSymbol={false} initialValues={{ }}//默认值 + scrollToFirstError > <Row gutter={[32, 0]} style={{ margin: '0 -10px' }}> <Col span={24}> @@ -212,12 +249,12 @@ <Col span={12}> <FormItem label={(<div style={{ display: 'flex' }}>代理对象<div className="must">必填</div></div>)} - rules={[{ required: true }]} + rules={[{ required: true, message: '请选择代理对象' }]} field='dailimap' > <CheckboxGroup direction='vertical' - options={props.fakeData.map(x => ({ + options={visitList.map(x => ({ label: <span>{x.trueName} <span style={{ color: '#86909c' }}>({x.perClassName})</span></span>, value: x.id, }))} @@ -241,7 +278,7 @@ className="dialogPrimary" onClick={handleSave} > - 保存信息 + 保存 </Button> <Button className="dialogBack"> 重置 -- Gitblit v1.8.0