更新部分功能

This commit is contained in:
孙景学
2025-07-03 10:24:33 +08:00
parent cf8e9d0820
commit e15c97d741
26 changed files with 199 additions and 114 deletions

View File

@ -4,7 +4,7 @@ import { RightOutlined, LeftOutlined } from '@ant-design/icons';
import { coscoSupplierBase } from '../services';
const { Option } = Select;
type OptionType = { label: string; value: string };
const SupplierSelector: React.FC<{ visible: boolean; onCancel: () => void; onSelect?: (selected: any[]) => void; }> = ({ visible, onCancel, onSelect }) => {
// 查询
const [form] = Form.useForm();
@ -20,6 +20,8 @@ const SupplierSelector: React.FC<{ visible: boolean; onCancel: () => void; onSel
const [rightSelected, setRightSelected] = useState<React.Key[]>([]);
//确认 已选供应商
const [chosenSuppliers, setChosenSuppliers] = useState<any[]>([]);
// 境内/境外下拉数据
const [regionOptions, setRegionOptions] = useState<OptionType[]>([]);
//已选供应商 去重
const filteredData = (chosenSuppliers:any, selected:any) => {
const ids = new Set(chosenSuppliers.map((item:any) => item.id));
@ -55,9 +57,16 @@ const SupplierSelector: React.FC<{ visible: boolean; onCancel: () => void; onSel
};
// 初始化
useEffect(() => {
const values = form.getFieldsValue();
getTableList(values,1 , 10)
}, [])
if(visible) {
// 境内/境外 下拉
setRegionOptions([
{ label: '境内企业', value: 'dvs' },
{ label: '境外企业', value: 'ovs' },
])
const values = form.getFieldsValue();
getTableList(values,1 , 10)
}
}, [visible])
//供应商名称
const columns = [
{ title: '供应商名称', dataIndex: 'name', ellipsis: true, render: (name: string) => (
@ -71,20 +80,28 @@ const SupplierSelector: React.FC<{ visible: boolean; onCancel: () => void; onSel
<Modal title="选择供应商" visible={visible} onCancel={onCancel} footer={null} width="80%">
<Form layout="inline" form={form} onFinish={getTableList} style={{ marginBottom: 16 }}>
<Form.Item name="accessType" label="供应商名称">
<Input placeholder="供应商名称" allowClear />
</Form.Item>
<Form.Item name="deptId" label="境内/境外">
<Select placeholder="境内/境外" allowClear >
<Option value="境内"></Option>
<Option value="境外"></Option>
</Select>
</Form.Item>
<Form.Item name="name" label="供应商名称">
<Input placeholder="请输入供应商名称关键字" style={{ width: 220 }} allowClear maxLength={20} />
</Form.Item>
<Form.Item name="supplierType" label="境内/境外">
<Select style={{ width: 160 }} placeholder="请选择境内/境外" allowClear>
{regionOptions.map(opt => (
<Select.Option key={opt.value} value={opt.value}>{opt.label}</Select.Option>
))}
</Select>
</Form.Item>
<Form.Item>
<Button type="primary" htmlType="submit"></Button>
</Form.Item>
<Form.Item>
<Button onClick={() => form.resetFields()}></Button>
<Button onClick={() => {
form.resetFields()
const values = form.getFieldsValue();
getTableList(values,1 , 10)
}}></Button>
</Form.Item>
</Form>