全局下拉修改

This commit is contained in:
孙景学
2025-07-17 15:28:18 +08:00
parent 5c505150e5
commit 75acc55222
8 changed files with 80 additions and 80 deletions

View File

@ -1,21 +1,30 @@
import React, { useEffect, useState } from 'react';
import { Select } from 'antd';
interface options {
label: string;
value: string;
interface Option {
label: string;
value: string;
}
const AdmissionTypeSelect = () => {
const [options, setOptions] = useState<options[]>([]);
const AdmissionTypeSelect: React.FC<any> = (props) => {
const [options, setOptions] = useState<Option[]>([]);
useEffect(() => {
setOptions([
{ label: '未准入', value: '0' },
{ label: '已准入', value: '1' },
{ label: '退出', value: '2' },
])
{ label: '未准入', value: '0' },
{ label: '已准入', value: '1' },
{ label: '退出', value: '2' },
]);
}, []);
return <Select style={{ width: 150 }} placeholder="请选择准入状态" options={options} allowClear />;
return (
<Select
style={{ width: 150 }}
placeholder="请选择准入状态"
options={options}
allowClear
{...props} // ⭐ 透传
/>
);
};
export default AdmissionTypeSelect;

View File

@ -1,21 +1,30 @@
import React, { useEffect, useState } from 'react';
import { Select } from 'antd';
interface options {
label: string;
value: string;
interface Option {
label: string;
value: string;
}
const AdmissionTypeSelect = () => {
const [options, setOptions] = useState<options[]>([]);
const AdmissionTypeSelect: React.FC<any> = (props) => {
const [options, setOptions] = useState<Option[]>([]);
useEffect(() => {
setOptions([
{ label: '线上准入', value: 'online' },
{ label: '线下准入', value: 'offline' },
{ label: '零星采购/应急采购/个人供应商', value: 'scattered' },
])
{ label: '线上准入', value: 'online' },
{ label: '线下准入', value: 'offline' },
{ label: '零星采购/应急采购/个人供应商', value: 'scattered' },
]);
}, []);
return <Select style={{ width: 150 }} placeholder="请选择准入方式" options={options} allowClear />;
return (
<Select
style={{ width: 150 }}
placeholder="请选择准入方式"
options={options}
allowClear
{...props} // 关键点props 透传!
/>
);
};
export default AdmissionTypeSelect;

View File

@ -1,23 +1,33 @@
import React, { useEffect, useState } from 'react';
import { Select } from 'antd';
interface options {
label: string;
value: string;
interface Option {
label: string;
value: string;
}
const AdmissionTypeSelect = () => {
const [options, setOptions] = useState<options[]>([]);
// 1. 传入 props
const AdmissionTypeSelect: React.FC<any> = (props) => {
const [options, setOptions] = useState<Option[]>([]);
useEffect(() => {
setOptions([
{ label: '未开始', value: '0' },
{ label: '进行中', value: '1' },
{ label: '结果汇总中', value: '2' },
{ label: '已完成', value: '3' },
])
{ label: '未开始', value: '0' },
{ label: '进行中', value: '1' },
{ label: '结果汇总中', value: '2' },
{ label: '已完成', value: '3' },
]);
}, []);
return <Select style={{ width: 150 }} placeholder="请选择审批状态" options={options} allowClear />;
// 2. 透传 props
return (
<Select
style={{ width: 150 }}
placeholder="请选择审批状态"
options={options}
allowClear
{...props}
/>
);
};
export default AdmissionTypeSelect;

View File

@ -1,21 +1,30 @@
// AdmissionTypeSelect.jsx
import React, { useEffect, useState } from 'react';
import { Select } from 'antd';
interface options {
label: string;
value: string;
interface Option {
label: string;
value: string;
}
const AdmissionTypeSelect = () => {
const [options, setOptions] = useState<options[]>([]);
const AdmissionTypeSelect: React.FC<any> = (props) => {
const [options, setOptions] = useState<Option[]>([]);
useEffect(() => {
setOptions([
{ label: '境内企业', value: 'dvs' },
{ label: '境外企业', value: 'ovs' },
{ label: '个人', value: 'pe' },
])
{ label: '境内企业', value: 'dvs' },
{ label: '境外企业', value: 'ovs' },
{ label: '个人', value: 'pe' },
]);
}, []);
return <Select style={{ width: 150 }} placeholder="请选择企业类型" options={options} allowClear />;
return (
<Select
style={{ width: 150 }}
placeholder="请选择企业类型"
options={options}
allowClear
{...props}
/>
);
};
export default AdmissionTypeSelect;