供应商名称点击弹出问题

This commit is contained in:
孙景学
2025-07-18 11:32:41 +08:00
parent 6960d402b2
commit e637f62d86
16 changed files with 123 additions and 37 deletions

View File

@ -1,7 +1,8 @@
import React, { useEffect, useState } from "react";
import { Modal, Button, Table, Descriptions, Spin, message } from "antd";
import { Modal, Button, Table, Descriptions, Spin, message, Tooltip } from "antd";
import {viewBlacklist } from "../services"; // 假设的接口
import type { ColumnsType } from 'antd/es/table';
import { useSupplierDetailModal } from '@/components/SupplierDetailModalContext/SupplierDetailModalContext';
interface Supplier {
id: number; // 作为 rowKey 用于唯一标识
@ -34,6 +35,7 @@ const ViewBlacklistModal: React.FC<ViewBlacklistModalProps> = ({
const [loading, setLoading] = useState(false);
const [detail, setDetail] = useState<DetailData | null>(null);
const [suppliers, setSuppliers] = useState<Supplier[]>([]);
const supplierDetailModal = useSupplierDetailModal();
const fetchData = async () => {
setLoading(true);
@ -64,12 +66,30 @@ const ViewBlacklistModal: React.FC<ViewBlacklistModalProps> = ({
}, [visible, recordId]);
const columns:ColumnsType<Supplier> = [
{ title: "供应商名称", dataIndex: "supplierName", align: "center" },
{
title: "供应商名称", dataIndex: "supplierName", align: "left",
width: 200,
ellipsis: true,
render: (dom, record) => {
return (
<Tooltip title={record.supplierName} overlayStyle={{ zIndex: 1200 }}>
<a onClick={() => supplierDetailModal?.(record.supplierId)}>{record.supplierName || ''}</a>
</Tooltip>
)
}
},
{ title: "准入部门", dataIndex: "deptName", align: "center" },
{ title: "准入时间", dataIndex: "evaluateTime", align: "center" },
{ title: "准入品类", dataIndex: "categoryName", align: "center" },
// { title: "最近一次评价", dataIndex: "lastEval", align: "center" },
// { title: "评价时间", dataIndex: "lastEvalDate", align: "center" },
{ title: "准入品类", dataIndex: "categoryName", align: "center", width: 180,
ellipsis: true,
render: (dom, record) => {
return (
<Tooltip title={record.categoryName} overlayStyle={{ zIndex: 1200 }}>
{record.categoryName}
</Tooltip>
)
} },
];
return (