优化初始化以及去掉固定供应商ID

This commit is contained in:
孙景学
2025-07-14 10:06:48 +08:00
parent 49f302194f
commit e1dd6bfa98
14 changed files with 73 additions and 51 deletions

View File

@ -75,8 +75,10 @@ const OtherAttachmentsTab: React.FC<Props> = (props) => {
//初始化 //初始化
useEffect(() => { useEffect(() => {
getList(); if(record) {
}, []); getList();
}
}, [record]);
const columns: ColumnsType<attachmentsAdd> = [ const columns: ColumnsType<attachmentsAdd> = [

View File

@ -38,6 +38,7 @@ const InvoiceFormModal: React.FC<props> = ({
initialValues, initialValues,
readOnly = false, readOnly = false,
}) => { }) => {
const userId = sessionStorage.getItem('userId') || '';
// 新增与修改 // 新增与修改
const [form] = Form.useForm(); const [form] = Form.useForm();
//查看 //查看
@ -75,7 +76,7 @@ const InvoiceFormModal: React.FC<props> = ({
const values = await form.validateFields(); const values = await form.validateFields();
const payload = { const payload = {
...values, ...values,
"supplierId": "9c12e8ea-a681-4184-81ba-5fa276299a00", supplierId: userId,
}; };
if (!values.id) { if (!values.id) {
bankAdd(payload).then((res) => { bankAdd(payload).then((res) => {

View File

@ -75,8 +75,10 @@ const BankInfoTab: React.FC<Props> = (props) => {
//初始化 //初始化
useEffect(() => { useEffect(() => {
getList(); if(record) {
}, []); getList();
}
}, [record]);
// 表格头部 // 表格头部
const columns: ColumnsType<BankInfo> = [ const columns: ColumnsType<BankInfo> = [
{ {

View File

@ -77,9 +77,11 @@ const BaseInfoTab: React.FC<BaseInfoTabProps> = (props) => {
useEffect(() => { useEffect(() => {
//供应商信息 if(record) {
fetchData() //供应商信息
}, []); fetchData()
}
}, [record]);
if (!registerInfo?.coscoSupplierBase) return <div>{intl.formatMessage({ id: 'component.globalModal.loading' })}...</div>; if (!registerInfo?.coscoSupplierBase) return <div>{intl.formatMessage({ id: 'component.globalModal.loading' })}...</div>;

View File

@ -41,8 +41,10 @@ const ContactsInfoTab: React.FC<Props> = (props) => {
}; };
useEffect(() => { useEffect(() => {
fetchContacts(); if(record) {
}, []); fetchContacts();
}
}, [record]);
const handleTableChange = (pagination: TablePaginationConfig) => { const handleTableChange = (pagination: TablePaginationConfig) => {
fetchContacts(pagination.current!, pagination.pageSize!); fetchContacts(pagination.current!, pagination.pageSize!);

View File

@ -35,7 +35,8 @@ const InvoiceFormModal: React.FC<props> = ({
initialValues, initialValues,
readOnly = false, readOnly = false,
}) => { }) => {
// 新增与修改 const userId = sessionStorage.getItem('userId') || '';
// 新增与修改
const [form] = Form.useForm(); const [form] = Form.useForm();
//查看 //查看
const [viewData, setViewData] = useState<viewDataData>({}); const [viewData, setViewData] = useState<viewDataData>({});
@ -72,7 +73,7 @@ const InvoiceFormModal: React.FC<props> = ({
const payload = { const payload = {
...values, ...values,
qualificationCertificate, qualificationCertificate,
"supplierId": "9c12e8ea-a681-4184-81ba-5fa276299a00", supplierId: userId,
}; };
console.log(values,'values'); console.log(values,'values');

View File

@ -77,8 +77,10 @@ const InvoiceTab: React.FC<InvoiceTabProps> = (props) => {
//初始化 //初始化
useEffect(() => { useEffect(() => {
getList(); if(record) {
}, []); getList();
}
}, [record]);
const columns: ColumnsType<InvoiceInfo> = [ const columns: ColumnsType<InvoiceInfo> = [
{ title: 'page.workbench.invoice.index', dataIndex: 'index', width: 80, key: 'index', render: (_: any, __: any, index: number) => index + 1 }, { title: 'page.workbench.invoice.index', dataIndex: 'index', width: 80, key: 'index', render: (_: any, __: any, index: number) => index + 1 },

View File

@ -62,9 +62,11 @@ const BaseInfoTab: React.FC<BaseInfoTabProps> = (props) => {
useEffect(() => { useEffect(() => {
//供应商信息 if(record) {
fetchData() //供应商信息
}, []); fetchData()
}
}, [record]);
if (!registerInfo?.coscoSupplierBase) return <div>{intl.formatMessage({ id: 'component.globalModal.loading' })}...</div>; if (!registerInfo?.coscoSupplierBase) return <div>{intl.formatMessage({ id: 'component.globalModal.loading' })}...</div>;

View File

@ -34,6 +34,7 @@ const QualificationFormModal: React.FC<QualificationFormModalProps> = ({
initialValues, initialValues,
readOnly = false, readOnly = false,
}) => { }) => {
const userId = sessionStorage.getItem('userId') || '';
// 新增与修改 // 新增与修改
const [form] = Form.useForm(); const [form] = Form.useForm();
//查看 //查看
@ -78,7 +79,7 @@ const QualificationFormModal: React.FC<QualificationFormModalProps> = ({
dateTime: values.dateTime ? moment(values.dateTime) : undefined, dateTime: values.dateTime ? moment(values.dateTime) : undefined,
termOfValidity: values.termOfValidity ? moment(values.termOfValidity) : undefined, termOfValidity: values.termOfValidity ? moment(values.termOfValidity) : undefined,
accessory, accessory,
"supplierId": "9c12e8ea-a681-4184-81ba-5fa276299a00", supplierId: userId,
}; };
if(!values.id) { if(!values.id) {
qualificationsaAdd(payload).then((res) => { qualificationsaAdd(payload).then((res) => {

View File

@ -48,8 +48,10 @@ const QualificationTab: React.FC<QualificationTabProps> = (props) => {
}; };
useEffect(() => { useEffect(() => {
getList(); if(record) {
}, []); getList();
}
}, [record]);
const handleAdd = () => { const handleAdd = () => {
setEditingRecord(null); setEditingRecord(null);

View File

@ -26,16 +26,17 @@ const CompanyInfo: React.FC<CompanyInfoProps> = (props) => {
const [subTab, setSubTab] = useState<string>(''); const [subTab, setSubTab] = useState<string>('');
useEffect(() => { useEffect(() => {
coscoSupplierBase(record).then((res) => { if(record) {
if (res.code === 200) { coscoSupplierBase(record).then((res) => {
if (res.data.coscoSupplierBase.supplierType === 'pe') { if (res.code === 200) {
setSubTab('pe') if (res.data.coscoSupplierBase.supplierType === 'pe') {
} else { setSubTab('pe')
setSubTab('base') } else {
setSubTab('base')
}
} }
} })
}) }
}, [record]) }, [record])
return ( return (

View File

@ -5,17 +5,17 @@ import { useIntl } from 'umi';
import type { ColumnsType } from 'antd/es/table'; import type { ColumnsType } from 'antd/es/table';
interface data { interface data {
hit:string; hit: string;
countries:string; countries: string;
d1:string; d1: string;
d2:string; d2: string;
[key: string]: any; [key: string]: any;
} }
const RiskList = ({id}:{id:string}) => { const RiskList = ({ id }: { id: string }) => {
const intl = useIntl(); const intl = useIntl();
const columns:ColumnsType<data> = [ const columns: ColumnsType<data> = [
{ {
title: intl.formatMessage({ id: 'component.globalModal.hit', defaultMessage: '命中对象' }), title: intl.formatMessage({ id: 'component.globalModal.hit', defaultMessage: '命中对象' }),
dataIndex: 'hit', dataIndex: 'hit',
@ -51,17 +51,17 @@ const RiskList = ({id}:{id:string}) => {
if (code === 200) { if (code === 200) {
setDataList(data); setDataList(data);
} else { } else {
message.error(intl.formatMessage({id: 'component.globalModal.fetchRiskFail'})); message.error(intl.formatMessage({ id: 'component.globalModal.fetchRiskFail' }));
} }
} catch (error) { } catch (error) {
message.error(intl.formatMessage({id: 'component.globalModal.apiError'})); message.error(intl.formatMessage({ id: 'component.globalModal.apiError' }));
} finally { } finally {
// setLoading(false); // setLoading(false);
} }
}; };
//初始化 //初始化
useEffect(() => { useEffect(() => {
if(id) { if (id) {
getList(); getList();
} }
}, [id]); }, [id]);
@ -69,16 +69,16 @@ const RiskList = ({id}:{id:string}) => {
return ( return (
<> <>
{ {
dataList.map((item, idx) => ( dataList.map((item, idx) => (
<Descriptions bordered column={1} key={item.id || idx} style={{ marginBottom: 24 }}> <Descriptions bordered column={1} key={item.id || idx} style={{ marginBottom: 24 }}>
{columns.map(col => ( {columns.map(col => (
<Descriptions.Item label={col.title} key={col.key} labelStyle={{ width: '140px' }}> <Descriptions.Item label={col.title} key={col.key} labelStyle={{ width: '140px' }}>
{item[(col as any).dataIndex] ?? '-'} {item[(col as any).dataIndex] ?? '-'}
</Descriptions.Item> </Descriptions.Item>
))} ))}
</Descriptions> </Descriptions>
)) ))
} }
</> </>
); );

View File

@ -144,7 +144,7 @@ const SupplierChangeReviewManage: React.FC<Props> = ({ dispatch }) => {
}, },
{ {
title: '境内/境外', title: '境内/境外',
dataIndex: 'supplierTypeCn', dataIndex: 'supplierType',
align: 'center', align: 'center',
width: 160, width: 160,
}, },
@ -179,6 +179,7 @@ const SupplierChangeReviewManage: React.FC<Props> = ({ dispatch }) => {
key: 'action', key: 'action',
align: 'center', align: 'center',
width: 160, width: 160,
fixed: 'right',
render: (_: any, record: any) => ( render: (_: any, record: any) => (
<Button type="link" onClick={() => handleDetail(record)}> <Button type="link" onClick={() => handleDetail(record)}>

View File

@ -152,6 +152,8 @@ const mySupplierInquiry: React.FC<mySupplierInquiryProps> = ({ dispatch }) => {
dataIndex: 'categoryName', dataIndex: 'categoryName',
key: 'categoryName', key: 'categoryName',
align: 'center', align: 'center',
width: 120,
ellipsis: true,
}, },
{ {
title: '准入时间', title: '准入时间',
@ -172,6 +174,7 @@ const mySupplierInquiry: React.FC<mySupplierInquiryProps> = ({ dispatch }) => {
key: 'option', key: 'option',
align: 'center', align: 'center',
width: 160, width: 160,
fixed: 'right',
render: (record: any) => ( render: (record: any) => (
<Space> <Space>
<a <a