From 42fae277ae5ebe794fc070bf38482a919eb661fc Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 25 十一月 2020 14:36:02 +0800
Subject: [PATCH] 2020-11-25

---
 src/menu/datasource/verifycard/settingform/index.jsx |  112 ++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 76 insertions(+), 36 deletions(-)

diff --git a/src/menu/datasource/verifycard/settingform/index.jsx b/src/menu/datasource/verifycard/settingform/index.jsx
index de9225c..3cfed31 100644
--- a/src/menu/datasource/verifycard/settingform/index.jsx
+++ b/src/menu/datasource/verifycard/settingform/index.jsx
@@ -20,8 +20,11 @@
 
   state = {
     interType: this.props.setting.interType || 'system',
+    laypage: this.props.setting.laypage || 'true',
     modules: [],
-    useMSearch: this.props.setting.useMSearch || 'false'
+    usefulFields: [],
+    useMSearch: this.props.setting.useMSearch || 'false',
+    supModule: this.props.setting.supModule || []
   }
 
   UNSAFE_componentWillMount () {
@@ -37,7 +40,18 @@
       label: '鏃�'
     })
 
-    this.setState({modules})
+    let usefulFields = sessionStorage.getItem('permFuncField')
+    if (usefulFields) {
+      try {
+        usefulFields = JSON.parse(usefulFields)
+      } catch {
+        usefulFields = []
+      }
+    } else {
+      usefulFields = []
+    }
+
+    this.setState({modules, usefulFields})
   }
 
   getModules = (components, selfId) => {
@@ -171,10 +185,14 @@
     }
   }
 
