供应商过坐台地区回显
This commit is contained in:
@ -4,7 +4,7 @@ import type { ColumnsType, TablePaginationConfig } from 'antd/es/table';
|
||||
import { invoiceGetPage, invoiceEdit } from '../services';
|
||||
import { useIntl } from 'umi';
|
||||
import InvoiceFormModal from './InvoiceFormModal';
|
||||
|
||||
import { getDictList } from '@/servers/api/dicts';
|
||||
interface InvoiceInfo {
|
||||
id: string;
|
||||
taxpayerType: string;
|
||||
@ -76,10 +76,10 @@ const InvoiceTab: React.FC<InvoiceTabProps> = (props) => {
|
||||
setIsViewMode(true);
|
||||
setFormVisible(true);
|
||||
};
|
||||
//是否作废
|
||||
const handleObsoleteChange = async (checked: boolean, id:string) => {
|
||||
//是否作废
|
||||
const handleObsoleteChange = async (checked: boolean, id: string) => {
|
||||
// 调用你的作废接口
|
||||
const res = await invoiceEdit( { id, delFlag: checked? 'normal':'deleted' } );
|
||||
const res = await invoiceEdit({ id, delFlag: checked ? 'normal' : 'deleted' });
|
||||
if (res.code === 200) {
|
||||
message.success('操作成功');
|
||||
getList(pagination.current, pagination.pageSize); // 刷新列表
|
||||
@ -87,16 +87,27 @@ const InvoiceTab: React.FC<InvoiceTabProps> = (props) => {
|
||||
message.error('操作失败');
|
||||
}
|
||||
}
|
||||
const [taxpayerTypeMap, setTaxpayerTypeMap] = useState<{ [code: string]: string }>({});
|
||||
//初始化
|
||||
useEffect(() => {
|
||||
if(record) {
|
||||
if (record) {
|
||||
getDictList('taxpayer_type').then((res) => {
|
||||
if (res.code === 200) {
|
||||
const map: { [code: string]: string } = {};
|
||||
res.data.forEach((item: { code: string, dicName: string }) => {
|
||||
map[item.code] = item.dicName;
|
||||
});
|
||||
setTaxpayerTypeMap(map);
|
||||
}
|
||||
});
|
||||
getList();
|
||||
}
|
||||
}, [record]);
|
||||
|
||||
|
||||
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.taxpayerType', dataIndex: 'taxpayerTypeCn', ellipsis: true },
|
||||
{ title: 'page.workbench.invoice.taxpayerType', dataIndex: 'taxpayerType', ellipsis: true, render: (code: string) => taxpayerTypeMap[code] || code },
|
||||
{ title: 'page.workbench.invoice.taxpayerCode', dataIndex: 'taxpayerCode', ellipsis: true },
|
||||
{ title: 'page.workbench.invoice.head', dataIndex: 'head', ellipsis: true },
|
||||
{ title: 'page.workbench.invoice.address', dataIndex: 'address', ellipsis: true },
|
||||
@ -136,8 +147,8 @@ const InvoiceTab: React.FC<InvoiceTabProps> = (props) => {
|
||||
<>
|
||||
<a style={{ marginRight: 8 }} onClick={() => handleView(record)}>查看</a>
|
||||
{record.delFlag === 'normal' && (
|
||||
<a onClick={() => handleEdit(record)}>修改</a>
|
||||
)}
|
||||
<a onClick={() => handleEdit(record)}>修改</a>
|
||||
)}
|
||||
</>
|
||||
),
|
||||
},
|
||||
|
Reference in New Issue
Block a user