Commit 0b259dc1 authored by chenshouchao's avatar chenshouchao

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

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