2025-09-26 21:02:38 +08:00
|
|
|
import {
|
|
|
|
|
MyButtons,
|
|
|
|
|
MyColumns,
|
|
|
|
|
MyPageContainer,
|
|
|
|
|
MyProTableProps,
|
|
|
|
|
usePageTabs,
|
|
|
|
|
} from '@/common';
|
|
|
|
|
import { Apis } from '@/gen/Apis';
|
2025-09-30 14:30:47 +08:00
|
|
|
import {
|
|
|
|
|
CustomerMomentsChannelEnum,
|
|
|
|
|
CustomerMomentsContentTypeEnum,
|
|
|
|
|
CustomerMomentsPushTypeEnum,
|
|
|
|
|
CustomerMomentsTaskEndTypeEnum,
|
|
|
|
|
} from '@/gen/Enums';
|
2025-09-26 21:02:38 +08:00
|
|
|
import { ProTable } from '@ant-design/pro-components';
|
2025-09-30 14:30:47 +08:00
|
|
|
import { Card, Space } from 'antd';
|
2025-09-26 21:02:38 +08:00
|
|
|
import Create from './modals/Create';
|
|
|
|
|
|
|
|
|
|
export default function Index({ title = '推送任务' }) {
|
|
|
|
|
// 注册当前页面为标签页
|
|
|
|
|
usePageTabs({
|
|
|
|
|
tabKey: 'moments-list',
|
|
|
|
|
tabLabel: title,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<MyPageContainer
|
|
|
|
|
title={title}
|
|
|
|
|
enableTabs={true}
|
|
|
|
|
tabKey="moments-list"
|
|
|
|
|
tabLabel={title}
|
|
|
|
|
>
|
|
|
|
|
<ProTable
|
|
|
|
|
{...MyProTableProps.props}
|
|
|
|
|
expandable={{
|
|
|
|
|
defaultExpandAllRows: true,
|
|
|
|
|
}}
|
|
|
|
|
request={async (params, sort) =>
|
|
|
|
|
MyProTableProps.request(
|
|
|
|
|
params,
|
|
|
|
|
sort,
|
|
|
|
|
Apis.Customer.CustomerMoments.List,
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
toolBarRender={(action) => [
|
|
|
|
|
<Create key="Create" reload={action?.reload} title={title} />,
|
|
|
|
|
]}
|
|
|
|
|
columns={[
|
|
|
|
|
MyColumns.ID(),
|
|
|
|
|
{
|
|
|
|
|
title: '名称',
|
2025-09-30 14:30:47 +08:00
|
|
|
dataIndex: 'title',
|
|
|
|
|
render: (_, i: any) => {
|
|
|
|
|
return (
|
|
|
|
|
<Card size="small">
|
|
|
|
|
<Space align="start">
|
|
|
|
|
<img src={i?.cover_image[0]?.url} width={45} height={45} />
|
|
|
|
|
<div>{i?.title}</div>
|
|
|
|
|
</Space>
|
|
|
|
|
</Card>
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
MyColumns.EnumTag({
|
|
|
|
|
title: '发送渠道',
|
|
|
|
|
dataIndex: 'channel',
|
|
|
|
|
valueEnum: CustomerMomentsChannelEnum,
|
|
|
|
|
}),
|
|
|
|
|
MyColumns.EnumTag({
|
|
|
|
|
title: '内容类型',
|
|
|
|
|
dataIndex: 'content_type',
|
|
|
|
|
valueEnum: CustomerMomentsContentTypeEnum,
|
|
|
|
|
}),
|
|
|
|
|
MyColumns.EnumTag({
|
|
|
|
|
title: '推送类型',
|
|
|
|
|
dataIndex: 'push_type',
|
|
|
|
|
valueEnum: CustomerMomentsPushTypeEnum,
|
|
|
|
|
}),
|
|
|
|
|
{
|
|
|
|
|
title: '定时发送时间',
|
|
|
|
|
dataIndex: 'scheduled_time',
|
|
|
|
|
search: false,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
MyColumns.EnumTag({
|
|
|
|
|
title: '任务结束类型',
|
|
|
|
|
dataIndex: 'task_end_type',
|
|
|
|
|
valueEnum: CustomerMomentsTaskEndTypeEnum,
|
|
|
|
|
search: false,
|
|
|
|
|
}),
|
|
|
|
|
{
|
|
|
|
|
title: '任务结束天数',
|
|
|
|
|
dataIndex: 'task_days',
|
|
|
|
|
search: false,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '定时结束',
|
|
|
|
|
dataIndex: 'task_end_time',
|
|
|
|
|
search: false,
|
2025-09-26 21:02:38 +08:00
|
|
|
},
|
|
|
|
|
MyColumns.UpdatedAt(),
|
|
|
|
|
MyColumns.CreatedAt(),
|
|
|
|
|
MyColumns.Option({
|
|
|
|
|
render: (_, item: any, index, action) => (
|
|
|
|
|
<Space key={index}>
|
2025-09-30 14:30:47 +08:00
|
|
|
{/* <Update item={item} reload={action?.reload} title={title} /> */}
|
|
|
|
|
<MyButtons.Default
|
|
|
|
|
isConfirm
|
|
|
|
|
title="发送"
|
|
|
|
|
type="primary"
|
|
|
|
|
disabled={
|
|
|
|
|
item?.push_type === 'ScheduledPush' ||
|
|
|
|
|
item?.push_status === 'Pushed'
|
|
|
|
|
}
|
|
|
|
|
description="确定发送?"
|
|
|
|
|
onConfirm={() => {
|
|
|
|
|
Apis.Customer.CustomerMoments.Send({
|
|
|
|
|
id: item.id,
|
|
|
|
|
}).then(() => action?.reload());
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
{/* <MyButtons.Delete
|
2025-09-26 21:02:38 +08:00
|
|
|
onConfirm={() =>
|
2025-09-30 14:30:47 +08:00
|
|
|
Apis.Customer.CustomerMoments.Delete({
|
2025-09-26 21:02:38 +08:00
|
|
|
id: item.id,
|
|
|
|
|
}).then(() => action?.reload())
|
|
|
|
|
}
|
2025-09-30 14:30:47 +08:00
|
|
|
/> */}
|
2025-09-26 21:02:38 +08:00
|
|
|
</Space>
|
|
|
|
|
),
|
|
|
|
|
}),
|
|
|
|
|
]}
|
|
|
|
|
/>
|
|
|
|
|
</MyPageContainer>
|
|
|
|
|
);
|
|
|
|
|
}
|