Commit 185c5b56 authored by wuyongsheng's avatar wuyongsheng

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

parent f1521f2d
......@@ -68,6 +68,7 @@ const ProjectData = observer(() => {
useEffect(() => {
const locationInfo: any = location?.state;
setActiveTab(locationInfo?.dataType || 'file')
setPath(locationInfo?.pathName || "/");
}, [location]);
......
......@@ -47,21 +47,18 @@ const TaskCard = (props: TaskCardProps) => {
}
}, [outputs])
// 结果文件跳转
const goToProjectData = (path: string) => {
const goToProjectData = (info: any) => {
let { path = '' , type = '' } = info
const lastIndex = path.lastIndexOf("/");
// /projectData
// dataType
if (lastIndex !== -1) {
path = path.slice(0, lastIndex);
}
path = path.slice(12);
if (path) {
navigate(`/product/cadd/projectData`, {
state: { pathName: path },
});
} else {
navigate(`/product/cadd/projectData`, {
state: { pathName: "/" },
});
}
navigate(`/product/cadd/projectData`, {
state: { pathName: path || '/', dataType: type },
});
}
// 跳转详情页
const gotoDetail = (id: string) => {
......@@ -177,15 +174,15 @@ const TaskCard = (props: TaskCardProps) => {
{randerOutputs.length === 0 ? <div className={style.noResult}>暂无结果文件</div> :
<div className={style.resultBox}>
{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
className={style.outputLeftImg}
src={
item.type === "file" ? fileIcon : dataSetIcon
item?.type === "file" ? fileIcon : dataSetIcon
}
alt=""
/>
{item.name}</div>
{item?.name}</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