公司信息 列表作废以及基本信息 营业执照

This commit is contained in:
孙景学
2025-07-16 10:28:15 +08:00
parent 9618923a15
commit d58d4dd609
8 changed files with 314 additions and 143 deletions

View File

@ -1,12 +1,12 @@
import React, { useEffect, useState } from 'react';
import { Table, Button } from 'antd';
import { Table, Button, message, Switch } from 'antd';
import type { ColumnsType, TablePaginationConfig } from 'antd/es/table';
import { battachmentsGetPage } from '../services';
import { battachmentsGetPage, attachmentsEdit } from '../services';
import { useIntl } from 'umi';
import AttachmentsFormModal from './AttachmentsFormModal';
interface attachmentsAdd {
id?: string;
id: string;
attachmentsType?: string;
fileName?: string;
filePath?: string;
@ -15,6 +15,7 @@ interface attachmentsAdd {
fileUrl?: string;
supplierId?: string;
certificateUrl?: string;
delFlag: string;
}
interface Props {
@ -55,24 +56,35 @@ const OtherAttachmentsTab: React.FC<Props> = (props) => {
setFormVisible(false);
getList();
};
//新增
const handleAdd = () => {
setEditingRecord(null);
setIsViewMode(false);
setFormVisible(true);
};
// 作废 修改
const handleEdit = (record: attachmentsAdd) => {
setEditingRecord(record);
setIsViewMode(false);
setFormVisible(true);
};
// 作废 查看
const handleView = (record: attachmentsAdd) => {
setEditingRecord(record);
setIsViewMode(true);
setFormVisible(true);
};
//是否作废
const handleObsoleteChange = async (checked: boolean, id:string) => {
// 调用你的作废接口
const res = await attachmentsEdit( { id, delFlag: checked? 'normal':'deleted' } );
if (res.code === 200) {
message.success('操作成功');
getList(pagination.current, pagination.pageSize); // 刷新列表
} else {
message.error('操作失败');
}
}
//初始化
useEffect(() => {
if(record) {
@ -98,19 +110,38 @@ const OtherAttachmentsTab: React.FC<Props> = (props) => {
title: '更新时间',
dataIndex: 'updateTime',
},
...(viewType ? [] : [
{
title: 'page.workbench.attachments.action',
dataIndex: 'option',
width: 120,
render: (_: any, record: attachmentsAdd) => (
<>
<a style={{ marginRight: 8 }} onClick={() => handleView(record)}></a>
<a onClick={() => handleEdit(record)}></a>
</>
),
{
title: '是否作废',
dataIndex: 'delFlag',
align: 'center',
width: 100,
render: (value, record: attachmentsAdd) => {
let checkedType = value === 'normal' ? true : false;
return (
<Switch
checked={checkedType}
disabled={viewType}
onChange={(checked) => handleObsoleteChange(checked, record.id)}
/>
)
},
]),
},
// ...(viewType ? [] : [
// {
// title: 'page.workbench.attachments.action',
// dataIndex: 'option',
// width: 120,
// render: (_: any, record: attachmentsAdd) => (
// <>
// <a style={{ marginRight: 8 }} onClick={() => handleView(record)}>查看</a>
// <a onClick={() => handleEdit(record)}>修改</a>
// </>
// ),
// },
// ]),
];
return (
<div style={{ padding: '0 30px 0 0' }}>

View File

@ -1,7 +1,7 @@
import React, { useEffect, useState } from 'react';
import { Table, Button } from 'antd';
import { Table, Button, message, Switch } from 'antd';
import type { ColumnsType, TablePaginationConfig } from 'antd/es/table';
import { bankGetPage } from '../services';
import { bankGetPage, bankEdit } from '../services';
import { useIntl } from 'umi';
import BankFormModal from './BankFormModal';
@ -16,6 +16,7 @@ interface BankInfo {
nation: string;
province: string;
supplierId: string;
delFlag: string;
swiftCode: null;
}
interface Props {
@ -55,24 +56,35 @@ const BankInfoTab: React.FC<Props> = (props) => {
setFormVisible(false);
getList();
};
//新增
const handleAdd = () => {
setEditingRecord(null);
setIsViewMode(false);
setFormVisible(true);
};
//修改
const handleEdit = (record: BankInfo) => {
setEditingRecord(record);
setIsViewMode(false);
setFormVisible(true);
};
// 查看
const handleView = (record: BankInfo) => {
setEditingRecord(record);
setIsViewMode(true);
setFormVisible(true);
};
//是否作废
const handleObsoleteChange = async (checked: boolean, id:string) => {
// 调用你的作废接口
const res = await bankEdit( { id, delFlag: checked? 'normal':'deleted' } );
if (res.code === 200) {
message.success('操作成功');
getList(pagination.current, pagination.pageSize); // 刷新列表
} else {
message.error('操作失败');
}
}
//初始化
useEffect(() => {
if(record) {
@ -111,22 +123,22 @@ const BankInfoTab: React.FC<Props> = (props) => {
},
{
title: 'page.workbench.bank.currency',
dataIndex: 'currency',
dataIndex: 'currencyName',
key: 'currency', ellipsis: true
},
{
title: 'page.workbench.bank.nation',
dataIndex: 'nation',
dataIndex: 'nationName',
key: 'nation', ellipsis: true
},
{
title: 'page.workbench.bank.province',
dataIndex: 'province',
dataIndex: 'provinceName',
key: 'province', ellipsis: true
},
{
title: 'page.workbench.bank.city',
dataIndex: 'city',
dataIndex: 'cityName',
key: 'city', ellipsis: true
},
{
@ -134,6 +146,23 @@ const BankInfoTab: React.FC<Props> = (props) => {
dataIndex: 'updateTime',
key: 'updateTime', ellipsis: true
},
{
title: '是否作废',
dataIndex: 'delFlag',
align: 'center',
width: 100,
render: (value, record) => {
let checkedType = value === 'normal' ? true : false;
return (
<Switch
checked={checkedType}
disabled={viewType}
onChange={(checked) => handleObsoleteChange(checked, record.id)}
/>
)
},
},
...(viewType ? [] : [
{
title: 'page.workbench.attachments.action',
@ -142,7 +171,9 @@ const BankInfoTab: React.FC<Props> = (props) => {
render: (_: any, record: BankInfo) => (
<>
<a style={{ marginRight: 8 }} onClick={() => handleView(record)}></a>
<a onClick={() => handleEdit(record)}></a>
{record.delFlag === 'normal' && (
<a onClick={() => handleEdit(record)}></a>
)}
</>
),
},

View File

@ -94,6 +94,8 @@ const BaseInfoFormModal: React.FC<Props> = ({
//数据初始化
useEffect(() => {
if (visible && initialValues) {
console.log(initialValues,'initialValues');
form.setFieldsValue({
...changeData,
coscoSupplierBase: {
@ -106,29 +108,13 @@ const BaseInfoFormModal: React.FC<Props> = ({
url: initialValues.licenceAccessory,
thumbUrl: initialValues.licenceAccessory,
}]
: [],
},
attachment: changeData?.coscoSupplierSurveyAttachments
? [{
uid: '-1',
name: changeData?.coscoSupplierSurveyAttachments[0].fileName,
url: changeData?.coscoSupplierSurveyAttachments[0].fileUrl,
status: 'done',
response: {
fileName: changeData?.coscoSupplierSurveyAttachments[0].fileName,
fileType: changeData?.coscoSupplierSurveyAttachments[0].fileType,
fileSize: changeData?.coscoSupplierSurveyAttachments[0].fileSize,
filePath: changeData?.coscoSupplierSurveyAttachments[0].filePath,
fileUrl: changeData?.coscoSupplierSurveyAttachments[0].fileUrl,
attachmentsType: "change",
}
}]
: [],
: []
}
});
setChangeComparisonData({
name: initialValues.name,
range: initialValues.range,
range: initialValues.range
})
setViewData({
...changeData,
@ -151,7 +137,6 @@ const BaseInfoFormModal: React.FC<Props> = ({
message.success(`验证码已发送至 ${values.contactPhone}`);
let count = 60;
setCountdown(count);
const timer = setInterval(() => {
count--;
setCountdown(count);
@ -172,6 +157,8 @@ const BaseInfoFormModal: React.FC<Props> = ({
title: '是否确认个人信息变更?',
onOk: async () => {
const values = await form.validateFields();
console.log(values,'values');
const payload = {
...values,
};
@ -281,11 +268,11 @@ const BaseInfoFormModal: React.FC<Props> = ({
<>
<Form.Item
name='title'
label="名称"
label="变更标题"
labelCol={{ flex: '140px' }}
rules={[{ required: true, message: '请输入名称' }]}
rules={[{ required: true, message: '请输入变更标题' }]}
>
<Input placeholder="请输入名称" />
<Input placeholder="请输入变更标题" />
</Form.Item>
<Form.Item
name='changeDesc'
@ -297,7 +284,7 @@ const BaseInfoFormModal: React.FC<Props> = ({
</Form.Item>
<Form.Item
name="attachment"
label="附件"
label="相关证明文件(按需)"
labelCol={{ flex: '140px' }}
valuePropName="fileList"
getValueFromEvent={(e) => Array.isArray(e) ? e : e?.fileList}

View File

@ -98,9 +98,28 @@ const BaseInfoTab: React.FC<BaseInfoTabProps> = (props) => {
style={{ background: '#fff', padding: '16px 0 0' }}
>
{registerInfo.coscoSupplierBase.supplierType === 'dvs' && (
<Descriptions.Item label={intl.formatMessage({ id: 'component.globalModal.supplierIdentityType' })}>
{intl.formatMessage({ id: 'component.globalModal.domesticEnterprise' })}
</Descriptions.Item>
<>
<Descriptions.Item label={intl.formatMessage({ id: 'component.globalModal.supplierIdentityType' })}>
{intl.formatMessage({ id: 'component.globalModal.domesticEnterprise' })}
</Descriptions.Item>
<Descriptions.Item label="营业执照附件">
{registerInfo.coscoSupplierBase.licenceAccessory ? (
<a
href={registerInfo.coscoSupplierBase.licenceAccessory}
target="_blank"
rel="noopener noreferrer"
>
<img
src={registerInfo.coscoSupplierBase.licenceAccessory}
alt="营业执照"
style={{ width: 80, height: 80, objectFit: 'cover', borderRadius: 4, border: '1px solid #eee', cursor: 'pointer' }}
/>
</a>
) : (
<span style={{ color: '#999' }}></span>
)}
</Descriptions.Item>
</>
)}
<Descriptions.Item label={intl.formatMessage({ id: 'component.globalModal.enterpriseName' })}>
{registerInfo.coscoSupplierBase.name}
@ -151,6 +170,9 @@ const BaseInfoTab: React.FC<BaseInfoTabProps> = (props) => {
<Descriptions.Item label={intl.formatMessage({ id: 'component.globalModal.registerAddress' })}>
{registerInfo.coscoSupplierBase.regAddress}
</Descriptions.Item>
<Descriptions.Item label={intl.formatMessage({ id: 'component.globalModal.contactIdType' })}>
{registerInfo.coscoSupplierBase.contactsTypeName}
</Descriptions.Item>
<Descriptions.Item label={intl.formatMessage({ id: 'component.globalModal.idCardNumber' })}>
{registerInfo.coscoSupplierBase.idCard}
</Descriptions.Item>
@ -160,10 +182,6 @@ const BaseInfoTab: React.FC<BaseInfoTabProps> = (props) => {
<Descriptions.Item label={intl.formatMessage({ id: 'component.globalModal.contactMobile' })}>
{registerInfo.coscoSupplierBase.contactsPhone}
</Descriptions.Item>
<Descriptions.Item label={intl.formatMessage({ id: 'component.globalModal.contactIdType' })}>
{registerInfo.coscoSupplierBase.contactsType}
</Descriptions.Item>
</>
)}

View File

@ -4,7 +4,7 @@ import { Form, Input, Select, Row, Col, message, Upload, Button } from 'antd';
import type { UploadProps } from 'antd';
import { UploadOutlined } from '@ant-design/icons';
import { uploadFile } from '../services';
import type { UploadFile } from 'antd/es/upload/interface';
import { getDictList } from '@/servers/api/dicts';
import type { DictItem } from '@/servers/api/dicts';
const { Option } = Select;
@ -22,6 +22,8 @@ interface ForeignFormProps {
const DomesticForm: React.FC<ForeignFormProps> = ({ form, countdown, handleGetCaptcha }) => {
const [contactsType, setContactsType] = useState<DictItem[]>([]);
const [enterpriseType, setEnterpriseType] = useState<DictItem[]>([]);
//上传得图片
const [licenceFileList, setLicenceFileList] = useState<UploadFile[]>([]);
useEffect(() => {
getDictList('contacts_type').then((res) => {
if (res.code === 200) {
@ -33,11 +35,26 @@ const DomesticForm: React.FC<ForeignFormProps> = ({ form, countdown, handleGetCa
setEnterpriseType(res.data);
}
});
const licenceAccessory = form.getFieldValue(['coscoSupplierBase', 'licenceAccessory']);
if (licenceAccessory) {
setLicenceFileList([{
uid: '-1',
name: '营业执照',
status: 'done',
url: licenceAccessory,
thumbUrl: licenceAccessory,
}]);
} else {
setLicenceFileList([]);
}
}, [])
//上传接口
const uploadProps: UploadProps = {
name: 'file',
accept: 'image/*',
fileList: licenceFileList,
maxCount: 1,
showUploadList: true,
beforeUpload: (file) => {
if (file.size > 1048576) { // 1MB
@ -50,18 +67,39 @@ const DomesticForm: React.FC<ForeignFormProps> = ({ form, countdown, handleGetCa
try {
const realFile = file as File;
const res = await uploadFile(realFile);
const uploadedFile = {
uid: res.fileSize,
const uploadedFile: UploadFile = {
uid: String(res.fileSize),
name: res.fileName,
status: 'done',
url: res.url,
thumbUrl: res.url,
};
setLicenceFileList([uploadedFile]);
// 让表单跟随
form.setFieldsValue({
coscoSupplierBase: {
...form.getFieldValue('coscoSupplierBase'),
licenceAccessoryD: [uploadedFile]
}
});
onSuccess?.(uploadedFile, new XMLHttpRequest())
message.success('上传成功');
} catch (err: any) {
onError?.(err);
message.error(err.message || '上传失败');
}
},
onRemove: () => {
setLicenceFileList([]);
form.setFieldsValue({
coscoSupplierBase: {
...form.getFieldValue('coscoSupplierBase'),
licenceAccessoryD: []
}
});
return true;
}
};
return (
@ -281,20 +319,26 @@ const DomesticForm: React.FC<ForeignFormProps> = ({ form, countdown, handleGetCa
</Form.Item>
</Col>
<Col span={24}>
<Form.Item
name={['coscoSupplierBase', 'licenceAccessoryD']}
label="营业执照附件"
rules={[{ required: true, message: '请上传营业执照' }]}
getValueFromEvent={e => Array.isArray(e) ? e : e?.fileList}
>
<Upload {...uploadProps} maxCount={1} listType="picture-card" showUploadList={true}>
<Form.Item
name={['coscoSupplierBase', 'licenceAccessoryD']}
label="营业执照附件"
valuePropName="fileList"
getValueFromEvent={e => Array.isArray(e) ? e : e?.fileList}
rules={[{ required: true, message: '请上传营业执照' }]}
>
<Upload {...uploadProps}>
{licenceFileList.length < 1 && (
<Button icon={<UploadOutlined />}></Button>
</Upload>
</Form.Item>
</Col>
)}
</Upload>
</Form.Item>
</Col>
<Form.Item name={['coscoSupplierBase', 'id']} noStyle>
<Input type="hidden" />
</Form.Item>
<Form.Item name={['coscoSupplierBase', 'supplierType']} noStyle>
<Input type="hidden" />
</Form.Item>
</Row>
</>

View File

@ -1,7 +1,7 @@
import React, { useEffect, useState } from 'react';
import { Table, Button } from 'antd';
import { Table, Button, Switch, message } from 'antd';
import type { ColumnsType, TablePaginationConfig } from 'antd/es/table';
import { invoiceGetPage } from '../services';
import { invoiceGetPage, invoiceEdit } from '../services';
import { useIntl } from 'umi';
import InvoiceFormModal from './InvoiceFormModal';
@ -16,6 +16,7 @@ interface InvoiceInfo {
account: string;
updateTime: string;
certificateUrl: string;
delFlag: string;
}
interface InvoiceTabProps {
@ -57,24 +58,35 @@ const InvoiceTab: React.FC<InvoiceTabProps> = (props) => {
setFormVisible(false);
getList();
};
//新增
const handleAdd = () => {
setEditingRecord(null);
setIsViewMode(false);
setFormVisible(true);
};
// 修改
const handleEdit = (record: InvoiceInfo) => {
setEditingRecord(record);
setIsViewMode(false);
setFormVisible(true);
};
// 查看
const handleView = (record: InvoiceInfo) => {
setEditingRecord(record);
setIsViewMode(true);
setFormVisible(true);
};
//是否作废
const handleObsoleteChange = async (checked: boolean, id:string) => {
// 调用你的作废接口
const res = await invoiceEdit( { id, delFlag: checked? 'normal':'deleted' } );
if (res.code === 200) {
message.success('操作成功');
getList(pagination.current, pagination.pageSize); // 刷新列表
} else {
message.error('操作失败');
}
}
//初始化
useEffect(() => {
if(record) {
@ -92,6 +104,23 @@ const InvoiceTab: React.FC<InvoiceTabProps> = (props) => {
{ title: 'page.workbench.invoice.bank', dataIndex: 'bank', ellipsis: true },
{ title: 'page.workbench.invoice.account', dataIndex: 'account', ellipsis: true },
{ title: 'page.workbench.invoice.updateTime', dataIndex: 'updateTime', ellipsis: true },
{
title: '是否作废',
dataIndex: 'delFlag',
align: 'center',
width: 100,
render: (value, record) => {
let checkedType = value === 'normal' ? true : false;
return (
<Switch
checked={checkedType}
disabled={viewType}
onChange={(checked) => handleObsoleteChange(checked, record.id)}
/>
)
},
},
{
title: 'page.workbench.invoice.qualificationCertificate',
width: '180px',
@ -106,7 +135,9 @@ const InvoiceTab: React.FC<InvoiceTabProps> = (props) => {
render: (_: any, record: InvoiceInfo) => (
<>
<a style={{ marginRight: 8 }} onClick={() => handleView(record)}></a>
<a onClick={() => handleEdit(record)}></a>
{record.delFlag === 'normal' && (
<a onClick={() => handleEdit(record)}></a>
)}
</>
),
},

View File

@ -1,7 +1,7 @@
import React, { useEffect, useState } from 'react';
import { Table, Button, message } from 'antd';
import { Table, Button, Switch, message } from 'antd';
import type { ColumnsType, TablePaginationConfig } from 'antd/es/table';
import { qualificationsGetPage } from '../services';
import { qualificationsGetPage, qualificationsEdit } from '../services';
import { useIntl } from 'umi';
import QualificationFormModal from './QualificationFormModal';
@ -15,6 +15,7 @@ interface Qualification {
dateTime: string;
termOfValidity: string;
updateTime: string;
delFlag: string;
}
interface QualificationTabProps {
@ -33,7 +34,7 @@ const QualificationTab: React.FC<QualificationTabProps> = (props) => {
const [formVisible, setFormVisible] = useState(false);
const [editingRecord, setEditingRecord] = useState<Qualification | null>(null);
const [isViewMode, setIsViewMode] = useState(false);
//列表渲染
const getList = async (pageNo = 1, pageSize = 10) => {
setLoading(true);
try {
@ -46,36 +47,49 @@ const QualificationTab: React.FC<QualificationTabProps> = (props) => {
setLoading(false);
}
};
//初始化
useEffect(() => {
if(record) {
if (record) {
getList();
}
}, [record]);
//打开新增
const handleAdd = () => {
setEditingRecord(null);
setIsViewMode(false);
setFormVisible(true);
};
//打开修改
const handleEdit = (record: Qualification) => {
setEditingRecord(record);
setIsViewMode(false);
setFormVisible(true);
};
//打开查看
const handleView = (record: Qualification) => {
setEditingRecord(record);
setIsViewMode(true);
setFormVisible(true);
};
//提交回调
const handleFormSubmit = () => {
setFormVisible(false);
getList();
};
//是否作废
const handleObsoleteChange = async (checked: boolean, id:string) => {
// 调用你的作废接口
const res = await qualificationsEdit( { id, delFlag: checked? 'normal':'deleted' } );
if (res.code === 200) {
message.success('操作成功');
getList(pagination.current, pagination.pageSize); // 刷新列表
} else {
message.error('操作失败');
}
}
const columns: ColumnsType<Qualification> = [
{ title: 'page.workbench.certificateType', dataIndex: 'certificateType', ellipsis: true },
{ title: 'page.workbench.certificateName', dataIndex: 'name', ellipsis: true },
@ -85,18 +99,39 @@ const QualificationTab: React.FC<QualificationTabProps> = (props) => {
{ title: 'page.workbench.dateTime', dataIndex: 'dateTime', ellipsis: true },
{ title: 'page.workbench.termOfValidity', dataIndex: 'termOfValidity', ellipsis: true },
{ title: 'page.workbench.updateTime', dataIndex: 'updateTime', ellipsis: true },
{
title: '是否作废',
dataIndex: 'delFlag',
align: 'center',
width: 100,
render: (value, record) => {
let checkedType = value === 'normal' ? true : false;
return (
<Switch
checked={checkedType}
disabled={viewType}
onChange={(checked) => handleObsoleteChange(checked, record.id)}
/>
)
},
},
...(viewType ? [] : [
{
title: 'page.workbench.attachments.action',
dataIndex: 'option',
width: 120,
render: (_: any, record: Qualification) => (
<>
<a style={{ marginRight: 8 }} onClick={() => handleView(record)}></a>
<a onClick={() => handleEdit(record)}></a>
</>
),
render: (_: any, record: Qualification) => {
return (
<>
<a style={{ marginRight: 8 }} onClick={() => handleView(record)}></a>
{record.delFlag === 'normal' && (
<a onClick={() => handleEdit(record)}></a>
)}
</>
)
}
}
]),
];

View File

@ -25,16 +25,17 @@ export const qualificationsView = (id: string) => request.get(`/qualifications/$
* 资质新增
*/
interface qualificationsaAdd {
id: string;
accessory: string;
authority: string;
certificateType: string;
code: string;
dateTime: string;
name: string;
supplierId: string;
termOfValidity: string;
typeLevel: string;
id?: string;
accessory?: string;
authority?: string;
certificateType?: string;
code?: string;
dateTime?: string;
name?: string;
supplierId?: string;
termOfValidity?: string;
typeLevel?: string;
delFlag?: string;
}
export const qualificationsaAdd = (data: qualificationsaAdd) => request.post('/qualifications', { data });
/**
@ -77,16 +78,18 @@ export const invoiceView = (id: string) => request.get(`/invoice/${id}`);
* 开票新增
*/
interface invoiceAdd {
id: string;
account: string;
address: string;
bank: string;
head: string;
phone: string;
qualificationCertificate: string;
supplierId: string;
taxpayerCode: string;
taxpayerType: string;
id?: string;
account?: string;
address?: string;
bank?: string;
head?: string;
phone?: string;
qualificationCertificate?: string;
supplierId?: string;
taxpayerCode?: string;
taxpayerType?: string;
delFlag?: string;
}
export const invoiceAdd = (data: invoiceAdd) => request.post('/invoice', { data });
/**
@ -116,17 +119,18 @@ export const bankView = (id: string) => request.get(`/bank/${id}`);
* 银行新增
*/
interface bankAdd {
id: string;
account: string;
accountName: string;
bank: string;
city: string;
currency: string;
interbankNumber: string;
nation: string;
province: string;
supplierId: string;
swiftCode: null;
id?: string;
account?: string;
accountName?: string;
bank?: string;
city?: string;
currency?: string;
interbankNumber?: string;
nation?: string;
province?: string;
supplierId?: string;
swiftCode?: null;
delFlag?: string;
[property: string]: any;
}
export const bankAdd = (data: bankAdd) => request.post('/bank', { data });
@ -157,14 +161,15 @@ export const attachmentskView = (id: string) => request.get(`/attachments/${id}`
* 附件新增
*/
interface attachmentsAdd {
id: string;
attachmentsType: string;
fileName: string;
filePath: string;
fileSize: string;
fileType: string;
fileUrl: string;
supplierId: string;
id?: string;
attachmentsType?: string;
fileName?: string;
filePath?: string;
fileSize?: string;
fileType?: string;
fileUrl?: string;
supplierId?: string;
delFlag?: string;
[property: string]: any;
}
export const attachmentsAdd = (data: attachmentsAdd) => request.post('/attachments', { data });
@ -231,17 +236,6 @@ export const updateSupplierBase = (data: updateSupplierBase) => request.post('/c