From b6c698c8833836971184a0a9c2645a15f8174d37 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 08 五月 2025 16:31:18 +0800
Subject: [PATCH] Merge branch 'master' into positec

---
 src/views/menudesign/printmenuform/index.jsx |  442 +++++++++++++++++++++++++++++++++----------------------
 1 files changed, 265 insertions(+), 177 deletions(-)

diff --git a/src/views/menudesign/printmenuform/index.jsx b/src/views/menudesign/printmenuform/index.jsx
index 9f9c9bb..c015b1e 100644
--- a/src/views/menudesign/printmenuform/index.jsx
+++ b/src/views/menudesign/printmenuform/index.jsx
@@ -1,8 +1,9 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import { Form, Row, Col, InputNumber, Select, Radio, Tooltip } from 'antd'
-import { QuestionCircleOutlined } from '@ant-design/icons'
+import { Form, Row, Col, InputNumber, Select, Radio, Tooltip, Input, Modal } from 'antd'
+import { QuestionCircleOutlined, EditOutlined } from '@ant-design/icons'
 
+import CodeMirror from '@/templates/zshare/codemirror'
 // import './index.scss'
 
 class MainSearch extends Component {
@@ -11,49 +12,29 @@
     updateConfig: PropTypes.func
   }
 
-  changeCount = (val) => {
-    if (typeof(val) !== 'number') {
-      val = ''
+  state = {
+    visible: false,
+    printScripts: ''
+  }
+
+  selectChange = (key, value) => {
+    const { config } = this.props
+
+    if (['everyPCount', 'printWidth', 'printHeight'].includes(key)) {
+      if (typeof(value) !== 'number') {
+        value = ''
+      }
+    } else if (key === 'callNo') {
+      if (!/^[a-zA-Z0-9_]+$/.test(value)) {
+        value = ''
+      }
     }
-    this.props.updateConfig({...this.props.config, everyPCount: val})
-  }
 
-  changePrintWidth = (val) => {
-    if (typeof(val) !== 'number') {
-      val = ''
+    this.props.updateConfig({...config, [key]: value})
+
+    if (['pageSize', 'pageLayout', 'pagePadding', 'printCustom'].includes(key)) {
+      this.resetPage()
     }
-    this.props.updateConfig({...this.props.config, printWidth: val})
-  }
-
-  changePrintHeight = (val) => {
-    if (typeof(val) !== 'number') {
-      val = ''
-    }
-    this.props.updateConfig({...this.props.config, printHeight: val})
-  }
-
-  onPrintPageChange = (val) => {
-    this.props.updateConfig({...this.props.config, printPage: val})
-  }
-
-  pageSizeChange = (val) => {
-    this.props.updateConfig({...this.props.config, pageSize: val})
-    this.resetPage()
-  }
-
-  onLayoutChange = (val) => {
-    this.props.updateConfig({...this.props.config, pageLayout: val})
-    this.resetPage()
-  }
-  
-  onPaddingChange = (val) => {
-    this.props.updateConfig({...this.props.config, pagePadding: val})
-    this.resetPage()
-  }
-
-  onPrintCustomChange = (val) => {
-    this.props.updateConfig({...this.props.config, printCustom: val})
-    this.resetPage()
   }
 
   resetPage = () => {
@@ -101,9 +82,22 @@
     })
   }
 
+  onScriptChange = (val) => {
+    this.setState({printScripts: val})
+  }
+
+  submit = () => {
+    const { config } = this.props
+    const { printScripts } = this.state
+
+    this.setState({visible: false})
+    this.props.updateConfig({...config, printScripts})
+  }
+
   render() {
     const { config } = this.props
     const { getFieldDecorator } = this.props.form
+    const { visible, printScripts } = this.state
     const formItemLayout = {
       labelCol: {
         xs: { span: 24 },
@@ -116,141 +110,235 @@
     }
 
     return (
-      <Form {...formItemLayout}>
-        <Row>
-          <Col span={24}>
-            <Form.Item label="鎵撳嵃灏哄">
-              {getFieldDecorator('pageSize', {
-                initialValue: config.pageSize || 'A4',
-                rules: [
-                  {
-                    required: true,
-                    message: '璇烽�夋嫨鎵撳嵃灏哄!'
-                  }
-                ]
-              })(
-                <Select onChange={this.pageSizeChange}>
-                  <Select.Option value="A3">A3</Select.Option>
-                  <Select.Option value="A4">A4</Select.Option>
-                  <Select.Option value="A5">A5</Select.Option>
-                </Select>
-              )}
-            </Form.Item>
-          </Col>
-          <Col span={24}>
-            <Form.Item label="鎵撳嵃甯冨眬">
-              {getFieldDecorator('pageLayout', {
-                initialValue: config.pageLayout || 'vertical',
-                rules: [
-                  {
-                    required: true,
-                    message: '璇烽�夋嫨鎵撳嵃甯冨眬!'
-                  }
-                ]
-              })(
-                <Radio.Group onChange={(e) => {this.onLayoutChange(e.target.value)}}>
-                  <Radio value="vertical">绾靛悜</Radio>
-                  <Radio value="horizontal">妯悜</Radio>
-                </Radio.Group>
-              )}
-            </Form.Item>
-          </Col>
-          <Col span={24}>
-            <Form.Item label="鎵撳嵃杈硅窛">
-              {getFieldDecorator('pagePadding', {
-                initialValue: config.pagePadding || 'default',
-                rules: [
-                  {
-                    required: true,
-                    message: '璇烽�夋嫨鎵撳嵃杈硅窛!'
-                  }
-                ]
-              })(
-                <Radio.Group onChange={(e) => {this.onPaddingChange(e.target.value)}}>
-                  <Radio value="default">榛樿</Radio>
-                  <Radio value="without">鏃�</Radio>
-                </Radio.Group>
-              )}
-            </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: '璇疯緭鍏ラ椤垫暟!'
-                  }
-                ]
-              })(<InputNumber min={1} max={1000} precision={1} onChange={this.changeFirstCount}/>)}
-            </Form.Item>
-          </Col> */}
-          {config.printPage === 'page' ? <Col span={24}>
-            <Form.Item label="姣忛〉鏁�(鏉�)">
-              {getFieldDecorator('everyPCount', {
-                initialValue: config.everyPCount || 15,
-                rules: [
-                  {
-                    required: true,
-                    message: '璇疯緭鍏ユ瘡椤垫暟!'
-                  }
-                ]
-              })(<InputNumber min={1} max={1000} precision={1} onChange={this.changeCount}/>)}
-            </Form.Item>
-          </Col> : null}
-          {/* <Col span={24}>
-            <Form.Item label="灏鹃〉鏁�(鏉�)">
-              {getFieldDecorator('lastCount', {
-                initialValue: config.lastCount
-              })(<InputNumber min={1} max={1000} precision={1} onChange={this.changeLastCount}/>)}
-            </Form.Item>
-          </Col> */}
-          <Col span={24}>
-            <Form.Item label={
-              <Tooltip placement="topLeft" title="閽堝涓嶈鍒欑焊寮狅紝鍙嚜瀹氫箟璁剧疆鎵撳嵃楂樺害鍜屽搴︼紝娉細鍚屾椂璁剧疆鎵撳嵃瀹藉害鍜岄珮搴﹀悗鏂瑰彲鐢熸晥銆�">
-                <QuestionCircleOutlined className="mk-form-tip" />
-                鑷畾涔�
-              </Tooltip>
-            }>
-              {getFieldDecorator('printCustom', {
-                initialValue: config.printCustom || 'false'
-              })(
-                <Radio.Group onChange={(e) => {this.onPrintCustomChange(e.target.value)}}>
-                  <Radio value="false">涓嶅惎鐢�</Radio>
-                  <Radio value="true">鍚敤</Radio>
-                </Radio.Group>
-              )}
-            </Form.Item>
-          </Col>
-          {config.printCustom === 'true' ? <Col span={24}>
-            <Form.Item label="鎵撳嵃瀹藉害">
-              {getFieldDecorator('printWidth', {
-                initialValue: config.printWidth || ''
-              })(<InputNumber min={10} max={9999} precision={0} onChange={this.changePrintWidth}/>)}
-            </Form.Item>
-          </Col> : null}
-          {config.printCustom === 'true' ? <Col span={24}>
-            <Form.Item label="鎵撳嵃楂樺害">
-              {getFieldDecorator('printHeight', {
-                initialValue: config.printHeight || ''
-              })(<InputNumber min={10} max={9999} precision={0} onChange={this.changePrintHeight}/>)}
-            </Form.Item>
-          </Col> : null}
-        </Row>
-      </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', {
+                  initialValue: config.pageSize || 'A4',
+                  rules: [
+                    {
+                      required: true,
+                      message: '璇烽�夋嫨鎵撳嵃灏哄!'
+                    }
+                  ]
+                })(
+                  <Select onChange={(val) => this.selectChange('pageSize', val)}>
+                    <Select.Option value="A3">A3</Select.Option>
+                    <Select.Option value="A4">A4</Select.Option>
+                    <Select.Option value="A5">A5</Select.Option>
+                  </Select>
+                )}
+              </Form.Item>
+            </Col>
+            <Col span={24}>
+              <Form.Item label="鎵撳嵃甯冨眬">
+                {getFieldDecorator('pageLayout', {
+                  initialValue: config.pageLayout || 'vertical',
+                  rules: [
+                    {
+                      required: true,
+                      message: '璇烽�夋嫨鎵撳嵃甯冨眬!'
+                    }
+                  ]
+                })(
+                  <Radio.Group onChange={(e) => this.selectChange('pageLayout', e.target.value)}>
+                    <Radio value="vertical">绾靛悜</Radio>
+                    <Radio value="horizontal">妯悜</Radio>
+                  </Radio.Group>
+                )}
+              </Form.Item>
+            </Col>
+            <Col span={24}>
+              <Form.Item label="鎵撳嵃杈硅窛">
+                {getFieldDecorator('pagePadding', {
+                  initialValue: config.pagePadding || 'default',
+                  rules: [
+                    {
+                      required: true,
+                      message: '璇烽�夋嫨鎵撳嵃杈硅窛!'
+                    }
+                  ]
+                })(
+                  <Radio.Group onChange={(e) => this.selectChange('pagePadding', e.target.value)}>
+                    <Radio value="default">榛樿</Radio>
+                    <Radio value="without">鏃�</Radio>
+                  </Radio.Group>
+                )}
+              </Form.Item>
+            </Col>
+            <Col span={24}>
+              <Form.Item label="椤甸潰甯冨眬">
+                {getFieldDecorator('printPage', {
+                  initialValue: config.printPage || 'auto'
+                })(
+                  <Radio.Group className="mini-radio" onChange={(e) => this.selectChange('printPage', e.target.value)}>
+                    <Radio value="auto">鑷�傚簲</Radio>
+                    <Radio value="page">鍒嗛〉</Radio>
+                    <Radio value="custom">鑷畾涔�</Radio>
+                  </Radio.Group>
+                )}
+              </Form.Item>
+            </Col>
+            {config.printPage === 'custom' ? <Col span={24}>
+              <Form.Item label="鑷畾涔夎剼鏈�">
+                <EditOutlined style={{color: '#1890ff'}} onClick={() => this.setState({visible: true, printScripts: config.printScripts || ''})} />
+              </Form.Item>
+            </Col> : null}
+            {config.printPage === 'page' ? <Col span={24}>
+              <Form.Item label="姣忛〉鏁�(鏉�)">
+                {getFieldDecorator('everyPCount', {
+                  initialValue: config.everyPCount || 15,
+                  rules: [
+                    {
+                      required: true,
+                      message: '璇疯緭鍏ユ瘡椤垫暟!'
+                    }
+                  ]
+                })(<InputNumber min={1} max={1000} precision={1} onChange={(val) => this.selectChange('everyPCount', val)}/>)}
+              </Form.Item>
+            </Col> : null}
+            <Col span={24}>
+              <Form.Item label={
+                <Tooltip placement="topLeft" title="閽堝涓嶈鍒欑焊寮狅紝鍙嚜瀹氫箟璁剧疆鎵撳嵃楂樺害鍜屽搴︼紝娉細鍚屾椂璁剧疆鎵撳嵃瀹藉害鍜岄珮搴﹀悗鏂瑰彲鐢熸晥銆�">
+                  <QuestionCircleOutlined className="mk-form-tip" />
+                  鑷畾涔�
+                </Tooltip>
+              }>
+                {getFieldDecorator('printCustom', {
+                  initialValue: config.printCustom || 'false'
+                })(
+                  <Radio.Group onChange={(e) => this.selectChange('printCustom', e.target.value)}>
+                    <Radio value="false">涓嶅惎鐢�</Radio>
+                    <Radio value="true">鍚敤</Radio>
+                  </Radio.Group>
+                )}
+              </Form.Item>
+            </Col>
+            {config.printCustom === 'true' ? <Col span={24}>
+              <Form.Item label="鎵撳嵃瀹藉害">
+                {getFieldDecorator('printWidth', {
+                  initialValue: config.printWidth || ''
+                })(<InputNumber min={10} max={9999} precision={0} onChange={(val) => this.selectChange('printWidth', val)}/>)}
+              </Form.Item>
+            </Col> : null}
+            {config.printCustom === 'true' ? <Col span={24}>
+              <Form.Item label="鎵撳嵃楂樺害">
+                {getFieldDecorator('printHeight', {
+                  initialValue: config.printHeight || ''
+                })(<InputNumber min={10} max={9999} precision={0} onChange={(val) => this.selectChange('printHeight', val)}/>)}
+              </Form.Item>
+            </Col> : null}
+            <Col span={24}>
+              <Form.Item label={
+                <Tooltip placement="topLeft" title="鍚敤鏃讹紝鍦ㄨ彍鍗曞畬鎴愭暟鎹姞杞藉悗鑷姩瑙﹀彂鎵撳嵃棰勮銆�">
+                  <QuestionCircleOutlined className="mk-form-tip" />
+                  鑷姩鎵撳嵃
+                </Tooltip>
+              }>
+                {getFieldDecorator('autoExec', {
+                  initialValue: config.autoExec || 'false'
+                })(
+                  <Radio.Group onChange={(e) => this.selectChange('autoExec', e.target.value)}>
+                    <Radio value="false">涓嶅惎鐢�</Radio>
+                    <Radio value="true">鍚敤</Radio>
+                  </Radio.Group>
+                )}
+              </Form.Item>
+            </Col>
+            {config.autoExec === 'true' ? <Col span={24}>
+              <Form.Item label={
+                <Tooltip placement="topLeft" title="鑷姩瑙﹀彂鎵撳嵃棰勮鐨勫欢杩熸椂闂达紝鍗曚綅姣銆�">
+                  <QuestionCircleOutlined className="mk-form-tip" />
+                  寤惰繜鏃堕棿
+                </Tooltip>
+              }>
+                {getFieldDecorator('autoExecSplit', {
+                  initialValue: config.autoExecSplit || 500
+                })(<InputNumber min={1} max={9999} precision={0} onChange={(val) => this.selectChange('autoExecSplit', val)}/>)}
+              </Form.Item>
+            </Col> : null}
+            <Col span={24}>
+              <Form.Item label="鍥炶皟">
+                {getFieldDecorator('callback', {
+                  initialValue: config.callback || 'false'
+                })(
+                  <Radio.Group onChange={(e) => this.selectChange('callback', e.target.value)}>
+                    <Radio value="false">涓嶅惎鐢�</Radio>
+                    <Radio value="true">鍚敤</Radio>
+                  </Radio.Group>
+                )}
+              </Form.Item>
+            </Col>
+            {config.callback === 'true' ? <Col span={24}>
+              <Form.Item label={
+                <Tooltip placement="topLeft" title="鍥炶皟鍑芥暟鎵ц鎴愬姛鍚庨粯璁や細鍒锋柊婧愯彍鍗曢〉锛岃繑鍥炰俊鎭紙@retmsg锛変腑鍚湁锛園no_target_menu@锛夊彲闃绘姝ら」鍒锋柊銆�">
+                  <QuestionCircleOutlined className="mk-form-tip" />
+                  鍥炶皟鍑芥暟
+                </Tooltip>
+              }>
+                s_print_proc <EditOutlined style={{cursor: 'pointer'}} onClick={() => {window.open('#/proc/s_print_proc')}}/>
+              </Form.Item>
+            </Col> : null}
+            {config.callback === 'true' ? <Col span={24}>
+              <Form.Item label="鍥炶皟鍙傛暟">
+                {getFieldDecorator('callNo', {
+                  initialValue: config.callNo || '',
+                  rules: [
+                    {
+                      required: true,
+                      message: '璇峰~鍐欏洖璋冨弬鏁�!'
+                    },
+                    {
+                      pattern: /^[a-zA-Z0-9_]+$/,
+                      message: '鍥炶皟鍙傛暟鍙彲浣跨敤瀛楁瘝銆佹暟瀛椾互鍙奯'
+                    }
+                  ]
+                })(<Input onChange={(e) => this.selectChange('callNo', e.target.value)}/>)}
+              </Form.Item>
+            </Col> : null}
+            <Col span={24}>
+              <Form.Item label={
+                <Tooltip placement="topLeft" title="鍙嚜瀹氫箟鍦ㄦ祻瑙堝櫒鏍囬鏍忎腑鏄剧ず鐨勭綉椤垫爣棰樸��">
+                  <QuestionCircleOutlined className="mk-form-tip" />
+                  缃戦〉鏍囬
+                </Tooltip>
+              }>
+                {getFieldDecorator('webTitle', {
+                  initialValue: config.webTitle || ''
+                })(<Input onChange={(e) => this.selectChange('webTitle', e.target.value)}/>)}
+              </Form.Item>
+            </Col>
+          </Row>
+        </Form>
+        <Modal
+          title="鑷畾涔夎剼鏈�"
+          wrapClassName="normal-css-modal"
+          visible={visible}
+          width={800}
+          maskClosable={false}
+          onOk={this.submit}
+          onCancel={() => { this.setState({ visible: false })}}
+          destroyOnClose
+        >
+          <CodeMirror mode="text/javascript" theme="cobalt" value={printScripts} onChange={this.onScriptChange} />
+        </Modal>
+      </>
     )
   }
 }

--
Gitblit v1.8.0