2026-01-08 16:35:06 +08:00
|
|
|
import {
|
|
|
|
|
MyButtons,
|
|
|
|
|
MyColumns,
|
|
|
|
|
MyPageContainer,
|
|
|
|
|
MyProTableProps,
|
|
|
|
|
useCurrentPermissions,
|
|
|
|
|
} from '@/common';
|
2026-01-18 18:48:42 +08:00
|
|
|
import { MyExport } from '@/components/MyExport';
|
2026-01-08 16:35:06 +08:00
|
|
|
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';
|
2026-01-18 18:48:42 +08:00
|
|
|
import { useState } from 'react';
|
|
|
|
|
|
|
|
|
|
import SpaceShow from './modals/SpaceShow';
|
2026-01-08 16:35:06 +08:00
|
|
|
import SpaceUpdate from './modals/SpaceUpdate';
|
|
|
|
|
|
|
|
|
|
export default function Index({ title = '车位列表' }) {
|
2026-01-18 18:48:42 +08:00
|
|
|
const [getParams, setParams] = useState({ page: 1 });
|
2026-01-08 16:35:06 +08:00
|
|
|
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) =>
|
2026-01-18 18:48:42 +08:00
|
|
|
MyProTableProps.request(
|
|
|
|
|
params,
|
|
|
|
|
sort,
|
|
|
|
|
Apis.Asset.AssetCarPorts.List,
|
|
|
|
|
setParams,
|
|
|
|
|
)
|
2026-01-08 16:35:06 +08:00
|
|
|
}
|
2026-01-18 18:48:42 +08:00
|
|
|
toolBarRender={(action) => [
|
|
|
|
|
<MyExport
|
|
|
|
|
key="export"
|
|
|
|
|
item={{ current: getParams?.page || 1, ...getParams }}
|
|
|
|
|
reload={action?.reload}
|
|
|
|
|
download={Apis.Asset.AssetCarPorts}
|
|
|
|
|
/>,
|
|
|
|
|
// <Create key="Create" reload={action?.reload} title="车场" />,
|
|
|
|
|
]}
|
2026-01-08 16:35:06 +08:00
|
|
|
columns={[
|
|
|
|
|
MyColumns.ID({ search: false }),
|
|
|
|
|
Selects?.AssetProjects({
|
|
|
|
|
title: '选择项目',
|
|
|
|
|
key: 'asset_projects_id',
|
|
|
|
|
hidden: true,
|
|
|
|
|
}),
|
|
|
|
|
{
|
|
|
|
|
title: '项目名称',
|
|
|
|
|
dataIndex: ['asset_project', 'name'],
|
2026-01-18 18:48:42 +08:00
|
|
|
// search: {
|
|
|
|
|
// transform: (value) => {
|
|
|
|
|
// return { project_name: value };
|
|
|
|
|
// },
|
|
|
|
|
// },
|
|
|
|
|
search: false,
|
2026-01-08 16:35:06 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
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) => (
|
2026-01-18 18:48:42 +08:00
|
|
|
<Space key={index}>
|
|
|
|
|
<SpaceShow item={item} reload={action?.reload} title={title} />
|
|
|
|
|
{tableRender(item, action)}
|
|
|
|
|
</Space>
|
2026-01-08 16:35:06 +08:00
|
|
|
),
|
|
|
|
|
}),
|
|
|
|
|
]}
|
|
|
|
|
/>
|
|
|
|
|
</MyPageContainer>
|
|
|
|
|
);
|
|
|
|
|
}
|