'use client' import Pagination, { type Props as PaginationProps } from '@/app/components/base/pagination' import type { FC } from 'react' import { useState } from 'react' import Button from '@/app/components/base/button' import cn from '@/utils/classnames' import { delIntent } from '@/service/common' import Confirm from '@/app/components/base/confirm' import DetailModal from './detail-modal' import useTimestamp from '@/hooks/use-timestamp' import { useTranslation } from 'react-i18next' type PageListProps = { list: [] pagination: PaginationProps onUpdate: () => void } const IntentPageList: FC = ({ list = [], pagination, onUpdate, }) => { const { t } = useTranslation() const { formatTime } = useTimestamp() const [showConfirmDelete, setShowConfirmDelete] = useState(false) const [row, setRow] = useState({}) const handleDel = async () => { try { await delIntent({ url: `/intentions/${row.id}`, body: {}, }) setShowConfirmDelete(false) onUpdate() } catch (e) { } } const [detailModalVisible, setDetailModalVisible] = useState(false) const [transfer, setTransfer] = useState({ mode: 'add', row: {}, }) return ( <>
{list.map((item: any, index) => ( ))}
意图类型 意图名称 语料数量 关键词数量 创建时间 操作
{item.type_name} {item.name} {item.corpus_count} {item.keywords_count} {formatTime(item.created_at, t('datasetHitTesting.dateTimeFormat') as string)}
{/* Show Pagination only if the total is more than the limit */} {pagination.total && ( )}
{showConfirmDelete && ( setShowConfirmDelete(false)} /> )} { detailModalVisible && ( { setDetailModalVisible(false) onUpdate() }} onSend={() => { setDetailModalVisible(false) onUpdate() }} /> ) } ) } export default IntentPageList