2025-06-30 18:42:21 +08:00
|
|
|
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';
|
2025-08-08 18:35:02 +08:00
|
|
|
import GridCreate from './modals/GridCreate';
|
|
|
|
|
import GridMannger from './modals/GridMannger';
|
|
|
|
|
import GridCreateUpdate from './modals/GridUpdate';
|
2025-06-30 18:42:21 +08:00
|
|
|
|
|
|
|
|
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(
|
2025-07-16 10:18:01 +08:00
|
|
|
{ ...params, asset_projects_id: rest.item?.id },
|
2025-06-30 18:42:21 +08:00
|
|
|
sort,
|
|
|
|
|
Apis.Grid.Grids.List,
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
toolBarRender={(action) => [
|
|
|
|
|
<GridCreate key="Create" item={rest.item} reload={action?.reload} />,
|
|
|
|
|
]}
|
|
|
|
|
search={false}
|
|
|
|
|
columns={[
|
|
|
|
|
{
|
|
|
|
|
title: '网格ID',
|
|
|
|
|
dataIndex: 'id',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '网格名称',
|
|
|
|
|
dataIndex: 'name',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '网格标识',
|
|
|
|
|
dataIndex: 'grid_mark',
|
|
|
|
|
},
|
2025-07-16 10:18:01 +08:00
|
|
|
{
|
|
|
|
|
title: '网格员',
|
|
|
|
|
dataIndex: ['company_employee', 'name'],
|
|
|
|
|
render: (_, item: any) =>
|
|
|
|
|
`${item?.company_employee?.name || ''}-${
|
|
|
|
|
item?.company_employee?.phone || ''
|
|
|
|
|
}`,
|
|
|
|
|
},
|
|
|
|
|
// MyColumns.CreatedAt(),
|
2025-06-30 18:42:21 +08:00
|
|
|
MyColumns.UpdatedAt(),
|
|
|
|
|
MyColumns.Option({
|
|
|
|
|
render: (_, item: any, index, action) => (
|
|
|
|
|
<Space key={index}>
|
|
|
|
|
<GridCreateUpdate item={item} reload={action?.reload} />
|
2025-07-16 10:18:01 +08:00
|
|
|
<GridMannger item={item} reload={action?.reload} />
|
2025-06-30 18:42:21 +08:00
|
|
|
<MyButtons.Delete
|
|
|
|
|
onConfirm={() =>
|
2025-07-17 13:58:54 +08:00
|
|
|
Apis.Grid.Grids.Delete({ id: item.id }).then(() =>
|
2025-06-30 18:42:21 +08:00
|
|
|
action?.reload(),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
</Space>
|
|
|
|
|
),
|
|
|
|
|
}),
|
|
|
|
|
]}
|
|
|
|
|
/>
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
}
|