uiuJun b8407eeba7
All checks were successful
Build and Push Docker Image / build (push) Successful in 3m52s
fix:部分列表删除接口错误
2025-10-09 23:24:10 +08:00

87 lines
2.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import {
MyButtons,
MyColumns,
MyPageContainer,
MyProTableProps,
usePageTabs,
} from '@/common';
import { Apis } from '@/gen/Apis';
import { ProTable } from '@ant-design/pro-components';
import { useNavigate } from '@umijs/max';
import { Space } from 'antd';
import GridCreate from './modals/GridCreate';
import GridMannger from './modals/GridMannger';
import GridShow from './modals/GridShow';
import GridUpdate from './modals/GridUpdate';
export default function Index({ title = '楼栋范围' }) {
const navigate = useNavigate();
// 注册当前页面为标签页
usePageTabs({
tabKey: 'grids',
tabLabel: title,
});
return (
<MyPageContainer
title={title}
enableTabs={true}
tabKey="grids"
tabLabel={title}
>
<ProTable
{...MyProTableProps.props}
request={async (params, sort) =>
MyProTableProps.request(params, sort, Apis.Grid.Grids.List)
}
toolBarRender={(action) => [
<GridCreate key="Select" reload={action?.reload} title="楼栋划分" />,
]}
columns={[
MyColumns.ID(),
{
title: '关联项目',
dataIndex: ['asset_project', 'name'],
search: {
transform: (value) => {
return { project_name: value };
},
},
},
{
title: '板块名称',
dataIndex: 'name',
},
{
title: '楼栋管家',
dataIndex: ['company_employee', 'name'],
render: (_, item: any) =>
`${item?.company_employee?.name || ''}${
item?.company_employee?.phone || ''
}`,
},
// MyColumns.CreatedAt(),
MyColumns.UpdatedAt(),
MyColumns.Option({
render: (_, item: any, index, action) => (
<Space key={index}>
<GridShow item={item} reload={action?.reload} />
<GridUpdate item={item} reload={action?.reload} />
<GridMannger item={item} reload={action?.reload} />
<MyButtons.Delete
onConfirm={() =>
Apis.Grid.Grids.Delete({ id: item.id }).then(() =>
action?.reload(),
)
}
/>
</Space>
),
}),
]}
/>
</MyPageContainer>
);
}