公司信息 列表作废以及基本信息 营业执照
This commit is contained in:
@ -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' }}>
|
||||
|
Reference in New Issue
Block a user