Commit f64fe1c5 by zhaochengxiang

资产编码限制

parent 5739529f
......@@ -15,14 +15,14 @@ const CodeInput = ({ value = '', onChange, restrict = false, action }) => {
const onCodeChange = (e) => {
if (!restrict || (
restrict&&(e.target.value===''||/^[a-zA-Z]+$/.test(e.target.value))
restrict&&(e.target.value===''||/^[A-Z]+$/.test(e.target.value))
)) {
onChange?.(e.target.value);
}
}
return <Input
placeholder="请输入编号"
placeholder="请输入编号(只允许输入大写英文字母,并且最多3个)"
disabled={action!=='add'}
maxLength={restrict?3:null}
value={value}
......@@ -173,9 +173,9 @@ const UpdateDirectoryModal = (props) => {
if (action==='add') {
if (changedValues.type === 'theme') {
setIsThemeAdd(true);
if (allValues.code?.length > 3 || !(/^[a-zA-Z]+$/.test(allValues.code))) {
form.setFieldsValue({ code: '' });
}
// if (allValues.code?.length > 3 || !(/^[A-Z]+$/.test(allValues.code))) {
// form.setFieldsValue({ code: '' });
// }
} else if (changedValues.type === 'directory') {
setIsThemeAdd(false);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment