Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
bkunyun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
bkunyun
Commits
9d26c8e7
Commit
9d26c8e7
authored
Jun 21, 2022
by
吴永生#A02208
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'release' of
http://120.77.149.83/sunyihao/bkunyun
into feat-20220620-taskSubmission
parents
f5818d25
60871319
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
43 deletions
+47
-43
index.tsx
src/views/Project/ProjectData/MoveFile/index.tsx
+47
-43
No files found.
src/views/Project/ProjectData/MoveFile/index.tsx
View file @
9d26c8e7
...
@@ -16,6 +16,7 @@ import CloudEController from "@/api/fileserver/CloudEController";
...
@@ -16,6 +16,7 @@ import CloudEController from "@/api/fileserver/CloudEController";
import
{
getDataFileMove
,
getDataFileMovePackage
}
from
"@/api/project_api"
;
import
{
getDataFileMove
,
getDataFileMovePackage
}
from
"@/api/project_api"
;
import
useMyRequest
from
"@/hooks/useMyRequest"
;
import
useMyRequest
from
"@/hooks/useMyRequest"
;
import
classNames
from
"classnames"
;
import
classNames
from
"classnames"
;
import
_
from
"lodash"
;
const
MoveFile
=
(
props
:
any
)
=>
{
const
MoveFile
=
(
props
:
any
)
=>
{
const
{
const
{
...
@@ -28,27 +29,12 @@ const MoveFile = (props: any) => {
...
@@ -28,27 +29,12 @@ const MoveFile = (props: any) => {
showList
,
showList
,
}
=
props
;
}
=
props
;
const
Message
=
useMessage
();
const
Message
=
useMessage
();
const
{
run
:
getDataFileMoveRun
}
=
useMyRequest
(
getDataFileMove
,
{
onSuccess
:
(
res
:
any
)
=>
{
successMove
();
},
});
const
[
newPath
,
setNewPath
]
=
useState
(
"/"
);
const
[
newPath
,
setNewPath
]
=
useState
(
"/"
);
const
[
rootActive
,
setRootActive
]
=
useState
(
true
);
const
[
rootActive
,
setRootActive
]
=
useState
(
true
);
const
[
moveFileSubmitloading
,
setMoveFileSubmitloading
]
=
useState
(
false
);
const
[
moveFileSubmitloading
,
setMoveFileSubmitloading
]
=
useState
(
false
);
const
[
treeData
,
setTreeData
]
=
useState
<
any
>
([]);
const
[
treeData
,
setTreeData
]
=
useState
<
any
>
([]);
const
[
renderTreeData
,
setRenderTreeData
]
=
useState
<
any
>
([]);
let
moveFileDialogRef
:
any
=
React
.
createRef
();
let
moveFileDialogRef
:
any
=
React
.
createRef
();
const
{
run
:
getDataFileMovePackageRun
}
=
useMyRequest
(
getDataFileMovePackage
,
{
onSuccess
:
(
res
:
any
)
=>
{
successMove
();
},
}
);
// 要移动的文件夹 之后用来隐藏文件夹树中同路径的文件夹
// 要移动的文件夹 之后用来隐藏文件夹树中同路径的文件夹
const
[
moveFolderPathArr
,
setMoveFolderPathArr
]
=
useState
<
Array
<
string
>>
([]);
const
[
moveFolderPathArr
,
setMoveFolderPathArr
]
=
useState
<
Array
<
string
>>
([]);
...
@@ -62,31 +48,39 @@ const MoveFile = (props: any) => {
...
@@ -62,31 +48,39 @@ const MoveFile = (props: any) => {
)?.
then
((
res
)
=>
{
)?.
then
((
res
)
=>
{
if
(
Array
.
isArray
(
res
.
data
))
{
if
(
Array
.
isArray
(
res
.
data
))
{
let
arr
=
res
.
data
;
let
arr
=
res
.
data
;
const
disabledRepeatFolder
=
(
folderTree
:
any
)
=>
{
folderTree
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
if
(
moveFolderPathArr
.
indexOf
(
`
${
item
.
dir
.
substr
(
1
)}${
item
.
name
}
`
)
!==
-
1
)
{
item
.
disabled
=
true
;
// folderTree.splice(index, 1);
}
else
{
item
.
disabled
=
false
;
if
(
item
.
subdirs
.
length
>
0
)
{
disabledRepeatFolder
(
item
.
subdirs
);
}
}
});
};
disabledRepeatFolder
(
arr
);
setTreeData
(
arr
);
setTreeData
(
arr
);
}
else
{
}
else
{
setTreeData
([]);
setTreeData
([]);
}
}
});
});
}
}
},
[
fileToken
,
projectId
,
moveFolderPathArr
]);
},
[
fileToken
,
projectId
]);
const
getDisabledRepeatFolder
=
useCallback
(
(
folderTree
:
any
,
samePathFolederArr
:
Array
<
string
>
)
=>
{
const
arr
=
_
.
cloneDeep
(
folderTree
);
const
disabledRepeatFolder
=
(
tree
:
any
,
repeatPath
:
Array
<
string
>
)
=>
{
tree
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
if
(
repeatPath
.
indexOf
(
`
${
item
.
dir
.
substr
(
1
)}${
item
.
name
}
`
)
!==
-
1
)
{
item
.
disabled
=
true
;
}
else
{
item
.
disabled
=
false
;
if
(
item
.
subdirs
.
length
>
0
)
{
disabledRepeatFolder
(
item
.
subdirs
,
repeatPath
);
}
}
});
};
disabledRepeatFolder
(
arr
,
samePathFolederArr
);
return
arr
;
},
[]
);
useEffect
(()
=>
{
const
tree
=
getDisabledRepeatFolder
(
treeData
,
moveFolderPathArr
);
setRenderTreeData
(
tree
);
},
[
moveFolderPathArr
,
getDisabledRepeatFolder
,
treeData
]);
useEffect
(()
=>
{
useEffect
(()
=>
{
let
moveFolderArr
:
any
=
[];
let
moveFolderArr
:
any
=
[];
...
@@ -108,15 +102,9 @@ const MoveFile = (props: any) => {
...
@@ -108,15 +102,9 @@ const MoveFile = (props: any) => {
setMoveFolderPathArr
(
pathArr
);
setMoveFolderPathArr
(
pathArr
);
},
[
selectIds
,
showList
,
currentOperateFile
,
path
]);
},
[
selectIds
,
showList
,
currentOperateFile
,
path
]);
useEffect
(()
=>
{
if
(
moveFolderPathArr
.
length
>
0
)
{
getTree
();
}
},
[
moveFolderPathArr
,
getTree
]);
const
showDialog
=
()
=>
{
const
showDialog
=
()
=>
{
moveFileDialogRef
.
current
.
handleClickOpen
();
moveFileDialogRef
.
current
.
handleClickOpen
();
setTreeData
([]
);
getTree
(
);
};
};
useImperativeHandle
(
props
.
onRef
,
()
=>
{
useImperativeHandle
(
props
.
onRef
,
()
=>
{
...
@@ -125,6 +113,21 @@ const MoveFile = (props: any) => {
...
@@ -125,6 +113,21 @@ const MoveFile = (props: any) => {
};
};
});
});
const
{
run
:
getDataFileMoveRun
}
=
useMyRequest
(
getDataFileMove
,
{
onSuccess
:
(
res
:
any
)
=>
{
successMove
();
},
});
const
{
run
:
getDataFileMovePackageRun
}
=
useMyRequest
(
getDataFileMovePackage
,
{
onSuccess
:
(
res
:
any
)
=>
{
successMove
();
},
}
);
// 提供给fileserver相关接口的newpath 直接用newPath就可以了
// 提供给fileserver相关接口的newpath 直接用newPath就可以了
// const newPathProvidedToFileServer = useMemo(() => {
// const newPathProvidedToFileServer = useMemo(() => {
// return newPath
// return newPath
...
@@ -340,7 +343,8 @@ const MoveFile = (props: any) => {
...
@@ -340,7 +343,8 @@ const MoveFile = (props: any) => {
ProjectData
ProjectData
</
div
>
</
div
>
<
MyTreeView
<
MyTreeView
treeData=
{
treeData
}
// treeData={treeData}
treeData=
{
renderTreeData
}
renderLabel=
{
renderLabel
}
renderLabel=
{
renderLabel
}
onNodeSelect=
{
onNodeSelect
}
onNodeSelect=
{
onNodeSelect
}
idFunc=
{
idFunc
}
idFunc=
{
idFunc
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment