king
2022-06-18 fe21d23b147ed5cec22b4f76a88840b05495d4ad
src/templates/zshare/verifycard/index.jsx
@@ -1,19 +1,26 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { fromJS } from 'immutable'
import { Form, Tabs, Row, Col, Radio, Button, Table, Select, Popconfirm, Icon, notification, Modal, message, InputNumber, Tooltip, Typography } from 'antd'
import { is, fromJS } from 'immutable'
import { Form, Tabs, Row, Col, Radio, Button, Select, Popconfirm, notification, Modal, message, InputNumber, Tooltip, Typography } from 'antd'
import { QuestionCircleOutlined, CheckCircleOutlined, StopOutlined, EditOutlined, SwapOutlined, DeleteOutlined, ExclamationOutlined, BorderOutlined } from '@ant-design/icons'
import Toast from 'antd-mobile/es/components/toast'
import Dialog from 'antd-mobile/es/components/dialog'
import moment from 'moment'
import Api from '@/api'
import Utils from '@/utils/utils.js'
import options from '@/store/options.js'
import UniqueForm from './uniqueform'
import ContrastForm from './contrastform'
import CustomForm from './customform'
import CustomScript from './customscript'
import CallBackCustomScript from './callbackcustomscript'
import BillcodeForm from './billcodeform'
import VoucherForm from './voucherform'
import asyncComponent from '@/utils/asyncComponent'
import { updateForm } from '@/utils/utils-update.js'
import MKEmitter from '@/utils/events.js'
import MinView from '@/assets/img/minview.png'
import './index.scss'
const { TabPane } = Tabs
@@ -32,7 +39,11 @@
  state = {
    initsql: '',            // sql验证时变量声明及赋值
    appType: sessionStorage.getItem('appType'),
    notes: [],              // 短信模板
    setting: null,
    visible: false,
    scriptId: '',
    verify: {},
    fields: [],
    usefulfields: '',
@@ -43,6 +54,8 @@
    voucherDetail: [],
    systemScripts: [],
    columnsFields: [],
    unionFields: [],
    uniqueFields: [],  // 唯一性验证,表单字段
    uniqueColumns: [
      {
        title: '名称',
@@ -60,7 +73,7 @@
      {
        title: '报错编码',
        dataIndex: 'errorCode',
        width: '12%',
        width: '13%',
        editable: true,
        inputType: 'select',
        options: [
@@ -73,7 +86,7 @@
      {
        title: '验证类型',
        dataIndex: 'verifyType',
        width: '13%',
        width: '14%',
        render: (text, record) => record.verifyType === 'logic' ? '逻辑验证' : '物理验证',
        inputType: 'select',
        editable: true,
@@ -85,21 +98,21 @@
      {
        title: '是否启用',
        dataIndex: 'status',
        width: '13%',
        width: '14%',
        editable: true,
        required: false,
        inputType: 'switch',
        render: (text, record) => record.status === 'false' ?
          (
            <div>
            <div style={{color: '#ff4d4f'}}>
              {this.props.dict['model.status.forbidden']}
              <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" />
              <StopOutlined style={{marginLeft: '5px'}} />
            </div>
          ) :
          (
            <div>
            <div style={{color: '#26C281'}}>
              {this.props.dict['model.status.open']}
              <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" />
              <CheckCircleOutlined style={{marginLeft: '5px'}}/>
            </div>
          )
      }
@@ -127,15 +140,15 @@
        inputType: 'switch',
        render: (text, record) => record.status === 'false' ?
          (
            <div>
            <div style={{color: '#ff4d4f'}}>
              {this.props.dict['model.status.forbidden']}
              <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" />
              <StopOutlined style={{marginLeft: '5px'}} />
            </div>
          ) :
          (
            <div>
            <div style={{color: '#26C281'}}>
              {this.props.dict['model.status.open']}
              <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" />
              <CheckCircleOutlined style={{marginLeft: '5px'}}/>
            </div>
          )
      },
@@ -201,15 +214,15 @@
        inputType: 'switch',
        render: (text, record) => record.status === 'false' ?
          (
            <div>
            <div style={{color: '#ff4d4f'}}>
              {this.props.dict['model.status.forbidden']}
              <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" />
              <StopOutlined style={{marginLeft: '5px'}} />
            </div>
          ) :
          (
            <div>
            <div style={{color: '#26C281'}}>
              {this.props.dict['model.status.open']}
              <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" />
              <CheckCircleOutlined style={{marginLeft: '5px'}}/>
            </div>
          )
      }
@@ -219,9 +232,18 @@
        title: 'SQL',
        dataIndex: 'sql',
        width: '45%',
        render: (text) => (
          <Paragraph copyable ellipsis={{ rows: 5, expandable: true }}>{text}</Paragraph>
        )
        render: (text) => {
          let title = text.match(/^\s*\/\*.+\*\//)
          title = title && title[0] ? title[0] : ''
          let _text = title ? text.replace(title, '') : text
          return (
            <div>
              {title ? <span style={{color: '#a50'}}>{title}<span style={{fontSize: '12px', marginLeft: '5px'}}>{_text.length}</span></span> : null}
              <Paragraph copyable={{ text: text }} ellipsis={{ rows: 4, expandable: true }}>{_text}</Paragraph>
            </div>
          )
        }
      },
      {
        title: '结果处理',
@@ -244,15 +266,15 @@
        width: '9%',
        render: (text, record) => record.status === 'false' ?
          (
            <div>
            <div style={{color: '#ff4d4f'}}>
              {this.props.dict['model.status.forbidden']}
              <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" />
              <StopOutlined style={{marginLeft: '5px'}} />
            </div>
          ) :
          (
            <div>
            <div style={{color: '#26C281'}}>
              {this.props.dict['model.status.open']}
              <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" />
              <CheckCircleOutlined style={{marginLeft: '5px'}}/>
            </div>
          )
      },
@@ -262,17 +284,15 @@
        width: '15%',
        dataIndex: 'operation',
        render: (text, record) =>
          (<div>
            <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'customverify')} style={{color: '#1890ff'}}><Icon type="edit" /></span>
            <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'customverify', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span>
            <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'customverify', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span>
            <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'customverify')} style={{color: '#8E44AD'}}><Icon type="swap" /></span>
          (<div style={{textAlign: 'center'}}>
            <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'customverify')} style={{color: '#1890ff'}}><EditOutlined /></span>
            <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'customverify')} style={{color: '#8E44AD'}}><SwapOutlined /></span>
            <Popconfirm
              overlayClassName="popover-confirm"
              title={this.props.dict['model.query.delete']}
              onConfirm={() => this.handleDelete(record, 'customverify')
            }>
              <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span>
              <span className="operation-btn" style={{color: '#ff4d4f'}}><DeleteOutlined /></span>
            </Popconfirm>
          </div>)
      }
@@ -282,9 +302,18 @@
        title: 'SQL',
        dataIndex: 'sql',
        width: '60%',
        render: (text) => (
          <Paragraph copyable ellipsis={{ rows: 5, expandable: true }}>{text}</Paragraph>
        )
        render: (text) => {
          let title = text.match(/^\s*\/\*.+\*\//)
          title = title && title[0] ? title[0] : ''
          let _text = title ? text.replace(title, '') : text
          return (
            <div>
              {title ? <span style={{color: '#a50'}}>{title}<span style={{fontSize: '12px', marginLeft: '5px'}}>{_text.length}</span></span> : null}
              <Paragraph copyable={{ text: text }} ellipsis={{ rows: 4, expandable: true }}>{_text}</Paragraph>
            </div>
          )
        }
      },
      {
        title: '执行位置',
@@ -292,11 +321,11 @@
        width: '10%',
        render: (text, record) => {
          if (record.position === 'init') {
            return '初始化'
            return <span style={{color: 'orange'}}>初始化</span>
          } else if (record.position === 'front') {
            return 'sql前'
            return <span style={{color: '#26C281'}}>sql前</span>
          } else {
            return 'sql后'
            return <span style={{color: '#1890ff'}}>sql后</span>
          }
        }
      },
