From bfadd84fbc2b23c59695e5a94778ab7ac40fea03 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期六, 26 六月 2021 22:54:17 +0800
Subject: [PATCH] 2021-06-26

---
 src/templates/sharecomponent/searchcomponent/searchform/index.jsx |   40 ++++++++++++++++++++++++++++++++++------
 1 files changed, 34 insertions(+), 6 deletions(-)

diff --git a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx
index 4ea9001..af2d93c 100644
--- a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx
+++ b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx
@@ -87,7 +87,7 @@
 ]
 
 const searchTypeOptions = {
-  text: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced'],
+  text: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'inputType', 'advanced'],
   select: ['label', 'field', 'resourceType', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'setAll'],
   multiselect: ['label', 'field', 'resourceType', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced'],
   link: ['label', 'field', 'resourceType', 'initval', 'type', 'linkField', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'setAll'],
@@ -96,7 +96,7 @@
   dateweek: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced'],
   datemonth: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced'],
   daterange: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced'],
-  group: ['label', 'type', 'field', 'datefield', 'initval', 'blacklist', 'ratio', 'items', 'required', 'transfer', 'labelShow']
+  group: ['label', 'type', 'field', 'datefield', 'initval', 'blacklist', 'ratio', 'items', 'required', 'labelShow']
 }
 
 class MainSearch extends Component {
@@ -129,6 +129,7 @@
     let resourceType = ''
     let display = ''
     let cFields = []
+    let multiple = 'false'
 
     formlist.forEach(cell => {
       if (cell.key === 'type') {
@@ -141,6 +142,8 @@
         resourceType = cell.initVal
       } else if (cell.key === 'fields') {
         cFields = cell.initVal
+      } else if (cell.key === 'multiple') {
+        multiple = cell.initVal
       }
     })
 
@@ -163,7 +166,7 @@
         } else if (form.key === 'match') { // 琛ㄥ崟涓哄尮閰嶅瓧娈垫椂锛屾牴鎹笉鍚岀殑绫诲瀷锛屾樉绀哄搴旂殑鍖归厤瑙勫垯
           if (type === 'text') {
             form.options = matchReg.text
-          } else if (type === 'multiselect') {
+          } else if (type === 'multiselect' || (type === 'checkcard' && multiple === 'true')) {
             form.options = matchReg.multiselect
           } else if (type === 'select' || type === 'link' || type === 'checkcard') {
             form.options = matchReg.select
@@ -174,9 +177,10 @@
           } else if (type === 'dateweek' || type === 'daterange') {
             form.options = matchReg.daterange
           }
-        } else if (form.key === 'field' && type === 'text') {
+        } else if (form.key === 'field' && (type === 'text' || type === 'select')) {
           form.tooltip = this.state.textTooltip
         } else if (form.key === 'field' && type === 'group') {
+          form.tooltip = '鏌ヨ鏁版嵁鏃讹紙鑷畾涔夎剼鏈垨缁熻鏁版嵁婧愶級锛岀被鍨嬪瓧娈靛皢鐢ㄤ綔鏇挎崲鑴氭湰涓殑 @瀛楁@ 锛岀被鍨嬪瓧娈靛搴斿�间负 {"鏃�": "day", "鍛�": "week", "鏈�": "month", "瀛�": "quarter", "骞�": "year", "鑷畾涔�": "customized"}銆�'
           form.label = dict['model.form.type'] + dict['model.form.field']
         }
         form.hidden = !_options.includes(form.key)
@@ -268,9 +272,10 @@
           } else if (form.key === 'field') {
             form.tooltip = ''
             form.label = dict['model.form.field']
-            if (value === 'text') {
+            if (value === 'text' || value === 'select') {
               form.tooltip = this.state.textTooltip
             } else if (value === 'group') {
+              form.tooltip = '鏌ヨ鏁版嵁鏃讹紙鑷畾涔夎剼鏈垨缁熻鏁版嵁婧愶級锛岀被鍨嬪瓧娈靛皢鐢ㄤ綔鏇挎崲鑴氭湰涓殑 @瀛楁@ 锛岀被鍨嬪瓧娈靛搴斿�间负 {"鏃�": "day", "鍛�": "week", "鏈�": "month", "瀛�": "quarter", "骞�": "year", "鑷畾涔�": "customized"}銆�'
               form.label = dict['model.form.type'] + dict['model.form.field']
             }
           }
@@ -283,6 +288,9 @@
         }
         if (this.props.form.getFieldValue('match') !== undefined) {
           this.props.form.setFieldsValue({match: matchs[0].value})
+        }
+        if (this.props.form.getFieldValue('multiple') !== undefined) {
+          this.props.form.setFieldsValue({multiple: 'false'})
         }
       })
     }
@@ -314,6 +322,26 @@
           form.hidden = !_options.includes(form.key)
           return form
         })
+      })
+    } else if (key === 'multiple') {
+      let matchs = []
+      this.setState({
+        formlist: this.state.formlist.map(form => {
+          if (form.key === 'match') {
+            if (value === 'true') {
+              form.options = matchReg.multiselect
+            } else {
+              form.options = matchReg.select
+            }
+            matchs = form.options
+          }
+
+          return form
+        })
+      }, () => {
+        if (this.props.form.getFieldValue('match') !== undefined) {
+          this.props.form.setFieldsValue({match: matchs[0].value})
+        }
       })
     }
   }
@@ -365,7 +393,7 @@
     const { getFieldDecorator } = this.props.form
     const fields = []
     this.state.formlist.forEach((item, index) => {
-      if (item.hidden) return
+      if (item.hidden || item.forbid) return
 
       if (item.type === 'text') { // 鏂囨湰鎼滅储
         let rules = []

--
Gitblit v1.8.0