117 lines
3.3 KiB
TypeScript
117 lines
3.3 KiB
TypeScript
|
|
import {
|
||
|
|
MyButtons,
|
||
|
|
MyColumns,
|
||
|
|
MyPageContainer,
|
||
|
|
MyProTableProps,
|
||
|
|
useCurrentPermissions,
|
||
|
|
} from '@/common';
|
||
|
|
import { Selects } from '@/components/Select';
|
||
|
|
import { Apis } from '@/gen/Apis';
|
||
|
|
import {
|
||
|
|
AssetCarPortsPropertyTypeEnum,
|
||
|
|
AssetCarPortsStatusEnum,
|
||
|
|
AssetCarPortsTypeEnum,
|
||
|
|
} from '@/gen/Enums';
|
||
|
|
import { ProTable } from '@ant-design/pro-components';
|
||
|
|
import { Space } from 'antd';
|
||
|
|
import SpaceUpdate from './modals/SpaceUpdate';
|
||
|
|
|
||
|
|
export default function Index({ title = '车位列表' }) {
|
||
|
|
const getCurrentPermissions = useCurrentPermissions();
|
||
|
|
let tableRender = (item: any, action: any) => {
|
||
|
|
return getCurrentPermissions({
|
||
|
|
update: <SpaceUpdate item={item} reload={action?.reload} title={title} />,
|
||
|
|
delete: (
|
||
|
|
<MyButtons.Delete
|
||
|
|
onConfirm={() =>
|
||
|
|
Apis.Asset.AssetCarPorts.Delete({
|
||
|
|
id: item.id,
|
||
|
|
}).then(() => action?.reload())
|
||
|
|
}
|
||
|
|
/>
|
||
|
|
),
|
||
|
|
});
|
||
|
|
};
|
||
|
|
return (
|
||
|
|
<MyPageContainer
|
||
|
|
title={title}
|
||
|
|
enableTabs={true}
|
||
|
|
tabKey="asset_parking_places"
|
||
|
|
tabLabel={title}
|
||
|
|
>
|
||
|
|
<ProTable
|
||
|
|
{...MyProTableProps.props}
|
||
|
|
headerTitle="车位列表"
|
||
|
|
tooltip="车位列表的信息管理,请在【项目列表】的【配置】中进行操作"
|
||
|
|
request={async (params, sort) =>
|
||
|
|
MyProTableProps.request(params, sort, Apis.Asset.AssetCarPorts.List)
|
||
|
|
}
|
||
|
|
// toolBarRender={(action) => [
|
||
|
|
// <Create key="Create" reload={action?.reload} title="车场" />,
|
||
|
|
// ]}
|
||
|
|
columns={[
|
||
|
|
MyColumns.ID({ search: false }),
|
||
|
|
Selects?.AssetProjects({
|
||
|
|
title: '选择项目',
|
||
|
|
key: 'asset_projects_id',
|
||
|
|
hidden: true,
|
||
|
|
}),
|
||
|
|
{
|
||
|
|
title: '项目名称',
|
||
|
|
dataIndex: ['asset_project', 'name'],
|
||
|
|
search: {
|
||
|
|
transform: (value) => {
|
||
|
|
return { project_name: value };
|
||
|
|
},
|
||
|
|
},
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: '车场名称',
|
||
|
|
dataIndex: ['asset_parking_place', 'name'],
|
||
|
|
search: {
|
||
|
|
transform: (value) => {
|
||
|
|
return { parking_place_name: value };
|
||
|
|
},
|
||
|
|
},
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: '车位号',
|
||
|
|
dataIndex: 'name',
|
||
|
|
search: false,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: '车位全称',
|
||
|
|
dataIndex: 'full_name',
|
||
|
|
},
|
||
|
|
{
|
||
|
|
title: '建筑面积',
|
||
|
|
dataIndex: 'built_area',
|
||
|
|
search: false,
|
||
|
|
},
|
||
|
|
MyColumns.EnumTag({
|
||
|
|
title: '类型',
|
||
|
|
dataIndex: 'type',
|
||
|
|
valueEnum: AssetCarPortsTypeEnum,
|
||
|
|
}),
|
||
|
|
MyColumns.EnumTag({
|
||
|
|
title: '产权类型',
|
||
|
|
dataIndex: 'property_type',
|
||
|
|
valueEnum: AssetCarPortsPropertyTypeEnum,
|
||
|
|
}),
|
||
|
|
MyColumns.EnumTag({
|
||
|
|
title: '状态',
|
||
|
|
dataIndex: 'status',
|
||
|
|
valueEnum: AssetCarPortsStatusEnum,
|
||
|
|
}),
|
||
|
|
MyColumns.CreatedAt(),
|
||
|
|
MyColumns.Option({
|
||
|
|
render: (_, item: any, index, action) => (
|
||
|
|
<Space key={index}>{tableRender(item, action)}</Space>
|
||
|
|
),
|
||
|
|
}),
|
||
|
|
]}
|
||
|
|
/>
|
||
|
|
</MyPageContainer>
|
||
|
|
);
|
||
|
|
}
|