@@ -306,15 +335,82 @@
        width: '10%',
        render: (text, record) => record.status === 'false' ?
          (
            <div>
            <div style={{color: '#ff4d4f'}}>
              {this.props.dict['model.status.forbidden']}
              <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" />
              <StopOutlined style={{marginLeft: '5px'}} />
            </div>
          ) :
          (
            <div>
            <div style={{color: '#26C281'}}>
              {this.props.dict['model.status.open']}
              <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" />
              <CheckCircleOutlined style={{marginLeft: '5px'}}/>
            </div>
          )
      },
      {
        title: '操作',
        align: 'center',
        width: '140px',
        dataIndex: 'operation',
        render: (text, record) =>
          (<div style={{textAlign: 'center'}}>
            <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'scripts')} style={{color: '#1890ff'}}><EditOutlined /></span>
            <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'scripts')} style={{color: '#8E44AD'}}><SwapOutlined /></span>
            <Popconfirm
              overlayClassName="popover-confirm"
              title={this.props.dict['model.query.delete']}
              onConfirm={() => this.handleDelete(record, 'scripts')
            }>
              <span className="operation-btn" style={{color: '#ff4d4f'}}><DeleteOutlined /></span>
            </Popconfirm>
          </div>)
      }
    ],
    cbScriptsColumns: [
      {
        title: 'SQL',
        dataIndex: 'sql',
        width: '60%',
        render: (text) => {
          let title = text.match(/^\s*\/\*.+\*\//)
          title = title && title[0] ? title[0] : ''
          let _text = title ? text.replace(title, '') : text
          return (
            <div>
              {title ? <span style={{color: '#a50'}}>{title}<span style={{fontSize: '12px', marginLeft: '5px'}}>{_text.length}</span></span> : null}
              <Paragraph copyable={{ text: text }} ellipsis={{ rows: 4, expandable: true }}>{_text}</Paragraph>
            </div>
          )
        }
      },
      {
        title: '执行位置',
        dataIndex: 'position',
        width: '10%',
        render: (text, record) => {
          if (record.position === 'front') {
            return <span style={{color: '#26C281'}}>sql前</span>
          } else {
            return <span style={{color: '#1890ff'}}>sql后</span>
          }
        }
      },
      {
        title: '状态',
        dataIndex: 'status',
        width: '10%',
        render: (text, record) => record.status === 'false' ?
          (
            <div style={{color: '#ff4d4f'}}>
              {this.props.dict['model.status.forbidden']}
              <StopOutlined style={{marginLeft: '5px'}} />
            </div>
          ) :
          (
            <div style={{color: '#26C281'}}>
              {this.props.dict['model.status.open']}
              <CheckCircleOutlined style={{marginLeft: '5px'}}/>
            </div>
          )
      },
@@ -324,17 +420,15 @@
        width: '20%',
        dataIndex: 'operation',
        render: (text, record) =>
          (<div>
            <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'scripts')} style={{color: '#1890ff'}}><Icon type="edit" /></span>
            <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'scripts', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span>
            <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'scripts', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span>
            <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'scripts')} style={{color: '#8E44AD'}}><Icon type="swap" /></span>
          (<div style={{textAlign: 'center'}}>
            <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'cbscripts')} style={{color: '#1890ff'}}><EditOutlined /></span>
            <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'cbscripts')} style={{color: '#8E44AD'}}><SwapOutlined /></span>
            <Popconfirm
              overlayClassName="popover-confirm"
              title={this.props.dict['model.query.delete']}
              onConfirm={() => this.handleDelete(record, 'scripts')
              onConfirm={() => this.handleDelete(record, 'cbscripts')
            }>
              <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span>
              <span className="operation-btn" style={{color: '#ff4d4f'}}><DeleteOutlined /></span>
            </Popconfirm>
          </div>)
      }
@@ -382,18 +476,18 @@
          let _type = record.Type
          if (_type && typeof(_type) === 'string') {
            _type = parseInt(_type)
          } else {
          } else if (!_type) {
            _type = 4
          }
          if (record.TypeCharOne === 'n') {
            _text = record.ModularDetailCode + Array(_type).join('0') + '1'
          } else if (record.TypeCharOne === 'Y') {
            _text = record.ModularDetailCode + moment().format('YYYYMMDD') + Array(_type).join('0') + '1'
            _text = record.ModularDetailCode + moment().format('YYMMDD') + Array(_type).join('0') + '1'
          } else if (record.TypeCharOne === 'Lp') {
            _text = Array(_type).join('0') + '10'
          } else if (record.TypeCharOne === 'BN') {
            _text = moment().format('YYYYMMDD') + Array(_type).join('0') + '1'
            _text = moment().format('YYMMDD') + Array(_type).join('0') + '1'
          }
          return _text
        }
@@ -409,15 +503,15 @@
        width: '8%',
        render: (text, record) => record.status === 'false' ?
          (
            <div>
            <div style={{color: '#ff4d4f'}}>
              {this.props.dict['model.status.forbidden']}
              <Icon style={{marginLeft: '5px'}} type="stop" theme="twoTone" twoToneColor="#ff4d4f" />
              <StopOutlined style={{marginLeft: '5px'}} />
            </div>
          ) :
          (
            <div>
            <div style={{color: '#26C281'}}>
              {this.props.dict['model.status.open']}
              <Icon style={{marginLeft: '5px'}} type="check-circle" theme="twoTone" twoToneColor="#52c41a" />
              <CheckCircleOutlined style={{marginLeft: '5px'}}/>
            </div>
          )
      },
@@ -427,17 +521,15 @@
        width: '15%',
        dataIndex: 'operation',
        render: (text, record) =>
          (<div>
            <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'ordercode')} style={{color: '#1890ff'}}><Icon type="edit" /></span>
            <span className="operation-btn" title={this.props.dict['header.form.up']} onClick={() => this.handleUpDown(record, 'ordercode', 'up')} style={{color: '#1890ff'}}><Icon type="arrow-up" /></span>
            <span className="operation-btn" title={this.props.dict['header.form.down']} onClick={() => this.handleUpDown(record, 'ordercode', 'down')} style={{color: '#ff4d4f'}}><Icon type="arrow-down" /></span>
            <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'ordercode')} style={{color: '#8E44AD'}}><Icon type="swap" /></span>
          (<div style={{textAlign: 'center'}}>
            <span className="operation-btn" title={this.props.dict['model.edit']} onClick={() => this.handleEdit(record, 'ordercode')} style={{color: '#1890ff'}}><EditOutlined /></span>
            <span className="operation-btn" title={this.props.dict['header.form.status.change']} onClick={() => this.handleStatus(record, 'ordercode')} style={{color: '#8E44AD'}}><SwapOutlined /></span>
            <Popconfirm
              overlayClassName="popover-confirm"
              title={this.props.dict['model.query.delete']}
              onConfirm={() => this.handleDelete(record, 'ordercode')
            }>
              <span className="operation-btn" style={{color: '#ff4d4f'}}><Icon type="delete" /></span>
              <span className="operation-btn" style={{color: '#ff4d4f'}}><DeleteOutlined /></span>
            </Popconfirm>
          </div>)
      }
