diff --git a/web/client/src/sections/organization/components/userModal.js b/web/client/src/sections/organization/components/userModal.js index 29a91f9f..d229bc7a 100644 --- a/web/client/src/sections/organization/components/userModal.js +++ b/web/client/src/sections/organization/components/userModal.js @@ -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 ( { 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']}