Commit 863630c9 authored by 涂伟's avatar 涂伟

fix: '维保模板SQL过滤规则优化'

parent 653dfdf1
Pipeline #67727 failed with stages
...@@ -726,35 +726,12 @@ const AddModal = props => { ...@@ -726,35 +726,12 @@ const AddModal = props => {
validator: (rule, value) => { validator: (rule, value) => {
let filterValue = form.getFieldsValue().filterCondition; let filterValue = form.getFieldsValue().filterCondition;
if (filterValue) { if (filterValue) {
let filterArr = [];
filterArr.push(filterValue.indexOf('+') != -1);
filterArr.push(filterValue.indexOf('=') != -1);
filterArr.push(filterValue.indexOf('-') != -1);
filterArr.push(filterValue.indexOf('*') != -1);
filterArr.push(filterValue.indexOf('/') != -1);
filterArr.push(filterValue.indexOf('>') != -1);
filterArr.push(filterValue.indexOf('<') != -1);
filterArr.push(filterValue.indexOf('!=') != -1);
filterArr.push(filterValue.indexOf('<=') != -1);
filterArr.push(filterValue.indexOf('>-') != -1);
// console.log(bb);
let re = /[`~,.<>;:”“‘’\/\[\]\、{}()_@$%^,。;?]/;
// console.log(re.test(aa));
if ( if (
filterValue.substring(0, 3) !== 'and' && filterValue.substring(0, 3) !== 'and' &&
filterValue.substring(0, 3) !== 'AND' filterValue.substring(0, 3) !== 'AND'
) { ) {
return Promise.reject('请以and开头'); return Promise.reject('请以and开头');
} }
if (filterArr.indexOf(true) == -1) {
return Promise.reject(
'支持英文模式下运算符(+、-、*、/、>、<、=、!=、<=、>=)',
);
}
// if (re.test(aa)) {
// return Promise.reject('禁止输入特殊字符');
// }
return Promise.resolve(); return Promise.resolve();
} }
return Promise.resolve(); return Promise.resolve();
...@@ -762,7 +739,7 @@ const AddModal = props => { ...@@ -762,7 +739,7 @@ const AddModal = props => {
}, },
]} ]}
> >
<TextArea placeholder="例如:and 泵房品牌='熊猫'" /> <TextArea placeholder="例如:and 泵房品牌='熊猫'(SQL表达式)" />
</Item> </Item>
</Col> </Col>
</Row> </Row>
......
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