From 8d6f1d97f1f9d8c81313a2b27802be6426436518 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 04 二月 2020 20:07:19 +0800 Subject: [PATCH] 2020-02-04 --- src/templates/tableshare/verifycard/customform/index.jsx | 30 +++++++++++++++++++++++++++++- 1 files changed, 29 insertions(+), 1 deletions(-) diff --git a/src/templates/tableshare/verifycard/customform/index.jsx b/src/templates/tableshare/verifycard/customform/index.jsx index 6ac9c2e..d13eb4c 100644 --- a/src/templates/tableshare/verifycard/customform/index.jsx +++ b/src/templates/tableshare/verifycard/customform/index.jsx @@ -1,6 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Select, Button } from 'antd' +import { Form, Row, Col, Input, Select, Button, notification } from 'antd' import './index.scss' const { TextArea } = Input @@ -36,6 +36,30 @@ if (!err) { values.uuid = this.state.editItem ? this.state.editItem.uuid : '' values.resultName = values.result === 'false' ? '涓嶅瓨鍦�' : '瀛樺湪' + + let _quot = values.sql.match(/'{1}/g) + let _lparen = values.sql.match(/\({1}/g) + let _rparen = values.sql.match(/\){1}/g) + + _quot = _quot ? _quot.length : 0 + _lparen = _lparen ? _lparen.length : 0 + _rparen = _rparen ? _rparen.length : 0 + + if (_quot % 2 !== 0) { + notification.warning({ + top: 92, + message: 'sql涓璡'蹇呴』鎴愬鍑虹幇', + duration: 10 + }) + return + } else if (_lparen !== _rparen) { + notification.warning({ + top: 92, + message: 'sql涓�()蹇呴』鎴愬鍑虹幇', + duration: 10 + }) + return + } this.props.customChange(values) this.setState({ @@ -108,6 +132,10 @@ { required: true, message: this.props.dict['form.required.input'] + '鎻愮ず淇℃伅!' + }, + { + pattern: /^[^']*$/ig, + message: '鎻愮ず淇℃伅涓嶅厑璁稿寘鍚玕'' } ] })(<Input placeholder="" autoComplete="off" />)} -- Gitblit v1.8.0