king
2020-12-16 06404e701a89955958cbf56213e2eec618d8644d
src/tabviews/zshare/topSearch/index.jsx
@@ -8,6 +8,8 @@
import options from '@/store/options.js'
import DateGroup from '@/tabviews/zshare/dategroup'
import Utils from '@/utils/utils.js'
import zhCN from '@/locales/zh-CN/main.js'
import enUS from '@/locales/en-US/main.js'
import './index.scss'
const {MonthPicker, WeekPicker, RangePicker} = DatePicker
@@ -17,10 +19,10 @@
    BID: PropTypes.any,          // 父级Id,用于查询下拉选择项
    menuType: PropTypes.any,     // 菜单权限,是否为HS
    searchlist: PropTypes.array, // 搜索条件列表
    dict: PropTypes.object       // 字典项
  }
  state = {
    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
    match: null,            // 搜索条件匹配规则
    style: null,            // 搜索条件类型
    label: null,            // 提示文字
@@ -46,7 +48,7 @@
      if (fieldMap.has(item.field)) {
        item.field = item.field + '@tail@'
      }
      fieldMap.set(item.field, true)
      fieldMap.set(item.field, item)
      match[item.field] = item.match
      label[item.field] = item.label
@@ -58,7 +60,7 @@
          item.options.unshift({
            key: Utils.getuuid(),
            Value: '',
            Text: this.props.dict['main.all']
            Text: this.state.dict['main.all']
          })
        }
@@ -101,7 +103,7 @@
    let _groups = []
    _list = _list.map(item => {
      if (item.type === 'link') {
        let supItem = _list.filter(form => form.field === item.linkField)[0]
        let supItem = fieldMap.get(item.linkField)
        
        if (!supItem) {
          notification.warning({
@@ -112,7 +114,7 @@
          item.supInitVal = ''
        } else {
          item.supInitVal = supItem.initval
          item.options = item.oriOptions.filter(option => option.ParentID === supItem.initval)
          item.options = item.oriOptions.filter(option => option.ParentID === supItem.initval || option.Value === '')
        }
      } else if (item.type === 'group' && item.Hide !== 'true') {
        _groups.push(fromJS(item).toJS())
@@ -263,7 +265,7 @@
        searchlist: _searchlist.map(item => {
          if (item.type === 'link') {
            if (item.supInitVal) {
              item.options = item.oriOptions.filter(option => option.ParentID === item.supInitVal)
              item.options = item.oriOptions.filter(option => option.ParentID === item.supInitVal || option.Value === '')
            } else {
              item.options = item.oriOptions
            }
@@ -349,7 +351,7 @@
        searchlist: _searchlist.map(item => {
          if (item.type === 'link') {
            if (item.supInitVal) {
              item.options = item.oriOptions.filter(option => option.ParentID === item.supInitVal)
              item.options = item.oriOptions.filter(option => option.ParentID === item.supInitVal || option.Value === '')
            } else {
              item.options = item.oriOptions
            }
@@ -370,7 +372,7 @@
    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.options = item.oriOptions.filter(option => option.ParentID === supfield.initval || option.Value === '')
          item.initval = item.options[0] ? item.options[0].Value : ''
          
          if (this.props.form.getFieldValue(item.field) !== undefined) {
@@ -397,7 +399,7 @@
    let fieldsvalue = {}
    formlist = formlist.map(item => {
      if (item.type === 'link' && item.linkField === _field.field) {
        item.options = item.oriOptions.filter(option => option.ParentID === value)
        item.options = item.oriOptions.filter(option => option.ParentID === value || option.Value === '')
        item.initval = item.options[0] ? item.options[0].Value : ''
        if (this.props.form.getFieldValue(item.field) !== undefined) {
@@ -429,6 +431,7 @@
  getFields() {
    const { getFieldDecorator } = this.props.form
    const { dict } = this.state
    const fields = []
    this.state.searchlist.forEach((item, index) => {
@@ -443,7 +446,7 @@
                rules: [
                  {
                    required: item.required === 'true',
                    message: this.props.dict['form.required.input'] + item.label + '!'
                    message: dict['form.required.input'] + item.label + '!'
                  }
                ]
              })(<Input placeholder="" autoComplete="off" />)}
@@ -459,7 +462,7 @@
                rules: [
                  {
                    required: item.required === 'true',
                    message: this.props.dict['form.required.select'] + item.label + '!'
                    message: dict['form.required.select'] + item.label + '!'
                  }
                ]
              })(
@@ -487,7 +490,7 @@
                rules: [
                  {
                    required: item.required === 'true',
                    message: this.props.dict['form.required.select'] + item.label + '!'
                    message: dict['form.required.select'] + item.label + '!'
                  }
                ]
              })(
@@ -515,7 +518,7 @@
                rules: [
                  {
                    required: item.required === 'true',
                    message: this.props.dict['form.required.select'] + item.label + '!'
                    message: dict['form.required.select'] + item.label + '!'
                  }
                ]
              })(
@@ -533,7 +536,7 @@
                rules: [
                  {
                    required: item.required === 'true',
                    message: this.props.dict['form.required.select'] + item.label + '!'
                    message: dict['form.required.select'] + item.label + '!'
                  }
                ]
              })(
@@ -551,7 +554,7 @@
                rules: [
                  {
                    required: item.required === 'true',
                    message: this.props.dict['form.required.select'] + item.label + '!'
                    message: dict['form.required.select'] + item.label + '!'
                  }
                ]
              })(
@@ -581,7 +584,7 @@
                  rules: [
                    {
                      required: item.required === 'true',
                      message: this.props.dict['form.required.select'] + item.label + '!'
                      message: dict['form.required.select'] + item.label + '!'
                    }
                  ]
                })(
@@ -610,10 +613,10 @@
      <Col span={6} style={{ whiteSpace: 'nowrap' }} key="actions">
        <Form.Item label={' '} colon={false} style={{ minHeight: '40px' }}>
          <Button type="primary" htmlType="submit">
            {this.props.dict['main.search']}
            {dict['main.search']}
          </Button>
          <Button style={{ marginLeft: 8 }} onClick={this.handleReset}>
            {this.props.dict['main.reset']}
            {dict['main.reset']}
          </Button>
        </Form.Item>
      </Col>