king
2020-03-22 f0602b981659c6d1ff18e8dba4ca1ce89c5f5610
src/templates/zshare/verifycardprint/index.jsx
@@ -15,6 +15,7 @@
import './index.scss'
const { TabPane } = Tabs
let _printFunc = null
class VerifyCard extends Component {
  static propTpyes = {
@@ -43,8 +44,10 @@
      },
      linkType: _verify.linkType || 'system',
      printMode: _verify.printMode || 'normal',
      printFunc: _verify.printFunc || '// Function(data, notification) // data-打印数据列表,notification-信息提示控件',
      printFunc: _verify.printFunc || '// Function(socket, data, printer, notification) socket-WebSocket 对象,data-打印数据列表,printer-打印机,notification-信息提示控件'
    })
    _printFunc = _verify.printFunc || ''
  }
  componentDidMount() {
@@ -162,7 +165,7 @@
    return new Promise((resolve, reject) => {
      this.props.form.validateFieldsAndScroll((err, values) => {
        if (!err) {
          let _verify = {...verify, ...values}
          let _verify = {...verify, ...values, printFunc: _printFunc}
          resolve(_verify)
        } else {
@@ -231,6 +234,31 @@
                    )}
                  </Form.Item>
                </Col>
                <Col span={8}>
                  <Form.Item label={'链接类型'}>
                    {getFieldDecorator('linkType', {
                      initialValue: linkType || 'system'
                    })(
                      <Radio.Group onChange={this.changeLinkType}>
                        <Radio value="system">系统</Radio>
                        <Radio value="custom">自定义</Radio>
                      </Radio.Group>
                    )}
                  </Form.Item>
                </Col>
                <Col span={8}>
                  <Form.Item label={'链接地址'}>
                    {getFieldDecorator('linkUrl', {
                      initialValue: verify.linkUrl || '127.0.0.1:13529',
                      rules: [
                        {
                          required: true,
                          message: this.props.dict['form.required.input'] + '链接地址!'
                        }
                      ]
                    })(<Input placeholder="" autoComplete="off" disabled={linkType === 'system'} />)}
                  </Form.Item>
                </Col>
                {printMode === 'custom' ? <Col span={24}>
                  <Form.Item label={'处理函数'} className="printFunc">
                    {getFieldDecorator('printFunc', {
@@ -251,35 +279,13 @@
                          lineWrapping: true
                        }}
                        onBeforeChange={() => {}}
                        onBlur={(editor) => {
                          _printFunc = editor.getValue()
                        }}
                      />
                    )}
                    )}
                  </Form.Item>
                </Col> : null}
                {printMode === 'normal' ? <Col span={8}>
                  <Form.Item label={'链接类型'}>
                    {getFieldDecorator('linkType', {
                      initialValue: linkType || 'system'
                    })(
                      <Radio.Group onChange={this.changeLinkType}>
                        <Radio value="system">系统</Radio>
                        <Radio value="custom">自定义</Radio>
                      </Radio.Group>
                    )}
                  </Form.Item>
                </Col> : null}
                {printMode === 'normal' ? <Col span={8}>
                  <Form.Item label={'链接地址'}>
                    {getFieldDecorator('linkUrl', {
                      initialValue: verify.linkUrl || '127.0.0.1:13529',
                      rules: [
                        {
                          required: true,
                          message: this.props.dict['form.required.input'] + '链接地址!'
                        }
                      ]
                    })(<Input placeholder="" autoComplete="off" disabled={linkType === 'system'} />)}
                  </Form.Item>
                </Col> : null }
                {printMode === 'normal' ? <Col span={8}>
                  <Form.Item label={'打印模板'}>
                    {getFieldDecorator('Template', {