|
|
@@ -10,6 +10,7 @@ import { validateEnum } from '@/pages/Customer/Company/components/AddCompany/Com
|
|
|
|
|
|
const AddClient = props => {
|
|
|
const {
|
|
|
+ visible,
|
|
|
onCancel,
|
|
|
reload,
|
|
|
onConfirm,
|
|
|
@@ -29,12 +30,12 @@ const AddClient = props => {
|
|
|
const [validStatusFtl, setValidStatusFtl] = useState('')
|
|
|
const dispatch = useDispatch()
|
|
|
useEffect(() => {
|
|
|
- if (!sourceList?.length) {
|
|
|
+ if (visible && !sourceList?.length) {
|
|
|
dispatch({
|
|
|
type: 'client/fetchSourceList'
|
|
|
})
|
|
|
}
|
|
|
- }, [])
|
|
|
+ }, [visible])
|
|
|
|
|
|
const handleChange = changedValues => {
|
|
|
if (!changedValues) return
|
|
|
@@ -82,6 +83,7 @@ const AddClient = props => {
|
|
|
return (
|
|
|
<Modal
|
|
|
{...resetModalProps}
|
|
|
+ visible={visible}
|
|
|
onCancel={onCancel}
|
|
|
width="43vw"
|
|
|
title="添加客户"
|
|
|
@@ -105,12 +107,14 @@ const AddClient = props => {
|
|
|
}
|
|
|
formRef?.setFieldsValue(values)
|
|
|
handleOnOk()
|
|
|
- }}>
|
|
|
+ }}
|
|
|
+ >
|
|
|
添加并关联
|
|
|
</Button>
|
|
|
) : null}
|
|
|
</div>
|
|
|
- }>
|
|
|
+ }
|
|
|
+ >
|
|
|
<Form {...layout} form={formRef} onValuesChange={handleChange} initialValues={defaultValues}>
|
|
|
{showDataItem ? <ProFormText name={`${dataType}Id`} hidden /> : null}
|
|
|
<ProFormText
|
|
|
@@ -122,7 +126,8 @@ const AddClient = props => {
|
|
|
<Form.Item
|
|
|
label="客户地区"
|
|
|
name="districtIds"
|
|
|
- rules={[{ required: true, message: '请选择地区' }]}>
|
|
|
+ rules={[{ required: true, message: '请选择地区' }]}
|
|
|
+ >
|
|
|
<LazyCascader showFooter={true} />
|
|
|
</Form.Item>
|
|
|
<Row>
|
|
|
@@ -144,7 +149,8 @@ const AddClient = props => {
|
|
|
name="telephone"
|
|
|
validateStatus={validStatusFtl}
|
|
|
hasFeedback
|
|
|
- rules={[{ required: true, message: '请输入手机号码' }]}>
|
|
|
+ rules={[{ required: true, message: '请输入手机号码' }]}
|
|
|
+ >
|
|
|
<TelephoneFormItem validateFn={status => setValidStatusFtl(status)} />
|
|
|
</Form.Item>
|
|
|
<ProFormText
|