Commit 1de914d0 authored by 邓超's avatar 邓超

fix: 建表对特殊字符进行限制

parent f2a4ec16
Pipeline #63600 passed with stages
......@@ -215,11 +215,15 @@ const EditableCell = ({
value &&
dataSource.some((item, i) => item.Name === value && item.keyIndex !== record.keyIndex)
) {
return Promise.reject(new Error('字段名称不能重复'));
return Promise.reject(new Error('字段名称重复,请重新输入'));
}
return Promise.resolve();
},
},
{
pattern: /^(?!(\d+)$)[\u4e00-\u9fffa-zA-Z0-9_]+$/,
message: '不能输入特殊符号或者纯数字',
},
];
}
childNode = editing ? (
......@@ -662,7 +666,22 @@ const TableView = props => {
<Form form={form}>
<div style={{ display: 'flex', justifyContent: 'space-between' }}>
<div style={{ display: 'flex' }}>
<Form.Item label="表名" name="tableName" required style={{ marginBottom: '0' }}>
<Form.Item
label="表名"
rules={[
{
required: true,
message: '表名称不能为空',
},
{
pattern: /^[\u4e00-\u9fffa-zA-Z0-9_]+$/,
message: '不能输入特殊符号',
},
]}
name="tableName"
required
style={{ marginBottom: '0' }}
>
<Input
addonBefore={type === 'add' ? `${tableMap[tableType]}_` : null}
placeholder="请填写表名"
......
......@@ -29,10 +29,15 @@
overflow: visible;
}
.ant-table-cell {
overflow: visible;
}
.ant-form-item-explain {
position: absolute;
height: 35px;
width: 140px;
// width: 180px;
padding: 0 5px;
background-color: #ff4d4f;
top: -50px;
left: 50%;
......
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