@@ -446,7 +538,7 @@
  UNSAFE_componentWillMount() {
    const { columns, config, card, btnTab } = this.props
    let _verify = card.verify || {}
    let _verify = fromJS(card.verify || {}).toJS()
    let _invalid = _verify.invalid
@@ -465,30 +557,65 @@
    _verify.uniques = _verify.uniques || []
    _verify.contrasts = _verify.contrasts || []
    _verify.accountdate = _verify.accountdate || 'false'
    _verify.accountfield = _verify.accountfield || ''
    _verify.voucherdate = _verify.voucherdate || ''
    _verify.customverifys = _verify.customverifys || []
    _verify.billcodes = _verify.billcodes || []
    _verify.voucher = _verify.voucher || {enabled: false}
    _verify.scripts = _verify.scripts || []
    _verify.cbScripts = _verify.cbScripts || []
    if (window.GLOB.funcs && window.GLOB.funcs.length > 0) {
      window.GLOB.funcs.forEach(m => {
        let reg = new RegExp(`\\/\\*\\$ex@${m.func_code}-begin\\*\\/[\\s\\S]+\\/\\*@ex\\$-end\\*\\/`, 'ig')
        _verify.customverifys.forEach(item => {
          item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`)
        })
        _verify.scripts.forEach(item => {
          item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`)
        })
        _verify.cbScripts.forEach(item => {
          item.sql = item.sql.replace(reg, `$ex@${m.func_code}@ex$`)
        })
      })
    }
    _verify.customverifys.forEach((item, i) => {
      item.$index = i + 1
    })
    _verify.scripts.forEach((item, i) => {
      item.$index = i + 1
    })
    _verify.cbScripts.forEach((item, i) => {
      item.$index = i + 1
    })
    this.setState({
      verify: _verify
      setting: config.setting || {},
      verify: _verify,
      oriVerify: fromJS(_verify).toJS()
    })
    if (config.Template !== 'FormTab' && (card.intertype === 'inner' || card.intertype === 'outer')) { // 内部或外部接口
      return
    }
    new Promise(resolve => {
      let _fields = []
      if (config.Template === 'FormTab') {
      if (card.OpenType === 'form') {
        _fields.push({
          field: card.field,
          label: card.label,
          type: 'text'
        })
        resolve(_fields)
      } else if (config.Template === 'FormTab') {
        config.groups.forEach(group => {
          _fields.push(...group.sublist)
        })
        resolve(_fields)
      } else if (card.modal) {
        if (card.modal.groups && card.modal.groups.length > 0) {
          card.modal.groups.forEach(group => {
            _fields.push(...group.sublist)
          })
        } else {
          _fields = card.modal.fields || []
        }
        _fields = card.modal.fields || []
        resolve(_fields)
      } else if (card.OpenType === 'pop') {
        Api.getSystemConfig({
@@ -507,19 +634,10 @@
            }
            
            if (!_LongParam) {
              notification.warning({
                top: 92,
                message: '未获取到表单信息,部分验证将无法设置!',
                duration: 5
              })
              message.warning('未获取到表单信息,部分验证将无法设置!')
            } else {
              if (_LongParam.groups.length > 0) {
                _LongParam.groups.forEach(group => {
                  _fields.push(...group.sublist)
                })
              } else {
                _fields = _LongParam.fields || []
              }
              _LongParam = updateForm(_LongParam)
              _fields = _LongParam.fields || []
            }
          } else {
            notification.warning({
@@ -534,14 +652,20 @@
        resolve(_fields)
      }
    }).then(_fields => {
      let _usefulfields = ['BID', 'ID', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', 'UserName', 'FullName', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'ModularDetailCode']
      let _declare = ['@UserName nvarchar(50)', '@FullName nvarchar(50)', '@ErrorCode nvarchar(50)', '@retmsg nvarchar(4000)', '@BillCode nvarchar(50)', '@BVoucher nvarchar(50)', '@FIBVoucherDate nvarchar(50)', '@FiYear nvarchar(50)', '@ModularDetailCode nvarchar(50)']
      let _select = ['@UserName=\'\'', '@FullName=\'\'', '@ErrorCode=\'\'', '@retmsg=\'\'', '@BillCode=\'\'', '@BVoucher=\'\'', '@FIBVoucherDate=\'\'', '@FiYear=\'\'', '@ModularDetailCode=\'\'']
      let _usefulfields = ['UserName', 'FullName', 'RoleID', 'mk_departmentcode', 'mk_organization', 'login_city', 'BillCode', 'BVoucher', 'FIBVoucherDate', 'FiYear', 'ModularDetailCode']
      let _declare = ['@UserName nvarchar(50)', '@FullName nvarchar(50)', '@RoleID nvarchar(512)', '@mk_departmentcode nvarchar(50)', '@mk_organization nvarchar(50)', '@login_city nvarchar(50)', '@ErrorCode nvarchar(50)', '@retmsg nvarchar(4000)', '@BillCode nvarchar(50)', '@BVoucher nvarchar(50)', '@FIBVoucherDate nvarchar(50)', '@FiYear nvarchar(50)', '@ModularDetailCode nvarchar(50)', '@bid nvarchar(50)']
      let _select = ['@UserName=\'\'', '@FullName=\'\'', '@RoleID=\'\'', '@mk_departmentcode=\'\'', '@mk_organization=\'\'', '@login_city=\'\'', '@ErrorCode=\'\'', '@retmsg=\'\'', '@BillCode=\'\'', '@BVoucher=\'\'', '@FIBVoucherDate=\'\'', '@FiYear=\'\'', '@ModularDetailCode=\'\'', '@bid=\'\'']
      let fieldArr = _usefulfields.map(_f => _f.toLowerCase())
      let hasBid = false
      fieldArr.push('bid')
      _fields = _fields.filter(_f => _f.field)
      _fields.forEach(_f => {
        if (_f.field.toLowerCase() === 'bid') {
          hasBid = true
        }
        if (fieldArr.includes(_f.field.toLowerCase())) return
        fieldArr.push(_f.field.toLowerCase())
@@ -562,26 +686,25 @@
        if (_f.type.match(/date/ig)) {
          _type = 'datetime'
          _select.push(`@${_f.field}='1900-01-01'`)
          _select.push(`@${_f.field}='1949-10-01'`)
        } else if (_f.type === 'number') {
          _type = `decimal(18,${_fieldlen})`
          _select.push(`@${_f.field}=0`)
        } else if (_f.type === 'rate') {
          _type = `decimal(18,2)`
          _select.push(`@${_f.field}=0`)
        } else {
          _select.push(`@${_f.field}=''`)
        }
        _declare.push(`@${_f.field} ${_type}`)
        if (_f.field.toLowerCase() === 'bid') {
          hasBid = true
        }
      })
      if (!hasBid && (card.sqlType === 'insert' || card.sqlType === 'insertOrUpdate')) { // 表单中增加BID
      let uniqueFields = fromJS(_fields).toJS()
      if (!hasBid) { // 唯一性验证添加BID
        uniqueFields.unshift({ uuid: 'BID', field: 'BID', label: 'BID', type: 'text' })
        _fields.unshift({ uuid: 'BID', field: 'BID', label: 'BID', type: 'text' })
        fieldArr.push('bid')
        _declare.push(`@bid nvarchar(50)`)
        _select.push(`@bid=''`)
      }
      let hasColumn = false
@@ -595,12 +718,18 @@
        }
      }
      let unionFields = fromJS(_fields).toJS()
      let formArr = _fields.map(_f => _f.field.toLowerCase())
      if (hasColumn) {
        columns.forEach(_f => {
          if (_f.field && !formArr.includes(_f.field.toLowerCase())) {
            formArr.push(_f.field.toLowerCase())
            unionFields.push(_f)
          }
          if (!_f.field || fieldArr.includes(_f.field.toLowerCase())) return
          fieldArr.push(_f.field.toLowerCase())
          _usefulfields.push(_f.field)
          if (_f.datatype) { // 自定义字段
@@ -697,7 +826,11 @@
          if (!item.field || item.writein === 'false') return
          _arr.push(item.field.toLowerCase())
          _form.push(item.field + '=@' + item.field)
          if (item.field.toLowerCase() === 'bid' && item.uuid === 'BID') {
            _form.push(item.field + '=@BID@')
          } else {
            _form.push(item.field + '=@' + item.field)
          }
        })
        if (this.props.card.sqlType === 'audit') {
@@ -707,9 +840,15 @@
          if (!_arr.includes('submituserid')) {
            _form.push('submituserid=@userid@')
          }
          if (!_arr.includes('submituser')) {
            _form.push('submituser=@username')
          }
        } else {
          if (!_arr.includes('modifydate')) {
            _form.push('modifydate=getdate()')
          }
          if (!_arr.includes('modifyuser')) {
            _form.push('modifyuser=@username')
          }
          if (!_arr.includes('modifyuserid')) {
            _form.push('modifyuserid=@userid@')
@@ -729,7 +868,7 @@
        }
        _form = _form.join(', ')
        _updatesql = `update ${card.sql} set ${_form} where ${config.setting.primaryKey}${card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID  from dbo.SplitComma(@ID@))'};`
        _updatesql = `update ${card.sql} set ${_form} where ${config.setting.primaryKey || 'id'}${card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID  from dbo.SplitComma(@ID@))'};`
      }
      if (card.sqlType === 'insert') {
@@ -738,7 +877,7 @@
        _defaultsql = _updatesql
      } else if (card.sqlType === 'insertOrUpdate') {
        _defaultsql += `select @tbid=''
          select @tbid='X' from ${card.sql} where ${config.setting.primaryKey}=@ID@
          select @tbid='X' from ${card.sql} where ${config.setting.primaryKey || 'id'}=@ID@
          if @tbid=''
            begin
            ${_insertsql}
@@ -749,7 +888,11 @@
            end
        `
      } else if (card.sqlType === 'LogicDelete' || card.sqlType === 'custom') {
        _defaultsql = `update ${card.sql} set deleted=1,modifydate=getdate(),modifyuserid=@userid@ where ${config.setting.primaryKey}${card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID  from dbo.SplitComma(@ID@))'};`
        let _voucher = ''
        if (_verify.voucher && _verify.voucher.enabled) {
          _voucher = ',BVoucher=@BVoucher,FIBVoucherDate=@FIBVoucherDate,FiYear=@FiYear'
        }
        _defaultsql = `update ${card.sql} set deleted=1,modifydate=getdate(),modifyuser=@username,modifyuserid=@userid@${_voucher} where ${config.setting.primaryKey || 'id'}${card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID  from dbo.SplitComma(@ID@))'};`
      } else if (card.sqlType === 'delete') {
        let _msg = ''
        if (columns && columns.length > 0 && card.Ot !== 'notRequired' && card.Ot !== 'requiredOnce') {
@@ -761,7 +904,7 @@
            _index++
          })
        }
        _defaultsql += `insert into snote (remark,createuserid,CreateUser,CreateStaff) select left('删除表:${card.sql} 数据: ${_msg}${config.setting.primaryKey}='+@ID@,200),@userid@,@username,@fullname delete ${card.sql} where ${config.setting.primaryKey}${card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID  from dbo.SplitComma(@ID@))'};`
        _defaultsql += `insert into snote (remark,createuserid,CreateUser,CreateStaff) select left('删除表:${card.sql} 数据: ${_msg}${config.setting.primaryKey || 'id'}='+@ID@,200),@userid@,@username,@fullname delete ${card.sql} where ${config.setting.primaryKey}${card.Ot !== 'requiredOnce' ? '=@ID@' : ' in (select ID  from dbo.SplitComma(@ID@))'};`
      }
      let _columns = []
@@ -769,7 +912,7 @@
        _columns = fromJS(columns).toJS()
        let hasbid = false
        _columns = _columns.filter(col => {
          if (col.field.toLowerCase() === 'bid') {
          if (col.field && col.field.toLowerCase() === 'bid') {
            hasbid = true
          }
@@ -786,10 +929,10 @@
        columnsFields: _columns,
        initsql: _sql,
        defaultsql: _defaultsql,
        usefulfields: _usefulfields.join(', '),
        usefulfields: ['BID', 'ID', 'LoginUID', 'SessionUid', 'UserID', 'Appkey', ..._usefulfields].join(', '),
        uniqueColumns: this.state.uniqueColumns.map(col => {
          if (col.dataIndex === 'field') {
            col.options = _fields
            col.options = uniqueFields
          }
          return col
        }),
@@ -798,7 +941,9 @@
            col.options = _columns
          }
          return col
        })
        }),
        unionFields,
        uniqueFields
      })
    })
  }
