|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
import { observer } from 'mobx-react';
|
|
|
import { useParams } from 'react-router-dom';
|
|
|
import { List, Button, Divider, Empty, Modal, Form, Input, message } from 'antd';
|
|
|
-import { SettingOutlined, DeleteOutlined } from '@ant-design/icons';
|
|
|
+import { SettingOutlined, DeleteOutlined, ArrowLeftOutlined } from '@ant-design/icons';
|
|
|
import { apis } from '@/apis';
|
|
|
import { PaginationConfig } from 'antd/es/pagination';
|
|
|
import router from '@/router';
|
|
|
@@ -18,7 +18,8 @@ const SliceList: React.FC = () => {
|
|
|
interface Item {
|
|
|
slice_id: string,
|
|
|
document_id: string,
|
|
|
- slice_text: number,
|
|
|
+ slice_text: string,
|
|
|
+ slice_char_len: number,
|
|
|
};
|
|
|
|
|
|
interface PageInfo {
|
|
|
@@ -51,6 +52,7 @@ const SliceList: React.FC = () => {
|
|
|
slice_id: item.slice_id,
|
|
|
document_id: item.document_id,
|
|
|
slice_text: item.slice_text,
|
|
|
+ slice_char_len: item.slice_char_len,
|
|
|
}
|
|
|
});
|
|
|
setList(list);
|
|
|
@@ -79,10 +81,10 @@ const SliceList: React.FC = () => {
|
|
|
|
|
|
const deleteSlice = async (slice_id: string, knowledgeId: string) => {
|
|
|
try {
|
|
|
- if (!params.knowledgeId) {
|
|
|
- throw new Error('知识库ID未定义,请检查路由参数');
|
|
|
+ if (!params.knowledgeId || !params.documentId) {
|
|
|
+ throw new Error('knowledgeId或documentId未定义,请检查路由参数');
|
|
|
}
|
|
|
- const res = await apis.deleteTakaiSlice(slice_id, params.knowledgeId);
|
|
|
+ const res = await apis.deleteTakaiSlice(slice_id, params.knowledgeId, params.documentId);
|
|
|
if (res.code === 200 && res.data === 1) {
|
|
|
appApi.fetchList({ searchText: '' });
|
|
|
message.success('删除切片成功');
|
|
|
@@ -127,23 +129,32 @@ const SliceList: React.FC = () => {
|
|
|
return (
|
|
|
<div>
|
|
|
<div className='dataExport-search'>
|
|
|
- <Form form={form} layout='inline' colon={false}>
|
|
|
- <FormItem label='切片' name='text'>
|
|
|
- <Input />
|
|
|
- </FormItem>
|
|
|
- <FormItem>
|
|
|
- <Button
|
|
|
- style={{ marginRight: 16 }}
|
|
|
- type='primary'
|
|
|
- onClick={handleClickSearch}
|
|
|
- >
|
|
|
- 查询
|
|
|
- </Button>
|
|
|
- <Button onClick={handleClickReset}>
|
|
|
- 重置
|
|
|
- </Button>
|
|
|
- </FormItem>
|
|
|
- </Form>
|
|
|
+ <div style={{ display: 'flex', justifyContent: 'space-between' }}>
|
|
|
+ <Form form={form} layout='inline' colon={false}>
|
|
|
+ <FormItem label='切片' name='text'>
|
|
|
+ <Input />
|
|
|
+ </FormItem>
|
|
|
+ <FormItem>
|
|
|
+ <Button
|
|
|
+ style={{ marginRight: 16 }}
|
|
|
+ type='primary'
|
|
|
+ onClick={handleClickSearch}
|
|
|
+ >
|
|
|
+ 查询
|
|
|
+ </Button>
|
|
|
+ <Button onClick={handleClickReset}>
|
|
|
+ 重置
|
|
|
+ </Button>
|
|
|
+ </FormItem>
|
|
|
+ </Form>
|
|
|
+
|
|
|
+ <div>
|
|
|
+ <Button type='primary' icon={<ArrowLeftOutlined />} onClick={() => {
|
|
|
+ router.navigate(-1);
|
|
|
+ }}>返回</Button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
</div>
|
|
|
{
|
|
|
list.length
|
|
|
@@ -173,6 +184,7 @@ const SliceList: React.FC = () => {
|
|
|
|
|
|
<Divider plain></Divider>
|
|
|
<div style={{ display: 'flex', justifyContent: 'space-between', overflow: 'auto' }}>
|
|
|
+
|
|
|
<div style={{ overflow: 'auto' }}>
|
|
|
<a style={{ marginRight: 20 }} onClick={() => {
|
|
|
router.navigate({
|
|
|
@@ -196,8 +208,13 @@ const SliceList: React.FC = () => {
|
|
|
<DeleteOutlined /> 删除
|
|
|
</a>
|
|
|
</div>
|
|
|
- </div>
|
|
|
|
|
|
+ <div>
|
|
|
+ {
|
|
|
+ item.slice_char_len
|
|
|
+ }
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</List.Item>
|
|
|
)}
|