From 0d3088b8f89611dee059c6d7007d289ae73889d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E6=99=AF=E5=AD=A6?= <5412262+sun_jing_xue@user.noreply.gitee.com> Date: Fri, 18 Jul 2025 10:37:13 +0800 Subject: [PATCH] =?UTF-8?q?=E8=81=94=E7=B3=BB=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/AttachmentsFormModal.tsx | 2 +- .../CompanyInfo/component/BankFormModal.tsx | 8 +- .../component/ContactsInfoFormModal.tsx | 97 ++++++++++++-- .../CompanyInfo/component/ContactsInfoTab.tsx | 34 ++++- .../component/InvoiceFormModal.tsx | 12 +- .../component/QualificationFormModal.tsx | 10 +- src/components/CompanyInfo/services.ts | 5 +- .../GlobalModal/components/ContactsInfo.tsx | 122 ++++++++++++++++++ .../components/SupplierRegisterInfo.tsx | 16 ++- .../GlobalModal/components/TianyanchaInfo.tsx | 26 +++- src/components/GlobalModal/index.tsx | 8 +- src/components/GlobalModal/services.ts | 24 +++- .../components/SupplierAddModal.tsx | 11 +- 13 files changed, 328 insertions(+), 47 deletions(-) create mode 100644 src/components/GlobalModal/components/ContactsInfo.tsx diff --git a/src/components/CompanyInfo/component/AttachmentsFormModal.tsx b/src/components/CompanyInfo/component/AttachmentsFormModal.tsx index 1d8e69a..25407dc 100644 --- a/src/components/CompanyInfo/component/AttachmentsFormModal.tsx +++ b/src/components/CompanyInfo/component/AttachmentsFormModal.tsx @@ -168,7 +168,7 @@ const InvoiceFormModal: React.FC = ({ - + diff --git a/src/components/CompanyInfo/component/BankFormModal.tsx b/src/components/CompanyInfo/component/BankFormModal.tsx index 09b961b..a7aec29 100644 --- a/src/components/CompanyInfo/component/BankFormModal.tsx +++ b/src/components/CompanyInfo/component/BankFormModal.tsx @@ -161,22 +161,22 @@ const InvoiceFormModal: React.FC = ({ - + - + - + - + diff --git a/src/components/CompanyInfo/component/ContactsInfoFormModal.tsx b/src/components/CompanyInfo/component/ContactsInfoFormModal.tsx index f40e040..9af959e 100644 --- a/src/components/CompanyInfo/component/ContactsInfoFormModal.tsx +++ b/src/components/CompanyInfo/component/ContactsInfoFormModal.tsx @@ -1,7 +1,7 @@ import React, { useEffect, useState } from 'react'; -import { Modal, Form, Input, message, Row, Col, Descriptions } from 'antd'; -import { coscoSupplierUserView, coscoSupplierUserAdd, coscoSupplierUserEdit } from '../services'; - +import { Modal, Form, Input, message, Row, Col, Descriptions, Tree } from 'antd'; +//接口 +import { coscoSupplierUserView, coscoSupplierUserAdd, coscoSupplierUserEdit, categoryTree } from '../services'; interface props { visible: boolean; @@ -15,7 +15,10 @@ interface viewDataData { contactsName?: string; contactsPhone?: string; contactsEmail?: string; + categoryName?: string; + categoryNameList?: string[]; } + const InvoiceFormModal: React.FC = ({ visible, onOk, @@ -28,7 +31,10 @@ const InvoiceFormModal: React.FC = ({ const [form] = Form.useForm(); //查看 const [viewData, setViewData] = useState({}); - + //品类选择 + const [checkedKeys, setCheckedKeys] = useState([]); + //品类选择渲染数据 + const [categoriesTreeData, setCategoriesTreeData] = useState([]); useEffect(() => { if (visible) { if (initialValues) { @@ -38,11 +44,6 @@ const InvoiceFormModal: React.FC = ({ const fields = { ...data, id: data.id ? data.id : null, - address: [ - Number(data.nation), - Number(data.province), - Number(data.city), - ] }; console.log(fields); @@ -53,9 +54,55 @@ const InvoiceFormModal: React.FC = ({ } else { form.resetFields(); } + categoryTree().then((res) => { + const { code, data } = res; + if (code == 200) { + setCategoriesTreeData(data) + } + }) } }, [visible, initialValues]); + //品类选择数据中字段转换 + const convertTreeData = (data: any) => { + return data.map((item: any) => ({ + ...item, + title: item.categoryName, + key: item.id, + children: item.children ? convertTreeData(item.children) : undefined, + })); + } + function findLeafKeys(treeData: any[]): string[] { + let leafKeys: string[] = []; + function dfs(nodes: any[]) { + nodes.forEach(node => { + if (!node.children || node.children.length === 0) { + leafKeys.push(node.key); + } else { + dfs(node.children); + } + }); + } + dfs(treeData); + return leafKeys; + } + //品类选择 + const onCheck = ( + checkedKeysValue: + | React.Key[] + | { checked: React.Key[]; halfChecked: React.Key[] } + ) => { + const keys = Array.isArray(checkedKeysValue) + ? checkedKeysValue + : checkedKeysValue.checked; + + // 只取叶子节点 key + const leafKeys = findLeafKeys(convertTreeData(categoriesTreeData)); + const onlyLeafChecked = keys.filter(key => leafKeys.includes(String(key))); + + setCheckedKeys(keys); // UI 显示用,还是全量 + form.setFieldsValue({ categoryIdList: onlyLeafChecked }); // 只存叶子到表单 + }; // 提交 const handleFinish = async () => { try { @@ -64,6 +111,7 @@ const InvoiceFormModal: React.FC = ({ ...values, supplierId: userId, }; + console.log(payload); if (!values.id) { coscoSupplierUserAdd(payload).then((res) => { @@ -106,13 +154,18 @@ const InvoiceFormModal: React.FC = ({ {viewData.contactsName} {viewData.contactsPhone} {viewData.contactsEmail} + + {viewData.categoryNameList && viewData.categoryNameList.map((item) => { + return
{item}
+ })} +
) : (
- + @@ -121,7 +174,7 @@ const InvoiceFormModal: React.FC = ({ { required: true, message: '请输入联系人手机号码' }, { pattern: /^1[3-9]\d{9}$/, message: '请输入正确的手机号码' }, ]}> - + @@ -130,7 +183,27 @@ const InvoiceFormModal: React.FC = ({ { type: 'email', message: '请输入有效的电子邮箱' }, { required: true, message: '请输入电子邮箱' }, ]}> - + + + + + + diff --git a/src/components/CompanyInfo/component/ContactsInfoTab.tsx b/src/components/CompanyInfo/component/ContactsInfoTab.tsx index 44d809a..ca39c0c 100644 --- a/src/components/CompanyInfo/component/ContactsInfoTab.tsx +++ b/src/components/CompanyInfo/component/ContactsInfoTab.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useState } from 'react'; -import { Table, Button, message, Switch, Popconfirm } from 'antd'; +import { Table, Button, message, Switch, Popconfirm, Tooltip } from 'antd'; import type { ColumnsType, TablePaginationConfig } from 'antd/es/table'; import { getCoscoSupplierUserPage, editType, coscoSupplierUserDel } from '../services'; import { useIntl } from 'umi'; @@ -17,6 +17,12 @@ interface getCoscoSupplierUser { certificateUrl?: string; delFlag: string; type: string; + coscoSupplierUserCategoryList?: CoscoSupplierUserCategory[]; +} +interface CoscoSupplierUserCategory { + categoryId:string; + categoryName:string; + supplierUserId:string; } interface Props { @@ -86,6 +92,7 @@ const OtherAttachmentsTab: React.FC = (props) => { }; //是否为主联系人 const handleObsoleteChange = async (checked: boolean, id: string) => { + if(!checked) return // 调用你的作废接口 const res = await editType({ id, supplierId: record }); if (res.code === 200) { @@ -124,6 +131,29 @@ const OtherAttachmentsTab: React.FC = (props) => { dataIndex: 'contactsEmail', key: 'contactsEmail', }, + { + title: '负责品类', + dataIndex: 'coscoSupplierUserCategoryList', + key: 'coscoSupplierUserCategoryList', + ellipsis: true, + width: 160, + render: (value: { categoryName: string }[] = []) => { + if (!value || value.length === 0) return '-'; + if (value.length === 1) { + return {value[0].categoryName}; + } + // 多于1条 + const allNames = value.map(item => item.categoryName).join('、'); + return ( + + + {value[0].categoryName} + + + + ); + }, + }, { title: '是否为主联系人', @@ -181,7 +211,7 @@ const OtherAttachmentsTab: React.FC = (props) => { rowKey="id" columns={columns.map(column => ({ ...column, - title: intl.formatMessage({ id: column.title as string }) + title: column.title }))} dataSource={data} pagination={pagination} diff --git a/src/components/CompanyInfo/component/InvoiceFormModal.tsx b/src/components/CompanyInfo/component/InvoiceFormModal.tsx index e4e9bb4..34768ae 100644 --- a/src/components/CompanyInfo/component/InvoiceFormModal.tsx +++ b/src/components/CompanyInfo/component/InvoiceFormModal.tsx @@ -201,35 +201,35 @@ const InvoiceFormModal: React.FC = ({ - + - + - + - + - + - + diff --git a/src/components/CompanyInfo/component/QualificationFormModal.tsx b/src/components/CompanyInfo/component/QualificationFormModal.tsx index d867f19..e764727 100644 --- a/src/components/CompanyInfo/component/QualificationFormModal.tsx +++ b/src/components/CompanyInfo/component/QualificationFormModal.tsx @@ -176,27 +176,27 @@ const QualificationFormModal: React.FC = ({ - + - + - + - + - + diff --git a/src/components/CompanyInfo/services.ts b/src/components/CompanyInfo/services.ts index 5812bad..5c67a03 100644 --- a/src/components/CompanyInfo/services.ts +++ b/src/components/CompanyInfo/services.ts @@ -276,7 +276,10 @@ export const editType = (data: editType) => request.post('/coscoSupplierUser/edi export const coscoSupplierUserDel = (id: string) => request.delete(`/coscoSupplierUser/${id}`); - +/** + * 品类选择查询树 + */ +export const categoryTree = () => request.get('/cosco/category/categoryTree'); diff --git a/src/components/GlobalModal/components/ContactsInfo.tsx b/src/components/GlobalModal/components/ContactsInfo.tsx new file mode 100644 index 0000000..cab4e74 --- /dev/null +++ b/src/components/GlobalModal/components/ContactsInfo.tsx @@ -0,0 +1,122 @@ +import React, { useEffect, useState } from 'react'; +import { Table, Tooltip } from 'antd'; +import type { ColumnsType, TablePaginationConfig } from 'antd/es/table'; +import { getCoscoSupplierUserPage } from '../services'; +import { useIntl } from 'umi'; + +interface getCoscoSupplierUser { + id: string; + attachmentsType?: string; + fileName?: string; + filePath?: string; + fileSize?: string; + fileType?: string; + fileUrl?: string; + supplierId?: string; + certificateUrl?: string; + delFlag: string; + type: string; +} + +interface Props { + id?: string; +} +const OtherAttachmentsTab: React.FC = ({id}) => { + //语言切换 + const intl = useIntl(); + //列表渲染数据 + const [data, setData] = useState([]); + //列表加载 + const [loading, setLoading] = useState(false); + //列表分页 + const [pagination, setPagination] = useState({ current: 1, pageSize: 10, total: 0 }); + + //列表方法 + const getList = async (pageNo = 1, pageSize = 10) => { + setLoading(true); + try { + const { code, data } = await getCoscoSupplierUserPage({ pageNo, pageSize, supplierId: id }); + if (code === 200) { + setData(data.records); + setPagination({ current: pageNo, pageSize, total: data.total }); + } + } finally { + setLoading(false); + } + }; + + + //初始化 + useEffect(() => { + if (id) { + getList(); + } + }, [id]); + + + const columns: ColumnsType = [ + { + title: intl.formatMessage({ id: 'page.workbench.attachments.index' }), + render: (_: any, __: any, index: number) => index + 1, + width: 60, + }, + { + title: '联系人', + dataIndex: 'contactsName', + key: 'contactsName', + }, + { + title: '手机号', + dataIndex: 'contactsPhone', + key: 'contactsPhone', + }, + { + title: '邮箱', + dataIndex: 'contactsEmail', + key: 'contactsEmail', + }, + { + title: '负责品类', + dataIndex: 'coscoSupplierUserCategoryList', + key: 'coscoSupplierUserCategoryList', + ellipsis: true, + width: 160, + render: (value: { categoryName: string }[] = []) => { + if (!value || value.length === 0) return '-'; + if (value.length === 1) { + return {value[0].categoryName}; + } + // 多于1条 + const allNames = value.map(item => item.categoryName).join('、'); + return ( + + + {value[0].categoryName} + + + + ); + }, + }, + + ]; + return ( +
+ ({ + ...column, + title: intl.formatMessage({ id: column.title as string }) + }))} + dataSource={data} + pagination={pagination} + loading={loading} + onChange={(pagination) => getList(pagination.current!, pagination.pageSize!)} + /> + + + ); +}; + +export default OtherAttachmentsTab; \ No newline at end of file diff --git a/src/components/GlobalModal/components/SupplierRegisterInfo.tsx b/src/components/GlobalModal/components/SupplierRegisterInfo.tsx index acf73c2..c69aae6 100644 --- a/src/components/GlobalModal/components/SupplierRegisterInfo.tsx +++ b/src/components/GlobalModal/components/SupplierRegisterInfo.tsx @@ -261,7 +261,12 @@ const SupplierRegisterInfo = ({ registerInfo }: { registerInfo: any }) => { label={intl.formatMessage({ id: 'component.globalModal.antiBriberyLabel' })} labelStyle={{ width: '200px' }} > - {intl.formatMessage({ id: 'component.globalModal.viewAttachment' })} + { registerInfo.coscoSupplierSurveyAttachments.map((item:any) => { + const { attachmentsType, fileUrl , fileName } = item; + return attachmentsType === 'commitment'? ( + {fileName} + ) :null + })} @@ -276,9 +281,12 @@ const SupplierRegisterInfo = ({ registerInfo }: { registerInfo: any }) => { label={intl.formatMessage({ id: 'component.globalModal.otherAttachmentLabel' })} labelStyle={{ width: '200px' }} > - {registerInfo.coscoSupplierSurveyAttachments[0].fileUrl && ( - {intl.formatMessage({ id: 'component.globalModal.viewAttachment' })} - )} + { registerInfo.coscoSupplierSurveyAttachments.map((item:any) => { + const { attachmentsType, fileUrl , fileName } = item; + return attachmentsType === 'accessory'? ( + {fileName} + ) :null + })} diff --git a/src/components/GlobalModal/components/TianyanchaInfo.tsx b/src/components/GlobalModal/components/TianyanchaInfo.tsx index 9cf5351..338ddf3 100644 --- a/src/components/GlobalModal/components/TianyanchaInfo.tsx +++ b/src/components/GlobalModal/components/TianyanchaInfo.tsx @@ -2,13 +2,13 @@ import React, { useState, useEffect } from 'react'; import { Descriptions, Button, message } from 'antd'; import type { ColumnsType } from 'antd/es/table'; import type { IntlShape } from 'react-intl'; -import { getQuery } from '../services'; +import { getQuery, getQueryAndUpdate } from '../services'; import { useIntl } from 'umi'; interface TianyanchaInfoProps { base?: string; // 省份简称 - name: string; // 企业名称 + name?: string; // 企业名称 legalPersonName?: string; // 法人 legalPersonType?: string; // 法人类型 ,1 人 2 公司 regNumber?: string; // 注册号 @@ -40,14 +40,31 @@ const TianyanchaInfo = ({ id }: { id: string }) => { const intl = useIntl(); const [loading, setLoading] = useState(false); const [dataList, setDataList] = useState([]); - const [updateTime, setUpdateTime] = useState(new Date().toLocaleDateString()); + const [updateTime, setUpdateTime] = useState(''); + //列表 const getList = async () => { setLoading(true); try { const { code, data } = await getQuery({ supplierId: id }); + if (code === 200) { + if(data) { + setDataList(data); + setUpdateTime(new Date(Number(data.updateTimes)).toLocaleDateString()); + } + } + } finally { + setLoading(false); + } + }; + //更新 + const getUpdateList = async () => { + setLoading(true); + try { + const { code, data } = await getQueryAndUpdate({ supplierId: id }); if (code === 200) { setDataList(data); + setUpdateTime(new Date(Number(data.updateTimes)).toLocaleDateString()); } } finally { setLoading(false); @@ -56,12 +73,11 @@ const TianyanchaInfo = ({ id }: { id: string }) => { const onUpdateTime = () => { setUpdateTime(new Date().toLocaleDateString()); - getList(); + getUpdateList(); message.success(intl.formatMessage({ id: 'component.tianyancha.updateSuccess'})); }; useEffect(() => { if (id) { - setUpdateTime(new Date().toLocaleDateString()); getList(); } }, [id]); diff --git a/src/components/GlobalModal/index.tsx b/src/components/GlobalModal/index.tsx index d63920c..a074840 100644 --- a/src/components/GlobalModal/index.tsx +++ b/src/components/GlobalModal/index.tsx @@ -5,6 +5,7 @@ import { coscoSupplierBase } from './services' import SupplierRegisterInfo from './components/SupplierRegisterInfo'; import AccessCategoryTable from './components/AccessCategoryTable'; import TianyanchaInfo from './components/TianyanchaInfo'; +import ContactsInfo from './components/ContactsInfo'; import RiskList from './components/RiskList'; // 弹出主体 @@ -12,7 +13,7 @@ const GlobalModal = ({ visible, id, dispatch }: any) => { const intl = useIntl(); // 页面显示具体tab类型 - const [modalType, setModalType] = useState<'register' | 'category' | 'tianyancha' | 'risk'>('register'); + const [modalType, setModalType] = useState<'register' | 'category' | 'tianyancha' | 'risk' | 'ContactsInfo'>('register'); //供应商信息数据 const [registerInfo, setRegisterInfo] = useState(null); //获取供应商信息 @@ -48,6 +49,10 @@ const GlobalModal = ({ visible, id, dispatch }: any) => { //合规风险列表 return ; } + if (modalType === 'ContactsInfo') { + //合规风险列表 + return ; + } return null; }; // 初始化 @@ -81,6 +86,7 @@ const GlobalModal = ({ visible, id, dispatch }: any) => { +
{renderContent()} diff --git a/src/components/GlobalModal/services.ts b/src/components/GlobalModal/services.ts index 1ea9be3..ce4726a 100644 --- a/src/components/GlobalModal/services.ts +++ b/src/components/GlobalModal/services.ts @@ -2,12 +2,19 @@ import request from '@/utils/request'; /** - * 天眼查只查询 + * 天眼查查询 */ interface getQuery { supplierId: string; } -export const getQuery = (params: getQuery) => request.get('/tycAndFxSupplierBase/queryAndUpdate', { params}); +export const getQuery = (params: getQuery) => request.get('/tycAndFxSupplierBase/query', { params}); +/** + * 天眼查更新 + */ +interface getQuery { + supplierId: string; +} +export const getQueryAndUpdate = (params: getQuery) => request.get('/tycAndFxSupplierBase/queryAndUpdate', { params}); /** @@ -46,4 +53,15 @@ 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 }); + + +/** +* 联系人分页列表 +*/ +interface getCoscoSupplierUserPage { + pageNo: number; + pageSize: number; + supplierId?: string; +} +export const getCoscoSupplierUserPage = (data: getCoscoSupplierUserPage) => request.post('/coscoSupplierUser/getPage', { data }); diff --git a/src/pages/supplier/category/SupplierEntryManage/components/SupplierAddModal.tsx b/src/pages/supplier/category/SupplierEntryManage/components/SupplierAddModal.tsx index f294c85..747f9a7 100644 --- a/src/pages/supplier/category/SupplierEntryManage/components/SupplierAddModal.tsx +++ b/src/pages/supplier/category/SupplierEntryManage/components/SupplierAddModal.tsx @@ -146,9 +146,14 @@ const SupplierAddModal: React.FC<{ } } - apply({ categoryLibraryId: storeId, supplierIds: selectedIds, ...values }) - setSelectedIds([]); - onSuccess && onSuccess(); + apply({ categoryLibraryId: storeId, supplierIds: selectedIds, ...values }).then((res) => { + if(res.code == 200) { + message.success('操作成功'); + setSelectedIds([]); + onSuccess && onSuccess(); + } + }) + }; // 自定义上传