Commit 88289aac authored by chenshouchao's avatar chenshouchao

feat: 除下载外联调完成

parent c5517fd8
...@@ -18,8 +18,11 @@ const RESTAPI = { ...@@ -18,8 +18,11 @@ const RESTAPI = {
API_PROJECT_GET: `${BACKEND_API_URI_PREFIX}/cpp/project/get`, //获取项目信息 API_PROJECT_GET: `${BACKEND_API_URI_PREFIX}/cpp/project/get`, //获取项目信息
API_CPCE_HPCZONE: `${BACKEND_API_URI_PREFIX}/cpp/cpce/hpczone`, //获取计算区列表 API_CPCE_HPCZONE: `${BACKEND_API_URI_PREFIX}/cpp/cpce/hpczone`, //获取计算区列表
API_DATA_FILETOKEN: `${BACKEND_API_URI_PREFIX}/cpp/data/filetoken`, //获取项目目录的filetoken API_DATA_FILETOKEN: `${BACKEND_API_URI_PREFIX}/cpp/data/filetoken`, //获取项目目录的filetoken
API_USER_PERMISSION_LIST: `${BACKEND_API_URI_PREFIX}/uaa/routes/privilege/list`,//获取用户包含的权限列表 API_DATA_FIND: `${BACKEND_API_URI_PREFIX}/cpp/data/find`, //查询某路径下数据集
} API_DATA_SEARCH: `${BACKEND_API_URI_PREFIX}/cpp/data/search`, //搜索项目中某路径下的数据集
API_DATA_MOVE: `${BACKEND_API_URI_PREFIX}/cpp/data/move`, //移动到
API_DATA_DEL: `${BACKEND_API_URI_PREFIX}/cpp/data/del`, //删除项目中的数据集
API_USER_PERMISSION_LIST: `${BACKEND_API_URI_PREFIX}/uaa/routes/privilege/list`, //获取用户包含的权限列表
};
export default RESTAPI; export default RESTAPI;
...@@ -99,6 +99,74 @@ const getDataFileToken = (params: getDataFileTokenParams) => { ...@@ -99,6 +99,74 @@ const getDataFileToken = (params: getDataFileTokenParams) => {
}); });
}; };
type getDataFindParams = {
projectId: string;
path: string;
};
// 查询某路径下数据集
const getDataFind = (params: getDataFindParams) => {
return request({
url: Api.API_DATA_FIND,
method: "get",
params,
});
};
type getDataFileSearchParams = {
projectId: string;
name: string;
path?: string;
};
// 搜索项目中某路径下的数据集
const getDataFileSearch = (params: getDataFileSearchParams) => {
return request({
url: Api.API_DATA_SEARCH,
method: "get",
params,
});
};
type getDataFileMoveParams = {
projectId: string;
names: string;
spath?: string; // 原路径
dpath?: string; // 目标路径
};
// Content-Type application/x-www-form-urlencoded
// 移动到
const getDataFileMove = (params: getDataFileMoveParams) => {
return request({
url: Api.API_DATA_MOVE,
method: "put",
data: params,
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
});
};
type getDataFileDelParams = {
projectId: string;
names: string;
path?: string;
};
// Content-Type application/x-www-form-urlencoded
// 删除项目中的数据集
const getDataFileDel = (params: getDataFileDelParams) => {
return request({
url: Api.API_DATA_DEL,
method: "delete",
params,
headers: {
"Content-Type": "application/x-www-form-urlencoded",
},
});
};
export { export {
current, current,
menu, menu,
...@@ -109,4 +177,8 @@ export { ...@@ -109,4 +177,8 @@ export {
updateProject, updateProject,
deleteProject, deleteProject,
getDataFileToken, getDataFileToken,
getDataFind,
getDataFileSearch,
getDataFileMove,
getDataFileDel,
}; };
...@@ -15,6 +15,7 @@ import EnhancedTableHeadComponent from "./Table/EnhancedTableHead" ...@@ -15,6 +15,7 @@ import EnhancedTableHeadComponent from "./Table/EnhancedTableHead"
import { getComparator, stableSort, useStyles } from "./Table/function"; import { getComparator, stableSort, useStyles } from "./Table/function";
import ActionsComponent from "./Table/ActionsComponent" import ActionsComponent from "./Table/ActionsComponent"
import { useEffect } from "react"; import { useEffect } from "react";
import { useImperativeHandle } from "react";
export default function EnhancedTable(props) { export default function EnhancedTable(props) {
const classes = useStyles; const classes = useStyles;
...@@ -27,6 +28,17 @@ export default function EnhancedTable(props) { ...@@ -27,6 +28,17 @@ export default function EnhancedTable(props) {
// const [spin, setSpin] = React.useState(false) // const [spin, setSpin] = React.useState(false)
const [onRow, setOnRow] = React.useState('') const [onRow, setOnRow] = React.useState('')
// 重置复选框选中选项
const initSelectedFunc = (e) => {
setSelected(e)
}
useImperativeHandle(props.onRef, () => {
return {
initSelectedFunc: initSelectedFunc,
};
});
useEffect(() => { useEffect(() => {
setOnRow(defaultRow) setOnRow(defaultRow)
}, [defaultRow]) }, [defaultRow])
......
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: center;
} }
.rootTitleActive {
background-color: rgba(25, 118, 210, 0.2);
}
.bigFolderIcon { .bigFolderIcon {
margin: 0 9px; margin: 0 9px;
} }
......
import React, { import React, { useState, useImperativeHandle, useCallback } from "react";
useState,
useImperativeHandle,
useCallback,
} from "react";
import style from "./index.module.css"; import style from "./index.module.css";
import MyDialog from "@/components/mui/MyDialog"; import MyDialog from "@/components/mui/MyDialog";
...@@ -11,11 +7,31 @@ import bigFolderIcon from "@/assets/project/bigFolderIcon.svg"; ...@@ -11,11 +7,31 @@ import bigFolderIcon from "@/assets/project/bigFolderIcon.svg";
import { useMessage } from "@/components/MySnackbar"; import { useMessage } from "@/components/MySnackbar";
import MyTreeView from "@/components/mui/MyTreeView"; import MyTreeView from "@/components/mui/MyTreeView";
import CloudEController from "@/api/fileserver/CloudEController"; import CloudEController from "@/api/fileserver/CloudEController";
import { getDataFileMove } from "@/api/project_api";
import useMyRequest from "@/hooks/useMyRequest";
import classNames from "classnames";
const MoveFile = (props: any) => { const MoveFile = (props: any) => {
const { path, projectId, fileToken, currentOperateFile, selectIds, refresh } = props; const {
path,
projectId,
fileToken,
currentOperateFile,
selectIds,
refresh,
activeTab,
showList,
} = props;
const Message = useMessage(); const Message = useMessage();
const [newPath, setNewPath] = useState(""); const { run: getDataFileMoveRun } = useMyRequest(getDataFileMove, {
onSuccess: (res: any) => {
Message.success("移动成功!");
moveFileDialogRef.current.handleClose();
refresh();
},
});
const [newPath, setNewPath] = useState("/");
const [rootActive, setRootActive] = useState(true);
const [treeData, setTreeData] = useState<any>([]); const [treeData, setTreeData] = useState<any>([]);
...@@ -53,6 +69,7 @@ const MoveFile = (props: any) => { ...@@ -53,6 +69,7 @@ const MoveFile = (props: any) => {
if (newPath) { if (newPath) {
if (!currentOperateFile) { if (!currentOperateFile) {
// 批量移动 // 批量移动
if (activeTab === 1) {
const oldPaths = selectIds.map((name: any) => { const oldPaths = selectIds.map((name: any) => {
return `${path}${path === "/" ? "" : "/"}${name}`; return `${path}${path === "/" ? "" : "/"}${name}`;
}); });
...@@ -63,8 +80,55 @@ const MoveFile = (props: any) => { ...@@ -63,8 +80,55 @@ const MoveFile = (props: any) => {
fileToken, fileToken,
projectId projectId
)?.then((res) => { )?.then((res) => {
Message.success('移动成功!') Message.success("移动成功!");
refresh() moveFileDialogRef.current.handleClose();
refresh();
});
} else {
const datSetMoveList = showList.filter((item: any) => {
return (
selectIds.indexOf(item.name) !== -1 && item.type === "dataSet"
);
});
const otherMoveList = showList.filter((item: any) => {
return (
selectIds.indexOf(item.name) !== -1 && item.type !== "dataSet"
);
});
if (datSetMoveList.length > 0) {
const oldPaths = `${path}${path === "/" ? "" : "/"}`;
getDataFileMoveRun({
projectId: projectId as string,
names: datSetMoveList.map((item: any) => item.name).join(","),
spath: oldPaths,
dpath: newPath === "/" ? "/" : `${newPath}/`,
});
}
if (otherMoveList.length > 0) {
const oldPaths = otherMoveList.map((item: any) => {
return `${path}${path === "/" ? "" : "/"}${item.name}`;
});
CloudEController.JobFileBatchMove(
newPath,
oldPaths,
"",
fileToken,
projectId
)?.then((res) => {
Message.success("移动成功!");
moveFileDialogRef.current.handleClose();
refresh();
});
}
}
} else {
if (currentOperateFile.type === "dataSet") {
const oldPaths = `${path}${path === "/" ? "" : "/"}`;
getDataFileMoveRun({
projectId: projectId as string,
names: currentOperateFile.name,
spath: oldPaths,
dpath: newPath === "/" ? "/" : `${newPath}/`,
}); });
} else { } else {
const oldPath = `${path}${path === "/" ? "" : "/"}${ const oldPath = `${path}${path === "/" ? "" : "/"}${
...@@ -81,9 +145,11 @@ const MoveFile = (props: any) => { ...@@ -81,9 +145,11 @@ const MoveFile = (props: any) => {
fileToken, fileToken,
projectId projectId
)?.then((res) => { )?.then((res) => {
console.log(res); Message.success("移动成功!");
moveFileDialogRef.current.handleClose();
}); });
} }
}
} else { } else {
Message.error("请选择移动到哪个目录"); Message.error("请选择移动到哪个目录");
} }
...@@ -99,8 +165,13 @@ const MoveFile = (props: any) => { ...@@ -99,8 +165,13 @@ const MoveFile = (props: any) => {
}; };
const onNodeSelect = (a: any, b: any) => { const onNodeSelect = (a: any, b: any) => {
console.log("onNodeSelect", a, b);
setNewPath(b); setNewPath(b);
setRootActive(false);
};
const handleRoot = () => {
setNewPath("/");
setRootActive(true);
}; };
const moveFileSubmitloading = false; const moveFileSubmitloading = false;
...@@ -116,7 +187,13 @@ const MoveFile = (props: any) => { ...@@ -116,7 +187,13 @@ const MoveFile = (props: any) => {
title="移动至" title="移动至"
submitloading={moveFileSubmitloading} submitloading={moveFileSubmitloading}
> >
<div className={style.rootTitle}> <div
className={classNames({
[style.rootTitle]: true,
[style.rootTitleActive]: rootActive,
})}
onClick={handleRoot}
>
<img className={style.bigFolderIcon} src={bigFolderIcon} alt="" /> <img className={style.bigFolderIcon} src={bigFolderIcon} alt="" />
ProjectData ProjectData
</div> </div>
......
...@@ -31,6 +31,11 @@ import DialogContent from "@mui/material/DialogContent"; ...@@ -31,6 +31,11 @@ import DialogContent from "@mui/material/DialogContent";
import DialogContentText from "@mui/material/DialogContentText"; import DialogContentText from "@mui/material/DialogContentText";
import DialogTitle from "@mui/material/DialogTitle"; import DialogTitle from "@mui/material/DialogTitle";
import usePass from "@/hooks/usePass"; import usePass from "@/hooks/usePass";
import {
getDataFind,
getDataFileSearch,
getDataFileDel,
} from "@/api/project_api";
const theme = createTheme({ const theme = createTheme({
palette: { palette: {
...@@ -58,62 +63,111 @@ declare module "@mui/material/Button" { ...@@ -58,62 +63,111 @@ declare module "@mui/material/Button" {
const ProjectData = observer(() => { const ProjectData = observer(() => {
const isPass = usePass(); const isPass = usePass();
const Message = useMessage() const Message = useMessage();
const { currentProjectStore } = useStores(); const { currentProjectStore } = useStores();
const projectId = useMemo(() => {
return toJS(currentProjectStore.currentProjectInfo.id);
}, [currentProjectStore]);
const [tableLoadding, setTableLoadding] = useState(false); const [tableLoadding, setTableLoadding] = useState(false);
const [deleteDialogOpen, setDeleteDialogOpen] = useState(false); const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
const [currentOperateFile, setCurrentOperateFile] = useState<any>(null); const [currentOperateFile, setCurrentOperateFile] = useState<any>(null);
const [deleteloading, setDeleteloading] = useState(false); const [deleteloading, setDeleteloading] = useState(false);
const [path, setPath] = useState("/"); const [path, setPath] = useState("/");
const showPath = useMemo(() => {
if (path === "/") {
// return "ProjectData";
return <span className={style.showPathSpan}>ProjectData</span>
} else {
console.log(path)
console.log(path.split('/'))
const pathArr = path.split('/')
if (pathArr.length <= 4) {
return (pathArr.map((item, index) => {
return (<span onClick={()=>setPath(pathArr.slice(0, index + 1).join('/') === '' ? '' : pathArr.slice(0, index + 1).join('/'))} className={classnames({
[style.showPathSpan]: true,
[style.showPathSpanActive]: index === pathArr.length - 1
})}>{index === 0 ? 'ProjectData' :item} {index === pathArr.length - 1 ? null : <i className={style.showPathI}>{'>'}</i>}</span>)
}))
} else {
return (pathArr.map((item, index) => {
return (<span onClick={()=>setPath(pathArr.slice(0, index + 1).join('/') === '' ? '' : pathArr.slice(0, index + 1).join('/'))} className={classnames({
[style.showPathSpan]: true,
[style.showPathSpanActive]: index === pathArr.length - 1
})}>
{index === 0 ? 'ProjectData' : index > pathArr.length - 4 ? item : '' }
{/* && index > pathArr.length - 4 */}
{index === pathArr.length - 1 || (index <= pathArr.length - 4 && index > 0) ? null : <i className={style.showPathI}>{'>'}</i>}
{index === 1 && '...'}{index === 1 && <i className={style.showPathI}>{'>'}</i>}
</span>)
}))
}
}
}, [path]);
const [activeTab, setActiveTab] = useState(1); const [activeTab, setActiveTab] = useState(1);
const [selectIds, setSelectIds] = useState<Array<string>>([]);
let tableRef: any = React.createRef();
useEffect(() => {
setSelectIds([]);
}, [activeTab]);
const [keyWord, setKeyWord] = useState(""); const [keyWord, setKeyWord] = useState("");
const [fileToken, setFileToken] = useState(""); const [fileToken, setFileToken] = useState("");
// 文件列表
const [list, setList] = useState<any>([]); const [list, setList] = useState<any>([]);
// 数据集列表 不带文件
const [dataSetList, setDataSetList] = useState<any>([]);
const showList = useMemo(() => {
if (activeTab === 1) {
return list;
} else {
const folderList = list.filter((item: any) => {
return item.type === "directory";
});
return [...folderList, ...dataSetList];
}
}, [list, dataSetList, activeTab]);
const { run: getDataFileTokenRun } = useMyRequest(getDataFileToken, { const { run: getDataFileTokenRun } = useMyRequest(getDataFileToken, {
onSuccess: (res: any) => { onSuccess: (res: any) => {
console.log("res", res);
setFileToken(res.data); setFileToken(res.data);
}, },
}); });
const projectId = useMemo(() => { const { run: getDataFileSearchRun } = useMyRequest(getDataFileSearch, {
return toJS(currentProjectStore.currentProjectInfo.id); onSuccess: (res: any) => {
}, [currentProjectStore]); const dataSetList = res.data.map((item: any) => {
return {
...item,
type: "dataSet",
};
});
setDataSetList(dataSetList);
setSelectIds([]);
tableRef?.current?.initSelectedFunc([]);
},
});
// useEffect(() => {
// if (activeTab === 2) {
// getDataFileSearchRun()
// }
// }, [activeTab, getDataFileSearchRun]);
const { run: getDataFindRun } = useMyRequest(getDataFind, {
onSuccess: (res: any) => {
const dataSetList = res.data.map((item: any) => {
return {
...item,
type: "dataSet",
};
});
setDataSetList(dataSetList);
setSelectIds([]);
tableRef?.current?.initSelectedFunc([]);
},
});
const getDataSetList = useCallback(() => {
if (keyWord) {
return;
} else {
return getDataFindRun({
projectId: projectId as string,
path: path === "/" ? "/" : `${path}/`,
});
}
}, [keyWord, path, projectId, getDataFindRun]);
const getDataSetListSearch = useCallback(() => {
if (keyWord) {
return getDataFileSearchRun({
projectId: projectId as string,
name: keyWord,
});
} else {
return getDataSetList();
}
}, [keyWord, projectId, getDataFileSearchRun, getDataSetList]);
useEffect(() => {
getDataSetList();
}, [getDataSetList]);
const getList = useCallback(() => { const getList = useCallback(() => {
if (fileToken && projectId) { if (keyWord) {
return;
} else if (fileToken && projectId) {
setTableLoadding(true); setTableLoadding(true);
return CloudEController.JobOutFileList( return CloudEController.JobOutFileList(
path, path,
...@@ -127,20 +181,26 @@ const ProjectData = observer(() => { ...@@ -127,20 +181,26 @@ const ProjectData = observer(() => {
} else { } else {
setList([]); setList([]);
} }
setSelectIds([]);
}); });
} }
}, [fileToken, path, projectId]); }, [fileToken, path, projectId, keyWord]);
useEffect(() => { useEffect(() => {
getList(); getList();
}, [getList]); }, [getList]);
// 全局搜索文件列表 // 全局搜索文件列表
const searchFileList = useCallback(() => { const searchFileList = useCallback(() => {
if (!keyWord) {
getList();
} else {
if (fileToken && projectId) { if (fileToken && projectId) {
setTableLoadding(true); setTableLoadding(true);
setPath("/");
return CloudEController.JobSearchFileList( return CloudEController.JobSearchFileList(
keyWord, keyWord,
path, "/",
fileToken, fileToken,
projectId, projectId,
false false
...@@ -151,17 +211,22 @@ const ProjectData = observer(() => { ...@@ -151,17 +211,22 @@ const ProjectData = observer(() => {
} else { } else {
setList([]); setList([]);
} }
setSelectIds([]);
}); });
} }
}, [fileToken, path, projectId, keyWord]); }
}, [fileToken, projectId, keyWord, getList]);
const handleRefresh = () => { const handleRefresh = () => {
tableRef?.current?.initSelectedFunc([]);
setSelectIds([]);
if (keyWord) { if (keyWord) {
searchFileList() searchFileList();
getDataSetListSearch();
} else { } else {
getList(); getList();
getDataSetList();
} }
setSelectIds([])
}; };
useEffect(() => { useEffect(() => {
...@@ -172,19 +237,17 @@ const ProjectData = observer(() => { ...@@ -172,19 +237,17 @@ const ProjectData = observer(() => {
const handleKeyWordChange = (e: any) => { const handleKeyWordChange = (e: any) => {
if (e.target.value.length > 30) { if (e.target.value.length > 30) {
return return;
} }
setKeyWord(e.target.value); setKeyWord(e.target.value);
}; };
const handleKeyWordChangeKeyUp = (e: any) => { const handleKeyWordChangeKeyUp = (e: any) => {
if (e.keyCode === 13) { if (e.keyCode === 13) {
searchFileList() searchFileList();
console.log('搜索') getDataSetListSearch();
} }
} };
const [selectIds, setSelectIds] = useState([]);
const versionsHeadCells = [ const versionsHeadCells = [
{ id: "checkbox" }, { id: "checkbox" },
...@@ -202,8 +265,8 @@ const ProjectData = observer(() => { ...@@ -202,8 +265,8 @@ const ProjectData = observer(() => {
const handleViewFolders = (item: any) => { const handleViewFolders = (item: any) => {
console.log("handleViewFolders"); console.log("handleViewFolders");
console.log(item); console.log(item);
if (path === '/') { if (path === "/") {
setPath(`/${item.name}`) setPath(`/${item.name}`);
} else { } else {
setPath(`${path}/${item.name}`); setPath(`${path}/${item.name}`);
} }
...@@ -225,6 +288,13 @@ const ProjectData = observer(() => { ...@@ -225,6 +288,13 @@ const ProjectData = observer(() => {
{item.name} {item.name}
</span> </span>
); );
} else if (item.type === "dataSet") {
return (
<span className={style.folderIconBox}>
<img className={style.folderIcon} src={dataSetIcon} alt="" />
{item.name}
</span>
);
} else { } else {
return ( return (
<span className={style.folderIconBox}> <span className={style.folderIconBox}>
...@@ -236,6 +306,9 @@ const ProjectData = observer(() => { ...@@ -236,6 +306,9 @@ const ProjectData = observer(() => {
}; };
const renderSize = (item: any) => { const renderSize = (item: any) => {
if (item.type === "dataSet") {
return <span>{item.size}</span>;
}
return <span>{item.size ? `${item.size}b` : "-"}</span>; return <span>{item.size ? `${item.size}b` : "-"}</span>;
}; };
...@@ -300,28 +373,98 @@ const ProjectData = observer(() => { ...@@ -300,28 +373,98 @@ const ProjectData = observer(() => {
setDeleteDialogOpen(false); setDeleteDialogOpen(false);
}; };
const { run: getDataFileDelRun } = useMyRequest(getDataFileDel, {
onSuccess: (res: any) => {
Message.success("删除成功");
setDeleteloading(false);
setDeleteDialogOpen(false);
handleRefresh();
},
});
const handleDelete = () => { const handleDelete = () => {
let deletePath = '' let deletePath = "";
if (currentOperateFile) { if (currentOperateFile) {
deletePath = deletePath =
path === "/" path === "/"
? `${path}${currentOperateFile.name}` ? `${path}${currentOperateFile.name}`
: `${path}/${currentOperateFile.name}`; : `${path}/${currentOperateFile.name}`;
} else { } else {
deletePath = selectIds.map((name: any) => { deletePath = selectIds
.map((name: any) => {
return `${path}${path === "/" ? "" : "/"}${name}`; return `${path}${path === "/" ? "" : "/"}${name}`;
}).join(' '); })
.join(" ");
}
if (activeTab === 2) {
deletePath = path === "/" ? "/" : `${path}/`;
if (currentOperateFile) {
if (currentOperateFile.type === "dataSet") {
getDataFileDelRun({
projectId: projectId as string,
names: currentOperateFile.name,
path: deletePath,
});
} else {
deletePath =
path === "/"
? `${path}${currentOperateFile.name}`
: `${path}/${currentOperateFile.name}`;
CloudEController.JobOutFileDel(
deletePath,
fileToken,
projectId as string
)?.then((res) => {
Message.success("删除成功");
setDeleteloading(false);
setDeleteDialogOpen(false);
handleRefresh();
});
}
} else {
const datSetDeleteList = showList.filter((item: any) => {
return selectIds.indexOf(item.name) !== -1 && item.type === "dataSet";
});
const otherDeleteList = showList.filter((item: any) => {
return selectIds.indexOf(item.name) !== -1 && item.type !== "dataSet";
});
if (datSetDeleteList.length > 0) {
getDataFileDelRun({
projectId: projectId as string,
names: datSetDeleteList.map((item: any) => item.name).join(","),
path: deletePath,
});
}
if (otherDeleteList.length > 0) {
deletePath = otherDeleteList
.map((item: any) => {
return `${path}${path === "/" ? "" : "/"}${item.name}`;
})
.join(" ");
CloudEController.JobOutFileDel(
deletePath,
fileToken,
projectId as string
)?.then((res) => {
Message.success("删除成功");
setDeleteloading(false);
setDeleteDialogOpen(false);
handleRefresh();
});
} }
}
} else {
CloudEController.JobOutFileDel( CloudEController.JobOutFileDel(
deletePath, deletePath,
fileToken, fileToken,
projectId as string projectId as string
)?.then((res) => { )?.then((res) => {
Message.success('删除成功') Message.success("删除成功");
setDeleteloading(false); setDeleteloading(false);
setDeleteDialogOpen(false); setDeleteDialogOpen(false);
handleRefresh(); handleRefresh();
}); });
}
}; };
const handleBatchMove = () => { const handleBatchMove = () => {
...@@ -331,8 +474,73 @@ const ProjectData = observer(() => { ...@@ -331,8 +474,73 @@ const ProjectData = observer(() => {
const handleBatchDelete = () => { const handleBatchDelete = () => {
setCurrentOperateFile(null); setCurrentOperateFile(null);
setDeleteDialogOpen(true) setDeleteDialogOpen(true);
};
const showPath = useMemo(() => {
if (path === "/") {
return <span className={style.showPathSpan}>ProjectData</span>;
} else {
const pathArr = path.split("/");
if (pathArr.length <= 4) {
return pathArr.map((item, index) => {
return (
<span
key={index}
onClick={() =>
setPath(
pathArr.slice(0, index + 1).join("/") === ""
? "/"
: pathArr.slice(0, index + 1).join("/")
)
}
className={classnames({
[style.showPathSpan]: true,
[style.showPathSpanActive]: index === pathArr.length - 1,
})}
>
{index === 0 ? "ProjectData" : item}{" "}
{index === pathArr.length - 1 ? null : (
<i className={style.showPathI}>{">"}</i>
)}
</span>
);
});
} else {
return pathArr.map((item, index) => {
return (
<span
key={index}
onClick={() =>
setPath(
pathArr.slice(0, index + 1).join("/") === ""
? "/"
: pathArr.slice(0, index + 1).join("/")
)
}
className={classnames({
[style.showPathSpan]: true,
[style.showPathSpanActive]: index === pathArr.length - 1,
})}
>
{index === 0
? "ProjectData"
: index > pathArr.length - 4
? item
: ""}
{/* && index > pathArr.length - 4 */}
{index === pathArr.length - 1 ||
(index <= pathArr.length - 4 && index > 0) ? null : (
<i className={style.showPathI}>{">"}</i>
)}
{index === 1 && "..."}
{index === 1 && <i className={style.showPathI}>{">"}</i>}
</span>
);
});
} }
}
}, [path]);
return ( return (
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
...@@ -348,7 +556,9 @@ const ProjectData = observer(() => { ...@@ -348,7 +556,9 @@ const ProjectData = observer(() => {
size="small" size="small"
style={{ marginRight: "12px" }} style={{ marginRight: "12px" }}
onClick={hanleShowUpLoaderFileDialog} onClick={hanleShowUpLoaderFileDialog}
disabled={selectIds.length !== 0 || !isPass("PROJECT_DATA_UPLOAD")} disabled={
selectIds.length !== 0 || !isPass("PROJECT_DATA_UPLOAD")
}
> >
{/* todo 项目权限 */} {/* todo 项目权限 */}
上传文件 上传文件
...@@ -358,7 +568,9 @@ const ProjectData = observer(() => { ...@@ -358,7 +568,9 @@ const ProjectData = observer(() => {
variant="outlined" variant="outlined"
size="small" size="small"
onClick={hanleShowAddFolderDialog} onClick={hanleShowAddFolderDialog}
disabled={selectIds.length !== 0 || !isPass("PROJECT_DATA_ADDDIR")} disabled={
selectIds.length !== 0 || !isPass("PROJECT_DATA_ADDDIR")
}
> >
{/* todo 项目权限 */} {/* todo 项目权限 */}
新建文件夹 新建文件夹
...@@ -380,6 +592,7 @@ const ProjectData = observer(() => { ...@@ -380,6 +592,7 @@ const ProjectData = observer(() => {
aria-label="search" aria-label="search"
size="small" size="small"
style={{ padding: "4px" }} style={{ padding: "4px" }}
onClick={searchFileList}
> >
<SearchIcon <SearchIcon
className={style.searchIcon} className={style.searchIcon}
...@@ -428,7 +641,7 @@ const ProjectData = observer(() => { ...@@ -428,7 +641,7 @@ const ProjectData = observer(() => {
// param="name" // param="name"
rowHover={true} rowHover={true}
stickyheader={true} stickyheader={true}
rows={list.map((item: any) => ({ rows={showList.map((item: any) => ({
...item, ...item,
id: item.name, id: item.name,
name: renderName(item), name: renderName(item),
...@@ -441,6 +654,8 @@ const ProjectData = observer(() => { ...@@ -441,6 +654,8 @@ const ProjectData = observer(() => {
headCells={versionsHeadCells} headCells={versionsHeadCells}
nopadding={true} nopadding={true}
footer={false} footer={false}
initSelected={selectIds}
onRef={tableRef}
></Table> ></Table>
</div> </div>
{selectIds.length > 1 && ( {selectIds.length > 1 && (
...@@ -474,7 +689,10 @@ const ProjectData = observer(() => { ...@@ -474,7 +689,10 @@ const ProjectData = observer(() => {
<DialogTitle id="alert-dialog-title">{"提示"}</DialogTitle> <DialogTitle id="alert-dialog-title">{"提示"}</DialogTitle>
<DialogContent> <DialogContent>
<DialogContentText id="alert-dialog-description"> <DialogContentText id="alert-dialog-description">
确认要删除“{currentOperateFile ? currentOperateFile.name : selectIds.join('”,“')} 确认要删除“
{currentOperateFile
? currentOperateFile.name
: selectIds.join("”,“")}
”吗? ”吗?
</DialogContentText> </DialogContentText>
</DialogContent> </DialogContent>
...@@ -520,6 +738,8 @@ const ProjectData = observer(() => { ...@@ -520,6 +738,8 @@ const ProjectData = observer(() => {
currentOperateFile={currentOperateFile} currentOperateFile={currentOperateFile}
selectIds={selectIds} selectIds={selectIds}
refresh={handleRefresh} refresh={handleRefresh}
activeTab={activeTab}
showList={showList}
></MoveFile> ></MoveFile>
</div> </div>
</ThemeProvider> </ThemeProvider>
......
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