From 3350f99f61d0d52d4d4f215a86ab9bd90799295c Mon Sep 17 00:00:00 2001 From: uiuJun <> Date: Sat, 4 Oct 2025 22:22:41 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E6=A5=BC=E6=A0=8B=E5=88=92?= =?UTF-8?q?=E5=88=86=20bug=E3=80=81=E8=B0=83=E6=95=B4=E6=88=BF=E5=B1=8B=20?= =?UTF-8?q?show=20=E9=A1=B5=E9=9D=A2=E5=AE=9E=E7=8E=B0=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/components/schema/MyColumns.tsx | 3 +- src/components/Select.tsx | 22 +++-- .../asset/dictionary/modals/HousesShow.tsx | 62 +++++++++--- src/pages/asset/grids/index.tsx | 2 + src/pages/asset/grids/modals/GridShow.tsx | 97 +++++++++++++++++++ src/pages/asset/grids/modals/GridUpdate.tsx | 26 ++++- .../bills/summary/components/BillInfo.tsx | 15 ++- src/pages/charge/tasks/index.tsx | 19 ++++ src/pages/charge/tasks/modals/TaskShow.tsx | 11 +++ src/pages/meter/tasks/index.tsx | 54 +++++++---- src/pages/meter/tasks/modals/TaskShow.tsx | 4 +- 11 files changed, 264 insertions(+), 51 deletions(-) create mode 100644 src/pages/asset/grids/modals/GridShow.tsx diff --git a/src/common/components/schema/MyColumns.tsx b/src/common/components/schema/MyColumns.tsx index 736cc91..121a587 100644 --- a/src/common/components/schema/MyColumns.tsx +++ b/src/common/components/schema/MyColumns.tsx @@ -6,7 +6,8 @@ type ReturnType = ProColumns, '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(); diff --git a/src/components/Select.tsx b/src/components/Select.tsx index 0ebb2f5..76111db 100644 --- a/src/components/Select.tsx +++ b/src/components/Select.tsx @@ -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, diff --git a/src/pages/asset/dictionary/modals/HousesShow.tsx b/src/pages/asset/dictionary/modals/HousesShow.tsx index ab23e78..eaed782 100644 --- a/src/pages/asset/dictionary/modals/HousesShow.tsx +++ b/src/pages/asset/dictionary/modals/HousesShow.tsx @@ -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({}); + 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 ( - {props?.item?.full_name} + + 【{show?.id}】 + {show?.full_name} + - {props?.item?.name} + {show?.name} - {props?.item?.floor} + {show?.floor} - {props?.item?.built_area}m² + {show?.built_area}m² - {props?.item?.inside_area}m² + {show?.inside_area}m² - {props?.item?.chargeable_area}m² + {show?.chargeable_area}m² - {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 || ''}阳台 diff --git a/src/pages/asset/grids/index.tsx b/src/pages/asset/grids/index.tsx index 5210c0d..c1adcb7 100644 --- a/src/pages/asset/grids/index.tsx +++ b/src/pages/asset/grids/index.tsx @@ -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) => ( + ({}); + const getShow = () => { + Apis.Grid.Grids.Show({ + id: props?.item?.id, + }) + .then((res) => { + setShow(res?.data); + }) + .catch(() => false); + }; + + // 只在弹窗打开时获取数据 + const handleOpen = () => { + getShow(); + }; + + return ( + + + + + 【{show?.id}】 + {show?.name} + + + + {show?.name} + + + {show?.floor} + + + + + + + + + {show?.built_area}m² + + + {show?.inside_area}m² + + + {show?.chargeable_area}m² + + + + + + {show?.room || ''}房{show?.hall || ''}厅{show?.bathroom || ''}卫 + {show?.kitchen || ''}厨{show?.balcony || ''}阳台 + + + + + + + } + /> + ); +} diff --git a/src/pages/asset/grids/modals/GridUpdate.tsx b/src/pages/asset/grids/modals/GridUpdate.tsx index 2f51fb6..fff537f 100644 --- a/src/pages/asset/grids/modals/GridUpdate.tsx +++ b/src/pages/asset/grids/modals/GridUpdate.tsx @@ -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(() => { diff --git a/src/pages/bills/summary/components/BillInfo.tsx b/src/pages/bills/summary/components/BillInfo.tsx index ceadd72..f8955ae 100644 --- a/src/pages/bills/summary/components/BillInfo.tsx +++ b/src/pages/bills/summary/components/BillInfo.tsx @@ -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 ( - {item?.asset_house?.full_name || '-'} + + {item?.asset_house?.full_name || '-'} + {item?.asset_houses_id && ( + + )} + {item?.total_payable_sum || '-'} diff --git a/src/pages/charge/tasks/index.tsx b/src/pages/charge/tasks/index.tsx index 6ae1e83..9ffcc4d 100644 --- a/src/pages/charge/tasks/index.tsx +++ b/src/pages/charge/tasks/index.tsx @@ -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 = '账单任务' }) { , ]} 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) => ( + { + navigate( + `/charge/standard/show/${record.house_charge_standards_id}`, + ); + }} + /> + ), }, { title: '账单月份', diff --git a/src/pages/charge/tasks/modals/TaskShow.tsx b/src/pages/charge/tasks/modals/TaskShow.tsx index daf0a05..13b658f 100644 --- a/src/pages/charge/tasks/modals/TaskShow.tsx +++ b/src/pages/charge/tasks/modals/TaskShow.tsx @@ -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 ( ( + { + navigate(`/bills/summary/show/${record.asset_houses_id}`); + }} + /> + ), }, MyColumns.EnumTag({ title: '状态', diff --git a/src/pages/meter/tasks/index.tsx b/src/pages/meter/tasks/index.tsx index e248912..42c09d1 100644 --- a/src/pages/meter/tasks/index.tsx +++ b/src/pages/meter/tasks/index.tsx @@ -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 = '仪表账单' }) { , ]} 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) => ( - - Apis.HouseCharage.HouseChargeTasks.Delete({ + Apis.Meter.HouseMeterTasks.ExecuteMeterTasks({ id: item.id, }).then(() => action?.reload()) } /> + {/* + Apis.Meter.HouseMeterTasks.Delete({ + id: item.id, + }).then(() => action?.reload()) + } + /> */} ), }), diff --git a/src/pages/meter/tasks/modals/TaskShow.tsx b/src/pages/meter/tasks/modals/TaskShow.tsx index 9887856..9741e5b 100644 --- a/src/pages/meter/tasks/modals/TaskShow.tsx +++ b/src/pages/meter/tasks/modals/TaskShow.tsx @@ -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={[