king
2020-03-10 c39ea1f23d21b070188abcf5f4dd5bdd7b47c1f9
src/tabviews/tableshare/topSearch/index.jsx
@@ -172,7 +172,7 @@
      if (item.type === 'text') { // 文本搜索
        fields.push(
          <Col span={6} key={index}>
          <Col span={item.ratio || 6} key={index}>
            <Form.Item label={item.label}>
              {getFieldDecorator(item.field, {initialValue: item.initval })(<Input placeholder="" autoComplete="off" />)}
            </Form.Item>
@@ -180,7 +180,7 @@
        )
      } else if (item.type === 'select') { // 下拉搜索
        fields.push(
          <Col span={6} key={index}>
          <Col span={item.ratio || 6} key={index}>
            <Form.Item label={item.label}>
              {getFieldDecorator(item.field, {initialValue: item.initval })(
                <Select
@@ -200,7 +200,7 @@
      } else if (item.type === 'multiselect') { // 下拉多选
        let _initval = item.initval ? item.initval.split(',').filter(Boolean) : []
        fields.push(
          <Col span={6} key={index}>
          <Col span={item.ratio || 6} key={index}>
            <Form.Item label={item.label}>
              {getFieldDecorator(item.field, {initialValue: _initval })(
                <Select
@@ -220,7 +220,7 @@
        )
      } else if (item.type === 'date') { // 时间搜索
        fields.push(
          <Col span={6} key={index}>
          <Col span={item.ratio || 6} key={index}>
            <Form.Item label={item.label}>
              {getFieldDecorator(item.field, {initialValue: item.initval ? moment().subtract(item.initval, 'days') : null })(
                <DatePicker onChange={this.searchChange} getCalendarContainer={() => document.getElementById(this.state.formId)} />
@@ -230,7 +230,7 @@
        )
      } else if (item.type === 'datemonth') {
        fields.push(
          <Col span={6} key={index}>
          <Col span={item.ratio || 6} key={index}>
            <Form.Item label={item.label}>
              {getFieldDecorator(item.field, {initialValue: item.initval ? moment().subtract(item.initval, 'month') : null })(
                <MonthPicker onChange={this.searchChange} getCalendarContainer={() => document.getElementById(this.state.formId)} />
@@ -240,7 +240,7 @@
        )
      } else if (item.type === 'dateweek') {
        fields.push(
          <Col span={6} key={index}>
          <Col span={item.ratio || 6} key={index}>
            <Form.Item label={item.label}>
              {getFieldDecorator(item.field, {initialValue: item.initval ? moment().subtract(item.initval * 7, 'days') : null })(
                <WeekPicker onChange={this.searchChange} getCalendarContainer={() => document.getElementById(this.state.formId)} />
@@ -261,7 +261,7 @@
        }
        fields.push(
          <Col className="daterange" span={6} key={index}>
          <Col className="daterange" span={item.ratio || 6} key={index}>
            <Form.Item label={item.label}>
              {getFieldDecorator(item.field,
                {
@@ -280,29 +280,18 @@
      }
    })
    if (this.props.searchlist.length >= 4) { // 添加搜索、重置按钮
      fields.push(
        <Col span={this.props.searchlist.length % 4 ? 6 : 24} style={{paddingLeft: '112px', whiteSpace: 'nowrap'}} key="actions">
    fields.push(
      <Col span={6} style={{ whiteSpace: 'nowrap' }} key="actions">
        <Form.Item label={' '} colon={false}>
          <Button type="primary" htmlType="submit">
            {this.props.dict['main.search']}
          </Button>
          <Button style={{ marginLeft: 8 }} onClick={this.handleReset}>
            {this.props.dict['main.reset']}
          </Button>
        </Col>
      )
    } else {
      fields.push(
        <Col span={6} style={{ paddingTop: '4px', whiteSpace: 'nowrap' }} key="actions">
          <Button type="primary" htmlType="submit">
            {this.props.dict['main.search']}
          </Button>
          <Button style={{ marginLeft: 8 }} onClick={this.handleReset}>
            {this.props.dict['main.reset']}
          </Button>
        </Col>
      )
    }
        </Form.Item>
      </Col>
    )
    
    return fields
  }
@@ -402,8 +391,19 @@
  }
  render() {
    const formItemLayout = {
      labelCol: {
        xs: { span: 24 },
        sm: { span: 8 }
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 }
      }
    }
    return (
      <Form className="ant-advanced-search-form top-search" id={this.state.formId} onSubmit={this.handleSearch}>
      <Form {...formItemLayout} className="ant-advanced-search-form top-search" id={this.state.formId} onSubmit={this.handleSearch}>
        <Row gutter={24}>{this.getFields()}</Row>
      </Form>
    )