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

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

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