fix:楼栋划分 bug、调整房屋 show 页面实现方式
Some checks failed
Build and Push Docker Image / build (push) Failing after 3m51s
Some checks failed
Build and Push Docker Image / build (push) Failing after 3m51s
This commit is contained in:
parent
fcaee2806f
commit
3350f99f61
@ -6,7 +6,8 @@ type ReturnType = ProColumns<Record<string, any>, 'text'>;
|
||||
|
||||
export const MyColumns = {
|
||||
ID(props?: ReturnType): ReturnType {
|
||||
return { title: 'ID', dataIndex: 'id', hideInSearch: true, ...props };
|
||||
// return { title: 'ID', dataIndex: 'id', hideInSearch: true, ...props };
|
||||
return { title: 'ID', dataIndex: 'id', ...props };
|
||||
},
|
||||
DayStatus: (start: string, end: string) => {
|
||||
const now = new Date();
|
||||
|
||||
@ -586,14 +586,20 @@ export const Selects = {
|
||||
valueType: 'select',
|
||||
hideInTable: hideInTable,
|
||||
formItemProps: { ...(required ? rulesHelper.number : {}) },
|
||||
request: async (params) =>
|
||||
(
|
||||
await Apis.Meter.HouseMeters.List({
|
||||
keywords: params?.KeyWords,
|
||||
...params,
|
||||
asset_projects_id: params?.asset_projects_id,
|
||||
})
|
||||
).data,
|
||||
|
||||
request: async (params) => {
|
||||
let res = await Apis.Meter.HouseMeters.List({
|
||||
keywords: params?.KeyWords,
|
||||
asset_projects_id: params?.asset_projects_id,
|
||||
charge_standards_id: params?.house_charge_standards_id,
|
||||
...params,
|
||||
});
|
||||
res?.data?.map((l: any) => {
|
||||
l.label = l.id + ':' + l.name;
|
||||
l.value = l.house_meter_has_houses[0].asset_houses_id;
|
||||
});
|
||||
return res?.data;
|
||||
},
|
||||
...rest,
|
||||
fieldProps: {
|
||||
showSearch: true,
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
import { MyBetaModalFormProps, renderTextHelper } from '@/common';
|
||||
import { MyModal } from '@/components/MyModal';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import {
|
||||
AssetHousesOrientationEnum,
|
||||
AssetHousesOwnershipTypeEnum,
|
||||
@ -7,63 +8,96 @@ import {
|
||||
AssetHousesUsageEnum,
|
||||
} from '@/gen/Enums';
|
||||
import { ProCard, ProDescriptions } from '@ant-design/pro-components';
|
||||
import { Space } from 'antd';
|
||||
import { useCallback, useState } from 'react';
|
||||
|
||||
export default function info(props: MyBetaModalFormProps) {
|
||||
const [show, setShow] = useState<any>({});
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const getShow = useCallback(() => {
|
||||
if (loading || !props?.item?.id) return;
|
||||
|
||||
setLoading(true);
|
||||
Apis.Asset.AssetHouses.Show({
|
||||
id: props?.item?.id,
|
||||
})
|
||||
.then((res) => {
|
||||
setShow(res?.data);
|
||||
})
|
||||
.catch(() => {
|
||||
return false;
|
||||
})
|
||||
.finally(() => {
|
||||
setLoading(false);
|
||||
});
|
||||
}, [props?.item?.id, loading]);
|
||||
|
||||
// 只在弹窗打开时获取数据
|
||||
const handleOpen = useCallback(() => {
|
||||
if (!loading) {
|
||||
getShow();
|
||||
}
|
||||
}, [getShow, loading]);
|
||||
|
||||
return (
|
||||
<MyModal
|
||||
title={props.title || '查看'}
|
||||
width="1000px"
|
||||
width="800px"
|
||||
onOpen={handleOpen}
|
||||
node={
|
||||
<ProCard extra={props.extra}>
|
||||
<ProDescriptions bordered>
|
||||
<ProDescriptions.Item label="房屋全名" span={2}>
|
||||
{props?.item?.full_name}
|
||||
<Space>
|
||||
<span>【{show?.id}】</span>
|
||||
{show?.full_name}
|
||||
</Space>
|
||||
</ProDescriptions.Item>
|
||||
<ProDescriptions.Item label="房号">
|
||||
{props?.item?.name}
|
||||
{show?.name}
|
||||
</ProDescriptions.Item>
|
||||
<ProDescriptions.Item label="楼层">
|
||||
{props?.item?.floor}
|
||||
{show?.floor}
|
||||
</ProDescriptions.Item>
|
||||
<ProDescriptions.Item label="房屋用途">
|
||||
<renderTextHelper.Tag
|
||||
Enums={AssetHousesUsageEnum}
|
||||
value={props?.item?.usage}
|
||||
value={show?.usage}
|
||||
key="usage"
|
||||
/>
|
||||
</ProDescriptions.Item>
|
||||
<ProDescriptions.Item label="产权性质">
|
||||
<renderTextHelper.Tag
|
||||
Enums={AssetHousesOwnershipTypeEnum}
|
||||
value={props?.item?.ownership_type}
|
||||
value={show?.ownership_type}
|
||||
key="ownership_type"
|
||||
/>
|
||||
</ProDescriptions.Item>
|
||||
<ProDescriptions.Item label="建筑面积">
|
||||
{props?.item?.built_area}m²
|
||||
{show?.built_area}m²
|
||||
</ProDescriptions.Item>
|
||||
<ProDescriptions.Item label="套内面积">
|
||||
{props?.item?.inside_area}m²
|
||||
{show?.inside_area}m²
|
||||
</ProDescriptions.Item>
|
||||
<ProDescriptions.Item label="计费面积">
|
||||
{props?.item?.chargeable_area}m²
|
||||
{show?.chargeable_area}m²
|
||||
</ProDescriptions.Item>
|
||||
<ProDescriptions.Item label="房屋状态">
|
||||
<renderTextHelper.Tag
|
||||
Enums={AssetHousesStatusEnum}
|
||||
value={props?.item?.status}
|
||||
value={show?.status}
|
||||
key="status"
|
||||
/>
|
||||
</ProDescriptions.Item>
|
||||
<ProDescriptions.Item label="户型">
|
||||
{props?.item?.room || ''}房{props?.item?.hall || ''}厅
|
||||
{props?.item?.bathroom || ''}卫{props?.item?.kitchen || ''}厨
|
||||
{props?.item?.balcony || ''}阳台
|
||||
{show?.room || ''}房{show?.hall || ''}厅{show?.bathroom || ''}卫
|
||||
{show?.kitchen || ''}厨{show?.balcony || ''}阳台
|
||||
</ProDescriptions.Item>
|
||||
<ProDescriptions.Item label="朝向">
|
||||
<renderTextHelper.Tag
|
||||
Enums={AssetHousesOrientationEnum}
|
||||
value={props?.item?.orientation}
|
||||
value={show?.orientation}
|
||||
key="orientation"
|
||||
/>
|
||||
</ProDescriptions.Item>
|
||||
|
||||
@ -11,6 +11,7 @@ import { useNavigate } from '@umijs/max';
|
||||
import { Space } from 'antd';
|
||||
import GridCreate from './modals/GridCreate';
|
||||
import GridMannger from './modals/GridMannger';
|
||||
import GridShow from './modals/GridShow';
|
||||
import GridUpdate from './modals/GridUpdate';
|
||||
|
||||
export default function Index({ title = '楼栋范围' }) {
|
||||
@ -72,6 +73,7 @@ export default function Index({ title = '楼栋范围' }) {
|
||||
MyColumns.Option({
|
||||
render: (_, item: any, index, action) => (
|
||||
<Space key={index}>
|
||||
<GridShow item={item} reload={action?.reload} />
|
||||
<GridUpdate item={item} reload={action?.reload} />
|
||||
<GridMannger item={item} reload={action?.reload} />
|
||||
<MyButtons.Delete
|
||||
|
||||
97
src/pages/asset/grids/modals/GridShow.tsx
Normal file
97
src/pages/asset/grids/modals/GridShow.tsx
Normal file
@ -0,0 +1,97 @@
|
||||
import { MyBetaModalFormProps, renderTextHelper } from '@/common';
|
||||
import { MyModal } from '@/components/MyModal';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import {
|
||||
AssetHousesOrientationEnum,
|
||||
AssetHousesOwnershipTypeEnum,
|
||||
AssetHousesStatusEnum,
|
||||
AssetHousesUsageEnum,
|
||||
} from '@/gen/Enums';
|
||||
import { ProCard, ProDescriptions } from '@ant-design/pro-components';
|
||||
import { Space } from 'antd';
|
||||
import { useState } from 'react';
|
||||
|
||||
export default function info(props: MyBetaModalFormProps) {
|
||||
const [show, setShow] = useState<any>({});
|
||||
const getShow = () => {
|
||||
Apis.Grid.Grids.Show({
|
||||
id: props?.item?.id,
|
||||
})
|
||||
.then((res) => {
|
||||
setShow(res?.data);
|
||||
})
|
||||
.catch(() => false);
|
||||
};
|
||||
|
||||
// 只在弹窗打开时获取数据
|
||||
const handleOpen = () => {
|
||||
getShow();
|
||||
};
|
||||
|
||||
return (
|
||||
<MyModal
|
||||
title={props.title || '查看'}
|
||||
width="800px"
|
||||
onOpen={handleOpen}
|
||||
node={
|
||||
<ProCard extra={props.extra}>
|
||||
<ProDescriptions bordered>
|
||||
<ProDescriptions.Item label="房屋全名" span={2}>
|
||||
<Space>
|
||||
<span>【{show?.id}】</span>
|
||||
{show?.name}
|
||||
</Space>
|
||||
</ProDescriptions.Item>
|
||||
<ProDescriptions.Item label="房号">
|
||||
{show?.name}
|
||||
</ProDescriptions.Item>
|
||||
<ProDescriptions.Item label="楼层">
|
||||
{show?.floor}
|
||||
</ProDescriptions.Item>
|
||||
<ProDescriptions.Item label="房屋用途">
|
||||
<renderTextHelper.Tag
|
||||
Enums={AssetHousesUsageEnum}
|
||||
value={show?.usage}
|
||||
key="usage"
|
||||
/>
|
||||
</ProDescriptions.Item>
|
||||
<ProDescriptions.Item label="产权性质">
|
||||
<renderTextHelper.Tag
|
||||
Enums={AssetHousesOwnershipTypeEnum}
|
||||
value={show?.ownership_type}
|
||||
key="ownership_type"
|
||||
/>
|
||||
</ProDescriptions.Item>
|
||||
<ProDescriptions.Item label="建筑面积">
|
||||
{show?.built_area}m²
|
||||
</ProDescriptions.Item>
|
||||
<ProDescriptions.Item label="套内面积">
|
||||
{show?.inside_area}m²
|
||||
</ProDescriptions.Item>
|
||||
<ProDescriptions.Item label="计费面积">
|
||||
{show?.chargeable_area}m²
|
||||
</ProDescriptions.Item>
|
||||
<ProDescriptions.Item label="房屋状态">
|
||||
<renderTextHelper.Tag
|
||||
Enums={AssetHousesStatusEnum}
|
||||
value={show?.status}
|
||||
key="status"
|
||||
/>
|
||||
</ProDescriptions.Item>
|
||||
<ProDescriptions.Item label="户型">
|
||||
{show?.room || ''}房{show?.hall || ''}厅{show?.bathroom || ''}卫
|
||||
{show?.kitchen || ''}厨{show?.balcony || ''}阳台
|
||||
</ProDescriptions.Item>
|
||||
<ProDescriptions.Item label="朝向">
|
||||
<renderTextHelper.Tag
|
||||
Enums={AssetHousesOrientationEnum}
|
||||
value={show?.orientation}
|
||||
key="orientation"
|
||||
/>
|
||||
</ProDescriptions.Item>
|
||||
</ProDescriptions>
|
||||
</ProCard>
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@ -39,12 +39,30 @@ export default function Update(props: MyBetaModalFormProps) {
|
||||
}}
|
||||
onFinish={async (values: any) => {
|
||||
console.log(values);
|
||||
// values?.grid_ranges?.map((res: { asset_projects_id: string }) => {
|
||||
// res.asset_projects_id = props?.item?.id;
|
||||
// });
|
||||
// 确保grid_ranges是正确的对象数组格式
|
||||
if (
|
||||
values.grid_ranges &&
|
||||
Array.isArray(values.grid_ranges) &&
|
||||
typeof values.grid_ranges[0] === 'number'
|
||||
) {
|
||||
// 如果是ID数组,需要转换为对象数组
|
||||
const dataSource = form.getFieldValue('_dataSource') || [];
|
||||
const grid_ranges = values.grid_ranges.map((id: any) => {
|
||||
const unit = dataSource.find(
|
||||
(item: any) => item.asset_units_id === id.toString(),
|
||||
);
|
||||
return {
|
||||
asset_projects_id: props?.item?.asset_projects_id,
|
||||
asset_buildings_id: unit?.asset_buildings_id,
|
||||
asset_units_id: id.toString(),
|
||||
};
|
||||
});
|
||||
values.grid_ranges = grid_ranges;
|
||||
}
|
||||
|
||||
return Apis.Grid.Grids.Update({
|
||||
...values,
|
||||
asset_projects_id: props?.item?.id || values?.asset_projects_id,
|
||||
asset_projects_id: props?.item?.asset_projects_id,
|
||||
id: props?.item?.id,
|
||||
})
|
||||
.then(() => {
|
||||
|
||||
@ -1,20 +1,25 @@
|
||||
import { MyBetaModalFormProps } from '@/common';
|
||||
import HousesShow from '@/pages/asset/dictionary/modals/HousesShow';
|
||||
import { ProCard, ProDescriptions } from '@ant-design/pro-components';
|
||||
import { Space } from 'antd';
|
||||
|
||||
export default function info(props: MyBetaModalFormProps) {
|
||||
const { item } = props;
|
||||
|
||||
// 添加调试日志
|
||||
console.log('BillInfo props:', props);
|
||||
console.log('BillInfo 11111111:', item);
|
||||
|
||||
return (
|
||||
<Space direction="vertical" style={{ width: '100%' }}>
|
||||
<ProCard title="基本信息">
|
||||
<ProDescriptions bordered>
|
||||
<ProDescriptions.Item label="房屋名称" span={2}>
|
||||
{item?.asset_house?.full_name || '-'}
|
||||
<Space>
|
||||
{item?.asset_house?.full_name || '-'}
|
||||
{item?.asset_houses_id && (
|
||||
<HousesShow
|
||||
item={{ id: item?.asset_houses_id }}
|
||||
reload={props?.reload}
|
||||
/>
|
||||
)}
|
||||
</Space>
|
||||
</ProDescriptions.Item>
|
||||
<ProDescriptions.Item label="应付金额">
|
||||
{item?.total_payable_sum || '-'}
|
||||
|
||||
@ -11,11 +11,13 @@ import {
|
||||
HouseChargeTasksTypeEnum,
|
||||
} from '@/gen/Enums';
|
||||
import { ProTable } from '@ant-design/pro-components';
|
||||
import { useNavigate } from '@umijs/max';
|
||||
import { Space } from 'antd';
|
||||
import TaskCreate from './modals/TaskCreate';
|
||||
import TaskShow from './modals/TaskShow';
|
||||
|
||||
export default function Index({ title = '账单任务' }) {
|
||||
const navigate = useNavigate();
|
||||
// 注册当前页面为标签页
|
||||
usePageTabs({
|
||||
tabKey: 'house_charge_tasks',
|
||||
@ -42,11 +44,17 @@ export default function Index({ title = '账单任务' }) {
|
||||
<TaskCreate key="Create" reload={action?.reload} title="账单任务" />,
|
||||
]}
|
||||
columns={[
|
||||
MyColumns.ID(),
|
||||
{
|
||||
title: '机构',
|
||||
dataIndex: ['company', 'name'],
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: '项目',
|
||||
dataIndex: ['asset_project', 'name'],
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: '任务ID',
|
||||
dataIndex: 'id',
|
||||
@ -66,6 +74,17 @@ export default function Index({ title = '账单任务' }) {
|
||||
title: '收费标准',
|
||||
dataIndex: ['house_charge_standard', 'name'],
|
||||
search: false,
|
||||
render: (_, record) => (
|
||||
<MyButtons.View
|
||||
title={record?.house_charge_standard?.name || '-'}
|
||||
type="link"
|
||||
onClick={() => {
|
||||
navigate(
|
||||
`/charge/standard/show/${record.house_charge_standards_id}`,
|
||||
);
|
||||
}}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '账单月份',
|
||||
|
||||
@ -8,9 +8,11 @@ import { MyModal } from '@/components/MyModal';
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import { HouseChargeTaskDetailsStatusEnum } from '@/gen/Enums';
|
||||
import { ProTable } from '@ant-design/pro-components';
|
||||
import { useNavigate } from '@umijs/max';
|
||||
import { Space } from 'antd';
|
||||
|
||||
export default function AssetInfo(props: MyBetaModalFormProps) {
|
||||
const navigate = useNavigate();
|
||||
return (
|
||||
<MyModal
|
||||
title={props.title || '查看'}
|
||||
@ -32,6 +34,15 @@ export default function AssetInfo(props: MyBetaModalFormProps) {
|
||||
title: '对象',
|
||||
dataIndex: 'full_name',
|
||||
search: false,
|
||||
render: (_, record) => (
|
||||
<MyButtons.View
|
||||
title={record.full_name}
|
||||
type="link"
|
||||
onClick={() => {
|
||||
navigate(`/bills/summary/show/${record.asset_houses_id}`);
|
||||
}}
|
||||
/>
|
||||
),
|
||||
},
|
||||
MyColumns.EnumTag({
|
||||
title: '状态',
|
||||
|
||||
@ -8,7 +8,7 @@ import {
|
||||
import { Apis } from '@/gen/Apis';
|
||||
import {
|
||||
HouseChargeTasksStatusEnum,
|
||||
HouseChargeTasksTypeEnum,
|
||||
HouseMeterTasksGenerationMethodEnum,
|
||||
} from '@/gen/Enums';
|
||||
import { ProTable } from '@ant-design/pro-components';
|
||||
import { Space } from 'antd';
|
||||
@ -38,31 +38,32 @@ export default function Index({ title = '仪表账单' }) {
|
||||
<TaskCreate key="Create" reload={action?.reload} title="账单任务" />,
|
||||
]}
|
||||
columns={[
|
||||
MyColumns.ID(),
|
||||
{
|
||||
title: '机构',
|
||||
dataIndex: ['company', 'name'],
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: '任务ID',
|
||||
dataIndex: 'id',
|
||||
title: '项目',
|
||||
dataIndex: ['asset_project', 'name'],
|
||||
search: false,
|
||||
},
|
||||
MyColumns.EnumTag({
|
||||
title: '创建类型',
|
||||
dataIndex: 'type',
|
||||
valueEnum: HouseChargeTasksTypeEnum,
|
||||
}),
|
||||
MyColumns.EnumTag({
|
||||
title: '任务状态',
|
||||
dataIndex: 'status',
|
||||
valueEnum: HouseChargeTasksStatusEnum,
|
||||
}),
|
||||
{
|
||||
title: '收费标准',
|
||||
dataIndex: ['house_charge_standard', 'name'],
|
||||
search: false,
|
||||
},
|
||||
MyColumns.EnumTag({
|
||||
title: '生成方式',
|
||||
dataIndex: 'generation_method',
|
||||
valueEnum: HouseMeterTasksGenerationMethodEnum,
|
||||
}),
|
||||
// {
|
||||
// title: '收费标准',
|
||||
// dataIndex: ['house_charge_standard', 'name'],
|
||||
// search: false,
|
||||
// },
|
||||
{
|
||||
title: '账单月份',
|
||||
render: (_, record) => {
|
||||
@ -88,19 +89,38 @@ export default function Index({ title = '仪表账单' }) {
|
||||
dataIndex: 'task_count',
|
||||
search: false,
|
||||
},
|
||||
// MyColumns.UpdatedAt(),
|
||||
MyColumns.CreatedAt(),
|
||||
MyColumns.UpdatedAt(),
|
||||
// MyColumns.CreatedAt(),
|
||||
MyColumns.Option({
|
||||
render: (_, item: any, index, action) => (
|
||||
<Space key={index}>
|
||||
<TaskShow item={item} title="查看" reload={action?.reload} />
|
||||
<MyButtons.Delete
|
||||
|
||||
<MyButtons.Default
|
||||
title={
|
||||
item.status ===
|
||||
HouseChargeTasksStatusEnum.Completed.value ||
|
||||
item.status === HouseChargeTasksStatusEnum.Failed.value
|
||||
? '重新执行'
|
||||
: '执行'
|
||||
}
|
||||
type="link"
|
||||
color="primary"
|
||||
isConfirm
|
||||
description="是否重新执行此任务?"
|
||||
onConfirm={() =>
|
||||
Apis.HouseCharage.HouseChargeTasks.Delete({
|
||||
Apis.Meter.HouseMeterTasks.ExecuteMeterTasks({
|
||||
id: item.id,
|
||||
}).then(() => action?.reload())
|
||||
}
|
||||
/>
|
||||
{/* <MyButtons.Delete
|
||||
onConfirm={() =>
|
||||
Apis.Meter.HouseMeterTasks.Delete({
|
||||
id: item.id,
|
||||
}).then(() => action?.reload())
|
||||
}
|
||||
/> */}
|
||||
</Space>
|
||||
),
|
||||
}),
|
||||
|
||||
@ -15,9 +15,9 @@ export default function AssetInfo(props: MyBetaModalFormProps) {
|
||||
{...MyProTableProps.props}
|
||||
request={async (params, sort) =>
|
||||
MyProTableProps.request(
|
||||
{ ...params, house_charge_tasks_id: props?.item?.id },
|
||||
{ ...params, house_meter_task_id: props?.item?.id },
|
||||
sort,
|
||||
Apis.Meter.HouseMeterTasks.List,
|
||||
Apis.Meter.HouseMeterTaskDetails.List,
|
||||
)
|
||||
}
|
||||
columns={[
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user