供应商
This commit is contained in:
@ -0,0 +1,84 @@
|
||||
import { Request, Response } from 'express';
|
||||
export default {
|
||||
|
||||
'GET /api/system/list': (req: Request, res: Response) => {
|
||||
res.json({
|
||||
code: 200,
|
||||
data: [
|
||||
|
||||
],
|
||||
total: 2,
|
||||
msg: '操作成功'
|
||||
});
|
||||
},
|
||||
'GET /api/system/treeData': (req: Request, res: Response) => {
|
||||
res.json({
|
||||
code: 200,
|
||||
data: [ {
|
||||
title: '中国远洋海运集团集团总部',
|
||||
key: 'head',
|
||||
children: [
|
||||
{
|
||||
title: '集采',
|
||||
key: 'collection',
|
||||
children: [
|
||||
{ title: '镇江分公司', key: 'zhenjiang' },
|
||||
{ title: '浦东分公司', key: 'pudong' },
|
||||
],
|
||||
},
|
||||
],
|
||||
},],
|
||||
total: 2,
|
||||
msg: '操作成功'
|
||||
});
|
||||
},
|
||||
|
||||
'GET /api/system/regionOptions': (req: Request, res: Response) => {
|
||||
res.json({
|
||||
code: 200,
|
||||
data: [
|
||||
{ label: '境内', value: '境内' },
|
||||
{ label: '境外', value: '境外' },
|
||||
],
|
||||
total: 2,
|
||||
msg: '操作成功'
|
||||
});
|
||||
},
|
||||
|
||||
'GET /api/system/categoryOptions': (req: Request, res: Response) => {
|
||||
res.json({
|
||||
code: 200,
|
||||
data: [
|
||||
{ label: '原材料', value: '原材料' },
|
||||
{ label: '配件', value: '配件' },
|
||||
{ label: '燃油', value: '燃油' },
|
||||
],
|
||||
total: 2,
|
||||
msg: '操作成功'
|
||||
});
|
||||
},
|
||||
'GET /api/system/storeOptions': (req: Request, res: Response) => {
|
||||
res.json({
|
||||
code: 200,
|
||||
data: [
|
||||
{ label: '库1', value: '库1' },
|
||||
{ label: '库2', value: '库2' },
|
||||
],
|
||||
total: 2,
|
||||
msg: '操作成功'
|
||||
});
|
||||
},
|
||||
|
||||
'GET /api/system/supplierDetail': (req: Request, res: Response) => {
|
||||
res.json({ code: 200,
|
||||
data: [
|
||||
{ id: 1, unit: "中国远洋海运集团", category: "燃油", accessTime: "2025-01-05", exitTime: "2025-01-05", grayTime: "2024-01-01~2025-01-02", blackTime: "" },
|
||||
{ id: 2, unit: "中国远洋海运集团", category: "配件", accessTime: "2025-01-05", exitTime: "", grayTime: "", blackTime: "" },
|
||||
{ id: 3, unit: "中远海运(天津)有限公司", category: "天然气", accessTime: "2025-03-05", exitTime: "", grayTime: "", blackTime: "" },
|
||||
{ id: 4, unit: "中远海运(青岛)有限公司", category: "天然气", accessTime: "2025-03-09", exitTime: "", grayTime: "", blackTime: "" },
|
||||
],
|
||||
total: 10,
|
||||
msg: '操作成功' });
|
||||
},
|
||||
|
||||
};
|
@ -0,0 +1,98 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { Modal, TreeSelect, Button, message } from 'antd';
|
||||
//本地服务/接口
|
||||
import { treeData } from '../services';
|
||||
|
||||
|
||||
interface Props {
|
||||
visible: boolean;
|
||||
onCancel: () => void;
|
||||
}
|
||||
|
||||
const CategoryAddModal: React.FC<Props> = ({ visible, onCancel }) => {
|
||||
const [value, setValue] = useState<string[]>([]);
|
||||
// 树数据
|
||||
const [dataTree, setDataTree] = useState<any[]>([]);
|
||||
|
||||
const [submitting, setSubmitting] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (!visible) setValue([]);
|
||||
//tree数据
|
||||
treeData().then((res) => {
|
||||
const { code, data } = res;
|
||||
if (code == 200) {
|
||||
setDataTree(data)
|
||||
}
|
||||
})
|
||||
}, [visible]);
|
||||
|
||||
// 提交方法
|
||||
const handleOk = async () => {
|
||||
if (value.length === 0) {
|
||||
message.warning('请选择品类');
|
||||
return;
|
||||
}
|
||||
setSubmitting(true);
|
||||
try {
|
||||
// TODO: 替换为你自己的接口调用
|
||||
// const res = await addCategory({ categoryIds: value });
|
||||
// 假设接口成功
|
||||
// if (res.code === 200) {
|
||||
// message.success('新增品类成功');
|
||||
// onCancel();
|
||||
// } else {
|
||||
// message.error(res.msg || '操作失败');
|
||||
// }
|
||||
// 示例(去掉上面的注释用你自己的接口)
|
||||
setTimeout(() => {
|
||||
message.success('新增品类成功');
|
||||
setSubmitting(false);
|
||||
onCancel();
|
||||
}, 800);
|
||||
} catch (e) {
|
||||
message.error('提交失败');
|
||||
setSubmitting(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal
|
||||
visible={visible}
|
||||
title='品类'
|
||||
onCancel={onCancel}
|
||||
footer={
|
||||
<div style={{ display: 'flex', justifyContent: 'center', gap: 32 }}>
|
||||
<Button
|
||||
type="primary"
|
||||
style={{ minWidth: 120 }}
|
||||
loading={submitting}
|
||||
onClick={handleOk}
|
||||
>确定</Button>
|
||||
<Button style={{ minWidth: 120 }} onClick={onCancel}>取消</Button>
|
||||
</div>
|
||||
}
|
||||
width={600}
|
||||
destroyOnClose
|
||||
bodyStyle={{ minHeight: 300 }}
|
||||
>
|
||||
<TreeSelect
|
||||
style={{ width: '100%' }}
|
||||
value={value}
|
||||
treeData={dataTree}
|
||||
placeholder="请选择品类"
|
||||
allowClear
|
||||
multiple
|
||||
treeCheckable
|
||||
showSearch
|
||||
filterTreeNode={(input, node:any) =>
|
||||
(node.title as string).toLowerCase().includes(input.toLowerCase())
|
||||
}
|
||||
onChange={setValue}
|
||||
dropdownStyle={{ maxHeight: 350, overflow: 'auto' }}
|
||||
/>
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
||||
export default CategoryAddModal;
|
@ -0,0 +1,179 @@
|
||||
import React, { useState, useEffect } from "react";
|
||||
//第三方UI库/组件
|
||||
import { Modal, Form, Input, Button, Table, message, Tooltip } from "antd";
|
||||
//类型定义
|
||||
import type { ColumnsType, TablePaginationConfig } from 'antd/es/table';
|
||||
//umi 相关
|
||||
import { connect, useIntl } from 'umi';
|
||||
//本地服务/接口
|
||||
import { supplierDetail } from '../services';
|
||||
//本地组件
|
||||
import CategoryAddModal from './CategoryAddModal';
|
||||
|
||||
interface Data {
|
||||
id: number;
|
||||
unit: string;
|
||||
category: string;
|
||||
accessTime: string;
|
||||
exitTime?: string;
|
||||
grayTime?: string;
|
||||
blackTime?: string;
|
||||
}
|
||||
//主体接口
|
||||
interface SupplierAccessDetailModalProps {
|
||||
visible: boolean;
|
||||
onCancel: () => void;
|
||||
record?: any; // 你可以定义具体类型
|
||||
}
|
||||
//主体
|
||||
const SupplierAccessDetailModal: React.FC<SupplierAccessDetailModalProps> = ({ visible, onCancel, record, }) => {
|
||||
//双语
|
||||
const intl = useIntl();
|
||||
//查询表单
|
||||
const [form] = Form.useForm();
|
||||
//列表渲染数据
|
||||
const [data, setData] = useState<Data[]>([]);
|
||||
//列表加载
|
||||
const [loading, setLoading] = useState(false);
|
||||
//列表分页
|
||||
const [pagination, setPagination] = useState<TablePaginationConfig>({ current: 1, pageSize: 10, total: 0, });
|
||||
//品类弹窗状态
|
||||
const [addModalVisible, setAddModalVisible] = useState(false);
|
||||
// 搜索
|
||||
const handleSearch = () => {
|
||||
setPagination({ ...pagination, current: 1 });
|
||||
getList();
|
||||
};
|
||||
// 重置
|
||||
const handleReset = () => {
|
||||
form.resetFields();
|
||||
setPagination({ ...pagination, current: 1 });
|
||||
getList();
|
||||
};
|
||||
//列表方法
|
||||
const getList = async (page: number = 1, pageSize: number = 10) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const { code, data, msg, total } = await supplierDetail({ page, pageSize });
|
||||
if (code === 200) {
|
||||
setData(data);
|
||||
setPagination({ current: page, pageSize, total });
|
||||
} else {
|
||||
message.error(msg)
|
||||
}
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
//初始化
|
||||
useEffect(() => {
|
||||
getList();
|
||||
}, [])
|
||||
// 列表头部数据
|
||||
const columns:ColumnsType<Data> = [
|
||||
{
|
||||
title: "序号",
|
||||
dataIndex: "index",
|
||||
key: "index",
|
||||
align: "center",
|
||||
render: (_: any, __: any, idx: number) => idx + 1,
|
||||
width: 60,
|
||||
},
|
||||
{
|
||||
title: "准入单位",
|
||||
dataIndex: "unit",
|
||||
key: "unit",
|
||||
align: "left",
|
||||
ellipsis: true,
|
||||
render: (dom, record) =>
|
||||
<Tooltip title={record.unit}>
|
||||
{record.unit}
|
||||
</Tooltip>,
|
||||
},
|
||||
{
|
||||
title: "准入品类",
|
||||
dataIndex: "category",
|
||||
key: "category",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: "准入时间",
|
||||
dataIndex: "accessTime",
|
||||
key: "accessTime",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: "退出时间",
|
||||
dataIndex: "exitTime",
|
||||
key: "exitTime",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: "进入灰名单时间",
|
||||
dataIndex: "grayTime",
|
||||
key: "grayTime",
|
||||
align: "center",
|
||||
},
|
||||
{
|
||||
title: "进入黑名单时间",
|
||||
dataIndex: "blackTime",
|
||||
key: "blackTime",
|
||||
align: "center",
|
||||
},
|
||||
];
|
||||
return (
|
||||
<Modal
|
||||
visible={visible}
|
||||
title="准入明细"
|
||||
onCancel={onCancel}
|
||||
footer={null}
|
||||
width={1000}
|
||||
destroyOnClose
|
||||
>
|
||||
{/* 查询栏 */}
|
||||
<Form form={form} layout="inline" style={{ marginBottom: 16 }}>
|
||||
<Form.Item name="keyword">
|
||||
<Input
|
||||
placeholder="请输入准入单位或准入品类关键字"
|
||||
style={{ width: 300 }}
|
||||
allowClear
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
<Button type="primary" onClick={handleSearch}>
|
||||
查询
|
||||
</Button>
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
<Button onClick={handleReset}>重置</Button>
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
<Button
|
||||
type="primary"
|
||||
style={{ background: "#52a8ff", borderColor: "#52a8ff" }}
|
||||
onClick={() => setAddModalVisible(true)}
|
||||
>
|
||||
新增品类
|
||||
</Button>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
{/* 表格内容 */}
|
||||
<Table
|
||||
rowKey="id"
|
||||
columns={columns}
|
||||
dataSource={data}
|
||||
loading={loading}
|
||||
pagination={pagination}
|
||||
onChange={(pagination) => getList(pagination.current!, pagination.pageSize!)}
|
||||
/>
|
||||
{/* 新增品类弹窗 */}
|
||||
<CategoryAddModal
|
||||
visible={addModalVisible}
|
||||
onCancel={() => setAddModalVisible(false)}
|
||||
// onOk={...} // 根据你的业务需要加
|
||||
/>
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
||||
export default connect()(SupplierAccessDetailModal);
|
@ -0,0 +1,21 @@
|
||||
import React from "react";
|
||||
//第三方UI库/组件
|
||||
import { Modal } from "antd";
|
||||
//本地组件、业务逻辑
|
||||
import CompanyInfo from '@/components/CompanyInfo';
|
||||
//主体接口
|
||||
interface SupplierViewModalProps {
|
||||
visible: boolean;
|
||||
onCancel: () => void;
|
||||
record?: any;
|
||||
}
|
||||
// 查看主体
|
||||
const SupplierViewModal: React.FC<SupplierViewModalProps> = ({ visible, onCancel, record }) => {
|
||||
return (
|
||||
<Modal visible={visible} title="供应商信息查看" onCancel={onCancel} footer={null} width='80%' destroyOnClose >
|
||||
<CompanyInfo />
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
||||
export default SupplierViewModal;
|
@ -0,0 +1,232 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
//第三方UI库/组件
|
||||
import { Form, Button, Table, Select, Input, Space, message } from 'antd';
|
||||
import { SearchOutlined, DownloadOutlined, ReloadOutlined } from '@ant-design/icons';
|
||||
//类型定义
|
||||
import type { ColumnsType, TablePaginationConfig } from 'antd/es/table';
|
||||
//umi 相关
|
||||
import { connect } from 'umi';
|
||||
//本地组件、弹窗、业务逻辑
|
||||
import SupplierViewModal from './components/SupplierViewModal';
|
||||
import SupplierDetailModal from './components/SupplierDetailModal';
|
||||
//本地服务/接口
|
||||
import { list, systemDict } from './services';
|
||||
|
||||
const { Option } = Select;
|
||||
//下拉数据接口
|
||||
type OptionType = { label: string; value: string };
|
||||
// 列表数据接口
|
||||
interface Data {
|
||||
id: number;
|
||||
name: string;
|
||||
region: string;
|
||||
supplierType: string;
|
||||
regTime: string;
|
||||
status: string;
|
||||
}
|
||||
|
||||
const mySupplierInquiry: React.FC = () => {
|
||||
//搜搜表单
|
||||
const [form] = Form.useForm();
|
||||
//列表数据
|
||||
const [data, setData] = useState<Data[]>([]);
|
||||
//列表加载
|
||||
const [loading, setLoading] = useState(false);
|
||||
//分页
|
||||
const [pagination, setPagination] = useState<TablePaginationConfig>({ current: 1, pageSize: 10, total: 188 });
|
||||
//查看是否显示状态
|
||||
const [viewVisible, setViewVisible] = useState(false);
|
||||
//准入明细是否显示状态
|
||||
const [detailVisible, setDetailVisible] = useState(false);
|
||||
//查看、准入明细 参数传递
|
||||
const [currentRecord, setCurrentRecord] = useState<any>(null);
|
||||
// 境内/境外下拉数据
|
||||
const [regionOptions, setRegionOptions] = useState<OptionType[]>([]);
|
||||
//集采类别
|
||||
const [categoryOptions, setCategoryOptions] = useState<OptionType[]>([]);
|
||||
//集采库
|
||||
const [storeOptions, setStoreOptions] = useState<OptionType[]>([]);
|
||||
// 导出
|
||||
const handleExport = () => {
|
||||
message.success('导出成功(此处为前端示例,实际应调接口)');
|
||||
};
|
||||
// 查询
|
||||
const handleSearch = () => {
|
||||
setPagination({ ...pagination, current: 1 });
|
||||
getList();
|
||||
};
|
||||
// 重置
|
||||
const handleReset = () => {
|
||||
form.resetFields();
|
||||
setPagination({ ...pagination, current: 1 });
|
||||
getList();
|
||||
};
|
||||
//列表方法
|
||||
const getList = async (page: number = 1, pageSize: number = 10) => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const { code, data, msg, total } = await list({ page, pageSize });
|
||||
if (code === 200) {
|
||||
setData(data);
|
||||
setPagination({ current: page, pageSize, total });
|
||||
} else {
|
||||
message.error(msg)
|
||||
}
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
// 初始化
|
||||
useEffect(() => {
|
||||
// 境内/境外 下拉
|
||||
systemDict('regionOptions').then((res) => {
|
||||
const { code, data } = res;
|
||||
if (code == 200) {
|
||||
setRegionOptions(data)
|
||||
}
|
||||
});
|
||||
// 集采类别 下拉
|
||||
systemDict('categoryOptions').then((res) => {
|
||||
const { code, data } = res;
|
||||
if (code == 200) {
|
||||
setCategoryOptions(data)
|
||||
}
|
||||
});
|
||||
// 集采库 下拉
|
||||
systemDict('storeOptions').then((res) => {
|
||||
const { code, data } = res;
|
||||
if (code == 200) {
|
||||
setStoreOptions(data)
|
||||
}
|
||||
});
|
||||
getList();
|
||||
}, []);
|
||||
|
||||
|
||||
const columns: ColumnsType<Data> = [
|
||||
{
|
||||
title: '序号',
|
||||
dataIndex: 'index',
|
||||
key: 'index',
|
||||
align: 'center',
|
||||
width: 60,
|
||||
render: (_: any, __: any, idx: number) => idx + 1,
|
||||
},
|
||||
{
|
||||
title: '供应商名称',
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '统一社会信用代码/税号',
|
||||
dataIndex: 'code',
|
||||
key: 'code',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '境内/境外',
|
||||
dataIndex: 'region',
|
||||
key: 'region',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '企业类型',
|
||||
dataIndex: 'type',
|
||||
key: 'type',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '注册时间',
|
||||
dataIndex: 'regTime',
|
||||
key: 'regTime',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
key: 'option',
|
||||
align: 'center',
|
||||
render: (record: any) => (
|
||||
<Space>
|
||||
<a
|
||||
style={{ color: '#1677ff' }}
|
||||
onClick={() => { setCurrentRecord(record); setViewVisible(true); }}
|
||||
>查看</a>
|
||||
<a
|
||||
style={{ color: '#1677ff' }}
|
||||
onClick={() => { setCurrentRecord(record); setDetailVisible(true); }}
|
||||
>准入明细</a>
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<>
|
||||
<Form
|
||||
form={form}
|
||||
layout="inline"
|
||||
style={{ marginBottom: 12, }}
|
||||
>
|
||||
<Form.Item name="name" label="供应商名称">
|
||||
<Input placeholder="请输入供应商名称关键字" style={{ width: 180 }} />
|
||||
</Form.Item>
|
||||
<Form.Item name="category" label="集采类别">
|
||||
<Select style={{ width: 150 }} allowClear>
|
||||
{categoryOptions.map(opt => (
|
||||
<Option key={opt.value} value={opt.value}>{opt.label}</Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item name="store" label="集采库">
|
||||
<Select style={{ width: 150 }} allowClear>
|
||||
{storeOptions.map(opt => (
|
||||
<Option key={opt.value} value={opt.value}>{opt.label}</Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item name="region" label="境内/境外">
|
||||
<Select style={{ width: 130 }} allowClear>
|
||||
{regionOptions.map(opt => (
|
||||
<Option key={opt.value} value={opt.value}>{opt.label}</Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
<Button type="primary" icon={<DownloadOutlined />} style={{ marginRight: 8 }} onClick={handleExport}>
|
||||
数据导出
|
||||
</Button>
|
||||
<Button type="primary" icon={<SearchOutlined />} htmlType="submit" onClick={handleSearch}>
|
||||
查询
|
||||
</Button>
|
||||
<Button style={{ marginLeft: 8 }} icon={<ReloadOutlined />} onClick={handleReset}>
|
||||
重置
|
||||
</Button>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
{/* 表格 */}
|
||||
<Table
|
||||
rowKey="id"
|
||||
columns={columns}
|
||||
dataSource={data}
|
||||
loading={loading}
|
||||
pagination={pagination}
|
||||
onChange={(pagination) => getList(pagination.current!, pagination.pageSize!)}
|
||||
/>
|
||||
{/* 查看组件 */}
|
||||
<SupplierViewModal
|
||||
visible={viewVisible}
|
||||
record={currentRecord}
|
||||
onCancel={() => setViewVisible(false)}
|
||||
/>
|
||||
{/* 准入明细组件 */}
|
||||
<SupplierDetailModal
|
||||
visible={detailVisible}
|
||||
record={currentRecord}
|
||||
onCancel={() => setDetailVisible(false)}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default connect()(mySupplierInquiry);
|
@ -0,0 +1,36 @@
|
||||
import request from '@/utils/request';
|
||||
|
||||
export interface ListParams {
|
||||
page: number;
|
||||
pageSize: number;
|
||||
treeId?: string;
|
||||
tmpToken?: string;
|
||||
}
|
||||
export async function list(params:ListParams) {
|
||||
return request('/api/system/library', {
|
||||
method: 'GET',
|
||||
params
|
||||
});
|
||||
}
|
||||
export interface supplierDetailParams {
|
||||
page: number;
|
||||
pageSize: number;
|
||||
captcha?: string;
|
||||
tmpToken?: string;
|
||||
}
|
||||
export async function supplierDetail(params:supplierDetailParams) {
|
||||
return request(`/api/system/supplierDetail`, {
|
||||
method: 'GET',
|
||||
params
|
||||
});
|
||||
}
|
||||
export async function treeData() {
|
||||
return request('/api/system/treeData', {
|
||||
method: 'GET'
|
||||
});
|
||||
}
|
||||
export async function systemDict(dict:String) {
|
||||
return request(`/api/system/${dict}`, {
|
||||
method: 'GET'
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user