From 6e106eb13ce404d9955d6c9045d21050d3e08294 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 20 十一月 2020 11:19:36 +0800
Subject: [PATCH] 2020-11-20

---
 src/tabviews/custom/components/search/main-search/index.jsx |   46 +++++++++++++++++++++++++---------------------
 1 files changed, 25 insertions(+), 21 deletions(-)

diff --git a/src/tabviews/custom/components/search/main-search/index.jsx b/src/tabviews/custom/components/search/main-search/index.jsx
index 1aad4c6..e6ab5e5 100644
--- a/src/tabviews/custom/components/search/main-search/index.jsx
+++ b/src/tabviews/custom/components/search/main-search/index.jsx
@@ -434,6 +434,7 @@
 
   getFields() {
     const { getFieldDecorator } = this.props.form
+    const { config } = this.props
     const fields = []
 
     this.state.searchlist.forEach((item, index) => {
@@ -442,7 +443,7 @@
       if (item.type === 'text') { // 鏂囨湰鎼滅储
         fields.push(
           <Col span={item.ratio || 6} key={index}>
-            <Form.Item label={item.label}>
+            <Form.Item label={item.labelShow !== 'false' ? item.label : ''}>
               {getFieldDecorator(item.field, {
                 initialValue: item.initval,
                 rules: [
@@ -458,7 +459,7 @@
       } else if (item.type === 'select') { // 涓嬫媺鎼滅储
         fields.push(
           <Col span={item.ratio || 6} key={index}>
-            <Form.Item label={item.label}>
+            <Form.Item label={item.labelShow !== 'false' ? item.label : ''}>
               {getFieldDecorator(item.field, {
                 initialValue: item.initval,
                 rules: [
@@ -486,7 +487,7 @@
         let _initval = item.initval ? item.initval.split(',').filter(Boolean) : []
         fields.push(
           <Col span={item.ratio || 6} key={index}>
-            <Form.Item label={item.label}>
+            <Form.Item label={item.labelShow !== 'false' ? item.label : ''}>
               {getFieldDecorator(item.field, {
                 initialValue: _initval,
                 rules: [
@@ -514,7 +515,7 @@
       } else if (item.type === 'date') { // 鏃堕棿鎼滅储
         fields.push(
           <Col span={item.ratio || 6} key={index}>
-            <Form.Item label={item.label}>
+            <Form.Item label={item.labelShow !== 'false' ? item.label : ''}>
               {getFieldDecorator(item.field, {
                 initialValue: item.initval ? moment().subtract(item.initval, 'days') : null,
                 rules: [
@@ -532,7 +533,7 @@
       } else if (item.type === 'datemonth') {
         fields.push(
           <Col span={item.ratio || 6} key={index}>
-            <Form.Item label={item.label}>
+            <Form.Item label={item.labelShow !== 'false' ? item.label : ''}>
               {getFieldDecorator(item.field, {
                 initialValue: item.initval ? moment().subtract(item.initval, 'month') : null,
                 rules: [
@@ -550,7 +551,7 @@
       } else if (item.type === 'dateweek') {
         fields.push(
           <Col span={item.ratio || 6} key={index}>
-            <Form.Item label={item.label}>
+            <Form.Item label={item.labelShow !== 'false' ? item.label : ''}>
               {getFieldDecorator(item.field, {
                 initialValue: item.initval ? moment().subtract(item.initval * 7, 'days') : null,
                 rules: [
@@ -579,7 +580,7 @@
 
         fields.push(
           <Col className="daterange" span={item.ratio || 6} key={index}>
-            <Form.Item label={item.label}>
+            <Form.Item label={item.labelShow !== 'false' ? item.label : ''}>
               {getFieldDecorator(item.field,
                 {
                   initialValue: _defaultValue,
@@ -603,7 +604,7 @@
       } else if (item.type === 'group') {
         fields.push(
           <Col span={item.ratio || 6} key={index}>
-            <Form.Item label={item.label} className={item.required === 'true' ? 'group-required' : ''}>
+            <Form.Item label={item.labelShow !== 'false' ? item.label : ''} className={item.required === 'true' ? 'group-required' : ''}>
               <DateGroup ref={item.uuid} position={index} card={item} onGroupChange={this.searchChange} />
             </Form.Item>
           </Col>
@@ -611,18 +612,20 @@
       }
     })
 
-    fields.push(
-      <Col span={6} style={{ whiteSpace: 'nowrap' }} key="actions">
-        <Form.Item label={' '} colon={false} style={{ minHeight: '40px' }}>
-          <Button type="primary" htmlType="submit">
-            {this.state.dict['main.search']}
-          </Button>
-          <Button style={{ marginLeft: 8 }} onClick={this.handleReset}>
-            {this.state.dict['main.reset']}
-          </Button>
-        </Form.Item>
-      </Col>
-    )
+    if (config.wrap.float !== 'right' && config.wrap.show !== 'false') {
+      fields.push(
+        <Col span={6} style={{ whiteSpace: 'nowrap' }} key="actions">
+          <Form.Item label={' '} colon={false} style={{ minHeight: '40px' }}>
+            <Button type="primary" htmlType="submit">
+              {this.state.dict['main.search']}
+            </Button>
+            <Button style={{ marginLeft: 8 }} onClick={this.handleReset}>
+              {this.state.dict['main.reset']}
+            </Button>
+          </Form.Item>
+        </Col>
+      )
+    }
     
     return fields
   }
@@ -770,6 +773,7 @@
   }
 
   render() {
+    const { config } = this.props
     const formItemLayout = {
       labelCol: {
         xs: { span: 24 },
@@ -782,7 +786,7 @@
     }
 
     return (
-      <Form {...formItemLayout} className="custom-main-search" id={this.state.formId} onSubmit={this.handleSearch}>
+      <Form {...formItemLayout} className={`custom-main-search ${config.wrap.float} ${config.wrap.show}`} style={config.style} id={this.state.formId} onSubmit={this.handleSearch}>
         <Row gutter={24}>{this.getFields()}</Row>
       </Form>
     )

--
Gitblit v1.8.0