diff --git a/src/components/AccessDepartmentSelect/index.tsx b/src/components/AccessDepartmentSelect/index.tsx index 682ec26..b3cfbdc 100644 --- a/src/components/AccessDepartmentSelect/index.tsx +++ b/src/components/AccessDepartmentSelect/index.tsx @@ -46,7 +46,7 @@ const AccessDepartmentSelect: React.FC = ({ disabled={disabled} treeData={buildTree(userOrgAll)} allowClear - style={{ width: '100%' }} + style={{ width: '160px' }} showSearch /> ); diff --git a/src/pages/supplier/supplierBlacklist/blacklistManage/components/ViewBlacklistModal.tsx b/src/pages/supplier/supplierBlacklist/blacklistManage/components/ViewBlacklistModal.tsx index 6fe0752..c7751c7 100644 --- a/src/pages/supplier/supplierBlacklist/blacklistManage/components/ViewBlacklistModal.tsx +++ b/src/pages/supplier/supplierBlacklist/blacklistManage/components/ViewBlacklistModal.tsx @@ -66,10 +66,10 @@ const ViewBlacklistModal: React.FC = ({ const columns:ColumnsType = [ { title: "供应商名称", dataIndex: "supplierName", align: "center" }, { title: "准入部门", dataIndex: "deptName", align: "center" }, - { title: "准入时间", dataIndex: "createTime", align: "center" }, + { title: "准入时间", dataIndex: "evaluateTime", align: "center" }, { title: "准入品类", dataIndex: "categoryName", align: "center" }, - { title: "最近一次评价", dataIndex: "lastEval", align: "center" }, - { title: "评价时间", dataIndex: "lastEvalDate", align: "center" }, + // { title: "最近一次评价", dataIndex: "lastEval", align: "center" }, + // { title: "评价时间", dataIndex: "lastEvalDate", align: "center" }, ]; return ( diff --git a/src/pages/supplier/supplierExit/supplierExitAudit/components/ViewBlacklistModal.tsx b/src/pages/supplier/supplierExit/supplierExitAudit/components/ViewBlacklistModal.tsx index 33e451a..5ef97ff 100644 --- a/src/pages/supplier/supplierExit/supplierExitAudit/components/ViewBlacklistModal.tsx +++ b/src/pages/supplier/supplierExit/supplierExitAudit/components/ViewBlacklistModal.tsx @@ -1,25 +1,26 @@ import React, { useEffect, useState } from "react"; -import { Modal, Button, Table, Descriptions, Spin, message, Tooltip } from "antd"; -import {coscoSupplierexit } from "../services"; +import { Modal, Button, Table, Form, Input, Tooltip, DatePicker } from "antd"; import type { ColumnsType } from 'antd/es/table'; +import { SearchOutlined, DeleteOutlined } from "@ant-design/icons"; +//umi 相关 +import { connect } from 'umi'; +import moment from 'moment'; +import AccessDepartmentSelect from "@/components/AccessDepartmentSelect" +//接口 +import { getExitInfoPage } from "../services"; import { useSupplierDetailModal } from '@/components/SupplierDetailModalContext/SupplierDetailModalContext'; - +//统一列表分页 +import tableProps from '@/utils/tableProps' interface Supplier { - id: number; // 作为 rowKey 用于唯一标识 - supplierName: string; // 供应商名称 - unit: string; // 准入部门 - accessTime: string; // 准入时间 - categoryName: string; // 准入品类 - lastEval: string; // 最近一次评价 - lastEvalDate: string; // 评价时间 - supplierId: string; - categoryId: string; - } -interface DetailData { - exitTheme: string; - deptName: string; - deptId: string; - exitReason: string; + id: string; // 作为 rowKey 用于唯一标识 + supplierName: string; // 供应商名称 + unit: string; // 准入部门 + accessTime: string; // 准入时间 + categoryName: string; // 准入品类 + lastEval: string; // 最近一次评价 + lastEvalDate: string; // 评价时间 + supplierId: string; + categoryId: string; } interface ViewBlacklistModalProps { @@ -34,38 +35,50 @@ const ViewBlacklistModal: React.FC = ({ recordId, }) => { const [loading, setLoading] = useState(false); - const [detail, setDetail] = useState(null); - const [suppliers, setSuppliers] = useState([]); - const supplierDetailModal = useSupplierDetailModal(); - const fetchData = async () => { - setLoading(true); - try { - const { code, data } = await coscoSupplierexit(recordId) - if (code == 200) { - setDetail(data.coscoSupplierexit); - } else { - message.error("获取详情失败"); - } - if (code == 200) { - setSuppliers(data.coscoSupplierexitSupplierCategoryList || []); - } else { - message.error("获取供应商列表失败"); - } - } catch (error) { - message.error("获取数据异常"); - } finally { - setLoading(false); + const [form] = Form.useForm(); + const [data, setData] = useState([]); + const [pagination, setPagination] = useState({ current: 1, pageSize: 10, total: 0 }); + + const supplierDetailModal = useSupplierDetailModal(); + + // 查询接口 + const getList = async (pageNo = 1, pageSize = 10) => { + setLoading(true); + // 可传查询条件 form.getFieldsValue() + + const values = form.getFieldsValue(); + const { exitTheme, time, deptId } = 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 getExitInfoPage({ supplierexitId: recordId, pageNo, pageSize, exitTheme, deptId, 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 }); + getList(1, pagination.pageSize); + }; + // 重置 + const handleReset = () => { + form.resetFields(); + setPagination({ ...pagination, current: 1 }); + getList(1, pagination.pageSize); }; useEffect(() => { if (visible && recordId) { - fetchData(); + getList(); } }, [visible, recordId]); - const columns:ColumnsType = [ + const columns: ColumnsType = [ { title: "供应商名称", dataIndex: "supplierName", align: "left", width: 360, @@ -78,8 +91,10 @@ const ViewBlacklistModal: React.FC = ({ ) } }, - { title: "准入部门", dataIndex: "deptId", align: "center", width: 160 }, - { title: "退出品类", dataIndex: "categoryName", align: "center", width: 160 }, + { title: "发起单位", dataIndex: "orgName", align: "center", ellipsis: true, width: 160 }, + { title: "发起部门", dataIndex: "deptName", align: "center", ellipsis: true, width: 160 }, + { title: "退出品类", dataIndex: "categoryName", align: "center", ellipsis: true, width: 160 }, + { title: "退出时间", dataIndex: "createTime", align: "center", width: 180 }, ]; return ( @@ -87,37 +102,44 @@ const ViewBlacklistModal: React.FC = ({ title="供应商退出详情" visible={visible} onCancel={onCancel} - width={900} + width='80%' footer={} destroyOnClose bodyStyle={{ padding: "36px 36px 16px" }} > - - {detail && ( - - {detail.exitTheme} - {detail.deptId} - {detail.exitReason} - - )} +
+
+ + + + + + + + + + + + + + + +
+
- - +
); }; -export default ViewBlacklistModal; +export default connect()(ViewBlacklistModal); diff --git a/src/pages/supplier/supplierExit/supplierExitAudit/services.ts b/src/pages/supplier/supplierExit/supplierExitAudit/services.ts index d793483..284f077 100644 --- a/src/pages/supplier/supplierExit/supplierExitAudit/services.ts +++ b/src/pages/supplier/supplierExit/supplierExitAudit/services.ts @@ -16,6 +16,25 @@ interface getPageData { endTime?: string; } export const getPage = (data: getPageData) => request.post('/coscoSupplierexit/getPage', { data }); + +/** + * + */ +interface getExitInfoPageData { + pageNo: number; + pageSize: number; + supplierexitId?: string; + deptId?: string; + accessType?: string; + reviewStatus?: string; + approveStatus?: string; + categoryId?: string; + exitTheme?: string; + startTime?: string; + endTime?: string; +} +export const getExitInfoPage = (data: getExitInfoPageData) => request.post('/coscoSupplierexit/getExitInfoPage', { data }); + /** * 供应商分页列表查询 */ diff --git a/src/pages/supplier/supplierExit/supplierExitManage/components/SupplierSelectModal.tsx b/src/pages/supplier/supplierExit/supplierExitManage/components/SupplierSelectModal.tsx index ac15ad2..18cf8b8 100644 --- a/src/pages/supplier/supplierExit/supplierExitManage/components/SupplierSelectModal.tsx +++ b/src/pages/supplier/supplierExit/supplierExitManage/components/SupplierSelectModal.tsx @@ -12,11 +12,15 @@ import { useSupplierDetailModal } from '@/components/SupplierDetailModalContext/ interface Supplier { - id: number; + id: number; // 作为 rowKey 用于唯一标识 + supplierName: string; // 供应商名称 + unit: string; // 准入部门 + accessTime: string; // 准入时间 + categoryName: string; // 准入品类 + lastEval: string; // 最近一次评价 + lastEvalDate: string; // 评价时间 supplierId: string; categoryId: string; - supplierName: string; - categoryName: string; // 准入品类 } interface SupplierSelectModalProps { diff --git a/src/pages/supplier/supplierExit/supplierExitManage/components/ViewBlacklistModal.tsx b/src/pages/supplier/supplierExit/supplierExitManage/components/ViewBlacklistModal.tsx index 38affe7..5ef97ff 100644 --- a/src/pages/supplier/supplierExit/supplierExitManage/components/ViewBlacklistModal.tsx +++ b/src/pages/supplier/supplierExit/supplierExitManage/components/ViewBlacklistModal.tsx @@ -1,12 +1,16 @@ import React, { useEffect, useState } from "react"; -import { Modal, Button, Table, Descriptions, Spin, message, Tooltip } from "antd"; +import { Modal, Button, Table, Form, Input, Tooltip, DatePicker } from "antd"; import type { ColumnsType } from 'antd/es/table'; +import { SearchOutlined, DeleteOutlined } from "@ant-design/icons"; //umi 相关 import { connect } from 'umi'; +import moment from 'moment'; +import AccessDepartmentSelect from "@/components/AccessDepartmentSelect" //接口 -import { coscoSupplierexit } from "../services"; +import { getExitInfoPage } from "../services"; import { useSupplierDetailModal } from '@/components/SupplierDetailModalContext/SupplierDetailModalContext'; - +//统一列表分页 +import tableProps from '@/utils/tableProps' interface Supplier { id: string; // 作为 rowKey 用于唯一标识 supplierName: string; // 供应商名称 @@ -18,12 +22,6 @@ interface Supplier { supplierId: string; categoryId: string; } -interface DetailData { - exitTheme: string; - deptName: string; - deptId: string; - exitReason: string; -} interface ViewBlacklistModalProps { visible: boolean; @@ -37,34 +35,46 @@ const ViewBlacklistModal: React.FC = ({ recordId, }) => { const [loading, setLoading] = useState(false); - const [detail, setDetail] = useState(null); - const [suppliers, setSuppliers] = useState([]); - const supplierDetailModal = useSupplierDetailModal(); - const fetchData = async () => { - setLoading(true); - try { - const { code, data } = await coscoSupplierexit(recordId) - if (code == 200) { - setDetail(data.coscoSupplierexit); - } else { - message.error("获取详情失败"); - } - if (code == 200) { - setSuppliers(data.coscoSupplierexitSupplierCategoryList || []); - } else { - message.error("获取供应商列表失败"); - } - } catch (error) { - message.error("获取数据异常"); - } finally { - setLoading(false); + const [form] = Form.useForm(); + const [data, setData] = useState([]); + const [pagination, setPagination] = useState({ current: 1, pageSize: 10, total: 0 }); + + const supplierDetailModal = useSupplierDetailModal(); + + // 查询接口 + const getList = async (pageNo = 1, pageSize = 10) => { + setLoading(true); + // 可传查询条件 form.getFieldsValue() + + const values = form.getFieldsValue(); + const { exitTheme, time, deptId } = 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 getExitInfoPage({ supplierexitId: recordId, pageNo, pageSize, exitTheme, deptId, 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 }); + getList(1, pagination.pageSize); + }; + // 重置 + const handleReset = () => { + form.resetFields(); + setPagination({ ...pagination, current: 1 }); + getList(1, pagination.pageSize); }; useEffect(() => { if (visible && recordId) { - fetchData(); + getList(); } }, [visible, recordId]); @@ -81,8 +91,10 @@ const ViewBlacklistModal: React.FC = ({ ) } }, - { title: "准入部门", dataIndex: "deptId", align: "center", width: 160 }, - { title: "退出品类", dataIndex: "categoryName", align: "center", width: 160 }, + { title: "发起单位", dataIndex: "orgName", align: "center", ellipsis: true, width: 160 }, + { title: "发起部门", dataIndex: "deptName", align: "center", ellipsis: true, width: 160 }, + { title: "退出品类", dataIndex: "categoryName", align: "center", ellipsis: true, width: 160 }, + { title: "退出时间", dataIndex: "createTime", align: "center", width: 180 }, ]; return ( @@ -95,30 +107,37 @@ const ViewBlacklistModal: React.FC = ({ destroyOnClose bodyStyle={{ padding: "36px 36px 16px" }} > - - {detail && ( - - {detail.exitTheme} - {detail.deptId} - {detail.exitReason} - - )} +
+
+ + + + + + + + + + + + + + + + +
-
- +
); }; diff --git a/src/pages/supplier/supplierExit/supplierExitManage/services.ts b/src/pages/supplier/supplierExit/supplierExitManage/services.ts index b0ca016..304d60e 100644 --- a/src/pages/supplier/supplierExit/supplierExitManage/services.ts +++ b/src/pages/supplier/supplierExit/supplierExitManage/services.ts @@ -17,6 +17,24 @@ interface getPageData { } export const getPage = (data: getPageData) => request.post('/coscoSupplierexit/getPage', { data }); +/** + * + */ +interface getExitInfoPageData { + pageNo: number; + pageSize: number; + supplierexitId?: string; + deptId?: string; + accessType?: string; + reviewStatus?: string; + approveStatus?: string; + categoryId?: string; + exitTheme?: string; + startTime?: string; + endTime?: string; +} +export const getExitInfoPage = (data: getExitInfoPageData) => request.post('/coscoSupplierexit/getExitInfoPage', { data }); + /** * 供应商分页列表查询 */