| | |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Tabs, Row, Col, Button, notification, Modal, message, InputNumber, Input, Select, Radio } from 'antd' |
| | | import moment from 'moment' |
| | | import {UnControlled as CodeMirror} from 'react-codemirror2' |
| | | import 'codemirror/mode/javascript/javascript' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import CodeMirror from '@/templates/zshare/codemirror' |
| | | import EditTable from './editable' |
| | | |
| | | import 'codemirror/lib/codemirror.css' |
| | | // import 'codemirror/theme/solarized.css' |
| | | import 'codemirror/theme/cobalt.css' |
| | | |
| | | import './index.scss' |
| | | |
| | | const { TabPane } = Tabs |
| | | let _printFunc = null // antd 无法获取 codemirror 内容,手动控制 |
| | | |
| | | class VerifyCard extends Component { |
| | | static propTpyes = { |
| | |
| | | printMode: _verify.printMode, |
| | | printFunc: _verify.printFunc || '// Function(data, form, printer, notification) data-打印数据列表,form-表单信息(不存在时为{}),printer-打印设置,notification-信息提示控件' |
| | | }) |
| | | |
| | | _printFunc = _verify.printFunc || '' |
| | | } |
| | | |
| | | componentDidMount() { |
| | | let _sql = `select PrintTempNO,Images,PrintTempNO+PrintTempName as PN from sPrintTemplate |
| | | where appkey= @appkey@ and Deleted=0 |
| | | where appkey= @appkey@ and Deleted=0 and typechartwo='' |
| | | 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 |
| | | from (select * from sPrintTemplate where appkey= '' and Deleted=0 and typechartwo='') 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` |
| | |
| | | arr_field: 'PN,PrintTempNO,Images' |
| | | } |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000' |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | | |
| | | param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true) // 云端数据验证 |
| | | param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) // 云端数据验证 |
| | | |
| | | Api.getSystemConfig(param).then(res => { |
| | | if (res.status) { |
| | |
| | | return new Promise((resolve, reject) => { |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (!err) { |
| | | let _verify = {...verify, ...values, printFunc: _printFunc} |
| | | let _verify = {...verify, ...values} |
| | | |
| | | if (this.refs.editTable && this.refs.editTable.state) { |
| | | let printTypes = this.refs.editTable.state.dataSource |
| | |
| | | } |
| | | ] |
| | | })( |
| | | <CodeMirror |
| | | className="code-mirror-area" |
| | | options={{ |
| | | mode: 'text/javascript', |
| | | theme: 'cobalt', |
| | | lineNumbers: true, |
| | | lineWrapping: true |
| | | }} |
| | | onBeforeChange={() => {}} |
| | | onBlur={(editor) => { |
| | | _printFunc = editor.getValue() |
| | | }} |
| | | /> |
| | | <CodeMirror mode="text/javascript"/> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | |
| | | } |
| | | ] |
| | | })( |
| | | <Select onChange={this.changeTemplate}> |
| | | <Select dropdownClassName="print-template-setting" onChange={this.changeTemplate}> |
| | | {this.state.templates.map((option, key) => |
| | | <Select.Option id={key} key={key} value={option.value}> |
| | | {option.text} |
| | |
| | | </Row> |
| | | </Form> |
| | | </TabPane> |
| | | <TabPane tab="打印类型" key="2"> |
| | | <TabPane tab={ |
| | | <span> |
| | | 打印类型 |
| | | {verify.printerTypeList.length ? <span className="count-tip">{verify.printerTypeList.length}</span> : null} |
| | | </span> |
| | | } key="2"> |
| | | <Form {...formItemLayout}> |
| | | <Row gutter={24}> |
| | | <Col span={24} className="print-tip"> |