优化初始化以及去掉固定供应商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 (