king
2023-03-06 eb164d66b57fbc93a04415de4afce82f30f3e49f
src/views/menudesign/printmenuform/index.jsx
@@ -1,21 +1,14 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { Form, Row, Col, InputNumber, Select, Radio, Tooltip, Icon } from 'antd'
import { Form, Row, Col, InputNumber, Select, Radio, Tooltip } from 'antd'
import { QuestionCircleOutlined } from '@ant-design/icons'
import './index.scss'
// import './index.scss'
class MainSearch extends Component {
  static propTpyes = {
    dict: PropTypes.object, // 字典项
    config: PropTypes.object,
    updateConfig: PropTypes.func
  }
  changeFirstCount = (val) => {
    if (typeof(val) !== 'number') {
      val = ''
    }
    this.props.updateConfig({...this.props.config, firstCount: val})
  }
  changeCount = (val) => {
@@ -39,11 +32,8 @@
    this.props.updateConfig({...this.props.config, printHeight: val})
  }
  changeLastCount = (val) => {
    if (typeof(val) !== 'number') {
      val = ''
    }
    this.props.updateConfig({...this.props.config, lastCount: val})
  onPrintPageChange = (val) => {
    this.props.updateConfig({...this.props.config, printPage: val})
  }
  pageSizeChange = (val) => {
@@ -112,7 +102,7 @@
  }
  render() {
    const { dict, config } = this.props
    const { config } = this.props
    const { getFieldDecorator } = this.props.form
    const formItemLayout = {
      labelCol: {
@@ -126,8 +116,22 @@
    }
    return (
      <Form {...formItemLayout} className="print-menu-form">
      <Form {...formItemLayout}>
        <Row>
          <Col span={24}>
            <Form.Item label="菜单名称">
              <span style={{display: 'inline-block', wordBreak: 'break-all', lineHeight: 1.5}}>
                {config.MenuName}
              </span>
            </Form.Item>
          </Col>
          <Col span={24}>
            <Form.Item label="菜单参数">
              <span style={{display: 'inline-block', wordBreak: 'break-all', lineHeight: 1.5}}>
                {config.MenuNo}
              </span>
            </Form.Item>
          </Col>
          <Col span={24}>
            <Form.Item label="打印尺寸">
              {getFieldDecorator('pageSize', {
@@ -135,7 +139,7 @@
                rules: [
                  {
                    required: true,
                    message: dict['mob.required.input'] + '打印尺寸!'
                    message: '请选择打印尺寸!'
                  }
                ]
              })(
@@ -154,7 +158,7 @@
                rules: [
                  {
                    required: true,
                    message: dict['mob.required.select'] + '打印布局!'
                    message: '请选择打印布局!'
                  }
                ]
              })(
@@ -172,7 +176,7 @@
                rules: [
                  {
                    required: true,
                    message: dict['mob.required.select'] + '打印边距!'
                    message: '请选择打印边距!'
                  }
                ]
              })(
@@ -184,42 +188,54 @@
            </Form.Item>
          </Col>
          <Col span={24}>
            <Form.Item label="页面布局">
              {getFieldDecorator('printPage', {
                initialValue: config.printPage || 'auto'
              })(
                <Radio.Group onChange={(e) => {this.onPrintPageChange(e.target.value)}}>
                  <Radio value="auto">自适应</Radio>
                  <Radio value="page">分页</Radio>
                </Radio.Group>
              )}
            </Form.Item>
          </Col>
          {/* <Col span={24}>
            <Form.Item label="首页数(条)">
              {getFieldDecorator('firstCount', {
                initialValue: config.firstCount,
                rules: [
                  {
                    required: true,
                    message: dict['mob.required.input'] + '首页数!'
                    message: '请输入首页数!'
                  }
                ]
              })(<InputNumber min={1} max={1000} precision={0} onChange={this.changeFirstCount}/>)}
              })(<InputNumber min={1} max={1000} precision={1} onChange={this.changeFirstCount}/>)}
            </Form.Item>
          </Col>
          <Col span={24}>
          </Col> */}
          {config.printPage === 'page' ? <Col span={24}>
            <Form.Item label="每页数(条)">
              {getFieldDecorator('everyPCount', {
                initialValue: config.everyPCount,
                initialValue: config.everyPCount || 15,
                rules: [
                  {
                    required: true,
                    message: dict['mob.required.input'] + '每页数!'
                    message: '请输入每页数!'
                  }
                ]
              })(<InputNumber min={1} max={1000} precision={0} onChange={this.changeCount}/>)}
              })(<InputNumber min={1} max={1000} precision={1} onChange={this.changeCount}/>)}
            </Form.Item>
          </Col>
          <Col span={24}>
          </Col> : null}
          {/* <Col span={24}>
            <Form.Item label="尾页数(条)">
              {getFieldDecorator('lastCount', {
                initialValue: config.lastCount
              })(<InputNumber min={1} max={1000} precision={0} onChange={this.changeLastCount}/>)}
              })(<InputNumber min={1} max={1000} precision={1} onChange={this.changeLastCount}/>)}
            </Form.Item>
          </Col>
          </Col> */}
          <Col span={24}>
            <Form.Item label={
              <Tooltip placement="topLeft" title="针对不规则纸张,可自定义设置打印高度和宽度,注:同时设置打印宽度和高度后方可生效。">
                <Icon type="question-circle" />
                <QuestionCircleOutlined className="mk-form-tip" />
                自定义
              </Tooltip>
            }>