+  changeSupModule = (val) => {
+    this.setState({supModule: val})
+  }
+
   render() {
     const { setting, menu, columns, config } = this.props
     const { getFieldDecorator } = this.props.form
-    const { interType, modules, useMSearch } = this.state
+    const { interType, modules, useMSearch, laypage, supModule, usefulFields } = this.state
 
     const formItemLayout = {
       labelCol: {
@@ -190,9 +208,9 @@
     let tooltip = null
     let rules = []
 
-    if (menu.permFuncField && menu.permFuncField.length > 0) {
-      tooltip = '寮�澶村彲鐢ㄥ瓧绗︼細' + menu.permFuncField.join(', ')
-      let str = '^(' + menu.permFuncField.join('|') + ')'
+    if (usefulFields.length > 0) {
+      tooltip = '寮�澶村彲鐢ㄥ瓧绗︼細' + usefulFields.join(', ')
+      let str = '^(' + usefulFields.join('|') + ')'
       let _patten = new RegExp(str + formRule.func.innerPattern + '$', 'g')
 
       rules.push({
@@ -205,7 +223,6 @@
       <div className="model-datasource-setting-form-box">
         <Form {...formItemLayout} className="model-setting-form">
           <Row gutter={24}>
-            
             <Col span={8}>
               <Form.Item label="琛ㄥ悕">
                 {getFieldDecorator('tableName', {
@@ -237,6 +254,28 @@
                 </Radio.Group>)}
               </Form.Item>
             </Col>
+            {interType === 'system' ? <Col span={8}>
+              <Form.Item label={
+                <Tooltip placement="topLeft" title={'鑷畾涔夎剼鏈腑鐨勫彉閲忥紙闄ゆ姤閿欏強鍙敤瀛楁澶栵級锛岄渶浠ユ鏍囪瘑寮�澶淬��'}>
+                  <Icon type="question-circle" />
+                  鍙橀噺鏍囪瘑
+                </Tooltip>
+              }>
+                {getFieldDecorator('varMark', {
+                  initialValue: setting.varMark || '',
+                  rules: [
+                    {
+                      pattern: /^[a-zA-Z_]*$/ig,
+                      message: '璇蜂娇鐢ㄥ瓧姣嶆垨_'
+                    },
+                    {
+                      max: 3,
+                      message: '鏈�澶氫笁涓瓧绗︺��'
+                    }
+                  ]
+                })(<Input placeholder={''} autoComplete="off" />)}
+              </Form.Item>
+            </Col> : null}
             {interType === 'inner' ? <Col span={8}>
               <Form.Item label={tooltip ?
                 <Tooltip placement="topLeft" title={tooltip}>
@@ -347,7 +386,7 @@
                 </Radio.Group>)}
               </Form.Item>
             </Col> : null}
-            <Col span={8}>
+            {menu.MenuType !== 'billPrint' ? <Col span={8}>
               <Form.Item label={
                 <Tooltip placement="topLeft" title={'璇ョ粍浠跺鏋滃彈鍏朵粬缁勪欢鎺у埗锛岃閫夐」鐩稿簲鐨勭粍浠讹紝娌℃湁鏃堕�夆�滄棤鈥濄��'}>
                   <Icon type="question-circle" />
@@ -355,7 +394,7 @@
                 </Tooltip>
               }>
                 {getFieldDecorator('supModule', {
-                  initialValue: setting.supModule || [],
+                  initialValue: supModule,
                   rules: [
                     {
                       required: true,
@@ -363,40 +402,23 @@
                     }
                   ]
                 })(
-                  <Cascader options={modules} expandTrigger="hover" placeholder="" />
-                )}
-              </Form.Item>
-            </Col>
-            {!config.pageable ? <Col span={8}>
-              <Form.Item label={
-                <Tooltip placement="topLeft" title={'鍒濆鍖栧姞杞芥椂锛屾槸鍚︿笌鍏朵粬缁勪欢涓�鍚屽姞杞芥暟鎹紝娉細浠呭湪浣跨敤绯荤粺鍑芥暟锛屼笖鍒濆鍖栧姞杞芥暟鎹椂鏈夋晥锛屽垎椤佃姹傛椂鏃犳晥銆�'}>
-                  <Icon type="question-circle" />
-                  鍚屾鏌ヨ
-                </Tooltip>
-              }>
-                {getFieldDecorator('sync', {
-                  initialValue: setting.sync || 'true'
-                })(
-                  <Radio.Group>
-                    <Radio value="true">鏄�</Radio>
-                    <Radio value="false">鍚�</Radio>
-                  </Radio.Group>
+                  <Cascader options={modules} onChange={this.changeSupModule} expandTrigger="hover" placeholder="" />
                 )}
               </Form.Item>
             </Col> : null}
-            {config.pageable ? <Col span={8}>
+            {menu.MenuType !== 'billPrint' && config.pageable ? <Col span={8}>
               <Form.Item label="鍒嗛〉">
                 {getFieldDecorator('laypage', {
-                  initialValue: setting.laypage || 'false'
+                  initialValue: setting.laypage || 'true'
                 })(
-                  <Radio.Group>
+                  <Radio.Group onChange={(e) => this.setState({laypage: e.target.value})}>
                     <Radio value="true">鏄�</Radio>
                     <Radio value="false">鍚�</Radio>
                   </Radio.Group>
                 )}
               </Form.Item>
             </Col> : null}
-            {config.pageable ? <Col span={8}>
+            {menu.MenuType !== 'billPrint' && config.pageable && laypage !== 'false' ? <Col span={8}>
               <Form.Item label={
                 <Tooltip placement="topLeft" title="閫夋嫨鍒嗛〉鏃舵湁鏁堛��">
                   <Icon type="question-circle" />
@@ -414,7 +436,25 @@
                 })(<InputNumber min={1} max={500} precision={0} />)}
               </Form.Item>
             </Col> : null}
-            <Col span={8}>
+            {/* 1銆佷笉鍒嗛〉涓斾笉瀛樺湪涓婄骇妯″潡 2銆佹墦鍗版椂 */}
+            {((!config.pageable || (config.pageable && laypage === 'false')) && (!supModule || supModule.length === 0 || supModule[0] === 'empty')) || menu.MenuType === 'billPrint' ? <Col span={8}>
+              <Form.Item label={
+                <Tooltip placement="topLeft" title={'鍒濆鍖栧姞杞芥椂锛屾槸鍚︿笌鍏朵粬缁勪欢涓�鍚屽姞杞芥暟鎹紝娉細浠呭湪浣跨敤绯荤粺鍑芥暟锛屼笖鍒濆鍖栧姞杞芥暟鎹椂鏈夋晥锛屽垎椤佃姹傛椂鏃犳晥銆�'}>
+                  <Icon type="question-circle" />
+                  鍚屾鏌ヨ
+                </Tooltip>
+              }>
+                {getFieldDecorator('sync', {
+                  initialValue: setting.sync || 'true'
+                })(
+                  <Radio.Group>
+                    <Radio value="true">鏄�</Radio>
+                    <Radio value="false">鍚�</Radio>
+                  </Radio.Group>
+                )}
+              </Form.Item>
+            </Col> : null}
+            {menu.MenuType !== 'billPrint' ? <Col span={8}>
               <Form.Item label={
                 <Tooltip placement="topLeft" title={'浼樺厛浣跨敤鍚岀骇鐨勬悳绱㈡潯浠剁粍浠讹紝鍚岀骇鎼滅储涓嶅瓨鍦ㄦ椂锛屼緷娆″悜涓婇�夊彇锛屼笌褰撳墠缁勪欢鐨勬悳绱㈡潯浠朵竴鍚岀敤浣滄暟鎹繃婊わ紙褰撳墠缁勪欢鐨勬悳绱㈡潯浠朵紭鍏堬級銆�'}>
                   <Icon type="question-circle" />
@@ -430,8 +470,8 @@
                   </Radio.Group>
                 )}
               </Form.Item>
-            </Col>
-            {useMSearch === 'true' ? <Col span={8}>
+            </Col> : null}
+            {menu.MenuType !== 'billPrint' && useMSearch === 'true' ? <Col span={8}>
               <Form.Item label={
                 <Tooltip placement="topLeft" title={'澶栧眰鎼滅储鏉′欢鏀瑰彉鏃讹紝鏄惁鍒锋柊褰撳墠缁勪欢鏁版嵁銆�'}>
                   <Icon type="question-circle" />
@@ -448,7 +488,7 @@
                 )}
               </Form.Item>
             </Col> : null}
-            <Col span={8}>
+            {menu.MenuType !== 'billPrint' ? <Col span={8}>
               <Form.Item label="鍒濆鍖栨暟鎹�">
                 {getFieldDecorator('onload', {
                   initialValue: setting.onload || 'true'
@@ -459,7 +499,7 @@
                   </Radio.Group>
                 )}
               </Form.Item>
-            </Col>
+            </Col> : null}
           </Row>
         </Form>
       </div>

--
Gitblit v1.8.0