diff --git a/src/components/GlobalModal/components/AccessCategoryTable.tsx b/src/components/GlobalModal/components/AccessCategoryTable.tsx index 2608874..16e1214 100644 --- a/src/components/GlobalModal/components/AccessCategoryTable.tsx +++ b/src/components/GlobalModal/components/AccessCategoryTable.tsx @@ -2,8 +2,22 @@ import React, { useEffect, useState } from 'react'; import { Table, Tabs, message } from 'antd'; import { useIntl } from 'umi'; import { getCategoryPage, supplierIdPage } from '../services'; -const { TabPane } = Tabs; +// 类型定义 +import type { ColumnsType } from 'antd/es/table'; +//统一列表分页 +import tableProps from '@/utils/tableProps' +const { TabPane } = Tabs; +interface Data { + id: number; + storeName: string; + category: string; + region: string; + unit: string; + owner: string; + validTo: string; + supplierCount: number; +} const AccessCategoryTable = ({id}:{id:string}) => { const intl = useIntl(); const columns = [ @@ -33,28 +47,64 @@ const AccessCategoryTable = ({id}:{id:string}) => { key: 'exitReason', ellipsis: true, width: 120, + } + ] + //品类 + const categoryColumns: ColumnsType = [ + { + title: '品类库名称', + dataIndex: 'name', + key: 'name', + align: 'center', + ellipsis: true, + }, + { + title: '品类', + dataIndex: 'categoryNames', + key: 'categoryNames', + align: 'center', + width: 100, + ellipsis: true, + }, + { + title: '区域', + dataIndex: 'area', + key: 'area', + align: 'center', + ellipsis: true, + }, + { + title: '创建单位', + dataIndex: 'deptName', + key: 'deptName', + align: 'center', + ellipsis: true, + }, + { + title: '负责人', + dataIndex: 'createName', + key: 'createName', + align: 'center', + }, + { + title: '有效期至', + dataIndex: 'termOfValidity', + key: 'termOfValidity', + align: 'center', + ellipsis: true, }, - - - - - - - - - - - ] //Tabs切换key const [activeKey, setActiveKey] = useState<'access' | 'category'>('access'); + //准入品类 const [accessData, setAccessData] = useState([]); //分页 const [accessPagination, setAccessPagination] = useState({ current: 1, pageSize: 10, total: 0 }); //加载 const [accessLoading, setAccessLoading] = useState(false); + //品类库 const [categoryData, setCategoryData] = useState([]); //分页 @@ -81,7 +131,7 @@ const AccessCategoryTable = ({id}:{id:string}) => { const fetchCategoryData = async (current: number, pageSize: number) => { setCategoryLoading(true); try { - const { code, data } = await supplierIdPage({ basePageRequest: { pageNo: current, pageSize } , supplierId: '1935547019799363584' }); + const { code, data } = await supplierIdPage({ basePageRequest: { pageNo: current, pageSize } , supplierId: id }); if (code === 200) { setCategoryData(data.records); setCategoryPagination({ current, pageSize, total: data.total }); @@ -108,29 +158,42 @@ const AccessCategoryTable = ({id}:{id:string}) => { columns={columns} rowKey="code" loading={accessLoading} - pagination={{ - current: accessPagination.current, - pageSize: accessPagination.pageSize, - total: accessPagination.total, - showSizeChanger: true, - onChange: (page, pageSize = 10) => fetchAccessData(page, pageSize), + // pagination={{ + // current: accessPagination.current, + // pageSize: accessPagination.pageSize, + // total: accessPagination.total, + // showSizeChanger: true, + // onChange: (page, pageSize = 10) => fetchAccessData(page, pageSize), + // }} + pagination={{...tableProps.pagination, total: accessPagination.total }} + onChange={(pagination) => { + fetchCategoryData( pagination.current!, pagination.pageSize!) }} + style={{ flex: 1, minHeight: 0 }} + scroll={{ y: 'calc(100vh - 350px)' }} /> fetchCategoryData(page, pageSize), + // pagination={{ + // current: categoryPagination.current, + // pageSize: categoryPagination.pageSize, + // total: categoryPagination.total, + // showSizeChanger: true, + // onChange: (page, pageSize = 10) => fetchCategoryData(page, pageSize), + // }} + + pagination={{...tableProps.pagination, total: categoryPagination.total }} + onChange={(pagination) => { + fetchCategoryData( pagination.current!, pagination.pageSize!) }} + style={{ flex: 1, minHeight: 0 }} + scroll={{ y: 'calc(100vh - 350px)' }} /> diff --git a/src/components/GlobalModal/services.ts b/src/components/GlobalModal/services.ts index 5d5d0a5..1ea9be3 100644 --- a/src/components/GlobalModal/services.ts +++ b/src/components/GlobalModal/services.ts @@ -46,5 +46,4 @@ interface basePageRequests { pageNo: number; pageSize: number; } -export const supplierIdPage = (data: supplierIdPage) => request.post('/cosco/library/supplierIdPage', { data }); - \ No newline at end of file +export const supplierIdPage = (data: supplierIdPage) => request.post('/cosco/library/supplierIdPage', { data }); \ No newline at end of file diff --git a/src/pages/supplier/admission/admissionReviewManagement/index.tsx b/src/pages/supplier/admission/admissionReviewManagement/index.tsx index a6c1f96..8176793 100644 --- a/src/pages/supplier/admission/admissionReviewManagement/index.tsx +++ b/src/pages/supplier/admission/admissionReviewManagement/index.tsx @@ -18,6 +18,7 @@ interface Data { createTime: string; exitTime: string; exitReason: string; + categoryNameList: string[] } interface ModalInfo { @@ -116,7 +117,7 @@ const CooperateEnterprise: React.FC = () => { dataIndex: 'categoryNameList', align: 'center', width: 160, - render: (_: any, record: any) => { + render: (_: any, record: Data) => { return ( <> {record.categoryNameList && record.categoryNameList.map((item: string) => { diff --git a/src/pages/supplier/informationRetrieval/groupQualifiedSupplierQuery/index.tsx b/src/pages/supplier/informationRetrieval/groupQualifiedSupplierQuery/index.tsx index 19eb002..c5af0b8 100644 --- a/src/pages/supplier/informationRetrieval/groupQualifiedSupplierQuery/index.tsx +++ b/src/pages/supplier/informationRetrieval/groupQualifiedSupplierQuery/index.tsx @@ -10,6 +10,8 @@ import tableProps from '@/utils/tableProps'; import RegionTypeSelect from '@/components/CommonSelect/RegionTypeSelect' import SupplierViewModal from './components/SupplierViewModal'; import SupplierDetailModal from './components/SupplierDetailModal'; +import { downloadFile } from '@/utils/download'; + interface Data { id: number; @@ -62,6 +64,7 @@ const groupQualifiedSupplierQuery: React.FC = ({ dispatch }) => { const [dataTree, setDataTree] = useState([]); const [treeSelected, setTreeSelected] = useState([]); const [selectedKeys, setSelectedKeys] = useState(''); + const [DeptId, setDeptId] = useState(''); const [data, setData] = useState([]); const [loading, setLoading] = useState(false); const [treeLoading, setTreeLoading] = useState(false); @@ -110,6 +113,7 @@ const groupQualifiedSupplierQuery: React.FC = ({ dispatch }) => { const getList = async (deptId: string, pageNo: number = 1, pageSize: number = 10) => { setLoading(true); try { + setDeptId(deptId) const values = form.getFieldsValue(); const { code, data, message } = await getPageQualified({ pageNo, pageSize, deptId, ...values }); if (code === 200) { @@ -175,8 +179,8 @@ const groupQualifiedSupplierQuery: React.FC = ({ dispatch }) => { }, { title: '统一社会信用代码/税号', - dataIndex: 'socialCreditCode', - key: 'socialCreditCode', + dataIndex: 'unifiedCode', + key: 'unifiedCode', align: 'center', ellipsis: true, }, @@ -244,7 +248,12 @@ const groupQualifiedSupplierQuery: React.FC = ({ dispatch }) => { diff --git a/src/pages/supplier/informationRetrieval/mySupplierInquiry/index.tsx b/src/pages/supplier/informationRetrieval/mySupplierInquiry/index.tsx index 3358389..f9bc130 100644 --- a/src/pages/supplier/informationRetrieval/mySupplierInquiry/index.tsx +++ b/src/pages/supplier/informationRetrieval/mySupplierInquiry/index.tsx @@ -1,19 +1,20 @@ import React, { useEffect, useState } from "react"; //第三方UI库/组件 -import { Form, Button, Table, Select, Input, Space, Tooltip } from 'antd'; +import { Form, Button, Table, Input, Space, Tooltip } from 'antd'; import { SearchOutlined, DeleteOutlined } 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 SupplierViewModal from './components/SupplierViewModal'; +// import SupplierDetailModal from './components/SupplierDetailModal'; import CategorySelector from '@/components/CategorySelector'; import RegionTypeSelect from '@/components/CommonSelect/RegionTypeSelect' import AccessStatusSelect from '@/components/CommonSelect/AccessStatusSelect' //本地服务/接口 import { getPageMy } from './services'; +import { downloadFile } from '@/utils/download'; //统一列表分页 import tableProps from '@/utils/tableProps' @@ -38,18 +39,16 @@ const mySupplierInquiry: React.FC = ({ dispatch }) => { const [loading, setLoading] = useState(false); //分页 const [pagination, setPagination] = useState({ current: 1, pageSize: 10, total: 0 }); - //查看是否显示状态 - const [viewVisible, setViewVisible] = useState(false); - //准入明细是否显示状态 - const [detailVisible, setDetailVisible] = useState(false); - //查看、准入明细 参数传递 - const [currentRecord, setCurrentRecord] = useState(''); + // //查看是否显示状态 + // const [viewVisible, setViewVisible] = useState(false); + // //准入明细是否显示状态 + // const [detailVisible, setDetailVisible] = useState(false); + // //查看、准入明细 参数传递 + // const [currentRecord, setCurrentRecord] = useState(''); // 导出 const handleExport = async () => { - window.open( - `${SERVER_BASE}/coscoSupplierBase/getPageMyExport`, - '_blank', - ); + const values = form.getFieldsValue(); + downloadFile('/coscoSupplierBase/getPageMyExport', 'GET', values); }; // 查询 const handleSearch = () => { @@ -160,7 +159,7 @@ const mySupplierInquiry: React.FC = ({ dispatch }) => { render: (record: any) => ( { + onClick={() => { dispatch({ type: 'globalModal/show', payload: { @@ -193,7 +192,7 @@ const mySupplierInquiry: React.FC = ({ dispatch }) => { - + @@ -218,24 +217,24 @@ const mySupplierInquiry: React.FC = ({ dispatch }) => { columns={columns} dataSource={data} loading={loading} - pagination={{...tableProps.pagination, total: pagination.total }} + pagination={{ ...tableProps.pagination, total: pagination.total }} onChange={(pagination) => getList(pagination.current!, pagination.pageSize!)} style={{ flex: 1, minHeight: 0 }} scroll={{ y: 'calc(100vh - 350px)' }} /> - {/* 查看组件 */} + {/* 查看组件 setViewVisible(false)} - /> - {/* 准入明细组件 */} + />*/} + {/* 准入明细组件 setDetailVisible(false)} - /> + />*/} ); diff --git a/src/pages/supplier/informationRetrieval/personQualifiedSupplierQuery/index.tsx b/src/pages/supplier/informationRetrieval/personQualifiedSupplierQuery/index.tsx index f5fb340..89b44c9 100644 --- a/src/pages/supplier/informationRetrieval/personQualifiedSupplierQuery/index.tsx +++ b/src/pages/supplier/informationRetrieval/personQualifiedSupplierQuery/index.tsx @@ -7,8 +7,9 @@ import SupplierViewModal from './components/SupplierViewModal'; import SupplierDetailModal from './components/SupplierDetailModal'; import { treeData, getPagePe } from './services'; import tableProps from '@/utils/tableProps' +import { downloadFile } from '@/utils/download'; -type OptionType = { label: string; value: string }; +// type OptionType = { label: string; value: string }; interface Data { id: number; name: string; @@ -64,6 +65,7 @@ const PersonQualifiedSupplierQuery: React.FC = ({ dispatch }) => { const [dataTree, setDataTree] = useState([]); const [treeSelected, setTreeSelected] = useState([]); const [selectedKeys, setSelectedKeys] = useState(''); + const [DeptId, setDeptId] = useState(''); const [data, setData] = useState([]); const [loading, setLoading] = useState(false); const [treeLoading, setTreeLoading] = useState(false); @@ -85,7 +87,7 @@ const PersonQualifiedSupplierQuery: React.FC = ({ dispatch }) => { const handleTreeSelect = (keys: React.Key[]) => { const key = keys[0] as string; - if(key) { + if (key) { setSelectedKeys(key); setTreeSelected([key]); getList(key); @@ -108,11 +110,12 @@ const PersonQualifiedSupplierQuery: React.FC = ({ dispatch }) => { } }; - const getList = async (treeId: string, pageNo: number = 1, pageSize: number = 10) => { + const getList = async (deptId: string, pageNo: number = 1, pageSize: number = 10) => { setLoading(true); try { + setDeptId(deptId) const values = form.getFieldsValue(); - const { code, data, message } = await getPagePe({ pageNo, pageSize, treeId, ...values }); + const { code, data, message } = await getPagePe({ pageNo, pageSize, deptId, ...values }); if (code === 200) { setData(data.records); setPagination({ current: pageNo, pageSize, total: data.total }); @@ -173,8 +176,8 @@ const PersonQualifiedSupplierQuery: React.FC = ({ dispatch }) => { }, { title: '身份证号', dataIndex: 'idCard', key: 'idCard', align: 'center', ellipsis: true }, { title: '联系电话', dataIndex: 'personPhone', key: 'personPhone', align: 'center', ellipsis: true }, - { title: '准入单位', dataIndex: 'type', key: 'type', align: 'center' }, - { title: '创建部门', dataIndex: 'regTime', key: 'regTime', align: 'center' }, + { title: '准入单位', dataIndex: 'orgName', key: 'orgName', align: 'center' }, + { title: '创建部门', dataIndex: 'deptName', key: 'deptName', align: 'center' }, { title: '创建时间', dataIndex: 'createTime', key: 'createTime', align: 'center', ellipsis: true }, { title: '操作', @@ -183,14 +186,14 @@ const PersonQualifiedSupplierQuery: React.FC = ({ dispatch }) => { width: 140, render: (record: any) => ( - { - dispatch({ + { + dispatch({ type: 'globalModal/show', payload: { id: record.id, }, }); - }}>查看 + }}>查看 {/* { setCurrentRecord(record.id); setDetailVisible(true); }}>准入明细 */} ), @@ -220,7 +223,9 @@ const PersonQualifiedSupplierQuery: React.FC = ({ dispatch }) => { diff --git a/src/utils/download.ts b/src/utils/download.ts index 7852eda..95e64bb 100644 --- a/src/utils/download.ts +++ b/src/utils/download.ts @@ -22,13 +22,19 @@ export async function downloadFile( ? `${REQUEST_BASE}${url}?${new URLSearchParams(cleanedParams as any).toString()}` : `${REQUEST_BASE}${url}`; + const token = sessionStorage.getItem('token'); + const userId = sessionStorage.getItem('userId'); + const response = await fetch(fetchUrl, { method, headers: { 'Content-Type': 'application/json', + ...(token ? { Authorization: `Bearer ${token}` } : {}), + ...(userId ? { Mall3Check: `${userId}` } : {}), }, body: method === 'POST' ? JSON.stringify(params) : undefined, credentials: 'include', + }); const contentType = response.headers.get('content-type') || '';