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

137 lines
4.1 KiB
TypeScript

import {
MyButtons,
MyColumns,
MyPageContainer,
MyProTableProps,
usePageTabs,
} from '@/common';
import { Apis } from '@/gen/Apis';
import { AssetProjectsPropertyTypeEnum } from '@/gen/Enums';
import { ProTable } from '@ant-design/pro-components';
import { Space } from 'antd';
import { useNavigate } from 'react-router-dom';
import AssetInfo from './components/AssetInfo';
import AssetCreate from './modals/AssetCreate';
import AssetUpdate from './modals/AssetUpdate';
export default function Index({ title = '项目列表' }) {
const navigate = useNavigate();
// 注册当前页面为标签页
usePageTabs({
tabKey: 'asset-projects',
tabLabel: title,
});
return (
<MyPageContainer title={title}>
<ProTable
{...MyProTableProps.props}
// search={false}
request={async (params, sort) =>
MyProTableProps.request(params, sort, Apis.Asset.AssetProjects.List)
}
// headerTitle="项目列表"
toolBarRender={(action) => [
<AssetCreate key="Create" reload={action?.reload} title={'项目'} />,
]}
columns={[
MyColumns.ID(),
MyColumns.EnumTag({
title: '类型',
dataIndex: 'property_type',
valueEnum: AssetProjectsPropertyTypeEnum,
search: false,
}),
{
title: '项目名称',
dataIndex: 'name',
},
// {
// title: '项目别名',
// dataIndex: 'alias_name',
// },
{
title: '地址',
render: (_, i: any) => {
return `${i?.province || ''}${i?.city || ''}${i?.district || ''}${
i?.address || ''
}`;
},
search: false,
},
// MyColumns.EnumTag({
// title: '项目状态',
// dataIndex: 'status',
// valueEnum: AssetProjectsStatusEnum,
// search: false,
// }),
// MyColumns.EnumTag({
// title: '委托类型',
// dataIndex: 'entrust_type',
// valueEnum: AssetProjectsEntrustTypeEnum,
// search: false,
// }),
// MyColumns.EnumTag({
// title: '收费方式',
// dataIndex: 'charge',
// valueEnum: AssetProjectsChargeEnum,
// search: false,
// }),
MyColumns.SoftDelete({
title: '启/禁用',
onRestore: Apis.Asset.AssetProjects.Restore,
onSoftDelete: Apis.Asset.AssetProjects.SoftDelete,
search: false,
}),
{
title: '物业品牌',
dataIndex: ['company_property_brand', 'name'],
search: false,
},
{
title: '关联机构',
dataIndex: ['company', 'name'],
search: {
transform: (value) => {
return { company_name: value };
},
},
},
// {
// title: '接管日期',
// dataIndex: 'takeover_date',
// search:false,
// },
// {
// title: '封园日期',
// dataIndex: 'closure_date',
// search:false,
// },
MyColumns.CreatedAt(),
MyColumns.Option({
render: (_, item: any, index, action) => (
<Space key={index}>
<AssetInfo item={item} title="查看" reload={action?.reload} />
<AssetUpdate item={item} title="项目" reload={action?.reload} />
<MyButtons.View
title="配置"
onClick={() => {
navigate(`/asset/list/show/${item.id}`);
}}
/>
<MyButtons.Delete
onConfirm={() =>
Apis.Common.Admins.Delete({ id: item.id }).then(() =>
action?.reload(),
)
}
/>
</Space>
),
}),
]}
/>
</MyPageContainer>
);
}