king
2020-04-17 bf772e586c29b4858366dbad143b1eaeca3c46ed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { Form, Row, Col, Input, InputNumber, Select, DatePicker, notification } from 'antd'
import moment from 'moment'
import { formRule } from '@/utils/option.js'
import Utils from '@/utils/utils.js'
import FileUpload from '../fileupload'
import './index.scss'
 
const {MonthPicker} = DatePicker
const { TextArea } = Input
 
class MainSearch extends Component {
  static propTpyes = {
    action: PropTypes.object,    // 按钮信息、表单列表
    dict: PropTypes.object,      // 字典项
    data: PropTypes.any,         // 表格数据
    BData: PropTypes.any,        // 主表数据
    configMap: PropTypes.object, // 按钮及下拉表单配置信息集
    inputSubmit: PropTypes.func  // input回车提交
  }
 
  state = {
    cols: 2,
    datatype: null,
    readtype: null,
    readin: null,
    fieldlen: null,
    formlist: [],
    record: {}
  }
 
  UNSAFE_componentWillMount () {
    let cols = 2
    if (this.props.action.setting && this.props.action.setting.cols) {
      cols = parseInt(this.props.action.setting.cols)
      if (cols > 3 || cols < 1) {
        cols = 2
      }
    }
 
    this.setState({
      cols: cols
    })
  }
 
  componentDidMount () {
    const { data, BData } = this.props
    let action = JSON.parse(JSON.stringify(this.props.action))
    
    let datatype = {}
    let readtype = {}
    let readin = {}
    let fieldlen = {}
    let formlist = []
 
    if (action.groups.length > 0) {
      action.groups.forEach(group => {
        if (group.sublist.length === 0) return
 
        if (!group.default) {
          formlist.push({
            type: 'title',
            label: group.label,
            uuid: group.uuid
          })
        }
 
        formlist.push(...group.sublist)
      })
    } else {
      formlist = action.fields
    }
 
    let _inputfields = formlist.filter(item => item.type === 'text' || item.type === 'number') // 用于过滤下拉菜单关联表单
 
    formlist = formlist.map(item => {
      let _readin = item.readin !== 'false'
      if (item.type === 'linkMain' || item.type === 'funcvar') {
        _readin = false
      }
 
      item.initVal = item.initval ? JSON.parse(JSON.stringify(item.initval)) : '' // 用于受控值的表单,隐藏时传默认值
 
      let _fieldlen = item.fieldlength || 50
      if (item.type === 'textarea' || item.type === 'fileupload' || item.type === 'multiselect') {
        _fieldlen = item.fieldlength || 512
      } else if (item.type === 'number') {
        _fieldlen = item.decimal ? item.decimal : 0
      }
 
      datatype[item.field] = item.type
      readtype[item.field] = item.readonly === 'true'
      readin[item.field] = _readin
      fieldlen[item.field] = _fieldlen
 
      if (item.type === 'select' || item.type === 'link' || item.type === 'multiselect') {
        if (item.setAll === 'true') {
          item.options.unshift({
            key: Utils.getuuid(),
            Value: '',
            Text: this.props.dict['main.all']
          })
        }
 
        if (item.resourceType === '1' && this.props.configMap.hasOwnProperty(item.uuid)) {
          item.options = [...item.options, ...this.props.configMap[item.uuid]]
        }
 
        item.oriOptions = JSON.parse(JSON.stringify(item.options))
 
        if (item.linkSubField && item.linkSubField.length > 0) {
          let _fields = _inputfields.map(_item => _item.field)
          item.linkSubField = item.linkSubField.filter(_item => _fields.includes(_item))
        }
      }
 
      if (item.type === 'linkMain' && BData && BData.hasOwnProperty(item.field)) {
        item.initval = BData[item.field]
      } else if (item.type !== 'linkMain' && _readin && !/^date/.test(item.type) && this.props.data && this.props.data.hasOwnProperty(item.field)) {
        item.initval = this.props.data[item.field]
      }
 
      if (item.supvalue) {
        item.supvalue = item.supvalue.split(',')
      }
 
      return item
    })
 
    formlist = formlist.map(item => {
      if (item.type === 'link') {
        let supItem = formlist.filter(form => form.field === item.linkField)[0]
 
        // 关联显示列中的字段值,通过该值过滤下拉选项
        if (!supItem && data && data.hasOwnProperty(item.linkField)) {
          supItem = {initval: data[item.linkField]}
        }
        
        if (!supItem) {
          notification.warning({
            top: 92,
            message: '未查询到表单《' + item.label + '》关联字段!',
            duration: 10
          })
        } else {
          item.options = item.oriOptions.filter(option => option.parentId === supItem.initval)
        }
      }
 
      return item
    })
 
    this.setState({
      readtype: readtype,
      datatype: datatype,
      readin: readin,
      fieldlen: fieldlen,
      formlist: formlist
    }, () => {
      if (action.setting && action.setting.focus) {
        try {
          let _form = document.getElementById('main-form-box')
          let _item = _form.getElementsByTagName('input')
          _item = [..._item]
          _item.forEach(input => {
            if (!input || input.id !== action.setting.focus) return
            input.select()
          })
        } catch {
          console.warn('focus error!')
        }
      }
      this.setState({
        loaded: true
      })
    })
  }
 