@@ -813,22 +958,28 @@
      {
        obj_name: 'modularDetail',
        arr_field: 'ModularDetailCode,CodeName,BID,Type',
        LText: window.btoa(window.encodeURIComponent(`select distinct ModularDetailCode,ModularDetailCode+ModularDetailName as CodeName,ModularCode as BID,Type from sModularDetail where Deleted=0 and Appkey=case when Appkey='' then '' else @Appkey@ end order by ModularDetailCode`))
        LText: window.btoa(window.encodeURIComponent(`select distinct ModularDetailCode,ModularDetailCode+ModularDetailName as CodeName,ModularCode as BID,Type from sModularDetail where Appkey= @Appkey@ and deleted=0 order by ModularDetailCode desc`))
      },
      {
        obj_name: 'voucher',
        arr_field: 'ID,NameNO,TypeCharOne',
        LText: window.btoa(window.encodeURIComponent('select distinct ModularCode as ID,ModularCode+ModularName+ModularNo as NameNO,TypeCharOne from sModular where deleted=0  and Appkey=case when Appkey=\'\' then \'\' else @Appkey@ end  order by ModularCode'))
        LText: window.btoa(window.encodeURIComponent(`select distinct ModularCode as ID,ModularCode+ModularName+ModularNo as NameNO,TypeCharOne from sModular where deleted=0  and Appkey=case when Appkey='' then '' else @Appkey@ end  order by ModularCode`))
      },
      {
        obj_name: 'voucherDetail',
        arr_field: 'ModularDetailCode,CodeName,BID,VoucherTypeTwo,IDefine1',
        LText: window.btoa(window.encodeURIComponent('select distinct ModularDetailCode,ModularDetailCode+ModularDetailName as CodeName,ModularCode as BID, VoucherTypeTwo, IDefine1 from sModularDetail where Deleted=0 and VoucherTypeTwo!=\'\' and Appkey=case when Appkey=\'\' then \'\' else @Appkey@ end  order by ModularDetailCode'))
        LText: window.btoa(window.encodeURIComponent(`select distinct ModularDetailCode,ModularDetailCode+ModularDetailName as CodeName,ModularCode as BID, VoucherTypeTwo, IDefine1 from sModularDetail where Deleted=0 and VoucherTypeTwo!=''
          and Appkey=@Appkey@ union
          select distinct a.ModularDetailCode,a.ModularDetailCode+ModularDetailName as CodeName,ModularCode as BID, VoucherTypeTwo, IDefine1
          from (select * from sModularDetail where Deleted=0 and VoucherTypeTwo!='' and Appkey='') a
          left join (select distinct ModularDetailCode from sModularDetail where Deleted=0 and VoucherTypeTwo!=''
          and Appkey=@Appkey@) m on a.ModularDetailCode=m.ModularDetailCode where m.ModularDetailCode is null order by ModularDetailCode desc`
        ))
      },
      {
        obj_name: 'noteCodes',
        arr_field: 'templatecode,describe',
        LText: window.btoa(window.encodeURIComponent(`select templatecode,'['+SignName+']'+describe as describe from (select * from bd_msn_sms_temp where  deleted=0 and TypeDesc='QX' and status=20 ) t inner join (select openid from susers where uid=@userid@) u on t.openid =t.openid`))
        arr_field: 'templatecode,describe,id',
        LText: window.btoa(window.encodeURIComponent(`select t.id,templatecode,'['+SignName+']'+describe as describe from (select * from bd_msn_sms_temp where  deleted=0 and TypeDesc='QX' and status=20 ) t inner join (select openid from susers where uid=@userid@) u on t.openid =t.openid`))
      },
      {
        obj_name: 'scripts',
@@ -852,7 +1003,13 @@
    mutilparam.secretkey = Utils.encrypt(mutilparam.LText, mutilparam.timestamp)
    mutilparam.open_key = Utils.encryptOpenKey(mutilparam.secretkey, mutilparam.timestamp)
    Api.getCloudCacheConfig(mutilparam).then(res => {
    if (options.cloudServiceApi) { // 云端请求
      mutilparam.rduri = options.cloudServiceApi
      mutilparam.userid = sessionStorage.getItem('CloudUserID') || ''
      mutilparam.LoginUID = sessionStorage.getItem('CloudLoginUID') || ''
    }
    Api.getSystemCacheConfig(mutilparam).then(res => {
      if (res.status) {
        this.setState({
          orderModular: res.modular,
@@ -862,13 +1019,14 @@
          notes: res.noteCodes.map(item => {
            return {
              name: item.describe,
              value: item.templatecode
              value: item.templatecode,
              id: item.id
            }
          }),
          systemScripts: res.scripts.map(item => {
            return {
              name: item.funcname,
              value: Utils.UnformatOptions(item.longparam)
              value: window.decodeURIComponent(window.atob(item.longparam))
            }
          })
        })
@@ -946,6 +1104,27 @@
      verify.scripts.push(values)
    }
    MKEmitter.emit('editLineId', values.uuid)
    this.setState({ verify })
  }
  cbScriptsChange = (values) => {
    let verify = fromJS(this.state.verify).toJS()
    if (values.uuid) {
      verify.cbScripts = verify.cbScripts.map(item => {
        if (item.uuid === values.uuid) {
          return values
        } else {
          return item
        }
      })
    } else {
      values.uuid = Utils.getuuid()
      verify.cbScripts.push(values)
    }
    this.setState({ verify })
  }
@@ -968,11 +1147,11 @@
    this.setState({ verify })
  }
  onNoteCodeChange = (val) => {
  onNoteCodeChange = (val, option) => {
    const { verify } = this.state
    this.setState({
      verify: {...verify, noteCode: val}
      verify: {...verify, noteCode: val, noteId: option.props.id}
    })
  }
@@ -985,6 +1164,22 @@
    })
  }
  changeAccField = (val) => {
    const { verify } = this.state
    this.setState({
      verify: {...verify, accountfield: val}
    })
  }
  changeAccDate = (val) => {
    const { verify } = this.state
    this.setState({
      verify: {...verify, voucherdate: val}
    })
  }
  handleDelete = (record, type) => {
    const { verify } = this.state
@@ -994,6 +1189,8 @@
      verify.billcodes = verify.billcodes.filter(item => item.uuid !== record.uuid)
    } else if (type === 'scripts') {
      verify.scripts = verify.scripts.filter(item => item.uuid !== record.uuid)
    } else if (type === 'cbscripts') {
      verify.cbScripts = verify.cbScripts.filter(item => item.uuid !== record.uuid)
    }
    this.setState({ verify })
@@ -1006,6 +1203,8 @@
      this.orderForm.edit(record)
    } else if (type === 'scripts') {
      this.scriptsForm.edit(record)
    } else if (type === 'cbscripts') {
      this.cbscriptsForm.edit(record)
    }
    let node = document.getElementById('verify-card-box-tab').parentNode
