Commit b54c89e1 authored by chenshouchao's avatar chenshouchao

feat: 解决测试提的bug

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