Commit b54c89e1 authored by chenshouchao's avatar chenshouchao

feat: 解决测试提的bug

parent 500f7e4e
...@@ -5,16 +5,31 @@ import MyDialog from "@/components/mui/MyDialog"; ...@@ -5,16 +5,31 @@ import MyDialog from "@/components/mui/MyDialog";
import { checkIsNumberLetterChinese } from "@/utils/util"; import { checkIsNumberLetterChinese } from "@/utils/util";
import { useMessage } from "@/components/MySnackbar"; import { useMessage } from "@/components/MySnackbar";
import CloudEController from "@/api/fileserver/CloudEController"; import CloudEController from "@/api/fileserver/CloudEController";
import InputAdornment from '@mui/material/InputAdornment';
const AddFolder = (props: any) => { const AddFolder = (props: any) => {
const { list, path, projectId, fileToken, refresh } = props; const { list, path, projectId, fileToken, refresh } = props;
const Message = useMessage(); const Message = useMessage();
let addFolderDialogRef: any = React.createRef(); let addFolderDialogRef: any = React.createRef();
const [fileName, setFileName] = useState("");
const [fileNameCheck, setFileNameCheck] = useState({
error: false,
help: "",
});
const showDialog = () => { const showDialog = () => {
addFolderDialogRef.current.handleClickOpen(); addFolderDialogRef.current.handleClickOpen();
initData()
}; };
const initData = () => {
setFileName('')
setFileNameCheck({
error: false,
help: "",
})
}
useImperativeHandle(props.onRef, () => { useImperativeHandle(props.onRef, () => {
return { return {
showDialog: showDialog, showDialog: showDialog,
...@@ -41,11 +56,6 @@ const AddFolder = (props: any) => { ...@@ -41,11 +56,6 @@ const AddFolder = (props: any) => {
}; };
const addFolderSubmitloading = false; const addFolderSubmitloading = false;
const [fileName, setFileName] = useState("");
const [fileNameCheck, setFileNameCheck] = useState({
error: false,
help: "",
});
const handleFileNameChange = (e: any) => { const handleFileNameChange = (e: any) => {
const fileName = e.target.value; const fileName = e.target.value;
setFileName(fileName); setFileName(fileName);
...@@ -99,6 +109,9 @@ const AddFolder = (props: any) => { ...@@ -99,6 +109,9 @@ const AddFolder = (props: any) => {
value={fileName} value={fileName}
onChange={handleFileNameChange} onChange={handleFileNameChange}
helperText={fileNameCheck.help} helperText={fileNameCheck.help}
InputProps={{
endAdornment: <InputAdornment position="end">{fileName.length}/30</InputAdornment>,
}}
size="small" size="small"
/> />
</MyDialog> </MyDialog>
......
...@@ -20,7 +20,14 @@ ...@@ -20,7 +20,14 @@
display: flex; display: flex;
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: center;
}
.treeLabelText{
line-height: 44px; line-height: 44px;
overflow: hidden;
text-overflow: ellipsis;
-o-text-overflow:ellipsis;
white-space: nowrap;
width: 320px;
} }
.labelFolderIcon { .labelFolderIcon {
margin-right: 9px; margin-right: 9px;
......
...@@ -147,6 +147,7 @@ const MoveFile = (props: any) => { ...@@ -147,6 +147,7 @@ const MoveFile = (props: any) => {
)?.then((res) => { )?.then((res) => {
Message.success("移动成功!"); Message.success("移动成功!");
moveFileDialogRef.current.handleClose(); moveFileDialogRef.current.handleClose();
refresh();
}); });
} }
} }
...@@ -159,7 +160,7 @@ const MoveFile = (props: any) => { ...@@ -159,7 +160,7 @@ const MoveFile = (props: any) => {
return ( return (
<span className={style.treeLabel}> <span className={style.treeLabel}>
<img className={style.labelFolderIcon} src={folderIcon} alt="" /> <img className={style.labelFolderIcon} src={folderIcon} alt="" />
{labelNmae} <span className={style.treeLabelText}>{labelNmae}</span>
</span> </span>
); );
}; };
......
...@@ -54,7 +54,14 @@ ...@@ -54,7 +54,14 @@
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: center;
} }
.fileIconBoxText{
display: block;
width: 260px;
overflow: hidden;
text-overflow: ellipsis;
-o-text-overflow:ellipsis;
white-space: nowrap;
}
.noFile { .noFile {
position: absolute; position: absolute;
top: 92px; top: 92px;
......
...@@ -113,8 +113,13 @@ const UpLoaderFile = observer((props: any) => { ...@@ -113,8 +113,13 @@ const UpLoaderFile = observer((props: any) => {
const showDialog = () => { const showDialog = () => {
dialogRef.current.handleClickOpen(); dialogRef.current.handleClickOpen();
initData()
}; };
const initData = ()=>{
setFileList([])
}
useImperativeHandle(props.onRef, () => { useImperativeHandle(props.onRef, () => {
return { return {
showDialog: showDialog, showDialog: showDialog,
...@@ -131,7 +136,7 @@ const UpLoaderFile = observer((props: any) => { ...@@ -131,7 +136,7 @@ const UpLoaderFile = observer((props: any) => {
return ( return (
<span className={style.fileIconBox}> <span className={style.fileIconBox}>
<img className={style.fileIcon} src={fileIcon} alt="" /> <img className={style.fileIcon} src={fileIcon} alt="" />
{item.name} <span className={style.fileIconBoxText}>{item.name}</span>
</span> </span>
); );
}; };
......
...@@ -368,7 +368,7 @@ const ProjectData = observer(() => { ...@@ -368,7 +368,7 @@ const ProjectData = observer(() => {
// 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配置
...@@ -377,16 +377,16 @@ const ProjectData = observer(() => { ...@@ -377,16 +377,16 @@ const ProjectData = observer(() => {
<span> <span>
{item.type !== "dataSet" && item.type !== "directory" && ( {item.type !== "dataSet" && item.type !== "directory" && (
<Button <Button
sx={{ position: "relative", left: "-18px" }} sx={{ position: "relative", left: "-18px", minWidth: '10px', marginRight: '10px' }}
variant="text" variant="text"
size="small" size="small"
disabled={!isPass("PROJECT_DATA_DOWNLOAD")} disabled={selectIds.length > 0 || !isPass("PROJECT_DATA_DOWNLOAD")}
> >
下载 下载
</Button> </Button>
)} )}
<Button <Button
sx={{ position: "relative", left: "-18px" }} sx={{ position: "relative", left: "-18px", minWidth: '10px', marginRight: '10px' }}
variant="text" variant="text"
size="small" size="small"
onClick={() => hanleShowMoveFileDialog(item)} onClick={() => hanleShowMoveFileDialog(item)}
...@@ -397,7 +397,7 @@ const ProjectData = observer(() => { ...@@ -397,7 +397,7 @@ const ProjectData = observer(() => {
移动至 移动至
</Button> </Button>
<Button <Button
sx={{ position: "relative", left: "-18px" }} sx={{ position: "relative", left: "-18px", minWidth: '10px', marginRight: '10px' }}
variant="text" variant="text"
size="small" size="small"
color="error" color="error"
...@@ -585,13 +585,16 @@ const ProjectData = observer(() => { ...@@ -585,13 +585,16 @@ const ProjectData = observer(() => {
return ( return (
<span <span
key={index} key={index}
onClick={() => onClick={() =>{
if (index === 1) {
return
}
setPath( setPath(
pathArr.slice(0, index + 1).join("/") === "" pathArr.slice(0, index + 1).join("/") === ""
? "/" ? "/"
: pathArr.slice(0, index + 1).join("/") : pathArr.slice(0, index + 1).join("/")
) )
} }}
className={classnames({ className={classnames({
[style.showPathSpan]: true, [style.showPathSpan]: true,
[style.showPathSpanActive]: index === pathArr.length - 1, [style.showPathSpanActive]: index === pathArr.length - 1,
...@@ -740,7 +743,7 @@ const ProjectData = observer(() => { ...@@ -740,7 +743,7 @@ const ProjectData = observer(() => {
</div> </div>
)} )}
</div> </div>
{selectIds.length > 1 && ( {selectIds.length > 0 && (
<div className={style.projectDataStickyBox}> <div className={style.projectDataStickyBox}>
<Button <Button
color="error" color="error"
...@@ -773,11 +776,9 @@ const ProjectData = observer(() => { ...@@ -773,11 +776,9 @@ 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
? currentOperateFile.name ? '确认删除该数据吗?'
: selectIds.join("”,“")} : `确认删除这${selectIds.length}条数据吗?`}
”吗?
</DialogContentText> </DialogContentText>
</DialogContent> </DialogContent>
<DialogActions> <DialogActions>
......
...@@ -22,14 +22,25 @@ const AddProject = (props: any) => { ...@@ -22,14 +22,25 @@ const AddProject = (props: any) => {
const { currentProjectStore } = useStores(); const { currentProjectStore } = useStores();
const message = useMessage(); const message = useMessage();
let DialogRef: any = React.createRef(); let DialogRef: any = React.createRef();
const [name, setName] = useState("");
const [nameCheck, setNameCheck] = useState({
error: false,
help: "",
});
const [desc, setDesc] = useState("");
const [descCheck, setDescCheck] = useState({
error: false,
help: "",
});
const [zoneId, setZoneId] = useState("");
const [zoneIdOptions, setZoneIdOptions] = useState<Array<zoneIdOption>>([]);
const [submitloading, setSubmitloading] = useState(false);
useImperativeHandle(props.onRef, () => { useImperativeHandle(props.onRef, () => {
return { return {
handleClickOpen: handleClickOpen, handleClickOpen: handleClickOpen,
}; };
}); });
const [zoneId, setZoneId] = useState("");
const [zoneIdOptions, setZoneIdOptions] = useState<Array<zoneIdOption>>([]);
// 设置计算区 // 设置计算区
const { run } = useMyRequest(hpczone, { const { run } = useMyRequest(hpczone, {
onSuccess: (result: any) => { onSuccess: (result: any) => {
...@@ -37,7 +48,6 @@ const AddProject = (props: any) => { ...@@ -37,7 +48,6 @@ const AddProject = (props: any) => {
setZoneId(result[0].id || ""); setZoneId(result[0].id || "");
}, },
}); });
const [submitloading, setSubmitloading] = useState(false);
const { run: addProjectRun } = useMyRequest(addProject, { const { run: addProjectRun } = useMyRequest(addProject, {
onBefore: () => { onBefore: () => {
setSubmitloading(true); setSubmitloading(true);
...@@ -74,18 +84,17 @@ const AddProject = (props: any) => { ...@@ -74,18 +84,17 @@ const AddProject = (props: any) => {
const handleClickOpen = () => { const handleClickOpen = () => {
DialogRef.current.handleClickOpen(); DialogRef.current.handleClickOpen();
initData()
}; };
const [name, setName] = useState(""); const initData = () => {
const [nameCheck, setNameCheck] = useState({ setName('')
error: false, setDesc('')
help: "", if (zoneIdOptions.length > 0) {
}); setZoneId(zoneIdOptions[0].id)
const [desc, setDesc] = useState(""); }
const [descCheck, setDescCheck] = useState({ }
error: false,
help: "",
});
const checkName = (name: string) => { const checkName = (name: string) => {
if (name) { if (name) {
......
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