@@ -1052,66 +1251,14 @@
          return item
        }
      })
    }
    this.setState({ verify })
  }
  handleUpDown = (record, type, direction) => {
    let verify = fromJS(this.state.verify).toJS()
    let index = 0
    if (type === 'customverify') {
      verify.customverifys = verify.customverifys.filter((item, i) => {
    } else if (type === 'cbscripts') {
      verify.cbScripts = verify.cbScripts.map(item => {
        if (item.uuid === record.uuid) {
          index = i
          return record
        } else {
          return item
        }
        return item.uuid !== record.uuid
      })
      if ((index === 0 && direction === 'up') || (index === verify.customverifys.length && direction === 'down')) {
        return
      }
      if (direction === 'up') {
        verify.customverifys.splice(index - 1, 0, record)
      } else {
        verify.customverifys.splice(index + 1, 0, record)
      }
    } else if (type === 'ordercode') {
      verify.billcodes = verify.billcodes.filter((item, i) => {
        if (item.uuid === record.uuid) {
          index = i
        }
        return item.uuid !== record.uuid
      })
      if ((index === 0 && direction === 'up') || (index === verify.billcodes.length && direction === 'down')) {
        return
      }
      if (direction === 'up') {
        verify.billcodes.splice(index - 1, 0, record)
      } else {
        verify.billcodes.splice(index + 1, 0, record)
      }
    } else if (type === 'scripts') {
      verify.scripts = verify.scripts.filter((item, i) => {
        if (item.uuid === record.uuid) {
          index = i
        }
        return item.uuid !== record.uuid
      })
      if ((index === 0 && direction === 'up') || (index === verify.scripts.length && direction === 'down')) {
        return
      }
      if (direction === 'up') {
        verify.scripts.splice(index - 1, 0, record)
      } else {
        verify.scripts.splice(index + 1, 0, record)
      }
    }
    this.setState({ verify })
@@ -1129,35 +1276,66 @@
  }
  showError = (errorType) => {
    const { verify, appType } = this.state
    if (errorType === 'S') {
      notification.success({
        top: 92,
        message: '执行成功!',
        duration: 2
      })
      let time = verify.stime || 2
      if (appType === 'mob') {
        Toast.show({ icon: 'success', content: '执行成功!', duration: time * 1000 })
      } else {
        notification.success({
          top: 92,
          message: '执行成功!',
          duration: time
        })
      }
    } else if (errorType === 'Y') {
      Modal.success({
        title: '执行成功!'
      })
      if (appType === 'mob') {
        Dialog.alert({content: '执行成功!', confirmText: '知道了'})
      } else {
        Modal.success({
          title: '执行成功!'
        })
      }
    } else if (errorType === 'F') {
      notification.error({
        className: 'notification-custom-error',
        top: 92,
        message: '执行失败!',
        duration: 10
      })
      if (appType === 'mob') {
        let time = verify.ftime || 3
        Toast.show({ icon: 'fail', content: '执行失败!', duration: time * 1000 })
      } else {
        notification.error({
          className: 'notification-custom-error',
          top: 92,
          message: '执行失败!',
          duration: verify.ftime || 10
        })
      }
    } else if (errorType === 'N') {
      notification.error({
        top: 92,
        message: '执行失败!',
        duration: 10
      })
      if (appType === 'mob') {
        let time = verify.ntime || 3
        Toast.show({ content: '执行失败!', duration: time * 1000 })
      } else {
        notification.error({
          top: 92,
          message: '执行失败!',
          duration: verify.ntime || 10
        })
      }
    } else if (errorType === 'E') {
      Modal.error({
        title: '执行失败!'
      })
      if (appType === 'mob') {
        Dialog.alert({content: '执行失败!', confirmText: '知道了'})
      } else {
        Modal.error({
          title: '执行失败!'
        })
      }
    } else if (errorType === 'NM') {
      message.error('执行失败!')
      if (appType === 'mob') {
        let time = verify.ntime || 3
        Toast.show({ content: '执行失败!', duration: time * 1000 })
      } else {
        message.error('执行失败!')
      }
    }
  }
@@ -1205,32 +1383,45 @@
  handleConfirm = () => {
    const { card } = this.props
    const { setting } = this.state
    let verify = fromJS(this.state.verify).toJS()
    
    // 表单提交时检查输入值是否正确
    return new Promise((resolve, reject) => {
      if (card.sqlType !== 'custom' && verify.default === 'false' && verify.scripts.length === 0) {
      if ((card.sqlType === 'custom' || verify.default === 'false') && verify.scripts.length === 0) {
        notification.warning({
          top: 92,
          message: '不执行默认sql时,必须设置自定义脚本!',
          duration: 5
        })
        return
      } else if (verify.accountdate === 'true' && !verify.accountfield) {
        notification.warning({
          top: 92,
          message: '开启账期时,需要选择验证公司!',
          duration: 5
        })
        return
      } else if (verify.invalid === 'true' && setting.maxScript && setting.maxScript >= 300) {
        notification.warning({
          top: 92,
          message: '数据源中自定义脚本过于复杂,不能使用失效验证!',
          duration: 5
        })
        return
      }
      let _loading = false
      let msg = ''
      if (this.customForm && this.customForm.state.editItem) {
        _loading = true
        msg = '自定义验证'
      } else if (this.customForm && this.customForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.customForm.props.form.getFieldValue('sql'))) {
        msg = '自定义验证'
      } else if (this.orderForm && this.orderForm.state.editItem) {
        _loading = true
        msg = '单号生成'
      } else if (this.scriptsForm && this.scriptsForm.state.editItem) {
        _loading = true
      }
      if (this.scriptsForm && this.scriptsForm.props.form.getFieldValue('sql') && this.scriptsForm.props.form.getFieldValue('sql') !== ' ') {
        _loading = true
      } else if (this.customForm && this.customForm.props.form.getFieldValue('sql') && this.customForm.props.form.getFieldValue('sql') !== ' ') {
        _loading = true
        msg = '自定义脚本'
      } else if (this.scriptsForm && this.scriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.scriptsForm.props.form.getFieldValue('sql'))) {
        msg = '自定义脚本'
      }
      if (verify.noteEnable === 'true' && !verify.noteCode) { // 开启短信时,需要模板编码
@@ -1239,9 +1430,24 @@
        verify.noteCode = ''
      }
      if (_loading) {
      if (window.GLOB.funcs && window.GLOB.funcs.length > 0) {
        window.GLOB.funcs.forEach(m => {
          let reg = new RegExp('\\$ex@' + m.func_code + '@ex\\$', 'ig')
          verify.customverifys.forEach(item => {
            item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`)
          })
          verify.scripts.forEach(item => {
            item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`)
          })
          verify.cbScripts.forEach(item => {
            item.sql = item.sql.replace(reg, `/*$ex@${m.func_code}-begin*/\n${m.key_sql}\n/*@ex$-end*/`)
          })
        })
      }
      if (msg) {
        confirm({
          content: `存在未保存项,确定提交吗?`,
          content: msg + '未保存,确定提交吗?',
          onOk() {
            resolve(verify)
          },
@@ -1249,6 +1455,24 @@
        })
      } else {
        resolve(verify)
      }
    })
  }
  handleCancel = () => {
    const { verify, oriVerify } = this.state
    // 表单提交时检查输入值是否正确
    return new Promise((resolve, reject) => {
      if (!is(fromJS(verify), fromJS(oriVerify))) {
        confirm({
          content: '验证信息已修改,确定取消吗?',
          onOk() {
            resolve()
          },
          onCancel() {}
        })
      } else {
        resolve()
      }
    })
  }
@@ -1264,7 +1488,7 @@
  render() {
    const { card } = this.props
    const { verify, fields, uniqueColumns, onceUniqueColumns, columnsFields, contrastColumns, customColumns, orderColumns, scriptsColumns, orderModular, orderModularDetail, voucher, voucherDetail, notes } = this.state
    const { verify, fields, visible, uniqueFields, uniqueColumns, unionFields, onceUniqueColumns, columnsFields, contrastColumns, customColumns, orderColumns, scriptsColumns, cbScriptsColumns, orderModular, orderModularDetail, voucher, voucherDetail, notes, appType } = this.state
    const formItemLayout = {
      labelCol: {
        xs: { span: 24 },
@@ -1278,14 +1502,19 @@
    return (
      <div id="verify-card-box-tab">
        {card.intertype === 'system' ? <Tabs defaultActiveKey="1" className="verify-card-box">
          <TabPane tab="基础验证" key="1">
        <Tabs defaultActiveKey="1" className="verify-card-box">
          {card.intertype === 'system' || (card.intertype === 'custom' && card.procMode === 'system') ? <TabPane tab={
            <span>
              基础验证
              {verify.default === 'false' ? <span className="count-tip"><ExclamationOutlined style={{color: 'orange'}}/></span> : null}
            </span>
          } key="1">
            <Form {...formItemLayout}>
              <Row gutter={24}>
                {this.props.card.sqlType !== 'custom' ? <Col span={8}>
                  <Form.Item label={
                    <Tooltip placement="bottomLeft" title={'默认sql执行顺序为自定义脚本之前'}>
                      <Icon type="question-circle" style={{color: '#c49f47', marginRight: '5px'}} />
                      <QuestionCircleOutlined className="mk-form-tip" />
                      默认sql
                    </Tooltip>
                  }>
@@ -1303,6 +1532,33 @@
                    </Radio.Group>
                  </Form.Item>
                </Col>
                {verify.accountdate === 'true' ? <Col span={8}>
                  <Form.Item label={'验证公司'} required>
                    <Select defaultValue={verify.accountfield || ''} onChange={this.changeAccField}>
                      {unionFields.map(option =>
                        <Select.Option key={option.uuid} value={option.field}>
                          {option.label}
                        </Select.Option>
                      )}
                    </Select>
                  </Form.Item>
                </Col> : null}
                {verify.accountdate === 'true' ? <Col span={8}>
                  <Form.Item label={
                    <Tooltip placement="bottomLeft" title={'验证日期为空时,默认为当天。'}>
                      <QuestionCircleOutlined className="mk-form-tip" />
                      验证日期
                    </Tooltip>
                  }>
                    <Select allowClear defaultValue={verify.voucherdate || ''} onChange={this.changeAccDate}>
                      {unionFields.map(option =>
                        <Select.Option key={option.uuid} value={option.field}>
                          {option.label}
                        </Select.Option>
                      )}
                    </Select>
                  </Form.Item>
                </Col> : null}
                <Col span={8}>
                  <Form.Item label={'失效验证'}>
                    <Radio.Group value={verify.invalid} onChange={(e) => {this.onOptionChange(e, 'invalid')}}>
@@ -1314,7 +1570,7 @@
                <Col span={8}>
                  <Form.Item label={
                    <Tooltip placement="bottomLeft" title={'选择发送短信时,需完善短信设置。'}>
                      <Icon type="question-circle" style={{color: '#c49f47', marginRight: '5px'}} />
                      <QuestionCircleOutlined className="mk-form-tip" />
                      发送短信
                    </Tooltip>
                  }>
@@ -1328,7 +1584,7 @@
                  <Form.Item label="短信模板">
                    <Select value={verify.noteCode} onSelect={this.onNoteCodeChange}>
                      {notes.map(option =>
                        <Select.Option key={option.value} value={option.value}>
                        <Select.Option key={option.value} id={option.id} value={option.value}>
                          {option.name}
                        </Select.Option>
                      )}
@@ -1338,7 +1594,7 @@
                {verify.noteEnable === 'true' ? <Col span={8}>
                  <Form.Item label={
                    <Tooltip placement="bottomLeft" title={'实时发送最多同时发送5个用户,定时发送最多同时发送100个用户。'}>
                      <Icon type="question-circle" style={{color: '#c49f47', marginRight: '5px'}} />
                      <QuestionCircleOutlined className="mk-form-tip" />
                      发送方式
                    </Tooltip>
                  }>
@@ -1358,17 +1614,17 @@
                </Col> : null}
              </Row>
            </Form>
          </TabPane>
          <TabPane tab={
          </TabPane> : null}
          {card.intertype === 'system' || (card.intertype === 'custom' && card.procMode === 'system') ? <TabPane tab={
            <span>
              比较验证
              {verify.contrasts.length ? <span className="count-tip">{verify.contrasts.length}</span> : null}
            </span>
          } key="2x">
            <ContrastForm dict={this.props.dict} contrastChange={this.contrastChange}/>
            <EditTable data={verify.contrasts} columns={contrastColumns} onChange={(contrasts) => this.setState({verify: {...verify, contrasts}})}/>
          </TabPane>
          <TabPane tab={
            <EditTable actions={['edit', 'move', 'copy', 'del', 'status']} type="contrastverify" data={verify.contrasts} columns={contrastColumns} onChange={(contrasts) => this.setState({verify: {...verify, contrasts}})}/>
          </TabPane> : null}
          {card.intertype === 'system' || (card.intertype === 'custom' && card.procMode === 'system') ? <TabPane tab={
            <span>
              自定义验证
              {verify.customverifys.length ? <span className="count-tip">{verify.customverifys.length}</span> : null}
@@ -1382,16 +1638,9 @@
              customChange={this.customChange}
              wrappedComponentRef={(inst) => this.customForm = inst}
            />
            <Table
              bordered
              rowKey="uuid"
              className="custom-table"
              dataSource={verify.customverifys}
              columns={customColumns}
              pagination={false}
            />
          </TabPane>
          <TabPane tab={
            <EditTable actions={['move']} data={verify.customverifys} columns={customColumns} onChange={(customverifys) => {this.setState({verify: {...verify, customverifys}})}}/>
          </TabPane> : null}
          {card.intertype === 'system' || (card.intertype === 'custom' && card.procMode === 'system') ? <TabPane tab={
            <span>
              单号生成
              {verify.billcodes.length ? <span className="count-tip">{verify.billcodes.length}</span> : null}
@@ -1408,16 +1657,9 @@
              orderChange={this.orderChange}
              wrappedComponentRef={(inst) => this.orderForm = inst}
            />
            <Table
              bordered
              rowKey="uuid"
              className="custom-table"
              dataSource={verify.billcodes}
              columns={orderColumns}
              pagination={false}
            />
          </TabPane>
          <TabPane tab={
            <EditTable actions={['move']} data={verify.billcodes} columns={orderColumns} onChange={(billcodes) => {this.setState({verify: {...verify, billcodes}})}}/>
          </TabPane> : null}
          {card.intertype === 'system' || (card.intertype === 'custom' && card.procMode === 'system') ? <TabPane tab={
            <span>
              {card.Ot !== 'requiredOnce' ? '唯一性验证' : '同类数据验证'}
              {verify.uniques.length ? <span className="count-tip">{verify.uniques.length}</span> : null}
@@ -1425,13 +1667,13 @@
          } key="2">
            <UniqueForm
              btn={card}
              fields={card.Ot !== 'requiredOnce' ? fields : columnsFields}
              fields={card.Ot !== 'requiredOnce' ? uniqueFields : columnsFields}
              dict={this.props.dict}
              uniqueChange={this.uniqueChange}
            />
            <EditTable data={verify.uniques} columns={card.Ot !== 'requiredOnce' ? uniqueColumns : onceUniqueColumns} onChange={this.changeUniques}/>
          </TabPane>
          <TabPane tab={
            <EditTable actions={['edit', 'move', 'del', 'status']} data={verify.uniques} columns={card.Ot !== 'requiredOnce' ? uniqueColumns : onceUniqueColumns} onChange={this.changeUniques}/>
          </TabPane> : null}
          {card.intertype === 'system' || (card.intertype === 'custom' && card.procMode === 'system') ? <TabPane tab={
            <span>
              创建凭证
              {verify.voucher && verify.voucher.enabled ? <span className="count-tip">1</span> : null}
@@ -1446,33 +1688,55 @@
              voucherChange={this.voucherChange}
              wrappedComponentRef={(inst) => this.voucherForm = inst}
            />
          </TabPane>
          <TabPane tab={
          </TabPane> : null}
          {card.intertype === 'system' || (card.intertype === 'custom' && card.procMode === 'system') ? <TabPane tab={
            <span>
              自定义脚本
              {verify.scripts.length ? <span className="count-tip">{verify.scripts.length}</span> : null}
            </span>
          } key="6">
            <BorderOutlined className="full-scripts" onClick={() => {
              if (this.scriptsForm && (this.scriptsForm.state.editItem || (this.scriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.scriptsForm.props.form.getFieldValue('sql'))))) {
                notification.warning({
                  top: 92,
                  message: '请保存自定义脚本!',
                  duration: 5
                })
                return
              }
              this.setState({visible: true, scriptId: ''})
            }}/>
            <CustomScript
              usefulfields={this.state.usefulfields}
              initsql={this.state.initsql}
              dict={this.props.dict}
              btn={this.props.card}
              dict={this.props.dict}
              initsql={this.state.initsql}
              customScripts={verify.scripts}
              defaultsql={this.state.defaultsql}
              usefulfields={this.state.usefulfields}
              systemScripts={this.state.systemScripts}
              scriptsChange={this.scriptsChange}
              wrappedComponentRef={(inst) => this.scriptsForm = inst}
            />
            <Table
              bordered
              rowKey="uuid"
              className="custom-table"
              dataSource={verify.scripts}
              columns={scriptsColumns}
              pagination={false}
            <EditTable actions={['move']} data={verify.scripts} columns={scriptsColumns} onChange={(scripts) => {this.setState({verify: {...verify, scripts}})}}/>
          </TabPane> : null}
          {card.callbackType === 'script' && card.intertype === 'custom' ? <TabPane tab={
            <span>
              回调脚本
              {verify.cbScripts.length ? <span className="count-tip">{verify.cbScripts.length}</span> : null}
            </span>
          } key="6a">
            <CallBackCustomScript
              btn={this.props.card}
              dict={this.props.dict}
              initsql={this.state.initsql}
              customScripts={verify.cbScripts}
              usefulfields={this.state.usefulfields}
              systemScripts={this.state.systemScripts}
              scriptsChange={this.cbScriptsChange}
              wrappedComponentRef={(inst) => this.cbscriptsForm = inst}
            />
          </TabPane>
            <EditTable actions={['move']} data={verify.cbScripts} columns={cbScriptsColumns} onChange={(cbScripts) => {this.setState({verify: {...verify, cbScripts}})}}/>
          </TabPane> : null}
          <TabPane tab="信息提示" key="7">
            <Form {...formItemLayout}>
              <Row gutter={24}>
@@ -1511,7 +1775,7 @@
                </Col>
                <Col span={8}>
                  <Form.Item label={'停留时间'}>
                    <InputNumber defaultValue={verify.ntime || 10} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ntime')}} />
                    <InputNumber defaultValue={verify.ntime || (appType === 'mob' ? 3 : 10)} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ntime')}} />
                  </Form.Item>
                </Col>
              </Row>
@@ -1526,7 +1790,7 @@
                </Col>
                <Col span={8}>
                  <Form.Item label={'停留时间'}>
                    <InputNumber defaultValue={verify.ftime || 10} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ftime')}} />
                    <InputNumber defaultValue={verify.ftime || (appType === 'mob' ? 3 : 10)} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ftime')}} />
                  </Form.Item>
                </Col>
              </Row>
@@ -1560,96 +1824,77 @@
              </Row>
            </Form>
          </TabPane>
        </Tabs> : null}
        {card.intertype !== 'system' ? <Tabs defaultActiveKey="7" className="verify-card-box">
          <TabPane tab="信息提示" key="7">
            <Form {...formItemLayout}>
              <Row gutter={24}>
                <Col offset={6} span={6}>
                  <Form.Item label={'提示编码'}>
                    <span className="errorval"> S </span>
                    <Button onClick={() => {this.showError('S')}} type="primary" size="small">
                      查看
                    </Button>
                  </Form.Item>
                </Col>
                <Col span={8}>
                  <Form.Item label={'停留时间'}>
                    <InputNumber defaultValue={verify.stime || 2} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'stime')}} />
                  </Form.Item>
                </Col>
              </Row>
              <Row gutter={24}>
                <Col offset={6} span={6}>
                  <Form.Item label={'提示编码'}>
                    <span className="errorval"> Y </span>
                    <Button onClick={() => {this.showError('Y')}} type="primary" size="small">
                      查看
                    </Button>
                  </Form.Item>
                </Col>
              </Row>
              <Row gutter={24}>
                <Col offset={6} span={6}>
                  <Form.Item label={'提示编码'}>
                    <span className="errorval"> N </span>
                    <Button onClick={() => {this.showError('N')}} type="primary" size="small">
                      查看
                    </Button>
                  </Form.Item>
                </Col>
                <Col span={8}>
                  <Form.Item label={'停留时间'}>
                    <InputNumber defaultValue={verify.ntime || 10} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ntime')}} />
                  </Form.Item>
                </Col>
              </Row>
              <Row gutter={24}>
                <Col offset={6} span={6}>
                  <Form.Item label={'提示编码'}>
                    <span className="errorval"> F </span>
                    <Button onClick={() => {this.showError('F')}} type="primary" size="small">
                      查看
                    </Button>
                  </Form.Item>
                </Col>
                <Col span={8}>
                  <Form.Item label={'停留时间'}>
                    <InputNumber defaultValue={verify.ftime || 10} min={1} max={10000} precision={0} onChange={(val) => {this.timeChange(val, 'ftime')}} />
                  </Form.Item>
                </Col>
              </Row>
              <Row gutter={24}>
                <Col offset={6} span={6}>
                  <Form.Item label={'提示编码'}>
                    <span className="errorval"> E </span>
                    <Button onClick={() => {this.showError('E')}} type="primary" size="small">
                      查看
                    </Button>
                  </Form.Item>
                </Col>
              </Row>
              <Row gutter={24}>
                <Col offset={6} span={6}>
                  <Form.Item label={'提示编码'}>
                    <span className="errorval"> NM </span>
                    <Button onClick={() => {this.showError('NM')}} type="primary" size="small">
                      查看
                    </Button>
                  </Form.Item>
                </Col>
              </Row>
              <Row gutter={24}>
                <Col offset={6} span={6}>
                  <Form.Item label={'提示编码'}>
                    <span className="errorval"> -1 </span>
                    不提示
                  </Form.Item>
                </Col>
              </Row>
            </Form>
          </TabPane>
        </Tabs> : null}
        </Tabs>
        <Modal
          wrapClassName="model-custom-scripts-modal"
          title="自定义脚本"
          visible={visible}
          width={'95vw'}
          maskClosable={false}
          destroyOnClose
        >
          <img className="unfull-scripts" src={MinView} onClick={() => this.setState({visible: false, scriptId: ''})} alt=""/>
          <div className="script-table-wrap">
            {verify.scripts.map(item => {
              let title = item.sql.match(/^\s*\/\*.+\*\//)
              title = title && title[0] ? title[0] : ''
              let _text = title ? item.sql.replace(title, '') : item.sql
              let position = null
              if (item.position === 'init') {
                position = <span style={{color: 'orange'}}>初始化</span>
              } else if (item.position === 'front') {
                position = <span style={{color: '#26C281'}}>sql前</span>
              } else {
                position = <span style={{color: '#1890ff'}}>sql后</span>
              }
              return (
                <div className={'script-item ' + (this.state.scriptId === item.uuid ? 'active' : '') } key={item.uuid}>
                  <div style={{cursor: 'pointer'}} onClick={() => {
                    this.scriptsFullForm.edit(item)
                    this.setState({scriptId: item.uuid})
                  }}>
                    {title ? <div style={{color: '#a50', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis'}}>{title}</div> : null}
                    <Paragraph copyable={{ text: item.sql }} ellipsis={{ rows: 4 }}>{_text}</Paragraph>
                    <div>{position}{item.status === 'false' ?
                      <span style={{color: '#ff4d4f', marginLeft: '20px'}}>
                        禁用
                        <StopOutlined style={{marginLeft: '5px'}} />
                      </span> :
                      <span style={{color: '#26C281', marginLeft: '20px'}}>
                        启用
                        <CheckCircleOutlined style={{marginLeft: '5px'}}/>
                      </span>}
                    </div>
                  </div>
                  <div style={{textAlign: 'right'}}>
                    <span className="operation-btn" onClick={() => this.handleStatus(item, 'scripts')} style={{color: '#8E44AD'}}><SwapOutlined /></span>
                    <Popconfirm
                      overlayClassName="popover-confirm"
                      title={this.props.dict['model.query.delete']}
                      onConfirm={() => this.handleDelete(item, 'scripts')
                    }>
                      <span className="operation-btn" style={{color: '#ff4d4f'}}><DeleteOutlined /></span>
                    </Popconfirm>
                  </div>
                </div>
              )
            })}
          </div>
          <CustomScript
            type="fullscreen"
            btn={this.props.card}
            dict={this.props.dict}
            initsql={this.state.initsql}
            customScripts={verify.scripts}
            defaultsql={this.state.defaultsql}
            usefulfields={this.state.usefulfields}
            systemScripts={this.state.systemScripts}
            scriptsChange={this.scriptsChange}
            wrappedComponentRef={(inst) => this.scriptsFullForm = inst}
          />
        </Modal>
      </div>
    )
  }