sunsheng пре 4 месеци
родитељ
комит
7cf67c5f20

+ 12 - 9
src/pages/deepseek/knowledgeLib/detail/index.tsx

@@ -1,6 +1,7 @@
 import * as React from 'react';
-import { generatePath, useParams } from 'react-router-dom';
+import { generatePath, useParams, useLocation } from 'react-router-dom';
 import { observer } from 'mobx-react';
+
 import config, { getHeaders } from '@/apis/config';
 
 import {
@@ -54,7 +55,7 @@ const KnowledgeLibInfo : React.FC = () => {
     infoModalSettingId,
     knowledgeDetail,
   } = state;
-
+  const location = useLocation();
   const [ uploadLoading, setUploadLoading ] = React.useState( false );
 
   const params = useParams();
@@ -67,6 +68,7 @@ const KnowledgeLibInfo : React.FC = () => {
   const [ detailFlag, setDetailFlag ] = React.useState<boolean>();
   const [ deleteFlag, setDeleteFlag ] = React.useState<boolean>();
   const [ createFlag, setCreateFlag ] = React.useState<boolean>();
+  const [userInfoAll, setUserInfoAll] = React.useState<any>({});
 
   const props : UploadProps = {
     name: 'files',
@@ -181,6 +183,7 @@ const KnowledgeLibInfo : React.FC = () => {
     setDeleteFlag( deleteF );
     const createF = LocalStorage.getStatusFlag( 'deepseek:document:create' );
     setCreateFlag( createF );
+    setUserInfoAll(LocalStorage.getUserInfo());
     return () => reset();
   }, [] );
 
@@ -269,10 +272,10 @@ const KnowledgeLibInfo : React.FC = () => {
       dataIndex: 'operation',
       width: 180,
       fixed: 'right',
-      render: ( text, record ) => {
+      render: ( text, record:any ) => {
         return (
             <>
-              { createFlag &&
+              { (createFlag||userInfoAll.id===record.createBy) &&
                   <a
                       style={ { marginRight: 16 } }
                       onClick={ () => {
@@ -281,14 +284,14 @@ const KnowledgeLibInfo : React.FC = () => {
                           documentId: record.documentId,
                           embeddingId: state.knowledgeDetail.embeddingId,
                         } );
-                        router.navigate( { pathname: path } );
+                        router.navigate( { pathname: path },{state:{ createBy:record.createBy}} );
                       } }
                   >
                     切片
                   </a>
               }
               {
-                  cUpdateFlag &&
+                  (cUpdateFlag||userInfoAll.id===record.createBy) &&
                   <a
                       style={ { marginRight: 16 } }
                       onClick={ () => {
@@ -299,7 +302,7 @@ const KnowledgeLibInfo : React.FC = () => {
                   </a>
               }
               {
-                  cUpdateFlag &&
+                  (cUpdateFlag||userInfoAll.id===record.createBy) &&
                   <a
                       style={ { marginRight: 16 } }
                       onClick={ () => {
@@ -309,7 +312,7 @@ const KnowledgeLibInfo : React.FC = () => {
                   </a>
               }
               {
-                  deleteFlag &&
+                  (deleteFlag||userInfoAll.id===record.createBy) &&
                   <a
                       className='text-error'
                       onClick={ () => {
@@ -402,7 +405,7 @@ const KnowledgeLibInfo : React.FC = () => {
                     返回
                   </Button>
                   {
-                      createFlag &&
+                      (createFlag||userInfoAll.id===location?.state?.createBy) &&
                       <Upload { ...props }>
                         <Button type='primary' icon={ <PlusOutlined /> }>上传知识文件</Button>
                       </Upload>

+ 14 - 5
src/pages/deepseek/knowledgeLib/list/index.tsx

@@ -9,6 +9,7 @@ import store from './store';
 import { Record } from './types';
 import './style.less';
 import LocalStorage from '@/LocalStorage';
+import router from '@/router';
 
 const KnowledgeLibList: React.FC = () => {
     const {
@@ -34,7 +35,7 @@ const KnowledgeLibList: React.FC = () => {
     const [deleteFlag, setDeleteFlag] = React.useState<boolean>();
     const [updateFlag, setUpdateFlag] = React.useState<boolean>();
     const [listFlag, setListFlag] = React.useState<boolean>();
-
+    const [userInfoAll, setUserInfoAll] = React.useState<any>({});
     React.useEffect(() => {
         init();
         const cFlag = LocalStorage.getStatusFlag('deepseek:knowledge:create');
@@ -45,6 +46,7 @@ const KnowledgeLibList: React.FC = () => {
         setUpdateFlag(tFlag);
         const lFlag = LocalStorage.getStatusFlag('deepseek:knowledge:list');
         setListFlag(lFlag);
+        setUserInfoAll(LocalStorage.getUserInfo());
         
         // 监听面包屑创建知识库事件
         const handleKnowledgeLibCreate = (event: CustomEvent) => {
@@ -76,9 +78,16 @@ const KnowledgeLibList: React.FC = () => {
             render: (text, record) => {
                 if (createFlag) {
                     return (
-                        <Link to={{ pathname: `/deepseek/knowledgeLib/${record.knowledgeId}` }} >
+                        <a href=""
+                            onClick={()=>{
+                                router.navigate({ pathname: `/deepseek/knowledgeLib/${record.knowledgeId}` }, { state: { createBy: record.createBy } });
+                            }}
+                        >
                             {text}
-                        </Link>
+                        </a>
+                        // <Link to={{ pathname: `/deepseek/knowledgeLib/${record.knowledgeId}`}} >
+                        //     {text}
+                        // </Link>
                     )
                 } else {
                     return (
@@ -157,7 +166,7 @@ const KnowledgeLibList: React.FC = () => {
                 return (
                     <>
                         {
-                            updateFlag &&
+                            (updateFlag||userInfoAll.id===record.createBy) &&
                             <a
                                 style={{ marginRight: 16 }}
                                 onClick={() => {
@@ -169,7 +178,7 @@ const KnowledgeLibList: React.FC = () => {
                         }
 
                         {
-                            deleteFlag &&
+                            (deleteFlag||userInfoAll.id===record.createBy) &&
                             <a
                                 className='text-error'
                                 onClick={() => {

+ 7 - 5
src/pages/deepseek/knowledgeLib/slice/index.tsx

@@ -40,7 +40,8 @@ const SliceList: React.FC = () => {
     const [deleteFlag, setDeleteFlag] = React.useState<boolean>();
     const [updateFlag, setUpdateFlag] = React.useState<boolean>();
     const [listFlag, setListFlag] = React.useState<boolean>();
-
+    const [userInfoAll, setUserInfoAll] = React.useState<any>({});
+    
     const appApi = {
         fetchList: async (p0: { searchText: string; }) => {
             setListLoading(true);
@@ -125,6 +126,7 @@ const SliceList: React.FC = () => {
         const tFlag = LocalStorage.getStatusFlag('deepseek:slice:update');
         setUpdateFlag(tFlag);
         const lFlag = LocalStorage.getStatusFlag('deepseek:slice:list');
+        setUserInfoAll(LocalStorage.getUserInfo());
         setListFlag(lFlag);
         return () => {
             page.pageNum = 1;
@@ -179,7 +181,7 @@ const SliceList: React.FC = () => {
                     </Form>
                     <div>
                         {
-                            createFlag &&
+                            (createFlag||userInfoAll.id===location?.state.createBy) &&
                             <Button
                                 style={{ marginRight: 16 }}
                                 type='primary'
@@ -227,7 +229,7 @@ const SliceList: React.FC = () => {
                                     xxl: 5, // 展示的列数
                                 }}
                                 dataSource={list}
-                                renderItem={(item) => (
+                                renderItem={(item:any) => (
                                     <List.Item>
                                         <div className='card'>
                                             <div style={{ height: 80, overflow: 'auto' }}>
@@ -241,7 +243,7 @@ const SliceList: React.FC = () => {
 
                                                 <div style={{ overflow: 'auto' }}>
                                                     {
-                                                        updateFlag &&
+                                                        (updateFlag||userInfoAll.id===item.createBy) &&
                                                         <a
                                                             style={{ marginRight: 20 }}
                                                             onClick={() => {
@@ -259,7 +261,7 @@ const SliceList: React.FC = () => {
                                                     }
 
                                                     {
-                                                        deleteFlag &&
+                                                        (deleteFlag||userInfoAll.id===item.createBy) &&
                                                         <a className='text-error' onClick={() => {
                                                             Modal.confirm({
                                                                 title: '删除',

+ 24 - 11
src/pages/deepseek/questionAnswer/list/index.tsx

@@ -148,7 +148,7 @@ const QuestionAnswerList: React.FC = () => {
           pageNumber: page.pageNumber,
           userId: userId,
           typeId: typeId,
-          projectId: projectId,
+          projectId: projectId?.toString(),
           keyword: keyword,
         })
         const list = res.rows.map((item: any) => {
@@ -227,7 +227,7 @@ const QuestionAnswerList: React.FC = () => {
           pageNumber: page.pageNumber,
           userId: userId,
           typeId: typeId,
-          projectId: projectId,
+          projectId: projectId?.toString(),
           keyword: keyword,
         })
         setAppCount(res.data.applicationCount);
@@ -263,7 +263,18 @@ const QuestionAnswerList: React.FC = () => {
     fetchAppProType: async () => {
       try {
         const res = await apis.fetchTakaiAppTypeList('projectTree');
-        const list: AppTypeList = res.data;
+        // const list: AppTypeList = res.data;
+        const list: AppTypeList = res.data?.reduce((acc: any, item: any) => {
+          if (item.children.length > 0) {
+            item.children.forEach((val: any) => {
+              acc.push({
+                label: val.label,
+                value: `${val.value}`,
+              })
+            })
+          }
+          return acc;
+        }, []);
         setAppProjectList(list);
         // const res = await apis.fetchTakaiAppTypeList('projectTree');
         // const list = res.data.map((item: any) => {
@@ -665,6 +676,7 @@ const QuestionAnswerList: React.FC = () => {
                             flexDirection: 'column',
                             justifyContent: 'center',
                             overflow: 'hidden',
+                            maxWidth: '85%',
                             height: '100%'
                           }}>
                             <Tooltip title={item.name} placement="top">
@@ -677,7 +689,7 @@ const QuestionAnswerList: React.FC = () => {
                                 whiteSpace: 'nowrap',
                                 // maxWidth: '200px', // 可以根据需要调整宽度
                                 cursor: 'pointer'
-                              }}> 
+                              }}>
                                 {item.name.length > 20 ? `${item.name.substring(0, 30)}...` : item.name}
                               </div>
                             </Tooltip>
@@ -749,19 +761,19 @@ const QuestionAnswerList: React.FC = () => {
                         display: 'flex',
                         justifyContent: 'space-between',
                         alignItems: 'flex-end',
-                        marginTop: 3,
+                        paddingTop: 3,
                         // overflow: 'auto',
                         // paddingTop: 16,
                         // height: '100%'
                       }}>
-                        <div style={{ 
-                          overflow: 'auto' 
-                          }}>
+                        <div style={{
+                          overflow: 'auto'
+                        }}>
                           {
                             (item.status === '5' || item.status === '4' || item.status === '3' || item.status === '' || item.status === null) &&
                             <>
                               {
-                                (updateFlag||userInfoAll.id===item.createBy) &&
+                                (updateFlag || userInfoAll.id === item.createBy) &&
                                 <a
                                   className="action-button"
                                   style={{ marginRight: 16 }}
@@ -773,7 +785,7 @@ const QuestionAnswerList: React.FC = () => {
                               }
 
                               {
-                                (deleteFlag||userInfoAll.id===item.createBy) &&
+                                (deleteFlag || userInfoAll.id === item.createBy) &&
                                 <a className='delete-button' onClick={() => {
                                   Modal.confirm({
                                     title: '删除',
@@ -812,7 +824,8 @@ const QuestionAnswerList: React.FC = () => {
                             background: 'transparent',
                             border: '1px solid #1677ff',
                             color: '#1677ff',
-                            marginLeft: createFlag && item.status === '5'||(item.status === '5' || item.status === '4' || item.status === '3' || item.status === '' || item.status === null)&&updateFlag?8:0,
+                            marginTop: '2px',
+                            marginLeft: createFlag && item.status === '5' || (item.status === '5' || item.status === '4' || item.status === '3' || item.status === '' || item.status === null) && updateFlag||userInfoAll.id === item.createBy ? '10px' : 0,
                             fontSize: 12,
                           }} type="primary" variant="outlined" onClick={() => { useNowAppLication(item.appId) }}>立即使用</Button>
                         </div>