Commit 0b259dc1 authored by chenshouchao's avatar chenshouchao

fix: 解决首次切换产品后获取项目数据报错的问题

parent a1155ca9
......@@ -77,6 +77,8 @@ const ProjectData = observer(() => {
let tableRef: any = React.createRef();
// 是否显示复选框 用户搜索文件后不显示 其他情况显示
const [showCheckBox, setShowCheckBox] = useState<boolean>(true);
// 文件服务器指向
const fileServerEndPoint = localStorage.getItem("fileServerEndPoint");
// 切换文件、数据集
const handleChangeListType = (e: number) => {
......@@ -192,25 +194,27 @@ const ProjectData = observer(() => {
if (keyWord) {
return;
} else if (fileToken && projectId) {
setTableLoadding(true);
return CloudEController.JobOutFileList(
path,
fileToken,
projectId,
false
)?.then((res) => {
setTableLoadding(false);
if (Array.isArray(res.data)) {
setList(res.data);
} else {
setList([]);
}
setSelectIds([]);
setDebounce(false);
setShowCheckBox(true);
});
if (fileServerEndPoint) {
setTableLoadding(true);
return CloudEController.JobOutFileList(
path,
fileToken,
projectId,
false
)?.then((res) => {
setTableLoadding(false);
if (Array.isArray(res.data)) {
setList(res.data);
} else {
setList([]);
}
setSelectIds([]);
setDebounce(false);
setShowCheckBox(true);
});
}
}
}, [fileToken, path, projectId, keyWord]);
}, [fileToken, path, projectId, keyWord, fileServerEndPoint]);
useEffect(() => {
getList();
......
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