From e8edfdadb561cd83bf6e1c3e00d55b8cc2aee6d5 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 17 十月 2022 17:57:34 +0800 Subject: [PATCH] 2022-10-17 --- src/components/normalform/modalform/mkSelect/index.jsx | 49 ++++++++++++++++++++++++++++++++++--------------- 1 files changed, 34 insertions(+), 15 deletions(-) diff --git a/src/components/normalform/modalform/mkSelect/index.jsx b/src/components/normalform/modalform/mkSelect/index.jsx index c5c6ad4..660fea9 100644 --- a/src/components/normalform/modalform/mkSelect/index.jsx +++ b/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,40 @@ 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} disabled={option.disabled} value={option.value || option.field}>{option.label || option.text}</Select.Option> - )} - </Select> - ) + if (config.extendName) { + return ( + <Select + showSearch + allowClear + value={value} + dropdownMatchSelectWidth={config.dropdown !== 'false'} + 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} + dropdownMatchSelectWidth={config.dropdown !== 'false'} + 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 -- Gitblit v1.8.0