|
|
@ -1,22 +1,25 @@ |
|
|
|
import React from 'react'; |
|
|
|
import { connect } from 'react-redux'; |
|
|
|
import { Spin, Card, Modal, TreeSelect, message } from 'antd'; |
|
|
|
import { Spin } from 'antd'; |
|
|
|
import ProForm, { ProFormText, ModalForm, ProFormSwitch, ProFormTreeSelect } from '@ant-design/pro-form'; |
|
|
|
|
|
|
|
const UserModal = (props) => { |
|
|
|
const { visible, modalType, depData, onVisibleChange, onConfirm, editData } = props |
|
|
|
const reg_tel = /^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$/; |
|
|
|
const onFinish = (values) => { |
|
|
|
if (onConfirm) { |
|
|
|
onConfirm(values); |
|
|
|
} |
|
|
|
} |
|
|
|
const mobile = (value) => { |
|
|
|
if (reg_tel.test(value)) { |
|
|
|
return |
|
|
|
|
|
|
|
const checkName = (rule, value, callback) => { |
|
|
|
if (value && value.replace(/[^\u4E00-\u9FA5]/g).includes('undefined')) { |
|
|
|
callback(new Error('请输入中文!')); |
|
|
|
} else { |
|
|
|
callback() |
|
|
|
} |
|
|
|
return message('请输入姓名') |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
<Spin spinning={false}> |
|
|
|
<ModalForm |
|
|
@ -45,7 +48,10 @@ const UserModal = (props) => { |
|
|
|
label="姓名" |
|
|
|
required |
|
|
|
placeholder="请输入姓名" |
|
|
|
rules={[{ required: true, message: '请输入姓名' },{ max: 5, message: '请输入5个字以内的名称' }]} |
|
|
|
rules={[{ required: true, message: '请输入姓名' }, |
|
|
|
{ max: 5, message: '请输入5个字以内的名称' }, |
|
|
|
{ validator: checkName } |
|
|
|
]} |
|
|
|
/> |
|
|
|
< ProFormText |
|
|
|
name={['contract', 'phone']} |
|
|
|