feat:房屋导出功能
All checks were successful
Build and Push Docker Image / build (push) Successful in 5m43s
All checks were successful
Build and Push Docker Image / build (push) Successful in 5m43s
This commit is contained in:
parent
bca4eff39b
commit
036c7b4118
45
src/components/MyExport.tsx
Normal file
45
src/components/MyExport.tsx
Normal file
@ -0,0 +1,45 @@
|
||||
import { Button, Dropdown, MenuProps } from 'antd';
|
||||
|
||||
export const MyExport = (props: any) => {
|
||||
const items: MenuProps['items'] = [
|
||||
{
|
||||
key: '1',
|
||||
label: '当前页(含查询条件)',
|
||||
onClick: () =>
|
||||
props?.keyParams
|
||||
? props?.download?.({ download_type: 'page', ...props?.item })
|
||||
: props?.download?.Export?.({
|
||||
download_type: 'page',
|
||||
...props?.item,
|
||||
}),
|
||||
},
|
||||
{
|
||||
key: '2',
|
||||
label: '所有页(含查询条件)',
|
||||
onClick: () =>
|
||||
props?.keyParams
|
||||
? props?.download?.({ download_type: 'query', ...props?.item })
|
||||
: props?.download?.Export?.({
|
||||
download_type: 'query',
|
||||
...props?.item,
|
||||
}),
|
||||
},
|
||||
{
|
||||
key: '3',
|
||||
label: '所有记录',
|
||||
onClick: () =>
|
||||
props?.keyParams
|
||||
? props?.download?.({ download_type: 'all', ...props?.item })
|
||||
: props?.download?.Export?.({
|
||||
download_type: 'all',
|
||||
...props?.item,
|
||||
}),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<Dropdown menu={{ items }} placement="bottomLeft">
|
||||
<Button type="primary">{props?.title || '导出'}</Button>
|
||||
</Dropdown>
|
||||
);
|
||||
};
|
||||
@ -13,12 +13,12 @@ import AnnouncementCreate from './modals/AnnouncementCreate';
|
||||
import AnnouncementShow from './modals/AnnouncementShow';
|
||||
import AnnouncementUpdate from './modals/AnnouncementUpdate';
|
||||
|
||||
export default function Index({ title = '内容管理' }) {
|
||||
export default function Index({ title = '公告管理' }) {
|
||||
const navigate = useNavigate();
|
||||
|
||||
// 注册当前页面为标签页
|
||||
usePageTabs({
|
||||
tabKey: 'banners',
|
||||
tabKey: 'Msg',
|
||||
tabLabel: title,
|
||||
});
|
||||
|
||||
@ -131,9 +131,9 @@ export default function Index({ title = '内容管理' }) {
|
||||
/>
|
||||
<MyButtons.Delete
|
||||
onConfirm={() =>
|
||||
Apis.Banner.Banners.Delete({ id: item.id }).then(() =>
|
||||
action?.reload(),
|
||||
)
|
||||
Apis.Msg.MsgPropertyAnnouncements.Delete({
|
||||
id: item.id,
|
||||
}).then(() => action?.reload())
|
||||
}
|
||||
/>
|
||||
</Space>
|
||||
|
||||
@ -109,7 +109,7 @@ export default function Index({ title = '项目列表' }) {
|
||||
<AssetInfo item={item} title="查看" reload={action?.reload} />
|
||||
<AssetUpdate item={item} title="项目" reload={action?.reload} />
|
||||
<MyButtons.View
|
||||
title="楼栋"
|
||||
title="配置"
|
||||
onClick={() => {
|
||||
navigate(`/asset/${item.id}`);
|
||||
}}
|
||||
|
||||
@ -1,22 +1,26 @@
|
||||
import {
|
||||
MyButtons,
|
||||
MyColumns,
|
||||
MyPageContainer,
|
||||
MyProTableProps,
|
||||
usePageTabs,
|
||||
} from '@/common';
|
||||
import { MyExport } from '@/components/MyExport';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import {
|
||||
AssetHousesOrientationEnum,
|
||||
AssetHousesOwnershipTypeEnum,
|
||||
AssetHousesUsageEnum,
|
||||
} from '@/gen/Enums';
|
||||
import { ProTable } from '@ant-design/pro-components';
|
||||
import { useNavigate } from '@umijs/max';
|
||||
import { Space } from 'antd';
|
||||
import { useState } from 'react';
|
||||
import HousesShow from '../asset/components/modals/HousesShow';
|
||||
import HousesUpdate from '../asset/components/modals/HousesUpdate';
|
||||
|
||||
export default function Index({ title = '房屋列表' }) {
|
||||
const [getParams, setParams] = useState({});
|
||||
|
||||
const navigate = useNavigate();
|
||||
// 注册当前页面为标签页
|
||||
usePageTabs({
|
||||
@ -27,9 +31,21 @@ export default function Index({ title = '房屋列表' }) {
|
||||
<MyPageContainer title={title}>
|
||||
<ProTable
|
||||
{...MyProTableProps.props}
|
||||
request={async (params, sort) =>
|
||||
MyProTableProps.request(params, sort, Apis.Asset.AssetHouses.List)
|
||||
}
|
||||
request={async (params, sort) => {
|
||||
setParams(params);
|
||||
return MyProTableProps.request(
|
||||
params,
|
||||
sort,
|
||||
Apis.Asset.AssetHouses.List,
|
||||
);
|
||||
}}
|
||||
toolBarRender={() => [
|
||||
<MyExport
|
||||
key="export"
|
||||
item={getParams}
|
||||
download={Apis.Asset.AssetHouses}
|
||||
/>,
|
||||
]}
|
||||
columns={[
|
||||
MyColumns.ID(),
|
||||
{
|
||||
@ -64,7 +80,9 @@ export default function Index({ title = '房屋列表' }) {
|
||||
title: '建筑面积',
|
||||
dataIndex: 'built_area',
|
||||
render(_, record) {
|
||||
return `${record?.built_area || ''} m²`;
|
||||
return `${
|
||||
record?.built_area ? record?.built_area + ' m²' : '-'
|
||||
} `;
|
||||
},
|
||||
search: false,
|
||||
},
|
||||
@ -72,7 +90,9 @@ export default function Index({ title = '房屋列表' }) {
|
||||
title: '套内面积',
|
||||
dataIndex: 'inside_area',
|
||||
render(_, record) {
|
||||
return `${record?.inside_area || ''} m²`;
|
||||
return `${
|
||||
record?.inside_area ? record?.inside_area + ' m²' : '-'
|
||||
} `;
|
||||
},
|
||||
search: false,
|
||||
},
|
||||
@ -80,25 +100,27 @@ export default function Index({ title = '房屋列表' }) {
|
||||
title: '计费面积',
|
||||
dataIndex: 'chargeable_area',
|
||||
render(_, record) {
|
||||
return `${record?.chargeable_area || ''} m²`;
|
||||
return `${
|
||||
record?.chargeable_area ? record?.chargeable_area + ' m²' : '-'
|
||||
} `;
|
||||
},
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: '户型',
|
||||
render(_, record) {
|
||||
return `${record?.room || ''}室${record?.hall || ''}厅${
|
||||
record?.bathroom || ''
|
||||
}卫${record?.kitchen || ''}厨${record?.balcony || ''}阳台`;
|
||||
return `${record?.room || 'x'}室${record?.hall || 'x'}厅${
|
||||
record?.bathroom || 'x'
|
||||
}卫${record?.kitchen || 'x'}厨${record?.balcony || 'x'}阳台`;
|
||||
},
|
||||
search: false,
|
||||
},
|
||||
MyColumns.EnumTag({
|
||||
title: '朝向',
|
||||
dataIndex: 'orientation',
|
||||
valueEnum: AssetHousesOrientationEnum,
|
||||
search: false,
|
||||
}),
|
||||
// MyColumns.EnumTag({
|
||||
// title: '朝向',
|
||||
// dataIndex: 'orientation',
|
||||
// valueEnum: AssetHousesOrientationEnum,
|
||||
// search: false,
|
||||
// }),
|
||||
// MyColumns.EnumTag({
|
||||
// title: '房屋状态',
|
||||
// dataIndex: 'status',
|
||||
@ -129,6 +151,13 @@ export default function Index({ title = '房屋列表' }) {
|
||||
reload={action?.reload}
|
||||
title="编辑"
|
||||
/>
|
||||
<MyButtons.Delete
|
||||
onConfirm={() =>
|
||||
Apis.Asset.AssetHouses.Delete({
|
||||
id: item.id,
|
||||
}).then(() => action?.reload())
|
||||
}
|
||||
/>
|
||||
</Space>
|
||||
),
|
||||
}),
|
||||
|
||||
@ -30,7 +30,7 @@ export default function Create(props: MyBetaModalFormProps) {
|
||||
Apis.Company.CompanyReceiptAccounts.Store({
|
||||
...values,
|
||||
companies_id: props?.item?.id,
|
||||
is_default: values.is_default ? 1 : 0,
|
||||
is_default: 0,
|
||||
})
|
||||
.then(() => {
|
||||
props.reload?.();
|
||||
|
||||
@ -31,6 +31,7 @@ export default function Update(props: MyBetaModalFormProps) {
|
||||
...values,
|
||||
companies_id: props?.item?.companies_id,
|
||||
id: props.item?.id ?? 0,
|
||||
is_default: 0,
|
||||
})
|
||||
.then(() => {
|
||||
props.reload?.();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user