Commit 185c5b56 authored by wuyongsheng's avatar wuyongsheng

fix: 项目概览跳转数据集合

parent f1521f2d
...@@ -68,6 +68,7 @@ const ProjectData = observer(() => { ...@@ -68,6 +68,7 @@ const ProjectData = observer(() => {
useEffect(() => { useEffect(() => {
const locationInfo: any = location?.state; const locationInfo: any = location?.state;
setActiveTab(locationInfo?.dataType || 'file')
setPath(locationInfo?.pathName || "/"); setPath(locationInfo?.pathName || "/");
}, [location]); }, [location]);
......
...@@ -47,21 +47,18 @@ const TaskCard = (props: TaskCardProps) => { ...@@ -47,21 +47,18 @@ const TaskCard = (props: TaskCardProps) => {
} }
}, [outputs]) }, [outputs])
// 结果文件跳转 // 结果文件跳转
const goToProjectData = (path: string) => { const goToProjectData = (info: any) => {
let { path = '' , type = '' } = info
const lastIndex = path.lastIndexOf("/"); const lastIndex = path.lastIndexOf("/");
// /projectData
// dataType
if (lastIndex !== -1) { if (lastIndex !== -1) {
path = path.slice(0, lastIndex); path = path.slice(0, lastIndex);
} }
path = path.slice(12); path = path.slice(12);
if (path) { navigate(`/product/cadd/projectData`, {
navigate(`/product/cadd/projectData`, { state: { pathName: path || '/', dataType: type },
state: { pathName: path }, });
});
} else {
navigate(`/product/cadd/projectData`, {
state: { pathName: "/" },
});
}
} }
// 跳转详情页 // 跳转详情页
const gotoDetail = (id: string) => { const gotoDetail = (id: string) => {
...@@ -177,15 +174,15 @@ const TaskCard = (props: TaskCardProps) => { ...@@ -177,15 +174,15 @@ const TaskCard = (props: TaskCardProps) => {
{randerOutputs.length === 0 ? <div className={style.noResult}>暂无结果文件</div> : {randerOutputs.length === 0 ? <div className={style.noResult}>暂无结果文件</div> :
<div className={style.resultBox}> <div className={style.resultBox}>
{randerOutputs.map((item, index) => { {randerOutputs.map((item, index) => {
return <div key={index} className={style.result} onClick={() => goToProjectData(item.path)}> return <div key={index} className={style.result} onClick={() => goToProjectData(item)}>
<img <img
className={style.outputLeftImg} className={style.outputLeftImg}
src={ src={
item.type === "file" ? fileIcon : dataSetIcon item?.type === "file" ? fileIcon : dataSetIcon
} }
alt="" alt=""
/> />
{item.name}</div> {item?.name}</div>
})} })}
</div> </div>
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment