1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- import { useAjax } from "@/Hook/useAjax"
- import { getSelectAdTaskLogListApi } from "@/services/adqV3"
- import { Button, Modal, Space, Table, Tag } from "antd"
- import React, { useEffect, useState } from "react"
- import { columnsExecuteLog } from "./tableConfig"
- interface Props {
- data: any
- visible?: boolean,
- onClose?: () => void
- }
- /**
- * 任务执行记录
- * @param param0
- * @returns
- */
- const ExecuteLog: React.FC<Props> = ({ data, visible, onClose }) => {
- /*************************************/
- const { id, taskName } = data
- const [queryForm, setQueryForm] = useState<PULLIN.GetTaskV3LogProps>({ pageNum: 1, pageSize: 20 })
- const getSelectAdTaskLogList = useAjax((params) => getSelectAdTaskLogListApi(params), { formatResult: true })
- /*************************************/
- useEffect(() => {
- getList()
- }, [queryForm, id])
- /** 获取列表 */
- const getList = () => {
- if (id) {
- getSelectAdTaskLogList.run({ ...queryForm, taskId: id })
- }
- }
- return <Modal
- title={<Space>
- <strong>{taskName + ' 执行记录'}</strong>
- <Button type="link" loading={getSelectAdTaskLogList.loading} onClick={() => getSelectAdTaskLogList.refresh()}>刷新</Button>
- </Space>}
- className="modalResetCss"
- open={visible}
- width={750}
- onCancel={onClose}
- footer={null}
- >
- <Table
- columns={columnsExecuteLog()}
- dataSource={getSelectAdTaskLogList?.data?.data?.records}
- size="small"
- loading={getSelectAdTaskLogList?.loading}
- scroll={{ y: 600 }}
- bordered
- rowKey={'id'}
- pagination={{
- pageSize: queryForm.pageSize,
- current: queryForm.pageNum,
- total: getSelectAdTaskLogList?.data?.data?.total || 0,
- showTotal: (total) => <Tag color="cyan">总共{total}数据</Tag>
- }}
- onChange={(pagination) => {
- let { current, pageSize } = pagination
- let newQueryForm = JSON.parse(JSON.stringify(queryForm))
- newQueryForm.pageNum = current
- newQueryForm.pageSize = pageSize
- setQueryForm(newQueryForm)
- }}
- />
- </Modal>
- }
- export default React.memo(ExecuteLog)
|