全局下拉修改

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;

View File

@ -1,5 +1,5 @@
import React, { useEffect, useState } from 'react';
import { Modal, Form, Input, Select, Button, Upload, message, Row, Col, Descriptions } from 'antd';
import { Modal, Form, Input, Button, Upload, message, Row, Col, Descriptions } from 'antd';
import type { UploadProps } from 'antd';
import { UploadOutlined } from '@ant-design/icons';
import { uploadFile, attachmentskView, attachmentsAdd, attachmentsEdit } from '../services';

View File

@ -62,18 +62,6 @@ const OtherAttachmentsTab: React.FC<Props> = (props) => {
setIsViewMode(false);
setFormVisible(true);
};
// 作废 修改
const handleEdit = (record: attachmentsAdd) => {
setEditingRecord(record);
setIsViewMode(false);
setFormVisible(true);
};
// 作废 查看
const handleView = (record: attachmentsAdd) => {
setEditingRecord(record);
setIsViewMode(true);
setFormVisible(true);
};
//是否作废
const handleObsoleteChange = async (checked: boolean, id:string) => {
// 调用你的作废接口
@ -128,20 +116,6 @@ const OtherAttachmentsTab: React.FC<Props> = (props) => {
},
},
// ...(viewType ? [] : [
// {
// title: 'page.workbench.attachments.action',
// dataIndex: 'option',
// width: 120,
// render: (_: any, record: attachmentsAdd) => (
// <>
// <a style={{ marginRight: 8 }} onClick={() => handleView(record)}>查看</a>
// <a onClick={() => handleEdit(record)}>修改</a>
// </>
// ),
// },
// ]),
];
return (
<div style={{ padding: '0 30px 0 0' }}>

View File

@ -1,18 +1,8 @@
import React, { useEffect, useState } from 'react';
import { Modal, Form, Input, message, Row, Col, Descriptions } from 'antd';
import { getDictList } from '@/servers/api/dicts';
import { coscoSupplierUserView, coscoSupplierUserAdd, coscoSupplierUserEdit } from '../services';
import { getRegionTree } from '@/servers/api/register';
import type { DictItem } from '@/servers/api/dicts';
// 地区字段转换
function convertToCascaderOptions(data: any[]): any[] {
return data.map(item => ({
label: item.name,
value: item.id,
children: item.children && item.children.length > 0 ? convertToCascaderOptions(item.children) : undefined,
}));
}
interface props {
visible: boolean;
onOk: () => void;

View File

@ -7,7 +7,6 @@ import { uploadFile } from '../services';
import type { UploadFile } from 'antd/es/upload/interface';
import { getDictList } from '@/servers/api/dicts';
import type { DictItem } from '@/servers/api/dicts';
const { Option } = Select;
interface ForeignFormProps {
form: any;
countdown: number;