123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- import React from 'react';
- import { ProColumns, ProTable } from '@ant-design/pro-components';
- import { appTaskLogStatusEnum, conversationTypeEnum, timeRangeFieldProps } from '@/constants/enums';
- import { listAppTaskLog } from '@/services/api/appTask';
- type TableListItem = API.AppTaskLogPo;
- /**
- * 获取数据
- * @param params 参数
- * @param sort 排序
- */
- const getDataSource = async (params: any, sort: any) => {
- const res = await listAppTaskLog({
- ...params,
- startTime: params?.dateTimeRange?.[0],
- endTime: params?.dateTimeRange?.[1],
- sort,
- });
- return Promise.resolve({
- success: true,
- data: res?.data?.list,
- total: res?.data?.total,
- });
- };
- /** 应用任务日志组件 */
- const AppTaskLogTable: React.FC<{
- /** 任务id */
- taskId?: string;
- }> = ({ taskId }) => {
- // 表格列的配置描述
- const columns: ProColumns<TableListItem>[] = [
- {
- title: '执行时间',
- dataIndex: 'createTime',
- valueType: 'dateTime',
- search: false,
- sorter: true,
- },
- {
- title: '日志id',
- dataIndex: 'id',
- copyable: true,
- sorter: true,
- ellipsis: true,
- },
- {
- title: '应用名称',
- dataIndex: 'appName',
- copyable: true,
- sorter: true,
- },
- {
- title: 'appId',
- dataIndex: 'appId',
- copyable: true,
- sorter: true,
- ellipsis: true,
- },
- {
- title: '任务id',
- dataIndex: 'taskId',
- copyable: true,
- sorter: true,
- initialValue: taskId,
- ellipsis: true,
- },
- {
- title: '任务名称',
- dataIndex: 'taskName',
- copyable: true,
- sorter: true,
- },
- {
- title: '执行结果',
- dataIndex: 'status',
- valueEnum: appTaskLogStatusEnum.valueEnum,
- sorter: true,
- },
- {
- title: '详情',
- dataIndex: 'detail',
- copyable: true,
- search: false,
- ellipsis: true,
- },
- {
- title: '机器人编码',
- dataIndex: 'robotCode',
- copyable: true,
- sorter: true,
- ellipsis: true,
- },
- {
- title: '机器人名称',
- dataIndex: 'robotName',
- copyable: true,
- sorter: true,
- },
- {
- title: '会话类型',
- dataIndex: 'conversationType',
- valueEnum: conversationTypeEnum.valueEnum,
- sorter: true,
- },
- {
- title: '群id',
- dataIndex: 'openConversationId',
- copyable: true,
- sorter: true,
- ellipsis: true,
- },
- {
- title: '接收机器人消息的手机号列表',
- dataIndex: 'phones',
- copyable: true,
- sorter: true,
- },
- {
- title: '接收机器人消息的userId列表',
- dataIndex: 'userIds',
- copyable: true,
- sorter: true,
- },
- {
- title: 'sftpId',
- dataIndex: 'sftpId',
- copyable: true,
- sorter: true,
- ellipsis: true,
- },
- {
- title: 'sftp ip',
- dataIndex: 'host',
- copyable: true,
- sorter: true,
- },
- {
- title: 'sftp端口',
- dataIndex: 'port',
- copyable: true,
- sorter: true,
- },
- {
- title: '数据文件夹',
- dataIndex: 'dataDir',
- copyable: true,
- search: false,
- },
- {
- title: '文件名匹配正则表达式',
- dataIndex: 'filePattern',
- copyable: true,
- search: false,
- },
- {
- title: '文件路径',
- dataIndex: 'filePath',
- copyable: true,
- search: false,
- },
- {
- title: '时间范围',
- dataIndex: 'dateTimeRange',
- valueType: 'dateTimeRange',
- hideInTable: true,
- fieldProps: timeRangeFieldProps,
- },
- ];
- return (
- <ProTable<TableListItem>
- headerTitle="应用任务日志列表"
- rowKey="id"
- columns={columns}
- pagination={{
- showQuickJumper: true,
- defaultPageSize: 10,
- }}
- search={{
- layout: 'vertical',
- }}
- request={getDataSource}
- />
- );
- };
- export default AppTaskLogTable;
|