Commit f64fe1c5 by zhaochengxiang

资产编码限制

parent 5739529f
...@@ -15,14 +15,14 @@ const CodeInput = ({ value = '', onChange, restrict = false, action }) => { ...@@ -15,14 +15,14 @@ const CodeInput = ({ value = '', onChange, restrict = false, action }) => {
const onCodeChange = (e) => { const onCodeChange = (e) => {
if (!restrict || ( 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); onChange?.(e.target.value);
} }
} }
return <Input return <Input
placeholder="请输入编号" placeholder="请输入编号(只允许输入大写英文字母,并且最多3个)"
disabled={action!=='add'} disabled={action!=='add'}
maxLength={restrict?3:null} maxLength={restrict?3:null}
value={value} value={value}
...@@ -173,9 +173,9 @@ const UpdateDirectoryModal = (props) => { ...@@ -173,9 +173,9 @@ const UpdateDirectoryModal = (props) => {
if (action==='add') { if (action==='add') {
if (changedValues.type === 'theme') { if (changedValues.type === 'theme') {
setIsThemeAdd(true); setIsThemeAdd(true);
if (allValues.code?.length > 3 || !(/^[a-zA-Z]+$/.test(allValues.code))) { // if (allValues.code?.length > 3 || !(/^[A-Z]+$/.test(allValues.code))) {
form.setFieldsValue({ code: '' }); // form.setFieldsValue({ code: '' });
} // }
} else if (changedValues.type === 'directory') { } else if (changedValues.type === 'directory') {
setIsThemeAdd(false); 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