优化初始化以及去掉固定供应商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(() => {
getList();
}, []);
if(record) {
getList();
}
}, [record]);
const columns: ColumnsType<attachmentsAdd> = [

View File

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

View File

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

View File

@ -77,9 +77,11 @@ const BaseInfoTab: React.FC<BaseInfoTabProps> = (props) => {
useEffect(() => {
//供应商信息
fetchData()
}, []);
if(record) {
//供应商信息
fetchData()
}
}, [record]);
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(() => {
fetchContacts();
}, []);
if(record) {
fetchContacts();
}
}, [record]);
const handleTableChange = (pagination: TablePaginationConfig) => {
fetchContacts(pagination.current!, pagination.pageSize!);

View File

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

View File

@ -77,8 +77,10 @@ const InvoiceTab: React.FC<InvoiceTabProps> = (props) => {
//初始化
useEffect(() => {
getList();
}, []);
if(record) {
getList();
}
}, [record]);
const columns: ColumnsType<InvoiceInfo> = [
{ 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(() => {
//供应商信息
fetchData()
}, []);
if(record) {
//供应商信息
fetchData()
}
}, [record]);
if (!registerInfo?.coscoSupplierBase) return <div>{intl.formatMessage({ id: 'component.globalModal.loading' })}...</div>;

View File

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

View File

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

View File

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

View File

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