king
2025-01-13 8e3b4c6dede34e8be6ba47a20ecd9a70576675cf
src/templates/zshare/verifycard/voucherform/index.jsx
@@ -1,8 +1,9 @@
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 './index.scss'
import { Form, Row, Col, Select, Switch, notification, Modal } from 'antd'
import { ConsoleSqlOutlined } from '@ant-design/icons'
// import './index.scss'
class UniqueForm extends Component {
  static propTpyes = {
@@ -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
@@ -196,7 +241,7 @@
                  onChange={(value) => {this.voucherSChange(value)}}
                >
                  {this.state.voucher.map(option =>
                    <Select.Option title={option.NameNO} id={option.ID} key={option.ID} value={option.ID}>
                    <Select.Option key={option.ID} value={option.ID}>
                      {option.NameNO}
                    </Select.Option>
                  )}
@@ -221,7 +266,7 @@
                  onChange={this.contentChange}
                >
                  {this.state.voucherDetail.map(option =>
                    <Select.Option title={option.CodeName} id={option.ModularDetailCode} key={option.ModularDetailCode} value={option.ModularDetailCode}>
                    <Select.Option key={option.ModularDetailCode} value={option.ModularDetailCode}>
                      {option.CodeName}
                    </Select.Option>
                  )}
@@ -246,8 +291,8 @@
                  onChange={this.contentChange}
                >
                  {columns.map((option, index) =>
                    <Select.Option title={option.label} id={index + option.uuid} key={index + option.uuid} value={option.field}>
                      {option.label}
                    <Select.Option key={index + option.uuid} value={option.field}>
                      {`${option.label}(${option.field})`}
                    </Select.Option>
                  )}
                </Select>
@@ -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>