Selaa lähdekoodia

select 项目控件 支持搜索

魏熙美 5 vuotta sitten
vanhempi
commit
a096c626d4

+ 10
- 2
src/components/SelectButton/BuildSelect.jsx Näytä tiedosto

49
   }
49
   }
50
 
50
 
51
   return (
51
   return (
52
-      <Select value={'' === value ? undefined : value} style={{ width: '180px' }} placeholder="请选择项目" onChange={handleChange}>
52
+      <Select
53
+      showSearch
54
+      value={'' === value ? undefined : value}
55
+      style={{ width: '180px' }} 
56
+      placeholder="请选择项目" 
57
+      onChange={handleChange}
58
+      filterOption={(input, option) =>
59
+        option.props.children && option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
60
+      }>
53
           {data.map(building => (
61
           {data.map(building => (
54
-            <Option key={building.buildingId}>{building.buildingName}</Option>
62
+            <Option key={building.buildingId} value={building.buildingId}>{building.buildingName}</Option>
55
           ))}
63
           ))}
56
       </Select>
64
       </Select>
57
   )
65
   )

+ 1
- 1
src/components/SelectButton/CitySelect.jsx Näytä tiedosto

33
       <Select 
33
       <Select 
34
       showSearch 
34
       showSearch 
35
       value={props.value} 
35
       value={props.value} 
36
-      style={{ width: '180px' }} 
36
+      style={{ width: '180px' }}
37
       placeholder="请选择城市" 
37
       placeholder="请选择城市" 
38
       onChange={props.onChange} 
38
       onChange={props.onChange} 
39
       filterOption={(input, option) =>
39
       filterOption={(input, option) =>

+ 6
- 0
src/pages/customer/recommendCustomer/index.jsx Näytä tiedosto

6
 import Styles from './style.less';
6
 import Styles from './style.less';
7
 import { router } from 'umi';
7
 import { router } from 'umi';
8
 import AuthButton from '@/components/AuthButton';
8
 import AuthButton from '@/components/AuthButton';
9
+import BuildingSelect from '@/components/SelectButton/BuildSelect';
9
 
10
 
10
 
11
 
11
 const { Option } = Select;
12
 const { Option } = Select;
215
             </Select>,
216
             </Select>,
216
           )}
217
           )}
217
         </Form.Item>
218
         </Form.Item>
219
+        <Form.Item>
220
+          {getFieldDecorator('buildingId')(
221
+            <BuildingSelect />,
222
+          )}
223
+        </Form.Item>
218
         <Form.Item style={{ position:'absolute',right:'38px' }}>
224
         <Form.Item style={{ position:'absolute',right:'38px' }}>
219
             <Button type="primary" htmlType="submit" >
225
             <Button type="primary" htmlType="submit" >
220
               搜索
226
               搜索