|
|
@@ -40,43 +40,21 @@ const AddClient = props => {
|
|
|
})
|
|
|
}
|
|
|
}, [])
|
|
|
- // const handleChange = () => {
|
|
|
- // if (clientName !== '') {
|
|
|
- // const clientNameNum = clientName.value.split('')
|
|
|
- // const clientText = '工'
|
|
|
- // const symbolBefore = '('
|
|
|
- // const symbolAfter = ')'
|
|
|
- // if (clientNameNum?.length < 3) {
|
|
|
- // const clientNameTwo = clientNameNum[1]
|
|
|
- // const newClientName =
|
|
|
- // clientNameNum[0] + symbolBefore + clientNameTwo + symbolAfter + clientText
|
|
|
- // niceName.value = newClientName
|
|
|
- // } else if (clientNameNum?.length < 4) {
|
|
|
- // const clientNameTwo = clientNameNum[1] + clientNameNum[2]
|
|
|
- // const newClientName =
|
|
|
- // clientNameNum[0] + symbolBefore + clientNameTwo + symbolAfter + clientText
|
|
|
- // niceName.value = newClientName
|
|
|
- // } else if (clientNameNum?.length < 5) {
|
|
|
- // const clientNameTwo = clientNameNum[1] + clientNameNum[2] + clientNameNum[3]
|
|
|
- // const newClientName =
|
|
|
- // clientNameNum[0] + symbolBefore + clientNameTwo + symbolAfter + clientText
|
|
|
- // niceName.value = newClientName
|
|
|
- // } else {
|
|
|
- // niceName.value = ''
|
|
|
- // }
|
|
|
- // }
|
|
|
- // if (qq !== '') {
|
|
|
- // const emailText = 'qq.com'
|
|
|
- // const emailNew = qq.value + emailText
|
|
|
- // email.value = emailNew
|
|
|
- // }
|
|
|
- // }
|
|
|
- // const handleChange = () => {
|
|
|
- // const newEmail = `${email.value}@qq.com`
|
|
|
- // formRef.current?.setFieldsValue({
|
|
|
- // email: newEmail
|
|
|
- // })
|
|
|
- // }
|
|
|
+
|
|
|
+ const handleChange = () => {
|
|
|
+ if (!clientName.value === false) {
|
|
|
+ const clientNameNum = clientName.value.split('')
|
|
|
+ const [firstName, ...lastName] = clientNameNum
|
|
|
+ const nameAfter = `(${lastName.join('')})`
|
|
|
+ const newClientName = `${firstName + nameAfter}工`
|
|
|
+ formRef.current?.setFieldsValue({ niceName: newClientName })
|
|
|
+ }
|
|
|
+ if (!qq.value === false) {
|
|
|
+ const emailNum = qq.value
|
|
|
+ const newEmail = `${emailNum}@qq.com`
|
|
|
+ formRef.current?.setFieldsValue({ email: newEmail })
|
|
|
+ }
|
|
|
+ }
|
|
|
return (
|
|
|
<ModalDragForm
|
|
|
{...layout}
|
|
|
@@ -88,6 +66,7 @@ const AddClient = props => {
|
|
|
formRef.current?.setFieldsValue({ ...defaultValues })
|
|
|
}
|
|
|
}}
|
|
|
+ onChange={handleChange}
|
|
|
trigger={
|
|
|
<Button type="primary" {...buttonProps} className="mr-1">
|
|
|
<Plus className="mr-1" />
|
|
|
@@ -165,7 +144,8 @@ const AddClient = props => {
|
|
|
/>
|
|
|
</Col>
|
|
|
<Col span={12}>
|
|
|
- <ProFormDependency name={['clientName']}>
|
|
|
+ <ProFormText label="昵称" name="niceName" placeholder="" />
|
|
|
+ {/* <ProFormDependency name={['clientName']}>
|
|
|
{({ clientName, newClientName }) => {
|
|
|
if (!clientName === false) {
|
|
|
const clientNameNum = clientName.split('')
|
|
|
@@ -183,21 +163,10 @@ const AddClient = props => {
|
|
|
/>
|
|
|
)
|
|
|
}}
|
|
|
- </ProFormDependency>
|
|
|
+ </ProFormDependency> */}
|
|
|
<ProFormText label="职位" name="position" placeholder="" />
|
|
|
<ProFormText label="QQ" name="qq" placeholder="" />
|
|
|
- <Form.Item noStyle shouldUpdate>
|
|
|
- {form => {
|
|
|
- return (
|
|
|
- <ProFormText
|
|
|
- label="邮箱"
|
|
|
- name="email"
|
|
|
- placeholder=""
|
|
|
- value={`${form.getFieldValue('qq') || ''}@qq.com`}
|
|
|
- />
|
|
|
- )
|
|
|
- }}
|
|
|
- </Form.Item>
|
|
|
+ <ProFormText label="邮箱" name="email" placeholder="" />
|
|
|
</Col>
|
|
|
</Row>
|
|
|
<Row>
|