| | |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import EditTable from './editable' |
| | | |
| | | import 'codemirror/lib/codemirror.css' |
| | | // import 'codemirror/theme/solarized.css' |
| | |
| | | import './index.scss' |
| | | |
| | | const { TabPane } = Tabs |
| | | let _printFunc = null |
| | | let _printFunc = null // antd 无法获取 codemirror 内容,手动控制 |
| | | |
| | | class VerifyCard extends Component { |
| | | static propTpyes = { |
| | |
| | | UNSAFE_componentWillMount() { |
| | | let _verify = this.props.card.verify || {} |
| | | |
| | | _verify.Template = _verify.Template || '' |
| | | _verify.printerTypeList = _verify.printerTypeList || [] |
| | | _verify.linkType = _verify.linkType || 'system' |
| | | _verify.printMode = _verify.printMode || 'normal' |
| | | |
| | | this.setState({ |
| | | verify: { |
| | | ..._verify, |
| | | Template: _verify.Template || '' |
| | | }, |
| | | linkType: _verify.linkType || 'system', |
| | | printMode: _verify.printMode || 'normal', |
| | | printFunc: _verify.printFunc || '// Function(socket, data, printer, notification) socket-WebSocket 对象,data-打印数据列表,printer-打印机,notification-信息提示控件' |
| | | verify: _verify, |
| | | linkType: _verify.linkType, |
| | | printMode: _verify.printMode, |
| | | printFunc: _verify.printFunc || '// Function(data, form, printer, notification) data-打印数据列表,form-表单信息(不存在时为{}),printer-打印设置,notification-信息提示控件' |
| | | }) |
| | | |
| | | _printFunc = _verify.printFunc || '' |
| | |
| | | this.props.form.validateFieldsAndScroll((err, values) => { |
| | | if (!err) { |
| | | let _verify = {...verify, ...values, printFunc: _printFunc} |
| | | |
| | | if (this.refs.editTable && this.refs.editTable.state) { |
| | | let printTypes = this.refs.editTable.state.dataSource |
| | | |
| | | let emptys = printTypes.filter(item => !item.Value || !item.Text) |
| | | let valMap = new Map() |
| | | let isvalid = true |
| | | |
| | | printTypes.forEach(item => { |
| | | if (valMap.has(item.Value)) { |
| | | isvalid = false |
| | | } else { |
| | | valMap.set(item.Value, item.Text) |
| | | } |
| | | }) |
| | | |
| | | if (emptys.length > 0) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '打印类型表格中Value、Text字段不可为空!', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } else if (!isvalid) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '打印类型表格中Value字段不可重复!', |
| | | duration: 10 |
| | | }) |
| | | return |
| | | } |
| | | |
| | | _verify.printerTypeList = printTypes |
| | | } |
| | | |
| | | resolve(_verify) |
| | | } else { |
| | |
| | | </Row> |
| | | </Form> |
| | | </TabPane> |
| | | <TabPane tab="打印类型" key="2"> |
| | | <Form {...formItemLayout}> |
| | | <Row gutter={24}> |
| | | <Col span={24} className="print-tip"> |
| | | <Form.Item label={'提示'}> |
| | | 如果此按钮的打印功能涉及多种打印类型,且不同类型需要设置不同的打印机时,可以添加打印类型控制信息, |
| | | 设置完成后,用户可针对不同的类型设置对应的打印机。注:在返回数据顶层结构中添加 printType、printCount、templateID 字段,可分别控制打印类型、打印数量和打印模板。 |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | | <EditTable data={verify.printerTypeList} dict={this.props.dict} ref="editTable"/> |
| | | </Col> |
| | | </Row> |
| | | </Form> |
| | | </TabPane> |
| | | <TabPane tab="信息提示" key="7"> |
| | | <Form {...formItemLayout}> |
| | | <Row gutter={24}> |