| | |
| | | import './index.scss' |
| | | |
| | | const { TabPane } = Tabs |
| | | let _printFunc = null |
| | | |
| | | class VerifyCard extends Component { |
| | | static propTpyes = { |
| | |
| | | }, |
| | | 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() { |
| | |
| | | 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 { |
| | |
| | | )} |
| | | </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', { |
| | |
| | | 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}> |