Commit 11a35e35 authored by chenshouchao's avatar chenshouchao

删除不必要的console.log

parent 24d0d635
...@@ -128,7 +128,6 @@ export class Http { ...@@ -128,7 +128,6 @@ export class Http {
if ( if (
newConfig?.headers['Content-Type'] === "application/x-www-form-urlencoded" newConfig?.headers['Content-Type'] === "application/x-www-form-urlencoded"
) { ) {
console.log(222)
newConfig.data = qs.stringify(data); newConfig.data = qs.stringify(data);
} }
return newConfig return newConfig
......
...@@ -28,726 +28,724 @@ import { useLocation } from "react-router-dom"; ...@@ -28,726 +28,724 @@ import { useLocation } from "react-router-dom";
import { getDataFind, getDataFileSearch } from "@/api/project_api"; import { getDataFind, getDataFileSearch } from "@/api/project_api";
const theme = createTheme({ const theme = createTheme({
palette: { palette: {
neutral: { neutral: {
main: "#1370FF", main: "#1370FF",
contrastText: "#fff", contrastText: "#fff",
}, },
}, },
}); });
declare module "@mui/material/styles" { declare module "@mui/material/styles" {
interface Palette { interface Palette {
neutral: Palette["primary"]; neutral: Palette["primary"];
} }
interface PaletteOptions { interface PaletteOptions {
neutral?: PaletteOptions["primary"]; neutral?: PaletteOptions["primary"];
} }
} }
declare module "@mui/material/Button" { declare module "@mui/material/Button" {
interface ButtonPropsColorOverrides { interface ButtonPropsColorOverrides {
neutral: true; neutral: true;
} }
} }
const ProjectData = observer(() => { const ProjectData = observer(() => {
const isPass = usePass(); const isPass = usePass();
const { currentProjectStore } = useStores(); const { currentProjectStore } = useStores();
const fileToken = toJS(currentProjectStore.currentProjectInfo.filetoken); const fileToken = toJS(currentProjectStore.currentProjectInfo.filetoken);
const projectId = toJS(currentProjectStore.currentProjectInfo.id); const projectId = toJS(currentProjectStore.currentProjectInfo.id);
/** 路由信息 */ /** 路由信息 */
const location = useLocation(); const location = useLocation();
// 当前文件路径 // 当前文件路径
const [path, setPath] = useState<String>("/"); const [path, setPath] = useState<String>("/");
const [tableLoadding, setTableLoadding] = useState(false); const [tableLoadding, setTableLoadding] = useState(false);
// 防止用户连续点击文件夹造成路径显示错误 // 防止用户连续点击文件夹造成路径显示错误
const [debounce, setDebounce] = useState(false); const [debounce, setDebounce] = useState(false);
// 点击操作列中的按钮 会设置当前点击的文件 // 点击操作列中的按钮 会设置当前点击的文件
const [currentOperateFile, setCurrentOperateFile] = useState<any>(null); const [currentOperateFile, setCurrentOperateFile] = useState<any>(null);
// 1文件 2数据集 // 1文件 2数据集
const [activeTab, setActiveTab] = useState(1); const [activeTab, setActiveTab] = useState(1);
// 复选框选中的文件名称数组 // 复选框选中的文件名称数组
const [selectIds, setSelectIds] = useState<Array<string>>([]); const [selectIds, setSelectIds] = useState<Array<string>>([]);
const [keyWord, setKeyWord] = useState(""); const [keyWord, setKeyWord] = useState("");
// 文件夹、文件列表 // 文件夹、文件列表
const [list, setList] = useState<any>([]); const [list, setList] = useState<any>([]);
// 数据集列表 不带文件 // 数据集列表 不带文件
const [dataSetList, setDataSetList] = useState<any>([]); const [dataSetList, setDataSetList] = useState<any>([]);
let tableRef: any = React.createRef(); let tableRef: any = React.createRef();
// 是否显示复选框 用户搜索文件后不显示 其他情况显示 // 是否显示复选框 用户搜索文件后不显示 其他情况显示
const [showCheckBox, setShowCheckBox] = useState<boolean>(true); const [showCheckBox, setShowCheckBox] = useState<boolean>(true);
// 切换文件、数据集 // 切换文件、数据集
const handleChangeListType = (e: number) => { const handleChangeListType = (e: number) => {
if (isPass("PROJECT_DATA_TYPECHANAGE")) { if (isPass("PROJECT_DATA_TYPECHANAGE")) {
setActiveTab(e); setActiveTab(e);
setSelectIds([]); setSelectIds([]);
tableRef?.current?.initSelectedFunc([]); tableRef?.current?.initSelectedFunc([]);
} }
}; };
useEffect(() => { useEffect(() => {
const locationInfo: any = location?.state; const locationInfo: any = location?.state;
setPath(locationInfo?.pathName || "/"); setPath(locationInfo?.pathName || "/");
}, [location]); }, [location]);
// 列表展示的数据 // 列表展示的数据
const showList = useMemo(() => { const showList = useMemo(() => {
if (activeTab === 1) { if (activeTab === 1) {
// 做排序 文件夹在前 // 做排序 文件夹在前
let folderList: any = []; let folderList: any = [];
let fileList: any = []; let fileList: any = [];
list.forEach((item: any) => { list.forEach((item: any) => {
if (item.type === "directory") { if (item.type === "directory") {
folderList.push(item); folderList.push(item);
} else { } else {
fileList.push(item); fileList.push(item);
} }
}); });
return [...folderList, ...fileList]; return [...folderList, ...fileList];
} else { } else {
const folderList = list.filter((item: any) => { const folderList = list.filter((item: any) => {
return item.type === "directory"; return item.type === "directory";
}); });
return [...folderList, ...dataSetList]; return [...folderList, ...dataSetList];
} }
}, [list, dataSetList, activeTab]); }, [list, dataSetList, activeTab]);
// 是否全是文件夹 // 是否全是文件夹
const isAllDirectory = useMemo(() => { const isAllDirectory = useMemo(() => {
return showList.every((li: any) => { return showList.every((li: any) => {
return li.type === "directory"; return li.type === "directory";
}); });
}, [showList]); }, [showList]);
// 全(文件、文件夹、数据集)列表 // 全(文件、文件夹、数据集)列表
const allList = useMemo(() => { const allList = useMemo(() => {
return [...list, ...dataSetList]; return [...list, ...dataSetList];
}, [list, dataSetList]); }, [list, dataSetList]);
// 全局搜索数据集 // 全局搜索数据集
const { run: getDataFileSearchRun } = useMyRequest(getDataFileSearch, { const { run: getDataFileSearchRun } = useMyRequest(getDataFileSearch, {
onSuccess: (res: any) => { onSuccess: (res: any) => {
const dataSetList = res.data.map((item: any) => { const dataSetList = res.data.map((item: any) => {
return { return {
...item, ...item,
type: "dataSet", type: "dataSet",
}; };
}); });
setDataSetList(dataSetList); setDataSetList(dataSetList);
setSelectIds([]); setSelectIds([]);
setDebounce(false); setDebounce(false);
tableRef?.current?.initSelectedFunc([]); tableRef?.current?.initSelectedFunc([]);
setShowCheckBox(false); setShowCheckBox(false);
}, },
}); });
// 获取某路径下的数据集 // 获取某路径下的数据集
const { run: getDataFindRun } = useMyRequest(getDataFind, { const { run: getDataFindRun } = useMyRequest(getDataFind, {
onSuccess: (res: any) => { onSuccess: (res: any) => {
const dataSetList = res.data.map((item: any) => { const dataSetList = res.data.map((item: any) => {
return { return {
...item, ...item,
type: "dataSet", type: "dataSet",
}; };
}); });
setDataSetList(dataSetList); setDataSetList(dataSetList);
setSelectIds([]); setSelectIds([]);
setDebounce(false); setDebounce(false);
tableRef?.current?.initSelectedFunc([]); tableRef?.current?.initSelectedFunc([]);
setShowCheckBox(true); setShowCheckBox(true);
}, },
}); });
// 获取某路径下的数据集 // 获取某路径下的数据集
const getDataSetList = useCallback(() => { const getDataSetList = useCallback(() => {
if (keyWord) { if (keyWord) {
return; return;
} else if (projectId) { } else if (projectId) {
return getDataFindRun({ return getDataFindRun({
projectId: projectId as string, projectId: projectId as string,
path: path === "/" ? "/" : `${path}/`, path: path === "/" ? "/" : `${path}/`,
}); });
} }
}, [keyWord, path, projectId, getDataFindRun]); }, [keyWord, path, projectId, getDataFindRun]);
// 全局搜索数据集 // 全局搜索数据集
const getDataSetListSearch = useCallback(() => { const getDataSetListSearch = useCallback(() => {
if (keyWord && projectId) { if (keyWord && projectId) {
return getDataFileSearchRun({ return getDataFileSearchRun({
projectId: projectId as string, projectId: projectId as string,
name: keyWord, name: keyWord,
}); });
} else { } else {
return getDataSetList(); return getDataSetList();
} }
}, [keyWord, projectId, getDataFileSearchRun, getDataSetList]); }, [keyWord, projectId, getDataFileSearchRun, getDataSetList]);
useEffect(() => { useEffect(() => {
getDataSetList(); getDataSetList();
}, [getDataSetList]); }, [getDataSetList]);
const getList = useCallback(() => { const getList = useCallback(() => {
if (keyWord) { if (keyWord) {
return; return;
} else if (fileToken && projectId) { } else if (fileToken && projectId) {
setTableLoadding(true); setTableLoadding(true);
return CloudEController.JobOutFileList( return CloudEController.JobOutFileList(
path, path,
fileToken, fileToken,
projectId, projectId,
false false
)?.then((res) => { )?.then((res) => {
setTableLoadding(false); setTableLoadding(false);
if (Array.isArray(res.data)) { if (Array.isArray(res.data)) {
setList(res.data); setList(res.data);
} else { } else {
setList([]); setList([]);
} }
setSelectIds([]); setSelectIds([]);
setDebounce(false); setDebounce(false);
setShowCheckBox(true); setShowCheckBox(true);
}); });
} }
}, [fileToken, path, projectId, keyWord]); }, [fileToken, path, projectId, keyWord]);
useEffect(() => { useEffect(() => {
getList(); getList();
}, [getList]); }, [getList]);
// 全局搜索文件列表 // 全局搜索文件列表
const searchFileList = useCallback(() => { const searchFileList = useCallback(() => {
if (!keyWord) { if (!keyWord) {
getList(); getList();
} else { } else {
if (fileToken && projectId) { if (fileToken && projectId) {
setTableLoadding(true); setTableLoadding(true);
setPath("/"); setPath("/");
return CloudEController.JobSearchFileList( return CloudEController.JobSearchFileList(
keyWord, keyWord,
"/", "/",
fileToken, fileToken,
projectId, projectId,
false false
)?.then((res) => { )?.then((res) => {
setTableLoadding(false); setTableLoadding(false);
if (Array.isArray(res.data)) { if (Array.isArray(res.data)) {
setList(res.data); setList(res.data);
} else { } else {
setList([]); setList([]);
} }
setSelectIds([]); setSelectIds([]);
setDebounce(false); setDebounce(false);
setShowCheckBox(false); setShowCheckBox(false);
}); });
} }
} }
}, [fileToken, projectId, keyWord, getList]); }, [fileToken, projectId, keyWord, getList]);
// 刷新 // 刷新
const handleRefresh = () => { const handleRefresh = () => {
if (isPass("PROJECT_DATA_REFRESH", "USER")) { if (isPass("PROJECT_DATA_REFRESH", "USER")) {
tableRef?.current?.initSelectedFunc([]); tableRef?.current?.initSelectedFunc([]);
setSelectIds([]); setSelectIds([]);
if (keyWord) { if (keyWord) {
searchFileList(); searchFileList();
getDataSetListSearch(); getDataSetListSearch();
} else { } else {
getList(); getList();
getDataSetList(); getDataSetList();
} }
} }
}; };
// 搜索值改变 // 搜索值改变
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();
getDataSetListSearch(); getDataSetListSearch();
} }
}; };
// todo name sort // todo name sort
// table配置 // table配置
const versionsHeadCells = useMemo(() => { const versionsHeadCells = useMemo(() => {
if (showCheckBox) { if (showCheckBox) {
return [ return [
{ id: "checkbox" }, { id: "checkbox" },
{ id: "name", numeric: false, label: "名称", width: "25%" }, { id: "name", numeric: false, label: "名称", width: "25%" },
{ id: "size", numeric: false, label: "大小", width: "25%", sort: true }, { id: "size", numeric: false, label: "大小", width: "25%", sort: true },
{ {
id: "mtime", id: "mtime",
numeric: false, numeric: false,
label: "创建时间", label: "创建时间",
width: "25%", width: "25%",
sort: true, sort: true,
}, },
{ id: "caozuo", numeric: false, label: "操作", width: "25%" }, { id: "caozuo", numeric: false, label: "操作", width: "25%" },
]; ];
} else { } else {
return [ return [
{ id: "name", numeric: false, label: "名称", width: "25%" }, { id: "name", numeric: false, label: "名称", width: "25%" },
{ id: "size", numeric: false, label: "大小", width: "25%", sort: true }, { id: "size", numeric: false, label: "大小", width: "25%", sort: true },
{ {
id: "mtime", id: "mtime",
numeric: false, numeric: false,
label: "创建时间", label: "创建时间",
width: "25%", width: "25%",
sort: true, sort: true,
}, },
{ id: "caozuo", numeric: false, label: "操作", width: "25%" }, { id: "caozuo", numeric: false, label: "操作", width: "25%" },
]; ];
} }
}, [showCheckBox]); }, [showCheckBox]);
// 点击复选框 // 点击复选框
const hanldeCheckbox = (e: any) => { const hanldeCheckbox = (e: any) => {
const selectarr = e.map((item: any) => { const selectarr = e.map((item: any) => {
let andIndex = item.indexOf("&index="); let andIndex = item.indexOf("&index=");
return item.slice(5, andIndex); return item.slice(5, andIndex);
}); });
setSelectIds(selectarr); setSelectIds(selectarr);
}; };
// 文件夹下钻 // 文件夹下钻
const handleViewFolders = (item: any) => { const handleViewFolders = (item: any) => {
if (debounce) { if (debounce) {
return; return;
} else { } else {
setDebounce(true); setDebounce(true);
if (path === "/") { if (path === "/") {
setPath(`/${item.name}`); setPath(`/${item.name}`);
} else { } else {
setPath(`${path}/${item.name}`); setPath(`${path}/${item.name}`);
} }
} }
}; };
// table配置 // table配置
const renderName = (item: any) => { const renderName = (item: any) => {
if (item.type === "directory") { if (item.type === "directory") {
return ( return (
<span <span
className={classnames({ className={classnames({
[style.folderIconBox]: true, [style.folderIconBox]: true,
[style.folderPointer]: true, [style.folderPointer]: true,
})} })}
onClick={() => handleViewFolders(item)} onClick={() => handleViewFolders(item)}
> >
<img className={style.folderIcon} src={folderIcon} alt="" /> <img className={style.folderIcon} src={folderIcon} alt="" />
{item.name} {item.name}
</span> </span>
); );
} else if (item.type === "dataSet") { } else if (item.type === "dataSet") {
return ( return (
<span className={style.folderIconBox}> <span className={style.folderIconBox}>
<img className={style.folderIcon} src={dataSetIcon} alt="" /> <img className={style.folderIcon} src={dataSetIcon} alt="" />
{item.name} {item.name}
</span> </span>
); );
} else { } else {
return ( return (
<span className={style.folderIconBox}> <span className={style.folderIconBox}>
<img className={style.folderIcon} src={fileIcon} alt="" /> <img className={style.folderIcon} src={fileIcon} alt="" />
{item.name} {item.name}
</span> </span>
); );
} }
}; };
// table配置 // table配置
const renderSize = (item: any) => { const renderSize = (item: any) => {
if (item.type === "dataSet") { if (item.type === "dataSet") {
return `${item.size}条`; return `${item.size}条`;
} }
return `${item.size ? storageUnitFromB(Number(item.size)) : "-"}`; return `${item.size ? storageUnitFromB(Number(item.size)) : "-"}`;
}; };
// table配置 // table配置
const renderMtime = (item: any) => { const renderMtime = (item: any) => {
return String(moment(item.mtime).format("YYYY-MM-DD HH:mm:ss")); return String(moment(item.mtime).format("YYYY-MM-DD HH:mm:ss"));
}; };
// table配置 // table配置
const renderButtons = (item: any) => { const renderButtons = (item: any) => {
return ( return (
<span style={{ whiteSpace: "nowrap" }}> <span style={{ whiteSpace: "nowrap" }}>
{!isAllDirectory && ( {!isAllDirectory && (
<Button <Button
sx={{ sx={{
position: "relative", position: "relative",
left: "-4px", left: "-4px",
minWidth: "10px", minWidth: "10px",
marginRight: "10px", marginRight: "10px",
visibility: visibility:
item.type !== "dataSet" && item.type !== "directory" item.type !== "dataSet" && item.type !== "directory"
? "visible" ? "visible"
: "hidden", : "hidden",
}} }}
variant="text" variant="text"
size="small" size="small"
disabled={selectIds.length > 0 || !isPass("PROJECT_DATA_DOWNLOAD")} disabled={selectIds.length > 0 || !isPass("PROJECT_DATA_DOWNLOAD")}
onClick={() => hanleDownloadFile(item)} onClick={() => hanleDownloadFile(item)}
> >
下载 下载
</Button> </Button>
)} )}
<Button <Button
sx={{ sx={{
position: "relative", position: "relative",
left: "-4px", left: "-4px",
minWidth: "10px", minWidth: "10px",
marginRight: "10px", marginRight: "10px",
}} }}
variant="text" variant="text"
size="small" size="small"
onClick={() => hanleShowMoveFileDialog(item)} onClick={() => hanleShowMoveFileDialog(item)}
disabled={ disabled={
selectIds.length > 0 || !isPass("PROJECT_DATA_MOVE", "USER") selectIds.length > 0 || !isPass("PROJECT_DATA_MOVE", "USER")
} }
> >
移动至 移动至
</Button> </Button>
<Button <Button
sx={{ sx={{
position: "relative", position: "relative",
left: "-4px", left: "-4px",
minWidth: "10px", minWidth: "10px",
marginRight: "10px", marginRight: "10px",
}} }}
variant="text" variant="text"
size="small" size="small"
color="error" color="error"
onClick={() => hanleShowDeleteDialogRef(item)} onClick={() => hanleShowDeleteDialogRef(item)}
disabled={ disabled={
selectIds.length > 0 || !isPass("PROJECT_DATA_DELETE", "USER") selectIds.length > 0 || !isPass("PROJECT_DATA_DELETE", "USER")
} }
> >
删除 删除
</Button> </Button>
</span> </span>
); );
}; };
// 文件上传 // 文件上传
let UpLoaderFileRef: any = React.createRef(); let UpLoaderFileRef: any = React.createRef();
const hanleShowUpLoaderFileDialog = () => { const hanleShowUpLoaderFileDialog = () => {
UpLoaderFileRef.current.showDialog(); UpLoaderFileRef.current.showDialog();
}; };
// 新增文件 // 新增文件
let addFolderRef: any = React.createRef(); let addFolderRef: any = React.createRef();
const hanleShowAddFolderDialog = () => { const hanleShowAddFolderDialog = () => {
addFolderRef.current.showDialog(); addFolderRef.current.showDialog();
}; };
// 下载文件 // 下载文件
const hanleDownloadFile = (item: any) => { const hanleDownloadFile = (item: any) => {
console.log(item); const downloadPath =
const downloadPath = path === "/" ? `/${item.name}` : `${path}/${item.name}`;
path === "/" ? `/${item.name}` : `${path}/${item.name}`; CloudEController.JobFileDownload(
console.log(downloadPath); downloadPath,
CloudEController.JobFileDownload( fileToken as string,
downloadPath, projectId as string
fileToken as string, );
projectId as string };
);
}; // 文件移动
let moveFileRef: any = React.createRef();
// 文件移动
let moveFileRef: any = React.createRef(); const hanleShowMoveFileDialog = (item: any) => {
setCurrentOperateFile(item);
const hanleShowMoveFileDialog = (item: any) => { moveFileRef.current.showDialog();
setCurrentOperateFile(item); };
moveFileRef.current.showDialog();
}; // 删除弹窗
let deleteDialogRef: any = React.createRef();
// 删除弹窗 const hanleShowDeleteDialogRef = (item: any) => {
let deleteDialogRef: any = React.createRef(); setCurrentOperateFile(item);
const hanleShowDeleteDialogRef = (item: any) => { deleteDialogRef.current.showDialog();
setCurrentOperateFile(item); };
deleteDialogRef.current.showDialog();
}; // 批量移动
const handleBatchMove = () => {
// 批量移动 setCurrentOperateFile(null);
const handleBatchMove = () => { moveFileRef.current.showDialog();
setCurrentOperateFile(null); };
moveFileRef.current.showDialog();
}; // 批量删除
const handleBatchDelete = () => {
// 批量删除 setCurrentOperateFile(null);
const handleBatchDelete = () => { deleteDialogRef.current.showDialog();
setCurrentOperateFile(null); };
deleteDialogRef.current.showDialog();
}; // 前端展示的文件路径
const showPath = useMemo(() => {
// 前端展示的文件路径 if (path === "/") {
const showPath = useMemo(() => { return <span className={style.showPathSpan}>ProjectData</span>;
if (path === "/") { } else {
return <span className={style.showPathSpan}>ProjectData</span>; const pathArr = path.split("/");
} else { if (pathArr.length <= 4) {
const pathArr = path.split("/"); return pathArr.map((item, index) => {
if (pathArr.length <= 4) { return (
return pathArr.map((item, index) => { <span
return ( key={index}
<span onClick={() =>
key={index} setPath(
onClick={() => pathArr.slice(0, index + 1).join("/") === ""
setPath( ? "/"
pathArr.slice(0, index + 1).join("/") === "" : pathArr.slice(0, index + 1).join("/")
? "/" )
: pathArr.slice(0, index + 1).join("/") }
) className={classnames({
} [style.showPathSpan]: true,
className={classnames({ [style.showPathSpanActive]: index === pathArr.length - 1,
[style.showPathSpan]: true, })}
[style.showPathSpanActive]: index === pathArr.length - 1, >
})} {index === 0 ? "ProjectData" : item}{" "}
> {index === pathArr.length - 1 ? null : (
{index === 0 ? "ProjectData" : item}{" "} <i className={style.showPathI}>{">"}</i>
{index === pathArr.length - 1 ? null : ( )}
<i className={style.showPathI}>{">"}</i> </span>
)} );
</span> });
); } else {
}); return pathArr.map((item, index) => {
} else { return (
return pathArr.map((item, index) => { <span
return ( key={index}
<span onClick={() => {
key={index} if (index === 1) {
onClick={() => { return;
if (index === 1) { }
return; setPath(
} pathArr.slice(0, index + 1).join("/") === ""
setPath( ? "/"
pathArr.slice(0, index + 1).join("/") === "" : pathArr.slice(0, index + 1).join("/")
? "/" );
: pathArr.slice(0, index + 1).join("/") }}
); className={classnames({
}} [style.showPathSpan]: true,
className={classnames({ [style.showPathSpanActive]: index === pathArr.length - 1,
[style.showPathSpan]: true, })}
[style.showPathSpanActive]: index === pathArr.length - 1, >
})} {index === 0
> ? "ProjectData"
{index === 0 : index > pathArr.length - 4
? "ProjectData" ? item
: index > pathArr.length - 4 : ""}
? item {/* && index > pathArr.length - 4 */}
: ""} {index === pathArr.length - 1 ||
{/* && index > pathArr.length - 4 */} (index <= pathArr.length - 4 && index > 0) ? null : (
{index === pathArr.length - 1 || <i className={style.showPathI}>{">"}</i>
(index <= pathArr.length - 4 && index > 0) ? null : ( )}
<i className={style.showPathI}>{">"}</i> {index === 1 && "..."}
)} {index === 1 && <i className={style.showPathI}>{">"}</i>}
{index === 1 && "..."} </span>
{index === 1 && <i className={style.showPathI}>{">"}</i>} );
</span> });
); }
}); }
} }, [path]);
}
}, [path]); if (currentProjectStore.currentProjectInfo.name) {
return (
if (currentProjectStore.currentProjectInfo.name) { <ThemeProvider theme={theme}>
return ( <div className={style.projectData}>
<ThemeProvider theme={theme}> <div className={style.projectDataStickyTop}>
<div className={style.projectData}> <div className={style.projectDataTitle}>项目数据</div>
<div className={style.projectDataStickyTop}> <div className={style.projectDataHeader}>
<div className={style.projectDataTitle}>项目数据</div> <div className={style.projectDataButtonAndSearch}>
<div className={style.projectDataHeader}> <div className={style.projectDataButtonBox}>
<div className={style.projectDataButtonAndSearch}> <Button
<div className={style.projectDataButtonBox}> color="neutral"
<Button variant="contained"
color="neutral" size="small"
variant="contained" style={{ marginRight: "12px" }}
size="small" onClick={hanleShowUpLoaderFileDialog}
style={{ marginRight: "12px" }} disabled={
onClick={hanleShowUpLoaderFileDialog} selectIds.length !== 0 ||
disabled={ !isPass("PROJECT_DATA_UPLOAD", "USER")
selectIds.length !== 0 || }
!isPass("PROJECT_DATA_UPLOAD", "USER") >
} 上传文件
> </Button>
上传文件 <Button
</Button> color="neutral"
<Button variant="outlined"
color="neutral" size="small"
variant="outlined" onClick={hanleShowAddFolderDialog}
size="small" disabled={
onClick={hanleShowAddFolderDialog} selectIds.length !== 0 ||
disabled={ !isPass("PROJECT_DATA_ADDDIR", "USER")
selectIds.length !== 0 || }
!isPass("PROJECT_DATA_ADDDIR", "USER") >
} 新建文件夹
> </Button>
新建文件夹 </div>
</Button> <div className={style.projectDataSearch}>
</div> <InputBase
<div className={style.projectDataSearch}> className={style.searchInput}
<InputBase placeholder="输入关键词搜索"
className={style.searchInput} inputProps={{ "aria-label": "输入关键词搜索" }}
placeholder="输入关键词搜索" value={keyWord}
inputProps={{ "aria-label": "输入关键词搜索" }} onChange={handleKeyWordChange}
value={keyWord} style={{ width: "280px", fontSize: "14px" }}
onChange={handleKeyWordChange} onKeyUp={handleKeyWordChangeKeyUp}
style={{ width: "280px", fontSize: "14px" }} />
onKeyUp={handleKeyWordChangeKeyUp} <IconButton
/> type="submit"
<IconButton className={style.searchButton}
type="submit" aria-label="search"
className={style.searchButton} size="small"
aria-label="search" style={{ padding: "4px" }}
size="small" onClick={handleRefresh}
style={{ padding: "4px" }} >
onClick={handleRefresh} <SearchIcon
> className={style.searchIcon}
<SearchIcon style={{ color: "#999" }}
className={style.searchIcon} />
style={{ color: "#999" }} </IconButton>
/> </div>
</IconButton> </div>
</div> <div className={style.projectDataPathAndTabs}>
</div> <div className={style.projectDataPath}>{showPath}</div>
<div className={style.projectDataPathAndTabs}> <div className={style.projectDataTabsAndBtton}>
<div className={style.projectDataPath}>{showPath}</div> <div className={style.projectDataTabs}>
<div className={style.projectDataTabsAndBtton}> <div
<div className={style.projectDataTabs}> className={classnames({
<div [style.projectDataTab]: true,
className={classnames({ [style.projectDataTabActive]: activeTab === 1,
[style.projectDataTab]: true, })}
[style.projectDataTabActive]: activeTab === 1, // onClick={() => setActiveTab(1)}
})} onClick={() => handleChangeListType(1)}
// onClick={() => setActiveTab(1)} >
onClick={() => handleChangeListType(1)} 文件
> </div>
文件 <div
</div> className={classnames({
<div [style.projectDataTab]: true,
className={classnames({ [style.projectDataTabActive]: activeTab !== 1,
[style.projectDataTab]: true, })}
[style.projectDataTabActive]: activeTab !== 1, // onClick={() => setActiveTab(2)}
})} onClick={() => handleChangeListType(2)}
// onClick={() => setActiveTab(2)} >
onClick={() => handleChangeListType(2)} 数据集
> </div>
数据集 </div>
</div> <IconButton
</div> aria-label="refreshIcon"
<IconButton size="small"
aria-label="refreshIcon" onClick={handleRefresh}
size="small" disabled={!isPass("PROJECT_DATA_REFRESH", "USER")}
onClick={handleRefresh} >
disabled={!isPass("PROJECT_DATA_REFRESH", "USER")} <RefreshIcon />
> </IconButton>
<RefreshIcon /> </div>
</IconButton> </div>
</div> </div>
</div> <Table
</div> footer={false}
<Table rowHover={true}
footer={false} onRef={tableRef}
rowHover={true} nopadding={true}
onRef={tableRef} stickyheader={true}
nopadding={true} load={tableLoadding}
stickyheader={true} initSelected={selectIds}
load={tableLoadding} headCells={versionsHeadCells}
initSelected={selectIds} rowsPerPage={"99"}
headCells={versionsHeadCells} checkboxData={(e: any) => {
rowsPerPage={"99"} hanldeCheckbox(e);
checkboxData={(e: any) => { }}
hanldeCheckbox(e); rows={showList.map((item: any, index: number) => ({
}} ...item,
rows={showList.map((item: any, index: number) => ({ id: `name=${item.name}&index=${index}`,
...item, name: renderName(item),
id: `name=${item.name}&index=${index}`, size: renderSize(item),
name: renderName(item), mtime: renderMtime(item),
size: renderSize(item), caozuo: renderButtons(item),
mtime: renderMtime(item), }))}
caozuo: renderButtons(item), ></Table>
}))} {showList.length === 0 && (
></Table> <div className={style.noDataBox}>
{showList.length === 0 && ( <img className={style.noDataImg} src={noFile} alt="" />
<div className={style.noDataBox}> <span className={style.noDataText}>暂未开启模板</span>
<img className={style.noDataImg} src={noFile} alt="" /> </div>
<span className={style.noDataText}>暂未开启模板</span> )}
</div> </div>
)} {selectIds.length > 0 && (
</div> <div className={style.projectDataStickyBox}>
{selectIds.length > 0 && ( <Button
<div className={style.projectDataStickyBox}> color="error"
<Button variant="outlined"
color="error" size="small"
variant="outlined" style={{ marginRight: "12px" }}
size="small" onClick={handleBatchDelete}
style={{ marginRight: "12px" }} disabled={!isPass("PROJECT_DATA_DELETE", "USER")}
onClick={handleBatchDelete} >
disabled={!isPass("PROJECT_DATA_DELETE", "USER")} 批量删除({selectIds.length}
> </Button>
批量删除({selectIds.length} <Button
</Button> color="neutral"
<Button variant="contained"
color="neutral" size="small"
variant="contained" style={{ marginRight: "24px" }}
size="small" onClick={handleBatchMove}
style={{ marginRight: "24px" }} disabled={!isPass("PROJECT_DATA_MOVE", "USER")}
onClick={handleBatchMove} >
disabled={!isPass("PROJECT_DATA_MOVE", "USER")} 批量移动({selectIds.length}
> </Button>
批量移动({selectIds.length} </div>
</Button> )}
</div> <DeleteDialog
)} onRef={deleteDialogRef}
<DeleteDialog path={path}
onRef={deleteDialogRef} fileToken={fileToken}
path={path} projectId={projectId}
fileToken={fileToken} currentOperateFile={currentOperateFile}
projectId={projectId} selectIds={selectIds}
currentOperateFile={currentOperateFile} refresh={handleRefresh}
selectIds={selectIds} showList={showList}
refresh={handleRefresh} ></DeleteDialog>
showList={showList} <UpLoaderFile
></DeleteDialog> onRef={UpLoaderFileRef}
<UpLoaderFile path={path}
onRef={UpLoaderFileRef} list={allList}
path={path} ></UpLoaderFile>
list={allList} <AddFolder
></UpLoaderFile> onRef={addFolderRef}
<AddFolder list={allList}
onRef={addFolderRef} path={path}
list={allList} refresh={handleRefresh}
path={path} fileToken={fileToken}
refresh={handleRefresh} projectId={projectId}
fileToken={fileToken} ></AddFolder>
projectId={projectId} <MoveFile
></AddFolder> onRef={moveFileRef}
<MoveFile path={path}
onRef={moveFileRef} fileToken={fileToken}
path={path} projectId={projectId}
fileToken={fileToken} currentOperateFile={currentOperateFile}
projectId={projectId} selectIds={selectIds}
currentOperateFile={currentOperateFile} refresh={handleRefresh}
selectIds={selectIds} showList={showList}
refresh={handleRefresh} ></MoveFile>
showList={showList} </div>
></MoveFile> </ThemeProvider>
</div> );
</ThemeProvider> } else {
); return <NoProject />;
} else { }
return <NoProject />;
}
}); });
export default ProjectData; export default ProjectData;
...@@ -103,7 +103,6 @@ const ProjectMembers = observer(() => { ...@@ -103,7 +103,6 @@ const ProjectMembers = observer(() => {
.then((res) => { .then((res) => {
const { data = {} } = res; const { data = {} } = res;
setTableData(data?.members || []); setTableData(data?.members || []);
console.log(data?.projectRole, data?.projectRole);
setProjectRole(data?.projectRole || ""); setProjectRole(data?.projectRole || "");
}); });
}, [currentProjectStore?.currentProjectInfo, http]); }, [currentProjectStore?.currentProjectInfo, http]);
......
...@@ -44,9 +44,7 @@ const AddTemplate = observer((props: IAddTemplateProps) => { ...@@ -44,9 +44,7 @@ const AddTemplate = observer((props: IAddTemplateProps) => {
const productId = toJS(currentProjectStore.currentProductInfo.id); const productId = toJS(currentProjectStore.currentProductInfo.id);
const { setShowAddTemplate, getTemplateInfo } = props; const { setShowAddTemplate, getTemplateInfo } = props;
const handleSearch = (value: string) => { const handleSearch = (value: string) => {};
console.log(value);
};
/** 可增加模板列表 */ /** 可增加模板列表 */
const [addTemplateList, setAddTemplateList] = useState([]); const [addTemplateList, setAddTemplateList] = useState([]);
...@@ -83,7 +81,6 @@ const AddTemplate = observer((props: IAddTemplateProps) => { ...@@ -83,7 +81,6 @@ const AddTemplate = observer((props: IAddTemplateProps) => {
}); });
const handleAddTemplate = () => { const handleAddTemplate = () => {
console.log("handleAddTemplate");
addTemplate({ addTemplate({
projectId: projectId as string, projectId: projectId as string,
workflowSpecIds: selectTemplateData, workflowSpecIds: selectTemplateData,
...@@ -93,7 +90,6 @@ const AddTemplate = observer((props: IAddTemplateProps) => { ...@@ -93,7 +90,6 @@ const AddTemplate = observer((props: IAddTemplateProps) => {
// 添加工作流模板-获取模板列表 // 添加工作流模板-获取模板列表
const { run: getAddTemplateList } = useMyRequest(getAddWorkbenchTemplate, { const { run: getAddTemplateList } = useMyRequest(getAddWorkbenchTemplate, {
onSuccess: (result: any) => { onSuccess: (result: any) => {
console.log(result);
setAddTemplateList(result.data); setAddTemplateList(result.data);
// setOpenAddTemplate(true); // setOpenAddTemplate(true);
}, },
......
...@@ -69,10 +69,6 @@ const ProjectMembers = observer(() => { ...@@ -69,10 +69,6 @@ const ProjectMembers = observer(() => {
}); });
}, [currentProjectStore.currentProjectInfo.id, getTemplateInfo]); }, [currentProjectStore.currentProjectInfo.id, getTemplateInfo]);
useEffect(() => {
console.log("projectIdData: ", projectIdData);
}, [projectIdData]);
/** 删除模板 */ /** 删除模板 */
const deleteTemplate = () => { const deleteTemplate = () => {
delTemplate({ delTemplate({
......
import { useMessage } from "@/components/MySnackbar"; import { useMessage } from "@/components/MySnackbar";
import usePass from "@/hooks/usePass"; // import usePass from "@/hooks/usePass";
import { operation, route } from "@/router"; import { operation, route } from "@/router";
import { Button } from "@mui/material"; import { Button } from "@mui/material";
import { Box } from "@mui/system"; import { Box } from "@mui/system";
import { useEffect } from "react"; import { useEffect } from "react";
const Demo = ({ const Demo = ({
childrenRoutes, childrenRoutes,
}: { }: {
childrenRoutes?: Array<route | operation>; childrenRoutes?: Array<route | operation>;
}) => { }) => {
const message = useMessage(); const message = useMessage();
const isPass = usePass(); // const isPass = usePass();
useEffect(() => { useEffect(() => {
console.log(isPass("PROJECT_OVERIVEW_CREATE"), "11111111111"); // console.log(isPass("PROJECT_OVERIVEW_CREATE"), "11111111111");
console.log(isPass("PROJECT_SUMMARY_MEMBER"), "2222222"); // console.log(isPass("PROJECT_SUMMARY_MEMBER"), "2222222");
console.log(isPass("test"), "33333"); // console.log(isPass("test"), "33333");
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, []); }, []);
return ( return (
<Box> <Box>
<Box>{JSON.stringify(childrenRoutes)}</Box> <Box>{JSON.stringify(childrenRoutes)}</Box>
<Box>{JSON.stringify(process.env.NODE_ENV)}</Box> <Box>{JSON.stringify(process.env.NODE_ENV)}</Box>
<Button onClick={() => message.success("测试测试")}>message测试</Button> <Button onClick={() => message.success("测试测试")}>message测试</Button>
</Box> </Box>
); );
}; };
export default Demo; export default Demo;
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