| | |
| | | import React, { useState, useEffect, useRef, Fragment } from "react"; |
| | | import { Row, Col, Space } from 'antd'; |
| | | import { Form, Input, Button, Radio, Select, Checkbox, Upload } from '@arco-design/web-react'; |
| | | import KeyVisits from "./keyVisits"; |
| | | import KeyVisits from "./KeyVisits"; |
| | | import { |
| | | IconLink, |
| | | } from '@arco-design/web-react/icon'; |
| | |
| | | |
| | | 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' }}> |
| | |
| | | requiredSymbol={false} |
| | | initialValues={{ |
| | | }}//默认值 |
| | | scrollToFirstError |
| | | > |
| | | <Row gutter={[32, 0]} style={{ margin: '0 -10px' }}> |
| | | <Col span={24}> |
| | |
| | | <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, |
| | | }))} |
| | |
| | | className="dialogPrimary" |
| | | onClick={handleSave} |
| | | > |
| | | 保存信息 |
| | | 保存 |
| | | </Button> |
| | | <Button className="dialogBack"> |
| | | 重置 |