|
|
@@ -3,6 +3,7 @@ import { Form, Row, Col, Button } from 'antd'
|
|
|
import LazyCascader from '@/components/LazyCascader'
|
|
|
import { ProFormSelect, ProFormText, ProFormTextArea } from '@ant-design/pro-form'
|
|
|
import { Plus } from '@icon-park/react'
|
|
|
+import { useDispatch } from 'umi'
|
|
|
import { ChangeCompMap } from '@/pages/Customer/Company/components/ChangeCompany'
|
|
|
import ModalDragForm from '@/components/Modal/src/components/ModalDragForm'
|
|
|
import { isNullOrUnDef } from '@/utils/is'
|
|
|
@@ -25,6 +26,7 @@ const AddClient = props => {
|
|
|
}
|
|
|
const [showDataItem, setShowDataItem] = useState(false)
|
|
|
const [validStatusFtl, setValidStatusFtl] = useState('')
|
|
|
+ const dispatch = useDispatch()
|
|
|
return (
|
|
|
<ModalDragForm
|
|
|
{...layout}
|
|
|
@@ -34,6 +36,11 @@ const AddClient = props => {
|
|
|
onVisibleChange={visible => {
|
|
|
if (visible) {
|
|
|
formRef.current?.setFieldsValue({ ...defaultValues })
|
|
|
+ dispatch({
|
|
|
+ type: 'client/fetchSourceList',
|
|
|
+ payload: reload
|
|
|
+ })
|
|
|
+ console.log(dispatch)
|
|
|
}
|
|
|
}}
|
|
|
trigger={
|
|
|
@@ -57,8 +64,7 @@ const AddClient = props => {
|
|
|
}
|
|
|
formRef.current && formRef.current.setFieldsValue(values)
|
|
|
submit()
|
|
|
- }}
|
|
|
- >
|
|
|
+ }}>
|
|
|
添加并关联
|
|
|
</Button>
|
|
|
) : null
|
|
|
@@ -70,8 +76,7 @@ const AddClient = props => {
|
|
|
setValidStatusFtl('')
|
|
|
!isNullOrUnDef(reload) && reload()
|
|
|
return true
|
|
|
- }}
|
|
|
- >
|
|
|
+ }}>
|
|
|
{showDataItem ? <ProFormText name={`${dataType}Id`} hidden /> : null}
|
|
|
<ProFormText
|
|
|
name="clientName"
|
|
|
@@ -82,8 +87,7 @@ const AddClient = props => {
|
|
|
<Form.Item
|
|
|
label="客户地区"
|
|
|
name="districtIds"
|
|
|
- rules={[{ required: true, message: '请选择地区' }]}
|
|
|
- >
|
|
|
+ rules={[{ required: true, message: '请选择地区' }]}>
|
|
|
<LazyCascader showFooter={true} />
|
|
|
</Form.Item>
|
|
|
<Row>
|
|
|
@@ -105,8 +109,7 @@ const AddClient = props => {
|
|
|
name="telephone"
|
|
|
validateStatus={validStatusFtl}
|
|
|
hasFeedback
|
|
|
- rules={[{ required: true, message: '请输入手机号码' }]}
|
|
|
- >
|
|
|
+ rules={[{ required: true, message: '请输入手机号码' }]}>
|
|
|
<TelephoneFormItem validateFn={status => setValidStatusFtl(status)} />
|
|
|
</Form.Item>
|
|
|
<ProFormText
|
|
|
@@ -134,6 +137,13 @@ const AddClient = props => {
|
|
|
<ProFormText label="客户住宿" name="stay" placeholder="" />
|
|
|
</Col>
|
|
|
</Row>
|
|
|
+ <ProFormSelect
|
|
|
+ name="sourceId"
|
|
|
+ label="来源"
|
|
|
+ placeholder=""
|
|
|
+ rules={[{ message: '来源' }]}
|
|
|
+ fieldProps={{ options: [] }}
|
|
|
+ />
|
|
|
<ProFormTextArea label="备注" name="mark" placeholder="" />
|
|
|
</ModalDragForm>
|
|
|
)
|