|
|
@@ -1,6 +1,6 @@
|
|
|
import * as React from 'react';
|
|
|
import { observer } from 'mobx-react';
|
|
|
-import { List, Button, Divider, Flex, Layout, Empty, Image, Modal } from 'antd';
|
|
|
+import { List, Button, Divider, Flex, Layout, Empty, Image, Modal, Tag } from 'antd';
|
|
|
import { PlusOutlined, FileOutlined, SettingOutlined, DeleteOutlined } from '@ant-design/icons';
|
|
|
import { apis } from '@/apis';
|
|
|
import './style.less';
|
|
|
@@ -49,6 +49,7 @@ const QuestionAnswerList: React.FC = () => {
|
|
|
desc: string,
|
|
|
appId: number,
|
|
|
createBy: string,
|
|
|
+ typeId: string;
|
|
|
};
|
|
|
|
|
|
interface PageInfo {
|
|
|
@@ -57,6 +58,11 @@ const QuestionAnswerList: React.FC = () => {
|
|
|
total: number,
|
|
|
};
|
|
|
|
|
|
+ type AppTypeList = {
|
|
|
+ label: string,
|
|
|
+ value: string,
|
|
|
+ }[];
|
|
|
+
|
|
|
const [listLoading, setListLoading] = React.useState(false);
|
|
|
const [list, setList] = React.useState<Item[]>([]);
|
|
|
const [page, setPage] = React.useState<PageInfo>({
|
|
|
@@ -67,6 +73,7 @@ const QuestionAnswerList: React.FC = () => {
|
|
|
const [appCount, setAppCount] = React.useState<string>();
|
|
|
const [knowCount, setKnowCount] = React.useState<string>();
|
|
|
const { Header, Footer, Sider, Content } = Layout;
|
|
|
+ const [appTypeList, setAppTypeList] = React.useState<AppTypeList>([]);
|
|
|
|
|
|
const appApi = {
|
|
|
fetchList: async () => {
|
|
|
@@ -82,7 +89,8 @@ const QuestionAnswerList: React.FC = () => {
|
|
|
name: item.name,
|
|
|
desc: item.desc,
|
|
|
appId: item.appId,
|
|
|
- createBy: item.createBy
|
|
|
+ createBy: item.createBy,
|
|
|
+ typeId: item.typeId,
|
|
|
}
|
|
|
});
|
|
|
setList(list);
|
|
|
@@ -130,11 +138,31 @@ const QuestionAnswerList: React.FC = () => {
|
|
|
setListLoading(false);
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+ };
|
|
|
+
|
|
|
+ // 获取应用类型
|
|
|
+ const appTypeApi = {
|
|
|
+ fetchAppType: async () => {
|
|
|
+ try {
|
|
|
+ const res = await apis.fetchTakaiAppTypeList('app_type');
|
|
|
+ const list = res.data.map((item: any) => {
|
|
|
+ return {
|
|
|
+ label: item.dictLabel,
|
|
|
+ value: item.dictCode,
|
|
|
+ }
|
|
|
+ });
|
|
|
+ setAppTypeList(list);
|
|
|
+ } catch (error: any) {
|
|
|
+ console.error(error);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ };
|
|
|
+
|
|
|
|
|
|
const init = async () => {
|
|
|
await appApi.fetchList();
|
|
|
await indexApi.fetchIndex();
|
|
|
+ await appTypeApi.fetchAppType();
|
|
|
}
|
|
|
|
|
|
React.useEffect(() => {
|
|
|
@@ -257,6 +285,23 @@ const QuestionAnswerList: React.FC = () => {
|
|
|
<DeleteOutlined /> 删除
|
|
|
</a>
|
|
|
</div>
|
|
|
+
|
|
|
+ <div>
|
|
|
+ <Tag
|
|
|
+ style={{
|
|
|
+ padding: '4px 8px',
|
|
|
+ fontSize: 14,
|
|
|
+ fontWeight: 'bold',
|
|
|
+ background: '#f0f0f0',
|
|
|
+ border: '1px solid #d9d9d9'
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ {
|
|
|
+ appTypeList
|
|
|
+ .find(item1 => item1.value === item.typeId)?.label || '未分类'
|
|
|
+ }
|
|
|
+ </Tag>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</List.Item>
|
|
|
@@ -268,10 +313,10 @@ const QuestionAnswerList: React.FC = () => {
|
|
|
:
|
|
|
<div>
|
|
|
<Button type='primary'
|
|
|
- icon={<PlusOutlined />}
|
|
|
- onClick={() => {
|
|
|
- router.navigate({ pathname: '/deepseek/questionAnswer/create' });
|
|
|
- }}>创建问答应用</Button>
|
|
|
+ icon={<PlusOutlined />}
|
|
|
+ onClick={() => {
|
|
|
+ router.navigate({ pathname: '/deepseek/questionAnswer/create' });
|
|
|
+ }}>创建问答应用</Button>
|
|
|
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
|
|
|
</div>
|
|
|
|