From 822bc67061448c6e3a1eb77d39be4ad2b84b416a Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 27 二月 2020 09:36:34 +0800 Subject: [PATCH] 2020-02-27 --- src/templates/tableshare/verifycard/index.jsx | 140 +++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 135 insertions(+), 5 deletions(-) diff --git a/src/templates/tableshare/verifycard/index.jsx b/src/templates/tableshare/verifycard/index.jsx index ebc1365..2f24da8 100644 --- a/src/templates/tableshare/verifycard/index.jsx +++ b/src/templates/tableshare/verifycard/index.jsx @@ -1,6 +1,6 @@ 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' @@ -33,6 +33,8 @@ orderModular: [], orderModularDetail: [], voucher: [], + templates: [], + selectimg: '', voucherDetail: [], uniqueColumns: [ { @@ -380,7 +382,8 @@ customverifys: _verify.customverifys || [], billcodes: _verify.billcodes || [], voucher: _verify.voucher || {enabled: false}, - scripts: _verify.scripts || [] + scripts: _verify.scripts || [], + Template: _verify.Template || '' } }) @@ -634,6 +637,64 @@ 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) => { @@ -983,7 +1044,39 @@ }) } + 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: { @@ -1002,7 +1095,7 @@ <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'}} /> @@ -1015,7 +1108,7 @@ </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> @@ -1023,7 +1116,7 @@ </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> @@ -1031,6 +1124,43 @@ </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> -- Gitblit v1.8.0