king
2025-01-16 5733fc7e386a51217ba6d07e272ca8bd95045abc
src/templates/zshare/verifycard/voucherform/index.jsx
@@ -1,7 +1,8 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
import { Form, Row, Col, Select, Switch, notification } from 'antd'
import { Form, Row, Col, Select, Switch, notification, Modal } from 'antd'
import { ConsoleSqlOutlined } from '@ant-design/icons'
// import './index.scss'
class UniqueForm extends Component {
@@ -141,6 +142,50 @@
    })
  }
  voucherSql = () => {
    let BVoucherType = this.props.form.getFieldValue('BVoucherType')
    let VoucherTypeOne = this.props.form.getFieldValue('VoucherTypeOne')
    let linkField = this.props.form.getFieldValue('linkField')
    let _detail = this.state.voucherDetail.filter(item => item.ModularDetailCode === VoucherTypeOne)[0]
    if (!_detail) {
      notification.warning({
        top: 92,
        message: '凭证类型或凭证标识不存在!',
        duration: 5
      })
      return
    }
    let _sql = `/* 创建凭证 */
      exec s_BVoucher_Create
        @Bill = @${linkField || ''},
        @BVoucherType ='${BVoucherType}',
        @VoucherTypeOne ='${VoucherTypeOne}',
        @VoucherTypeTwo ='${_detail.VoucherTypeTwo}',
        @Type =${_detail.IDefine1},
        @UserID=@UserID@,
        @Username=@Username,
        @FullName=@FullName,
        @BVoucher =@BVoucher OUTPUT ,
        @FIBVoucherDate =@FIBVoucherDate OUTPUT ,
        @FiYear =@FiYear OUTPUT ,
        @ErrorCode =@ErrorCode OUTPUT,
        @retmsg=@retmsg OUTPUT
      if @ErrorCode!=''
        GOTO aaa
    `
    Modal.info({
      title: '',
      width: 500,
      className: 'sql-example',
      icon: null,
      content: _sql.split(/\n\s{6}/ig).map((n, index) => <div key={index} dangerouslySetInnerHTML={{ __html: n.replace(/\s/ig, '&nbsp;') }} style={{whiteSpace: 'nowrap'}}></div>)
    })
  }
  render() {
    const { getFieldDecorator } = this.props.form
    const { voucherobj } = this.props
@@ -255,8 +300,9 @@
            </Form.Item>
          </Col>
          <Col span={11}>
            <Form.Item label={'是否启用'}>
            <Form.Item label="是否启用">
              <Switch checkedChildren="启" unCheckedChildren="停" checked={voucherobj.enabled} onChange={this.onEnabledChange} />
              {voucherobj.enabled ? <ConsoleSqlOutlined style={{marginLeft: '20px', fontSize: '18px', color: '#1890ff', verticalAlign: 'middle'}} onClick={this.voucherSql}/> : null}
            </Form.Item>
          </Col>
        </Row>