2025-09-29 17:00:12 +08:00
|
|
|
import {
|
|
|
|
|
MyButtons,
|
|
|
|
|
MyColumns,
|
|
|
|
|
MyPageContainer,
|
|
|
|
|
MyProTableProps,
|
|
|
|
|
usePageTabs,
|
|
|
|
|
} from '@/common';
|
|
|
|
|
import { Apis } from '@/gen/Apis';
|
|
|
|
|
import {
|
|
|
|
|
HouseChargeTasksStatusEnum,
|
2025-10-04 22:22:41 +08:00
|
|
|
HouseMeterTasksGenerationMethodEnum,
|
2025-09-29 17:00:12 +08:00
|
|
|
} from '@/gen/Enums';
|
|
|
|
|
import { ProTable } from '@ant-design/pro-components';
|
|
|
|
|
import { Space } from 'antd';
|
|
|
|
|
import TaskCreate from './modals/TaskCreate';
|
|
|
|
|
import TaskShow from './modals/TaskShow';
|
|
|
|
|
|
2025-10-09 20:30:37 +08:00
|
|
|
export default function Index({ title = '仪表任务' }) {
|
2025-09-29 17:00:12 +08:00
|
|
|
// 注册当前页面为标签页
|
|
|
|
|
usePageTabs({
|
2025-10-01 18:01:02 +08:00
|
|
|
tabKey: 'house_meter_tasks',
|
2025-09-29 17:00:12 +08:00
|
|
|
tabLabel: title,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<MyPageContainer
|
|
|
|
|
title={title}
|
|
|
|
|
enableTabs={true}
|
|
|
|
|
tabKey="house_charge_tasks"
|
|
|
|
|
tabLabel={title}
|
|
|
|
|
>
|
|
|
|
|
<ProTable
|
|
|
|
|
{...MyProTableProps.props}
|
|
|
|
|
request={async (params, sort) =>
|
2025-10-01 15:55:16 +08:00
|
|
|
MyProTableProps.request(params, sort, Apis.Meter.HouseMeterTasks.List)
|
2025-09-29 17:00:12 +08:00
|
|
|
}
|
|
|
|
|
toolBarRender={(action) => [
|
2025-10-10 17:55:46 +08:00
|
|
|
<TaskCreate key="Create" reload={action?.reload} title="仪表任务" />,
|
2025-09-29 17:00:12 +08:00
|
|
|
]}
|
|
|
|
|
columns={[
|
2025-10-04 22:22:41 +08:00
|
|
|
MyColumns.ID(),
|
2025-09-29 17:00:12 +08:00
|
|
|
{
|
|
|
|
|
title: '机构',
|
|
|
|
|
dataIndex: ['company', 'name'],
|
|
|
|
|
search: false,
|
|
|
|
|
},
|
|
|
|
|
{
|
2025-10-04 22:22:41 +08:00
|
|
|
title: '项目',
|
|
|
|
|
dataIndex: ['asset_project', 'name'],
|
2025-09-29 17:00:12 +08:00
|
|
|
search: false,
|
|
|
|
|
},
|
|
|
|
|
MyColumns.EnumTag({
|
|
|
|
|
title: '任务状态',
|
|
|
|
|
dataIndex: 'status',
|
|
|
|
|
valueEnum: HouseChargeTasksStatusEnum,
|
|
|
|
|
}),
|
2025-10-04 22:22:41 +08:00
|
|
|
MyColumns.EnumTag({
|
|
|
|
|
title: '生成方式',
|
|
|
|
|
dataIndex: 'generation_method',
|
|
|
|
|
valueEnum: HouseMeterTasksGenerationMethodEnum,
|
|
|
|
|
}),
|
|
|
|
|
// {
|
|
|
|
|
// title: '收费标准',
|
|
|
|
|
// dataIndex: ['house_charge_standard', 'name'],
|
|
|
|
|
// search: false,
|
|
|
|
|
// },
|
2025-09-29 17:00:12 +08:00
|
|
|
{
|
|
|
|
|
title: '账单月份',
|
|
|
|
|
render: (_, record) => {
|
|
|
|
|
return `${record.bill_year}-${String(record.bill_month).padStart(
|
|
|
|
|
2,
|
|
|
|
|
'0',
|
|
|
|
|
)}`;
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '计费周期',
|
|
|
|
|
|
|
|
|
|
render: (_, record) => {
|
|
|
|
|
return `${record.start_date}-${String(record.end_date).padStart(
|
|
|
|
|
2,
|
|
|
|
|
'0',
|
|
|
|
|
)}`;
|
|
|
|
|
},
|
|
|
|
|
search: false,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '账单数',
|
|
|
|
|
dataIndex: 'task_count',
|
|
|
|
|
search: false,
|
|
|
|
|
},
|
2025-10-04 22:22:41 +08:00
|
|
|
MyColumns.UpdatedAt(),
|
|
|
|
|
// MyColumns.CreatedAt(),
|
2025-09-29 17:00:12 +08:00
|
|
|
MyColumns.Option({
|
|
|
|
|
render: (_, item: any, index, action) => (
|
|
|
|
|
<Space key={index}>
|
|
|
|
|
<TaskShow item={item} title="查看" reload={action?.reload} />
|
2025-10-04 22:22:41 +08:00
|
|
|
<MyButtons.Default
|
|
|
|
|
title={
|
|
|
|
|
item.status ===
|
|
|
|
|
HouseChargeTasksStatusEnum.Completed.value ||
|
|
|
|
|
item.status === HouseChargeTasksStatusEnum.Failed.value
|
|
|
|
|
? '重新执行'
|
|
|
|
|
: '执行'
|
|
|
|
|
}
|
|
|
|
|
type="link"
|
|
|
|
|
color="primary"
|
|
|
|
|
isConfirm
|
|
|
|
|
description="是否重新执行此任务?"
|
2025-09-29 17:00:12 +08:00
|
|
|
onConfirm={() =>
|
2025-10-04 22:22:41 +08:00
|
|
|
Apis.Meter.HouseMeterTasks.ExecuteMeterTasks({
|
2025-09-29 17:00:12 +08:00
|
|
|
id: item.id,
|
|
|
|
|
}).then(() => action?.reload())
|
|
|
|
|
}
|
|
|
|
|
/>
|
2025-10-04 22:22:41 +08:00
|
|
|
{/* <MyButtons.Delete
|
|
|
|
|
onConfirm={() =>
|
|
|
|
|
Apis.Meter.HouseMeterTasks.Delete({
|
|
|
|
|
id: item.id,
|
|
|
|
|
}).then(() => action?.reload())
|
|
|
|
|
}
|
|
|
|
|
/> */}
|
2025-09-29 17:00:12 +08:00
|
|
|
</Space>
|
|
|
|
|
),
|
|
|
|
|
}),
|
|
|
|
|
]}
|
|
|
|
|
/>
|
|
|
|
|
</MyPageContainer>
|
|
|
|
|
);
|
|
|
|
|
}
|