uiuJun 60b89dd188
All checks were successful
Build and Push Docker Image / build (push) Successful in 3m29s
feat: 优化
2025-09-18 19:40:30 +08:00

80 lines
2.3 KiB
TypeScript

import { MyButtons, MyColumns, MyProTableProps } from '@/common';
import { Apis } from '@/gen/Apis';
import { ProTable } from '@ant-design/pro-components';
import { Space } from 'antd';
import { useEffect, useRef } from 'react';
import GridCreate from '../../grids/modals/GridCreate';
import GridMannger from '../../grids/modals/GridMannger';
import GridCreateUpdate from '../../grids/modals/GridUpdate';
export default function Index({ ...rest }) {
const actionLooks = useRef<any>();
useEffect(() => {
actionLooks?.current.reloadAndRest();
}, [rest.loadmore]);
return (
<>
<ProTable<Record<any, any>>
{...MyProTableProps.props}
actionRef={actionLooks}
request={async (params, sort) =>
MyProTableProps.request(
{ ...params, asset_projects_id: rest.item?.id },
sort,
Apis.Grid.Grids.List,
)
}
toolBarRender={(action) => [
<GridCreate
key="Create"
item={rest.item}
reload={action?.reload}
title="楼栋划分"
/>,
]}
search={false}
columns={[
{
title: 'ID',
dataIndex: 'id',
},
{
title: '板块名称',
dataIndex: 'name',
},
{
title: '板块标识',
dataIndex: 'grid_mark',
},
{
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}>
<GridCreateUpdate 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>
),
}),
]}
/>
</>
);
}