king
2022-08-02 8d66ff34fae5b048a6b7923cc75d34f13a08be9d
src/components/normalform/modalform/mkSelect/index.jsx
@@ -3,7 +3,6 @@
import { Select } from 'antd'
import MKEmitter from '@/utils/events.js'
import './index.scss'
class MKSelect extends Component {
  constructor(props) {
@@ -107,20 +106,38 @@
    const { value, config, options } = this.state
    if (config.type !== 'multiselect') {
      return (
        <Select
          showSearch
          allowClear
          value={value}
          filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
          onSelect={this.selectChange}
          onChange={(val) => val === undefined && this.selectChange('')}
        >
          {options.map(option =>
            <Select.Option key={option.value || option.field} value={option.value || option.field}>{option.label || option.text}</Select.Option>
          )}
        </Select>
      )
      if (config.extendName) {
        return (
          <Select
            showSearch
            allowClear
            value={value}
            filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 ||
              option.props.extend.toLowerCase().indexOf(input.toLowerCase()) >= 0}
            onSelect={this.selectChange}
            onChange={(val) => val === undefined && this.selectChange('')}
          >
            {options.map((option, i) =>
              <Select.Option key={i} disabled={option.disabled} extend={option[config.extendName] || ''} value={option.value || option.field || ''}>{option.label || option.text}</Select.Option>
            )}
          </Select>
        )
      } else {
        return (
          <Select
            showSearch
            allowClear
            value={value}
            filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
            onSelect={this.selectChange}
            onChange={(val) => val === undefined && this.selectChange('')}
          >
            {options.map((option, i) =>
              <Select.Option key={i} disabled={option.disabled} value={option.value || option.field || ''}>{option.label || option.text}</Select.Option>
            )}
          </Select>
        )
      }
    } else {
      return (<Select
        showSearch
@@ -130,7 +147,7 @@
        onChange={this.mutilselectChange}
      >
        {options.map(option =>
          <Select.Option key={option.value} value={option.value}>{option.label || option.text}</Select.Option>
          <Select.Option key={option.value} disabled={option.disabled} value={option.value}>{option.label || option.text}</Select.Option>
        )}
      </Select>)
    }