diff --git a/src/components/GlobalModal/components/AccessCategoryTable.tsx b/src/components/GlobalModal/components/AccessCategoryTable.tsx index 9f9db2d..2608874 100644 --- a/src/components/GlobalModal/components/AccessCategoryTable.tsx +++ b/src/components/GlobalModal/components/AccessCategoryTable.tsx @@ -9,25 +9,13 @@ const AccessCategoryTable = ({id}:{id:string}) => { const columns = [ { title: '准入单位', - dataIndex: 'deptId', - key: 'deptId', + dataIndex: 'deptName', + key: 'deptName', }, { title: '准入品类', - dataIndex: 'categoryNames', - key: 'categoryNames', - render: (_: any, record: any) => { - console.log(record.categoryNames); - const arr = record.categoryNames ? record.categoryNames.split(',') : []; - - return arr.length - ? arr.map((item: string, idx: number) => ( -
- {item} -
- )) - : ''; - }, + dataIndex: 'categoryName', + key: 'categoryName', }, { title: '准入时间', diff --git a/src/components/SupplierDetailModalContext/SupplierDetailModalContext.tsx b/src/components/SupplierDetailModalContext/SupplierDetailModalContext.tsx index 5c2eb57..dbb5c1b 100644 --- a/src/components/SupplierDetailModalContext/SupplierDetailModalContext.tsx +++ b/src/components/SupplierDetailModalContext/SupplierDetailModalContext.tsx @@ -18,7 +18,7 @@ export const SupplierDetailModalProvider = ({ children }: { children: React.Reac return ( {children} - setVisible(false)} footer={null} width="90%" title={ + setVisible(false)} footer={null} width="90%" title={
{intl.formatMessage({ id: 'component.globalModal.title' })}
diff --git a/src/pages/supplier/backend/cooperateEnterprise/index.tsx b/src/pages/supplier/backend/cooperateEnterprise/index.tsx index 3da0e77..431b546 100644 --- a/src/pages/supplier/backend/cooperateEnterprise/index.tsx +++ b/src/pages/supplier/backend/cooperateEnterprise/index.tsx @@ -80,25 +80,13 @@ const CooperateEnterprise: React.FC = () => { }, { title: '准入单位', - dataIndex: 'deptId', - key: 'deptId', + dataIndex: 'deptName', + key: 'deptName', }, { title: '准入品类', - dataIndex: 'categoryNames', - key: 'categoryNames', - render: (_: any, record: any) => { - console.log(record.categoryNames); - const arr = record.categoryNames ? record.categoryNames.split(',') : []; - - return arr.length - ? arr.map((item: string, idx: number) => ( -
- {item} -
- )) - : ''; - }, + dataIndex: 'categoryName', + key: 'categoryName', }, { title: '准入时间', diff --git a/src/pages/supplier/supplierBlacklist/blacklistManage/components/CreateBlacklistModal.tsx b/src/pages/supplier/supplierBlacklist/blacklistManage/components/CreateBlacklistModal.tsx index 3abf48d..ad4cdcd 100644 --- a/src/pages/supplier/supplierBlacklist/blacklistManage/components/CreateBlacklistModal.tsx +++ b/src/pages/supplier/supplierBlacklist/blacklistManage/components/CreateBlacklistModal.tsx @@ -1,19 +1,25 @@ import React, { useEffect , useState } from "react"; import { Modal, Button, Select, Input, Table, message, Form, Tooltip } from "antd"; -import SupplierSelectModal from "./SupplierSelectModal"; -import { blacklist, getAllList } from "../services"; import type { ColumnsType } from 'antd/es/table'; +//组件 +import SupplierSelectModal from "./SupplierSelectModal"; +import { useSupplierDetailModal } from '@/components/SupplierDetailModalContext/SupplierDetailModalContext'; +//接口 +import { blacklist, getAllList } from "../services"; + + const { Option } = Select; interface Supplier { - id: number; // 作为 rowKey 用于唯一标识 + id: string; // 作为 rowKey 用于唯一标识 supplierName: string; // 供应商名称 unit: string; // 准入部门 accessTime: string; // 准入时间 categoryName: string; // 准入品类 - lastEval: string; // 最近一次评价 - lastEvalDate: string; // 评价时间 supplierId: string; categoryId: string; + supplierType: string; + nameEn: string; + name: string; } interface CreateBlacklistModalProps { @@ -27,12 +33,13 @@ const CreateBlacklistModal: React.FC = ({ onOk, onCancel, }) => { + const [form] = Form.useForm(); const [selectVisible, setSelectVisible] = useState(false); const [suppliers, setSuppliers] = useState([]); const [timelimitOption, setTimelimitOption] = useState([]); - const [form] = Form.useForm(); + const supplierDetailModal = useSupplierDetailModal(); - const removeSupplier = (id: number) => { + const removeSupplier = (id: string) => { setSuppliers(suppliers.filter((s) => s.id !== id)); }; @@ -79,25 +86,21 @@ const CreateBlacklistModal: React.FC = ({ setTimelimitOption(data) } }) - - setSuppliers([]); form.resetFields(); } }, [visible]); const columns: ColumnsType = [ - { title: '供应商名称', dataIndex: 'name', ellipsis: true, width: 160, render: (_: any, record: any) => { + { title: '供应商名称', dataIndex: 'name', ellipsis: true, width: 160, render: (_: any, record: Supplier) => { const name = record.supplierType === "ovs"? record.nameEn : record.name; return( - {name} + supplierDetailModal?.(record.id)}>{name} ) } }, { title: "准入部门", dataIndex: "unit", align: "center" }, - { title: "准入时间", dataIndex: "accessTime", align: "center", render: () => "2023-04-20 13:00" }, + { title: "准入时间", dataIndex: "accessTime", align: "center" }, { title: "准入品类", dataIndex: "categoryName", align: "center" }, - { title: "最近一次评价", dataIndex: "lastEval", align: "center" }, - { title: "评价时间", dataIndex: "lastEvalDate", align: "center" }, { title: "操作", dataIndex: "option", diff --git a/src/pages/supplier/supplierBlacklist/blacklistManage/components/SupplierSelectModal.tsx b/src/pages/supplier/supplierBlacklist/blacklistManage/components/SupplierSelectModal.tsx index ae3a228..b95ab1a 100644 --- a/src/pages/supplier/supplierBlacklist/blacklistManage/components/SupplierSelectModal.tsx +++ b/src/pages/supplier/supplierBlacklist/blacklistManage/components/SupplierSelectModal.tsx @@ -1,23 +1,24 @@ import React, { useEffect, useState } from "react"; import { - Modal, Table, Button, Checkbox, Row, Col, Input, Select, Form, Space, message, Tooltip + Modal, Table, Button, Checkbox, Row, Col, Input, Form, Space, message, Tooltip } from "antd"; +//接口 import { getSupplierCategoryPage } from '../services'; +//组件 import CategorySelector from '@/components/CategorySelector'; -const { Option } = Select; +import { useSupplierDetailModal } from '@/components/SupplierDetailModalContext/SupplierDetailModalContext'; interface Supplier { - id: number; + id: string; supplierId: string; categoryId: string; supplierName: string; - unit: string; // 准入部门 accessTime: string; // 准入时间 categoryName: string; // 准入品类 - lastEval: string; // 最近一次评价 - lastEvalDate: string; // 评价时间 - + supplierType: string; + nameEn: string; + name: string; } interface SupplierSelectModalProps { @@ -35,12 +36,13 @@ const SupplierSelectModal: React.FC = ({ onCancel, }) => { const [form] = Form.useForm(); - const [leftSelected, setLeftSelected] = useState([]); - const [rightSelected, setRightSelected] = useState([]); + const [leftSelected, setLeftSelected] = useState([]); + const [rightSelected, setRightSelected] = useState([]); const [rightData, setRightData] = useState([]); const [data, setData] = useState([]); const [pagination, setPagination] = useState({ current: 1, pageSize: 5, total: 0 }); const [loading, setLoading] = useState(false); + const supplierDetailModal = useSupplierDetailModal(); useEffect(() => { if (visible) { @@ -114,11 +116,11 @@ const SupplierSelectModal: React.FC = ({ > ) }, - { title: '供应商名称', dataIndex: 'name', ellipsis: true, width: 160, render: (_: any, record: any) => { + { title: '供应商名称', dataIndex: 'name', ellipsis: true, width: 160, render: (_: any, record: Supplier) => { const name = record.supplierType === "ovs"? record.nameEn : record.name; return( - {name} + supplierDetailModal?.(record.id)}>{name} ) } }, { title: "准入品类", dataIndex: "categoryName", ellipsis: true, width: 100, render: (_: any, record: any) => { @@ -179,22 +181,12 @@ const SupplierSelectModal: React.FC = ({ bodyStyle={{ padding: 24 }} >
- - - - - - @@ -205,7 +197,7 @@ const SupplierSelectModal: React.FC = ({ -
备选供应商
+
备选供应商
= ({ -
已选供应商
+
已选供应商
{ ))} - -