合并代码
This commit is contained in:
@ -4,6 +4,8 @@ import { SearchOutlined, ReloadOutlined, PlusOutlined } from "@ant-design/icons"
|
||||
import type { ColumnsType } from 'antd/es/table';
|
||||
import CreateBlacklistModal from './components/CreateBlacklistModal'
|
||||
import ViewBlacklistModal from './components/ViewBlacklistModal';
|
||||
import moment from 'moment';
|
||||
import { getDictList } from '@/servers/api/dicts'
|
||||
import { getPage } from './services'
|
||||
interface ExitRecord {
|
||||
exitTheme: string; // 申请主题
|
||||
@ -11,43 +13,39 @@ interface ExitRecord {
|
||||
createTime: string; // 发起时间
|
||||
accessType: string; // 审批记录状态
|
||||
}
|
||||
// mock 数据与服务(实际请换为接口)
|
||||
const orgOptions = [
|
||||
{ label: "请选择", value: "" },
|
||||
{ label: "中远海运特运", value: "中远海运特运" },
|
||||
{ label: "中远海运散运", value: "中远海运散运" },
|
||||
{ label: "中远海运物流", value: "中远海运物流" },
|
||||
{ label: "中远海运广州公司", value: "中远海运广州公司" },
|
||||
];
|
||||
|
||||
interface Dict {
|
||||
dicName: string;
|
||||
code: string;
|
||||
}
|
||||
|
||||
// 查询记录状态
|
||||
const recordStatusOptions = [
|
||||
{ label: "请选择", value: "" },
|
||||
{ label: "未开始", value: "未开始" },
|
||||
{ label: "进行中", value: "进行中" },
|
||||
{ label: "已结束", value: "已结束" },
|
||||
];
|
||||
|
||||
const supplierExitAudit: React.FC = () => {
|
||||
const [form] = Form.useForm();
|
||||
const [data, setData] = useState<any[]>([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [pagination, setPagination] = useState({ current: 1, pageSize: 10, total: 0 });
|
||||
const [createVisible, setCreateVisible] = useState(false);
|
||||
const [viewVisible, setViewVisible] = useState(false);
|
||||
const [selectedRecordId, setSelectedRecordId] = useState<string | null>(null);
|
||||
// 查询接口
|
||||
const getList = async (pageNo = 1, pageSize = 10) => {
|
||||
setLoading(true);
|
||||
// 可传查询条件 form.getFieldsValue()
|
||||
const { code, data } = await getPage({ pageNo, pageSize });
|
||||
if (code === 200) {
|
||||
setData(data.records);
|
||||
setPagination(prev => ({ ...prev, current: pageNo, pageSize, total: data.total }));
|
||||
}
|
||||
setLoading(false);
|
||||
};
|
||||
const [form] = Form.useForm();
|
||||
const [data, setData] = useState<any[]>([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [pagination, setPagination] = useState({ current: 1, pageSize: 10, total: 0 });
|
||||
const [createVisible, setCreateVisible] = useState(false);
|
||||
const [viewVisible, setViewVisible] = useState(false);
|
||||
const [selectedRecordId, setSelectedRecordId] = useState<string | null>(null);
|
||||
const [enterpriseType, setEnterpriseType] = useState<Dict[]>();
|
||||
|
||||
// 查询接口
|
||||
const getList = async (pageNo = 1, pageSize = 10) => {
|
||||
setLoading(true);
|
||||
// 可传查询条件 form.getFieldsValue()
|
||||
const values = form.getFieldsValue();
|
||||
const { exitTheme, time, deptId, approveStatus } = values;
|
||||
const startTime = time ? moment(time[0]).format('YYYY-MM-DD') : '';
|
||||
const endTime = time ? moment(time[1]).format('YYYY-MM-DD') : '';
|
||||
|
||||
const { code, data } = await getPage({ pageNo, pageSize, exitTheme, deptId, approveStatus, startTime, endTime });
|
||||
if (code === 200) {
|
||||
setData(data.records);
|
||||
setPagination(prev => ({ ...prev, current: pageNo, pageSize, total: data.total }));
|
||||
}
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
// 查询
|
||||
const handleSearch = () => {
|
||||
setPagination({ ...pagination, current: 1 });
|
||||
@ -71,9 +69,14 @@ const supplierExitAudit: React.FC = () => {
|
||||
getList();
|
||||
setCreateVisible(false);
|
||||
};
|
||||
useEffect(() => {
|
||||
getList();
|
||||
}, []);
|
||||
useEffect(() => {
|
||||
getDictList('approve_type').then((res) => {
|
||||
if (res.code == 200) {
|
||||
setEnterpriseType(res.data)
|
||||
}
|
||||
})
|
||||
getList();
|
||||
}, []);
|
||||
|
||||
const columns: ColumnsType<ExitRecord> = [
|
||||
{
|
||||
@ -82,7 +85,7 @@ const supplierExitAudit: React.FC = () => {
|
||||
key: "index",
|
||||
align: "center",
|
||||
width: 60,
|
||||
render: (_: any, __: any, idx: number) => idx + 1,
|
||||
render: (_: any, __: any, idx: number) => (((pagination.current ?? 1) - 1) * (pagination.pageSize ?? 10)) + idx + 1,
|
||||
},
|
||||
{ title: "申请主题", dataIndex: "exitTheme", key: "exitTheme", align: "center" },
|
||||
{ title: "发起单位", dataIndex: "deptId", key: "deptId", align: "center" },
|
||||
@ -108,20 +111,24 @@ const supplierExitAudit: React.FC = () => {
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
|
||||
{/* 查询表单 */}
|
||||
<Form form={form} layout="inline" style={{ marginBottom: 12 }}>
|
||||
<Form.Item name="topic" label="申请主题">
|
||||
<Input placeholder="请输入供应商名称关键字" style={{ width: 180 }} />
|
||||
<Form.Item name="exitTheme" label="申请主题">
|
||||
<Input placeholder="请输入供应商名称关键字" style={{ width: 150 }} allowClear maxLength={50} />
|
||||
</Form.Item>
|
||||
<Form.Item name="org" label="发起单位">
|
||||
<Select style={{ width: 150 }} allowClear options={orgOptions} />
|
||||
<Form.Item name="deptId" label="发起单位">
|
||||
</Form.Item>
|
||||
<Form.Item name="status" label="审批记录状态">
|
||||
<Select style={{ width: 130 }} allowClear options={recordStatusOptions} />
|
||||
<Form.Item name="approveStatus" label="审批记录状态">
|
||||
<Select style={{ width: 150 }} placeholder="请选择审批记录状态" allowClear>
|
||||
{enterpriseType?.map(item => (
|
||||
<Select.Option key={item.code} value={item.code}>{item.dicName}</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item name="time" label="发起时间">
|
||||
<DatePicker.RangePicker style={{ width: 220 }} />
|
||||
<DatePicker.RangePicker style={{ width: 220 }} allowClear />
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
<Button type="primary" icon={<SearchOutlined />} onClick={handleSearch}>查询</Button>
|
||||
|
@ -11,6 +11,9 @@ interface getPageData {
|
||||
reviewStatus?: string;
|
||||
approveStatus?: string;
|
||||
categoryId?: string;
|
||||
exitTheme?: string;
|
||||
startTime?: string;
|
||||
endTime?: string;
|
||||
}
|
||||
export const getPage = (data: getPageData) => request.post('/coscoSupplierexit/getPage', { data });
|
||||
/**
|
||||
|
@ -4,6 +4,8 @@ import { SearchOutlined, ReloadOutlined, PlusOutlined } from "@ant-design/icons"
|
||||
import type { ColumnsType } from 'antd/es/table';
|
||||
import CreateBlacklistModal from './components/CreateBlacklistModal'
|
||||
import ViewBlacklistModal from './components/ViewBlacklistModal';
|
||||
import moment from 'moment';
|
||||
import { getDictList } from '@/servers/api/dicts'
|
||||
import { getPage } from './services'
|
||||
interface ExitRecord {
|
||||
exitTheme: string; // 申请主题
|
||||
@ -11,43 +13,39 @@ interface ExitRecord {
|
||||
createTime: string; // 发起时间
|
||||
accessType: string; // 审批记录状态
|
||||
}
|
||||
// mock 数据与服务(实际请换为接口)
|
||||
const orgOptions = [
|
||||
{ label: "请选择", value: "" },
|
||||
{ label: "中远海运特运", value: "中远海运特运" },
|
||||
{ label: "中远海运散运", value: "中远海运散运" },
|
||||
{ label: "中远海运物流", value: "中远海运物流" },
|
||||
{ label: "中远海运广州公司", value: "中远海运广州公司" },
|
||||
];
|
||||
|
||||
|
||||
// 查询记录状态
|
||||
const recordStatusOptions = [
|
||||
{ label: "请选择", value: "" },
|
||||
{ label: "未开始", value: "未开始" },
|
||||
{ label: "进行中", value: "进行中" },
|
||||
{ label: "已结束", value: "已结束" },
|
||||
];
|
||||
|
||||
interface Dict {
|
||||
dicName: string;
|
||||
code: string;
|
||||
}
|
||||
const supplierExitManage: React.FC = () => {
|
||||
const [form] = Form.useForm();
|
||||
const [data, setData] = useState<any[]>([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [pagination, setPagination] = useState({ current: 1, pageSize: 10, total: 0 });
|
||||
const [createVisible, setCreateVisible] = useState(false);
|
||||
const [viewVisible, setViewVisible] = useState(false);
|
||||
const [selectedRecordId, setSelectedRecordId] = useState<string | null>(null);
|
||||
// 查询接口
|
||||
const getList = async (pageNo = 1, pageSize = 10) => {
|
||||
setLoading(true);
|
||||
// 可传查询条件 form.getFieldsValue()
|
||||
const { code, data } = await getPage({ pageNo, pageSize });
|
||||
if (code === 200) {
|
||||
setData(data.records);
|
||||
setPagination(prev => ({ ...prev, current: pageNo, pageSize, total: data.total }));
|
||||
}
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
const [form] = Form.useForm();
|
||||
const [data, setData] = useState<any[]>([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [pagination, setPagination] = useState({ current: 1, pageSize: 10, total: 0 });
|
||||
const [createVisible, setCreateVisible] = useState(false);
|
||||
const [viewVisible, setViewVisible] = useState(false);
|
||||
const [selectedRecordId, setSelectedRecordId] = useState<string | null>(null);
|
||||
const [enterpriseType, setEnterpriseType] = useState<Dict[]>();
|
||||
// 查询接口
|
||||
const getList = async (pageNo = 1, pageSize = 10) => {
|
||||
setLoading(true);
|
||||
// 可传查询条件 form.getFieldsValue()
|
||||
|
||||
const values = form.getFieldsValue();
|
||||
const { exitTheme, time, deptId, approveStatus } = values;
|
||||
const startTime = time ? moment(time[0]).format('YYYY-MM-DD') : '';
|
||||
const endTime = time ? moment(time[1]).format('YYYY-MM-DD') : '';
|
||||
|
||||
const { code, data } = await getPage({ pageNo, pageSize, exitTheme, deptId, approveStatus, startTime, endTime });
|
||||
if (code === 200) {
|
||||
setData(data.records);
|
||||
setPagination(prev => ({ ...prev, current: pageNo, pageSize, total: data.total }));
|
||||
}
|
||||
setLoading(false);
|
||||
};
|
||||
|
||||
// 查询
|
||||
const handleSearch = () => {
|
||||
setPagination({ ...pagination, current: 1 });
|
||||
@ -71,9 +69,14 @@ const supplierExitManage: React.FC = () => {
|
||||
getList();
|
||||
setCreateVisible(false);
|
||||
};
|
||||
useEffect(() => {
|
||||
getList();
|
||||
}, []);
|
||||
useEffect(() => {
|
||||
getDictList('approve_type').then((res) => {
|
||||
if (res.code == 200) {
|
||||
setEnterpriseType(res.data)
|
||||
}
|
||||
})
|
||||
getList();
|
||||
}, []);
|
||||
|
||||
const columns: ColumnsType<ExitRecord> = [
|
||||
{
|
||||
@ -82,7 +85,7 @@ const supplierExitManage: React.FC = () => {
|
||||
key: "index",
|
||||
align: "center",
|
||||
width: 60,
|
||||
render: (_: any, __: any, idx: number) => idx + 1,
|
||||
render: (_: any, __: any, idx: number) => (((pagination.current ?? 1) - 1) * (pagination.pageSize ?? 10)) + idx + 1,
|
||||
},
|
||||
{ title: "申请主题", dataIndex: "exitTheme", key: "exitTheme", align: "center" },
|
||||
{ title: "发起单位", dataIndex: "deptId", key: "deptId", align: "center" },
|
||||
@ -108,28 +111,32 @@ const supplierExitManage: React.FC = () => {
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
|
||||
{/* 查询表单 */}
|
||||
<Form form={form} layout="inline" style={{ marginBottom: 12 }}>
|
||||
<Form.Item name="topic" label="申请主题">
|
||||
<Input placeholder="请输入供应商名称关键字" style={{ width: 180 }} />
|
||||
<Form.Item name="exitTheme" label="申请主题">
|
||||
<Input placeholder="请输入供应商名称关键字" style={{ width: 150 }} allowClear maxLength={50} />
|
||||
</Form.Item>
|
||||
<Form.Item name="org" label="发起单位">
|
||||
<Select style={{ width: 150 }} allowClear options={orgOptions} />
|
||||
<Form.Item name="deptId" label="发起单位">
|
||||
</Form.Item>
|
||||
<Form.Item name="status" label="审批记录状态">
|
||||
<Select style={{ width: 130 }} allowClear options={recordStatusOptions} />
|
||||
<Form.Item name="approveStatus" label="审批记录状态">
|
||||
<Select style={{ width: 150 }} placeholder="请选择审批记录状态" allowClear>
|
||||
{enterpriseType?.map(item => (
|
||||
<Select.Option key={item.code} value={item.code}>{item.dicName}</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item name="time" label="发起时间">
|
||||
<DatePicker.RangePicker style={{ width: 220 }} />
|
||||
<DatePicker.RangePicker style={{ width: 220 }} allowClear />
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
<Button type="primary" icon={<SearchOutlined />} onClick={handleSearch}>查询</Button>
|
||||
<Button style={{ marginLeft: 8 }} icon={<ReloadOutlined />} onClick={handleReset}>重置</Button>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
{/* 顶部按钮区 */}
|
||||
<div style={{ marginBottom: 16 }}>
|
||||
{/* 顶部按钮区 */}
|
||||
<div style={{ marginBottom: 16 }}>
|
||||
<Button type="primary" icon={<PlusOutlined />} onClick={handleApply}>
|
||||
发起申请
|
||||
</Button>
|
||||
|
@ -11,8 +11,12 @@ interface getPageData {
|
||||
reviewStatus?: string;
|
||||
approveStatus?: string;
|
||||
categoryId?: string;
|
||||
exitTheme?: string;
|
||||
startTime?: string;
|
||||
endTime?: string;
|
||||
}
|
||||
export const getPage = (data: getPageData) => request.post('/coscoSupplierexit/getPage', { data });
|
||||
|
||||
/**
|
||||
* 供应商分页列表查询
|
||||
*/
|
||||
|
Reference in New Issue
Block a user