From 7d206112a4ca1930639907a7cb131d0c1e6525a6 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期日, 24 十一月 2019 12:23:08 +0800
Subject: [PATCH] 2019-11-24-01

---
 src/tabviews/commontable/mainSearch/index.jsx |   61 +++++++++++++++---------------
 1 files changed, 31 insertions(+), 30 deletions(-)

diff --git a/src/tabviews/commontable/modules/mainSearch/index.jsx b/src/tabviews/commontable/mainSearch/index.jsx
similarity index 77%
rename from src/tabviews/commontable/modules/mainSearch/index.jsx
rename to src/tabviews/commontable/mainSearch/index.jsx
index 0b555de..c8bb8e8 100644
--- a/src/tabviews/commontable/modules/mainSearch/index.jsx
+++ b/src/tabviews/commontable/mainSearch/index.jsx
@@ -23,21 +23,22 @@
   }
 
   UNSAFE_componentWillMount () {
-    let formats = {}
-    let match = {}
-    this.props.searchlist.forEach(item => {
-      if (item.Type === 'date') {
-        // formats[item.FieldName] = dateFormat
-        formats[item.FieldName] = weekFormat
-      } else if (item.ID === 'WHE1400200905') {
-        formats[item.FieldName] = monthFormat
-      }
-      match[item.FieldName] = item.Op
-    })
-    this.setState({
-      formats: formats,
-      match: match
-    })
+    console.log(this.props.searchlist)
+    // let formats = {}
+    // let match = {}
+    // this.props.searchlist.forEach(item => {
+    //   if (item.Type === 'date') {
+    //     // formats[item.FieldName] = dateFormat
+    //     formats[item.FieldName] = weekFormat
+    //   } else if (item.ID === 'WHE1400200905') {
+    //     formats[item.FieldName] = monthFormat
+    //   }
+    //   match[item.FieldName] = item.Op
+    // })
+    // this.setState({
+    //   formats: formats,
+    //   match: match
+    // })
   }
 
   // shouldComponentUpdate (nextProps, nextState) {
@@ -48,39 +49,39 @@
     const { getFieldDecorator } = this.props.form
     const fields = []
     this.props.searchlist.forEach((item, index) => {
-      if (item.Type === 'text' || item.Type === 'string') { // 鏂囨湰鎼滅储
+      if (item.type === 'text') { // 鏂囨湰鎼滅储
         fields.push(
           <Col span={6} key={index}>
-            <Form.Item label={item.Label}>
-              {getFieldDecorator(item.FieldName)(<Input placeholder="" autoComplete="off" />)}
+            <Form.Item label={item.label}>
+              {getFieldDecorator(item.field, {initialValue: item.initval })(<Input placeholder="" autoComplete="off" />)}
             </Form.Item>
           </Col>
         )
-      } else if (item.Type === 'select') { // 涓嬫媺鎼滅储
+      } else if (item.type === 'select') { // 涓嬫媺鎼滅储
         fields.push(
           <Col span={6} key={index}>
-            <Form.Item label={item.Label}>
-              {getFieldDecorator(item.FieldName, {initialValue: item.DynOptions[0].id })(
+            <Form.Item label={item.label}>
+              {getFieldDecorator(item.field, {initialValue: item.initval })(
                 <Select
                   showSearch
-                  onChange={(val) => {this.selectChange(item.FieldName, val)}}
+                  onChange={(val) => {this.selectChange(item.field, val)}}
                   filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                 >
-                  {item.DynOptions.map(option =>
-                    <Select.Option id={option.id} title={option.text} key={option.id} value={option.id}>{option.text}</Select.Option>
+                  {item.options.map(option =>
+                    <Select.Option id={option.key} title={option.Text} key={option.key} value={option.Value}>{option.Text}</Select.Option>
                   )}
                 </Select>
               )}
             </Form.Item>
           </Col>
         )
-      } else if (item.Type === 'date') { // 鏃堕棿鎼滅储
+      } else if (item.type === 'date') { // 鏃堕棿鎼滅储
         if (item.ID === 'WHE14002009024') {
           fields.push(
             <Col span={6} key={index}>
-              <Form.Item label={item.Label}>
-                {getFieldDecorator(item.FieldName, {initialValue: moment('2019-09-14', dateFormat) })(
-                  <DatePicker format={dateFormat} onChange={(val) => {this.timeChange(item.FieldName, val)}} />
+              <Form.Item label={item.label}>
+                {getFieldDecorator(item.field, {initialValue: moment('2019-09-14', dateFormat) })(
+                  <DatePicker format={dateFormat} onChange={(val) => {this.timeChange(item.field, val)}} />
                 )}
               </Form.Item>
             </Col>
@@ -88,8 +89,8 @@
         } else if (item.ID === 'WHE1400200905') {
           fields.push(
             <Col span={6} key={index}>
-              <Form.Item label={item.Label}>
-                {getFieldDecorator(item.FieldName, {initialValue: moment('2019-09', monthFormat) })(
+              <Form.Item label={item.label}>
+                {getFieldDecorator(item.field, {initialValue: moment('2019-09', monthFormat) })(
                   <MonthPicker format={monthFormat} onChange={(val) => {this.timeChange(item.FieldName, val)}} />
                 )}
               </Form.Item>

--
Gitblit v1.8.0