| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Tabs, Row, Col, Radio, Button, Table, Popconfirm, Icon, notification, Modal, message, InputNumber, Tooltip } from 'antd' |
| | | import { Form, Tabs, Row, Col, Radio, Button, Table, Popconfirm, Icon, notification, Modal, message, InputNumber, Tooltip, Input, Select } from 'antd' |
| | | import moment from 'moment' |
| | | |
| | | import Api from '@/api' |
| | |
| | | orderModular: [], |
| | | orderModularDetail: [], |
| | | voucher: [], |
| | | templates: [], |
| | | selectimg: '', |
| | | voucherDetail: [], |
| | | uniqueColumns: [ |
| | | { |
| | |
| | | customverifys: _verify.customverifys || [], |
| | | billcodes: _verify.billcodes || [], |
| | | voucher: _verify.voucher || {enabled: false}, |
| | | scripts: _verify.scripts || [] |
| | | scripts: _verify.scripts || [], |
| | | Template: _verify.Template || '' |
| | | } |
| | | }) |
| | | |
| | |
| | | voucherDetail: result[1].data |
| | | }) |
| | | }) |
| | | |
| | | if (this.props.card.execMode) { |
| | | let _sql = `select ID,Images,PrintTempNO+PrintTempName as PN from sPrintTemplate |
| | | where appkey= @appkey@ and Deleted=0 |
| | | union select ID,Images,a.PrintTempNO+PrintTempName as PN |
| | | from (select * from sPrintTemplate where appkey= '' and Deleted=0 ) a |
| | | left join (select PrintTempNO from sPrintTemplate where appkey= @appkey@ and Deleted=0 ) b |
| | | on a.PrintTempNO=b.PrintTempNO |
| | | left join (select Srcid from sPrintTemplate_Log where appkey='' and apicode= @appkey@ and Deleted=0 ) c |
| | | on a.ID=c.Srcid where b.PrintTempNO is null and c.Srcid is null` |
| | | |
| | | let param = { |
| | | func: 'sPC_Get_SelectedList', |
| | | LText: Utils.formatOptions(_sql), |
| | | obj_name: 'data', |
| | | arr_field: 'PN,ID,Images' |
| | | } |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | Api.getSystemConfig(param).then(res => { |
| | | if (res.status) { |
| | | let temps = res.data.map(temp => { |
| | | return { |
| | | value: temp.ID, |
| | | text: temp.PN, |
| | | img: temp.Images |
| | | } |
| | | }) |
| | | |
| | | let Template = this.state.verify.Template |
| | | let selectimg = '' |
| | | let selectTemp = temps.filter(temp => temp.value === Template)[0] |
| | | |
| | | if (!selectTemp) { |
| | | Template = '' |
| | | } else { |
| | | selectimg = selectTemp.img |
| | | } |
| | | |
| | | this.setState({ |
| | | selectimg: selectimg, |
| | | templates: temps, |
| | | verify: { |
| | | ...this.state.verify, |
| | | Template: Template |
| | | } |
| | | }) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: res.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | uniqueChange = (values) => { |
| | |
| | | }) |
| | | } |
| | | |
| | | changeTemplate = (val) => { |
| | | const { templates } = this.state |
| | | |
| | | let temp = templates.filter(temp => temp.value === val)[0] |
| | | |
| | | this.setState({ |
| | | selectimg: temp.img |
| | | }) |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | | const { verify } = this.state |
| | | // 表单提交时检查输入值是否正确 |
| | | return new Promise((resolve, reject) => { |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (!err) { |
| | | let _verify = {...verify, ...values} |
| | | |
| | | resolve(_verify) |
| | | } else { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '链接地址与打印模板不可为空!', |
| | | duration: 10 |
| | | }) |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { getFieldDecorator } = this.props.form |
| | | |
| | | const { verify, fields, uniqueColumns, contrastColumns, customColumns, orderColumns, scriptsColumns, orderModular, orderModularDetail, voucher, voucherDetail } = this.state |
| | | const formItemLayout = { |
| | | labelCol: { |
| | |
| | | <TabPane tab="基础验证" key="1"> |
| | | <Form {...formItemLayout}> |
| | | <Row gutter={24}> |
| | | <Col span={12}> |
| | | <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="bottomLeft" title={'默认sql执行顺序为自定义脚本之前'}> |
| | | <Icon type="question-circle" style={{color: '#c49f47', marginRight: '5px'}} /> |
| | |
| | | </Radio.Group> |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={12}> |
| | | <Col span={8}> |
| | | <Form.Item label={'账期验证'}> |
| | | <Radio.Group value={verify.accountdate} onChange={(e) => {this.onOptionChange(e, 'accountdate')}}> |
| | | <Radio value="true">开启</Radio> |
| | |
| | | </Radio.Group> |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={12}> |
| | | <Col span={8}> |
| | | <Form.Item label={'失效验证'}> |
| | | <Radio.Group value={verify.invalid} onChange={(e) => {this.onOptionChange(e, 'invalid')}}> |
| | | <Radio value="true">开启</Radio> |
| | |
| | | </Radio.Group> |
| | | </Form.Item> |
| | | </Col> |
| | | {this.props.card.execMode ? <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" />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {this.props.card.execMode ? <Col span={8}> |
| | | <Form.Item label={'打印模板'}> |
| | | {getFieldDecorator('Template', { |
| | | initialValue: verify.Template || '', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.select'] + '打印模板!' |
| | | } |
| | | ] |
| | | })( |
| | | <Select onChange={this.changeTemplate}> |
| | | {this.state.templates.map((option, key) => |
| | | <Select.Option id={key} key={key} value={option.value}> |
| | | {option.text} |
| | | </Select.Option> |
| | | )} |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {this.state.selectimg ? <Col span={9}> |
| | | <img style={{width: '90%', marginBottom: '25px'}} src={this.state.selectimg} alt=""/> |
| | | </Col> : null} |
| | | </Row> |
| | | </Form> |
| | | </TabPane> |