All checks were successful
Build and Push Docker Image / build (push) Successful in 3m52s
87 lines
2.4 KiB
TypeScript
87 lines
2.4 KiB
TypeScript
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>
|
||
);
|
||
}
|