Commit a72b5ebe authored by chenshouchao's avatar chenshouchao

feat: 数据集跳转到数据管理页面逻辑修改

parent 43cfd8b7
import { useMemo, useCallback, useEffect, useState } from "react"; import { useMemo, useCallback, useState } from "react";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import MyProgress from "@/components/mui/MyProgress"; import MyProgress from "@/components/mui/MyProgress";
import { getDatasetPath } from "../../ProjectJobDetail/utils";
import style from "./index.module.css"; import style from "./index.module.css";
import { useStores } from "@/store"; import { useStores } from "@/store";
import { toJS } from "mobx"; import { toJS } from "mobx";
...@@ -27,7 +28,7 @@ type TaskCardProps = { ...@@ -27,7 +28,7 @@ type TaskCardProps = {
outputs: Array<any>; outputs: Array<any>;
}; };
const TaskCard = (props: TaskCardProps) => { const TaskCard = observer((props: TaskCardProps) => {
const { const {
id, id,
name, name,
...@@ -66,15 +67,17 @@ const TaskCard = (props: TaskCardProps) => { ...@@ -66,15 +67,17 @@ const TaskCard = (props: TaskCardProps) => {
// 结果文件跳转 // 结果文件跳转
const goToProjectData = (info: any) => { const goToProjectData = (info: any) => {
let { path = "", type = "" } = info; let { path = "", type = "" } = info;
if (type === "file") {
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);
} else {
path = getDatasetPath(path);
}
navigate(`/product/${productId || "cadd"}/projectData`, { navigate(`/product/${productId || "cadd"}/projectData`, {
state: { pathName: path || "/", dataType: type }, state: { pathName: path, dataType: type },
}); });
}; };
// 跳转详情页 // 跳转详情页
...@@ -247,6 +250,6 @@ const TaskCard = (props: TaskCardProps) => { ...@@ -247,6 +250,6 @@ const TaskCard = (props: TaskCardProps) => {
</div> </div>
</div> </div>
); );
}; });
export default TaskCard; export default TaskCard;
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