供应商准入情况统计
This commit is contained in:
@ -2,25 +2,29 @@ import React, { useEffect, useState } from "react";
|
||||
import { Table, Form, Input, Button, Select, Modal, Descriptions } from 'antd';
|
||||
import { SearchOutlined, ReloadOutlined } from '@ant-design/icons';
|
||||
import type { ColumnsType, TablePaginationConfig } from 'antd/es/table';
|
||||
//字典与接口
|
||||
import { getPage, update } from './services';
|
||||
import { getDictList } from '@/servers/api/dicts'
|
||||
|
||||
const messageTypeOptions = [
|
||||
{ label: '请选择', value: '' },
|
||||
{ label: '供应商变更', value: '供应商变更' },
|
||||
{ label: '供应商准入', value: '供应商准入' },
|
||||
{ label: '供应商评价', value: '供应商评价' },
|
||||
{ label: '供应商评审', value: '供应商评审' },
|
||||
{ label: '供应商退出', value: '供应商退出' },
|
||||
{ label: '供应商黑名单', value: '供应商黑名单' },
|
||||
];
|
||||
interface CategoryOption {
|
||||
code: string;
|
||||
dicName: string;
|
||||
}
|
||||
|
||||
const SupplierMessage: React.FC = () => {
|
||||
//搜索
|
||||
const [form] = Form.useForm();
|
||||
//列表渲染
|
||||
const [data, setData] = useState<any[]>([]);
|
||||
//列表加载
|
||||
const [loading, setLoading] = useState(false);
|
||||
//列表分页
|
||||
const [pagination, setPagination] = useState<TablePaginationConfig>({ current: 1, pageSize: 10, total: 0 });
|
||||
//查看信息与组件
|
||||
const [viewRecord, setViewRecord] = useState<any>(null); // 当前查看的消息
|
||||
const [viewVisible, setViewVisible] = useState(false); // 弹窗显隐
|
||||
//下拉数据
|
||||
const [categoryOptions, setCategoryOptions] = useState<CategoryOption[]>([]);
|
||||
|
||||
// 获取数据
|
||||
const getList = async (pageNo = 1, pageSize = 10) => {
|
||||
@ -53,8 +57,13 @@ const SupplierMessage: React.FC = () => {
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
getDictList('message_type').then((res: any) => {
|
||||
const { code, data } = res;
|
||||
if (code == 200) {
|
||||
setCategoryOptions(data)
|
||||
}
|
||||
})
|
||||
getList();
|
||||
// eslint-disable-next-line
|
||||
}, []);
|
||||
|
||||
// 表头
|
||||
@ -76,8 +85,8 @@ const SupplierMessage: React.FC = () => {
|
||||
},
|
||||
{
|
||||
title: '业务类型',
|
||||
dataIndex: 'type',
|
||||
key: 'type',
|
||||
dataIndex: 'typeCn',
|
||||
key: 'typeCn',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
@ -93,7 +102,7 @@ const SupplierMessage: React.FC = () => {
|
||||
key: 'read',
|
||||
align: 'center',
|
||||
width: 120,
|
||||
render: (_, record) => ( <span>{ record.read === '0'? '否':'是' }</span> )
|
||||
render: (_, record) => (<span>{record.read === '0' ? '否' : '是'}</span>)
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
@ -104,7 +113,7 @@ const SupplierMessage: React.FC = () => {
|
||||
<a onClick={() => {
|
||||
setViewRecord(record);
|
||||
setViewVisible(true);
|
||||
update({ id:record.id })
|
||||
update({ id: record.id })
|
||||
getList()
|
||||
}}>查看</a>
|
||||
),
|
||||
@ -119,8 +128,8 @@ const SupplierMessage: React.FC = () => {
|
||||
</Form.Item>
|
||||
<Form.Item name="type" label="业务类型">
|
||||
<Select style={{ width: 200 }} placeholder="请选择业务类型" allowClear>
|
||||
{messageTypeOptions.map(opt => (
|
||||
<Select.Option key={opt.value} value={opt.value}>{opt.label}</Select.Option>
|
||||
{categoryOptions.map(opt => (
|
||||
<Select.Option key={opt.code} value={opt.code}>{opt.dicName}</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
@ -140,7 +149,6 @@ const SupplierMessage: React.FC = () => {
|
||||
showSizeChanger: true,
|
||||
}}
|
||||
onChange={handleTableChange}
|
||||
bordered
|
||||
/>
|
||||
|
||||
<Modal
|
||||
|
Reference in New Issue
Block a user