  resetform = (formlist, supfields, index, fieldsvalue) => {
    index++
    let subfields = []
 
    supfields.forEach(supfield => {
      formlist = formlist.map(item => {
        if (item.type === 'link' && item.linkField === supfield.field) {
          item.options = item.oriOptions.filter(option => option.parentId === supfield.initval)
          item.initval = item.options[0] ? item.options[0].Value : ''
 
          fieldsvalue[item.field] = item.initval
  
          subfields.push(item)
        }
        return item
      })
    })
 
    if (subfields.length === 0 || index > 6) {
      return {formlist: formlist, fieldsvalue: fieldsvalue}
    } else {
      return this.resetform(formlist, subfields, index, fieldsvalue)
    }
  }
 
  selectChange = (_field, value, option) => {
    const { record } = this.state
    let formlist = JSON.parse(JSON.stringify(this.state.formlist))
 
    let subfields = []
    let fieldsvalue = {}
    let _record = {}
    formlist = formlist.map(item => {
      if (item.type === 'link' && item.linkField === _field.field) {
        item.options = item.oriOptions.filter(option => option.parentId === value)
        item.initval = item.options[0] ? item.options[0].Value : ''
 
        fieldsvalue[item.field] = item.initval
 
        subfields.push(item)
      }
      return item
    })
    
    // 表单切换时,更新关联字段
    if (_field.type === 'select' && _field.linkSubField && _field.linkSubField.length > 0 && option.props.data) {
      let _data = option.props.data
      _field.linkSubField.forEach(subfield => {
        if (this.props.form.getFieldValue(subfield) !== undefined) {
          fieldsvalue[subfield] = _data[subfield] || ''
        } else {
          _record[subfield] = _data[subfield] || ''
        }
      })
    }
 
    if (subfields.length === 0) {
      if (Object.keys(fieldsvalue).length > 0) {
        this.props.form.setFieldsValue(fieldsvalue)
      }
      if (Object.keys(_record).length > 0) {
        this.setState({
          record: {...record, ..._record}
        })
      }
    } else {
      let result = this.resetform(formlist, subfields, 0, fieldsvalue)
 
      if (Object.keys(result.fieldsvalue).length > 0) {
        this.props.form.setFieldsValue(fieldsvalue)
      }
 
      let _param = {
        formlist: result.formlist
      }
 
      if (Object.keys(_record).length > 0) {
        _param.record = {...record, ..._record}
      }
 
      this.setState(_param)
    }
  }
 
  handleConfirmPassword = (rule, value, callback, item) => {
    let val = parseFloat(value)
 
    if (!isNaN(val)) {
      if (typeof(item.min) === 'number' && val < item.min) {
        callback(item.label + '最小值为 ' + item.min)
      } else if (typeof(item.max) === 'number' && val > item.max) {
        callback(item.label + '最大值为 ' + item.max)
      }
    }
 
    callback()
  }
 
