king
2020-02-04 8d6f1d97f1f9d8c81313a2b27802be6426436518
src/templates/tableshare/verifycard/customscript/index.jsx
@@ -1,6 +1,6 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { Form, Row, Col, Input, Button } from 'antd'
import { Form, Row, Col, Input, Button, notification } from 'antd'
import './index.scss'
const { TextArea } = Input
@@ -33,6 +33,30 @@
      if (!err) {
        values.uuid = this.state.editItem ? this.state.editItem.uuid : ''
        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.scriptsChange(values)
        this.setState({
          editItem: null