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

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,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>
)}
</>
),
},