搜索弄成全局

This commit is contained in:
孙景学
2025-07-16 14:51:36 +08:00
parent af2bd823b6
commit 05f46a8dee
17 changed files with 106 additions and 628 deletions

View File

@ -1,15 +1,15 @@
import React, { useEffect, useState } from "react";
import { Form, Button, Table, Select, Input, Tree, Space, Tooltip, Spin } from 'antd';
import { Form, Button, Table, Input, Tree, Space, Tooltip, Spin } from 'antd';
import { SearchOutlined, DoubleLeftOutlined, DeleteOutlined, DoubleRightOutlined } from '@ant-design/icons';
import type { ColumnsType, TablePaginationConfig } from 'antd/es/table';
import { connect } from 'umi';
//接口
import { treeData, getPageQualified } from './services';
//组件
import tableProps from '@/utils/tableProps';
import RegionTypeSelect from '@/components/CommonSelect/RegionTypeSelect'
import SupplierViewModal from './components/SupplierViewModal';
import SupplierDetailModal from './components/SupplierDetailModal';
import { treeData, getPageQualified } from './services';
import tableProps from '@/utils/tableProps';
const { Option } = Select;
type OptionType = { label: string; value: string };
interface Data {
id: number;
@ -69,7 +69,6 @@ const groupQualifiedSupplierQuery: React.FC<Props> = ({ dispatch }) => {
const [viewVisible, setViewVisible] = useState(false);
const [detailVisible, setDetailVisible] = useState(false);
const [currentRecord, setCurrentRecord] = useState<any>(null);
const [regionOptions, setRegionOptions] = useState<OptionType[]>([]);
// 查询
const handleSearch = () => {
@ -127,10 +126,6 @@ const groupQualifiedSupplierQuery: React.FC<Props> = ({ dispatch }) => {
// 初始化
useEffect(() => {
setTreeLoading(true);
setRegionOptions([
{ label: '境内企业', value: 'dvs' },
{ label: '境外企业', value: 'ovs' },
]);
treeData({}).then((res) => {
const { code, data } = res;
if (code === 200) {
@ -229,12 +224,8 @@ const groupQualifiedSupplierQuery: React.FC<Props> = ({ dispatch }) => {
<Form.Item name="name" label="供应商名称">
<Input placeholder="请输入供应商名称关键字" style={{ width: 180 }} maxLength={50} />
</Form.Item>
<Form.Item name="supplierType" label="境内/境外">
<Select style={{ width: 130 }} allowClear placeholder="请选择境内/境外" >
{regionOptions.map(opt => (
<Option key={opt.value} value={opt.value}>{opt.label}</Option>
))}
</Select>
<Form.Item name="supplierType" label="企业类型">
<RegionTypeSelect />
</Form.Item>
<Form.Item>
<Button className="buttonSubmit" type="primary" htmlType="submit" icon={<SearchOutlined />} onClick={handleSearch} disabled={treeLoading}>

View File

@ -10,14 +10,13 @@ import { connect } from 'umi';
import SupplierViewModal from './components/SupplierViewModal';
import SupplierDetailModal from './components/SupplierDetailModal';
import CategorySelector from '@/components/CategorySelector';
import RegionTypeSelect from '@/components/CommonSelect/RegionTypeSelect'
import AccessStatusSelect from '@/components/CommonSelect/AccessStatusSelect'
//本地服务/接口
import { getPageMy } from './services';
//统一列表分页
import tableProps from '@/utils/tableProps'
const { Option } = Select;
//下拉数据接口
type OptionType = { label: string; value: string };
// 列表数据接口
interface Data {
id: number;
@ -45,10 +44,6 @@ const mySupplierInquiry: React.FC<mySupplierInquiryProps> = ({ dispatch }) => {
const [detailVisible, setDetailVisible] = useState(false);
//查看、准入明细 参数传递
const [currentRecord, setCurrentRecord] = useState('');
// 境内/境外下拉数据
const [regionOptions, setRegionOptions] = useState<OptionType[]>([]);
// 准入状态
const [storeOptions, setStoreOptions] = useState<OptionType[]>([]);
// 导出
const handleExport = async () => {
window.open(
@ -85,20 +80,6 @@ const mySupplierInquiry: React.FC<mySupplierInquiryProps> = ({ dispatch }) => {
};
// 初始化
useEffect(() => {
// 境内/境外 下拉
setRegionOptions([
{ label: '境内企业', value: 'dvs' },
{ label: '境外企业', value: 'ovs' },
{ label: '个人', value: 'pe' },
])
// 准入状态下拉
setStoreOptions([
{ label: '未准入', value: '0' },
{ label: '已准入', value: '1' },
{ label: '退出', value: '2' },
])
getList();
}, []);
@ -205,18 +186,10 @@ const mySupplierInquiry: React.FC<mySupplierInquiryProps> = ({ dispatch }) => {
<CategorySelector multiple={false} style={{ width: 140 }} />
</Form.Item>
<Form.Item name="accessStatus" label="准入状态">
<Select style={{ width: 140 }} allowClear placeholder="请选择准入状态">
{storeOptions.map(opt => (
<Option key={opt.value} value={opt.value}>{opt.label}</Option>
))}
</Select>
<AccessStatusSelect/>
</Form.Item>
<Form.Item name="supplierType" label="境内/境外">
<Select style={{ width: 140 }} allowClear placeholder="请选择境内/境外" >
{regionOptions.map(opt => (
<Option key={opt.value} value={opt.value}>{opt.label}</Option>
))}
</Select>
<Form.Item name="supplierType" label="企业类型">
<RegionTypeSelect />
</Form.Item>
<Form.Item>
<Button className="buttonSubmit" type="primary" htmlType="submit" icon={<SearchOutlined />} onClick={handleSearch} >

View File

@ -9,6 +9,8 @@ import { useIntl, connect } from 'umi';
//本地组件、弹窗、业务逻辑
import SupplierViewModal from './components/SupplierViewModal';
import SupplierDetailModal from './components/SupplierDetailModal';
import RegionTypeSelect from '@/components/CommonSelect/RegionTypeSelect'
import AccessStatusSelect from '@/components/CommonSelect/AccessStatusSelect'
//本地服务/接口
import { getRegisterPage } from './services';
//统一列表分页
@ -23,15 +25,12 @@ interface Data {
regTime: string;
status: string;
}
//下拉数据接口
type OptionType = { label: string; value: string };
//准入状态
const statusColor = (status: string) => {
if (status === '已驳回' || status === '已退出') return '#ef6969';
if (status === '已准入') return '#004f8e';
return undefined;
};
interface RegistrationQueryProps {
dispatch: any;
}
@ -54,10 +53,6 @@ const RegistrationQuery: React.FC<RegistrationQueryProps> = ({ dispatch }) => {
const [detailVisible, setDetailVisible] = useState(false);
//查看、准入明细 参数传递
const [currentRecord, setCurrentRecord] = useState('');
// 境内/境外下拉数据
const [regionOptions, setRegionOptions] = useState<OptionType[]>([]);
//状态 下拉数据
const [statusOptions, setStatusOptions] = useState<OptionType[]>([]);
// 搜索
const handleSearch = () => {
setPagination({ ...pagination, current: 1 });
@ -87,18 +82,6 @@ const RegistrationQuery: React.FC<RegistrationQueryProps> = ({ dispatch }) => {
};
//初始化
useEffect(() => {
// 境内/境外 下拉
setRegionOptions([
{ label: '境内企业', value: 'dvs' },
{ label: '境外企业', value: 'ovs' },
{ label: '个人', value: 'pe' },
])
//状态 下拉
setStatusOptions([
{ label: '未准入', value: '0' },
{ label: '已准入', value: '1' },
{ label: '退出', value: '2' },
])
//列表
getList();
}, [])
@ -199,19 +182,11 @@ const RegistrationQuery: React.FC<RegistrationQueryProps> = ({ dispatch }) => {
<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 name="supplierType" label="企业类型">
<RegionTypeSelect />
</Form.Item>
<Form.Item name="accessStatus" label="准入状态">
<Select style={{ width: 160 }} placeholder="请选择状态" allowClear>
{statusOptions.map(opt => (
<Select.Option key={opt.value} value={opt.value}>{opt.label}</Select.Option>
))}
</Select>
<AccessStatusSelect />
</Form.Item>
<Form.Item>
<Button className="buttonSubmit" type="primary" htmlType="submit" icon={<SearchOutlined />}></Button>