  getFields(formlist) {
    const { getFieldDecorator } = this.props.form
    const { cols } = this.state
 
    const fields = []
 
    formlist.forEach((item, index) => {
      // if ((!item.field && item.type !== 'title') || item.hidden === 'true') return
 
      // if (item.supField && !item.supvalue.includes(this.props.form.getFieldValue(item.supField))) return
 
      if (item.type === 'title') {
        fields.push(
          <Col span={24} key={index}>
            <p>{item.label}</p>
          </Col>
        )
      } else if (item.type === 'text') {
        let _max = item.fieldlength || 50
        let _rules = []
        if (item.regular) {
          if (item.regular === 'number') {
            _rules = [{
              pattern: /^[0-9]*$/ig,
              message: formRule.input.numbermsg
            }]
          } else if (item.regular === 'letter') {
            _rules = [{
              pattern: /^[a-zA-Z]*$/ig,
              message: formRule.input.lettermsg
            }]
          } else if (item.regular === 'letter&number') {
            _rules = [{
              pattern: /^[a-zA-Z0-9]*$/ig,
              message: formRule.input.letternummsg
            }]
          }
        }
        fields.push(
          <Col span={24 / cols} key={index}>
            <Form.Item label={item.label}>
              {getFieldDecorator(item.field, {
                initialValue: item.initval || '',
                rules: [
                  {
                    required: item.required === 'true',
                    message: this.props.dict['form.required.input'] + item.label + '!'
                  },
                  {
                    max: _max,
                    message: formRule.input.formMessage.replace('@max', _max)
                  },
                  ..._rules
                ]
              })(<Input placeholder="" autoComplete="off" disabled={item.readonly === 'true'} onPressEnter={this.handleSubmit} />)}
            </Form.Item>
          </Col>
        )
      } else if (item.type === 'number') { // 数字
        let _initval = item.initval
        let precision = (item.decimal || item.decimal === 0) ? item.decimal : null
 
        fields.push(
          <Col span={24 / cols} key={index}>
            <Form.Item label={item.label}>
              {getFieldDecorator(item.field, {
                initialValue: _initval,
                rules: [
                  {
                    required: true,
                    message: this.props.dict['form.required.input'] + item.label + '!'
                  },
                  {
                    validator: (rule, value, callback) => this.handleConfirmPassword(rule, value, callback, item)
                  }
                ]
              })(
                precision === null ?
                <InputNumber disabled={item.readonly === 'true'} onPressEnter={this.handleSubmit} /> :
                <InputNumber precision={precision} disabled={item.readonly === 'true'} onPressEnter={this.handleSubmit} />
                )}
            </Form.Item>
          </Col>
        )
      } else if (item.type === 'select' || item.type === 'link') { // 下拉搜索
        let hasSubField = false
        if (item.linkSubField && item.linkSubField.length > 0) { // 存在关联字段,数据存储
          hasSubField = true
        }
        
        fields.push(
          <Col span={24 / cols} key={index}>
            <Form.Item label={item.label}>
              {getFieldDecorator(item.field, {
                initialValue: item.initval,
                rules: [
                  {
                    required: item.required === 'true',
                    message: this.props.dict['form.required.select'] + item.label + '!'
                  }
                ]
              })(
                <Select
                  showSearch
                  filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                  onChange={(value, option) => {this.selectChange(item, value, option)}}
                  disabled={item.readonly === 'true'}
                >
                  {item.options.map(option =>
                    <Select.Option id={option.key} data={hasSubField ? option : ''} title={option.Text} key={option.key} value={option.Value}>{option.Text}</Select.Option>
                  )}
                </Select>
              )}
            </Form.Item>
          </Col>
        )
      } else if (item.type === 'multiselect') { // 多选
        let _initval = item.initval ? item.initval.split(',').filter(Boolean) : []
        fields.push(
          <Col span={24 / cols} key={index}>
            <Form.Item label={item.label}>
              {getFieldDecorator(item.field, {
                initialValue: _initval,
                rules: [
                  {
                    required: item.required === 'true',
                    message: this.props.dict['form.required.select'] + item.label + '!'
                  }
                ]
              })(
                <Select
                  showSearch
                  mode="multiple"
                  filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                  disabled={item.readonly === 'true'}
                >
                  {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') { // 时间搜索
        let _initval = this.props.data ? this.props.data[item.field] : ''
        if (_initval && this.state.readin[item.field]) {
          _initval = moment(_initval, 'YYYY-MM-DD')
        } else {
          _initval = item.initval ? moment().subtract(item.initval, 'days') : null
        }
        fields.push(
          <Col span={24 / cols} key={index}>
            <Form.Item label={item.label}>
              {getFieldDecorator(item.field, {
                initialValue: _initval,
                rules: [
                  {
                    required: item.required === 'true',
                    message: this.props.dict['form.required.select'] + item.label + '!'
                  }
                ]
              })(
                <DatePicker disabled={item.readonly === 'true'} />
              )}
            </Form.Item>
          </Col>
        )
      } else if (item.type === 'datemonth') {
        let _initval = this.props.data ? this.props.data[item.field] : ''
        if (_initval && this.state.readin[item.field]) {
          _initval = moment(_initval, 'YYYY-MM')
        } else {
          _initval = item.initval ? moment().subtract(item.initval, 'month') : null
        }
        fields.push(
          <Col span={24 / cols} key={index}>
            <Form.Item label={item.label}>
              {getFieldDecorator(item.field, {
                initialValue: _initval,
                rules: [
                  {
                    required: item.required === 'true',
                    message: this.props.dict['form.required.select'] + item.label + '!'
                  }
                ]
              })(
                <MonthPicker disabled={item.readonly === 'true'} />
              )}
            </Form.Item>
          </Col>
        )
      } else if (item.type === 'datetime') {
        let _initval = this.props.data ? this.props.data[item.field] : ''
        if (_initval && this.state.readin[item.field]) {
          _initval = moment(_initval, 'YYYY-MM-DD HH:mm:ss')
        } else {
          _initval = item.initval ? moment().subtract(item.initval, 'days') : null
        }
        fields.push(
          <Col span={24 / cols} key={index}>
            <Form.Item label={item.label}>
              {getFieldDecorator(item.field, {
                initialValue: _initval,
                rules: [
                  {
                    required: item.required === 'true',
                    message: this.props.dict['form.required.select'] + item.label + '!'
                  }
                ]
              })(
                // <DatePicker showTime getCalendarContainer={() => document.getElementById('form-box')} />
                <DatePicker showTime disabled={item.readonly === 'true'} />
              )}
            </Form.Item>
          </Col>
        )
      } else if (item.type === 'fileupload') {
        let filelist = this.props.data ? this.props.data[item.field] : item.initval
        if (filelist && this.state.readin[item.field]) {
          try {
            filelist = filelist.split(',').map((url, index) => {
              return {
                uid: `${index}`,
                name: url.slice(url.lastIndexOf('/') + 1),
                status: 'done',
                url: url,
                origin: true
              }
            })
          } catch {
            filelist = []
          }
        } else {
          filelist = []
        }
 
        fields.push(
          <Col span={24 / cols} key={index}>
            <Form.Item label={item.label}>
              {getFieldDecorator(item.field, {
                initialValue: filelist,
                rules: [
                  {
                    required: item.required === 'true',
                    message: this.props.dict['form.required.select'] + item.label + '!'
                  }
                ]
              })(
                <FileUpload maxFile={item.maxfile} fileType={item.fileType || 'text'} />
              )}
            </Form.Item>
          </Col>
        )
      } else if (item.type === 'linkMain') {
        fields.push(
          <Col span={24 / cols} key={index}>
            <Form.Item label={item.label}>
              {getFieldDecorator(item.field, {
                initialValue: item.initval,
                rules: [
                  {
                    required: item.required === 'true',
                    message: this.props.dict['form.required.input'] + item.label + '!'
                  }
                ]
              })(<Input placeholder="" autoComplete="off" disabled={item.readonly === 'true'} />)}
            </Form.Item>
          </Col>
        )
      } else if (item.type === 'funcvar') {
        // fields.push(
        //   <Col span={24 / cols} key={index}>
        //     <Form.Item label={item.label}>
        //       {getFieldDecorator(item.field, {
        //         initialValue: item.linkfield || '',
        //       })(<Input placeholder="" autoComplete="off" disabled={item.readonly === 'true'} />)}
        //     </Form.Item>
        //   </Col>
        // )
      } else if (item.type === 'textarea') {
        let _max = item.fieldlength || 512
        let _labelcol = cols !== 3 ? 8 / cols : 3
        let _wrapcol = cols !== 3 ? 16 + (cols - 1) * 4 : 21
        let _style = {}
        if (cols === 2) {
          _style.paddingLeft = '7px'
        }
        fields.push(
          <Col span={24} key={index} className="textarea-row" style={{..._style}}>
            <Form.Item label={item.label} labelCol={{xs: { span: 24 }, sm: { span: _labelcol }}} wrapperCol={ {xs: { span: 24 }, sm: { span: _wrapcol }} }>
              {getFieldDecorator(item.field, {
                initialValue: item.initval || '',
                rules: [
                  {
                    required: item.required === 'true',
                    message: this.props.dict['form.required.input'] + item.label + '!'
                  },
                  {
                    max: _max,
                    message: formRule.input.formMessage.replace('@max', _max)
                  }
                ]
              })(<TextArea autosize={{ minRows: 2, maxRows: item.maxRows || 6 }} disabled={item.readonly === 'true'} />)}
            </Form.Item>
          </Col>
        )
      }
    })
    
    return fields
  }
 
  handleConfirm = () => {
    const { record } = this.state
    // 表单提交时检查输入值是否正确
    return new Promise((resolve, reject) => {
      this.props.form.validateFieldsAndScroll((err, values) => {
        if (!err) {
          let search = []
          // 隐藏表单
          this.state.formlist.forEach(item => {
            if (!item.field) return
 
            if (item.type === 'funcvar') {
              search.push({
                type: 'funcvar',
                readonly: 'true',
                readin: false,
                fieldlen: this.state.fieldlen[item.field],
                key: item.field,
                value: ''
              })
            } else if (item.hidden === 'true') {
              let _val = item.initval
              if (record.hasOwnProperty(item.field)) {
                _val = record[item.field]
              }
              search.push({
                type: this.state.datatype[item.field],
                readonly: this.state.readtype[item.field],
                readin: this.state.readin[item.field],
                fieldlen: this.state.fieldlen[item.field],
                key: item.field,
                value: _val
              })
            } else if (item.supField && !item.supvalue.includes(this.props.form.getFieldValue(item.supField))) {
              search.push({
                type: this.state.datatype[item.field],
                readonly: this.state.readtype[item.field],
                readin: this.state.readin[item.field],
                fieldlen: this.state.fieldlen[item.field],
                key: item.field,
                value: item.initVal
              })
            }
          })
 
          Object.keys(values).forEach(key => {
            let _value = ''
            if (this.state.datatype[key] === 'datetime') {
              if (values[key]) {
                _value = moment(values[key]).format('YYYY-MM-DD HH:mm:ss')
              }
            } else if (this.state.datatype[key] === 'datemonth') {
              if (values[key]) {
                _value = moment(values[key]).format('YYYY-MM')
              }
            } else if (this.state.datatype[key] === 'date') {
              if (values[key]) {
                _value = moment(values[key]).format('YYYY-MM-DD')
              }
            } else if (this.state.datatype[key] === 'number') {
              _value = values[key]
 
            } else if (this.state.datatype[key] === 'multiselect') {
              _value = values[key] ? values[key].join(',') : ''
 
            } else if (this.state.datatype[key] === 'fileupload') {
              let vals = []
 
              if (values[key] && values[key].length > 0) {
                values[key].forEach(_val => {
                  if (_val.origin && _val.url) {
                    vals.push(_val.url)
                  } else if (!_val.origin && _val.status === 'done' && _val.response) {
                    vals.push(Utils.getrealurl(_val.response))
                  }
                })
              }
 
              _value = vals.join(',')
            } else if (this.state.datatype[key] === 'text') {
              _value = values[key].replace(/(^\s*|\s*$) | \t* | \v*/ig, '')
 
            } else {
              _value = values[key]
              
            }
 
            search.push({
              type: this.state.datatype[key],
              readonly: this.state.readtype[key],
              readin: this.state.readin[key],
              fieldlen: this.state.fieldlen[key],
              key: key,
              value: _value
            })
          })
 
          resolve(search)
        } else {
          reject(err)
        }
      })
    })
  }
 
  handleSubmit = (e) => {
    e.preventDefault()
    this.props.inputSubmit()
  }
 
  render() {
    const { formlist, cols } = this.state
    const formItemLayout = {
      labelCol: {
        xs: { span: 24 },
        sm: { span: 8 }
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 }
      }
    }
 
    let _formlist = []
    let rowIndex = 0
    let colIndex = 0
 
    formlist.forEach(item => {
      if ((!item.field && item.type !== 'title') || item.hidden === 'true' || item.type === 'funcvar') return
 
      if (item.supField && !item.supvalue.includes(this.props.form.getFieldValue(item.supField))) return
 
      _formlist[rowIndex] = _formlist[rowIndex] || []
      if (item.type === 'textarea' || item.type === 'title') {
        if (colIndex === 0) {
          _formlist[rowIndex].push(item)
        } else {
          rowIndex++
          _formlist[rowIndex] = [item]
        }
        rowIndex++
        colIndex = 0
      } else {
        _formlist[rowIndex].push(item)
        colIndex++
      }
      if (colIndex >= cols) {
        rowIndex++
        colIndex = 0
      }
    })
 
    return (
      <Form {...formItemLayout} className="ant-advanced-search-form main-form-field" id="main-form-box">
        {/* <Row gutter={24}>{this.getFields(formlist)}</Row> */}
        {_formlist.map((formrow, index) => <Row key={index} gutter={24}>{this.getFields(formrow)}</Row>)}
      </Form>
    )
  }
}
 
export default Form.create()(MainSearch)