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
sunyihao
bkunyun
Commits
6efbcfe3
Commit
6efbcfe3
authored
Jun 20, 2022
by
chenshouchao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat-20220608-projectdata' into 'release'
cn- fix: 移动文件时同路径文件置灰计算错误修复 See merge request
!63
parents
e4a2d9c8
cb906073
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
31 deletions
+37
-31
index.tsx
src/views/Project/ProjectData/MoveFile/index.tsx
+36
-30
index.tsx
src/views/Project/ProjectData/index.tsx
+1
-1
No files found.
src/views/Project/ProjectData/MoveFile/index.tsx
View file @
6efbcfe3
...
...
@@ -3,6 +3,7 @@ import React, {
useImperativeHandle
,
useCallback
,
useMemo
,
useEffect
,
}
from
"react"
;
import
style
from
"./index.module.css"
;
...
...
@@ -33,6 +34,12 @@ const MoveFile = (props: any) => {
},
});
const
[
newPath
,
setNewPath
]
=
useState
(
"/"
);
const
[
rootActive
,
setRootActive
]
=
useState
(
true
);
const
[
moveFileSubmitloading
,
setMoveFileSubmitloading
]
=
useState
(
false
);
const
[
treeData
,
setTreeData
]
=
useState
<
any
>
([]);
let
moveFileDialogRef
:
any
=
React
.
createRef
();
const
{
run
:
getDataFileMovePackageRun
}
=
useMyRequest
(
getDataFileMovePackage
,
{
...
...
@@ -43,31 +50,7 @@ const MoveFile = (props: any) => {
);
// 要移动的文件夹 之后用来隐藏文件夹树中同路径的文件夹
const
moveFolderPathArr
=
useMemo
(()
=>
{
let
moveFolderArr
:
any
=
[];
let
pathArr
=
[];
if
(
currentOperateFile
)
{
if
(
currentOperateFile
.
type
===
"directory"
)
{
moveFolderArr
=
[
currentOperateFile
];
}
else
{
moveFolderArr
=
[];
}
}
else
{
moveFolderArr
=
showList
.
filter
((
item
:
any
)
=>
{
return
selectIds
.
indexOf
(
item
.
name
)
!==
-
1
&&
item
.
type
===
"directory"
;
});
}
pathArr
=
moveFolderArr
.
map
((
item
:
any
)
=>
{
return
path
===
"/"
?
`/
${
item
.
name
}
`
:
`
${
path
}
/
${
item
.
name
}
`
;
});
return
pathArr
;
},
[
selectIds
,
showList
,
currentOperateFile
,
path
]);
const
[
newPath
,
setNewPath
]
=
useState
(
"/"
);
const
[
rootActive
,
setRootActive
]
=
useState
(
true
);
const
[
moveFileSubmitloading
,
setMoveFileSubmitloading
]
=
useState
(
false
);
const
[
treeData
,
setTreeData
]
=
useState
<
any
>
([]);
const
[
moveFolderPathArr
,
setMoveFolderPathArr
]
=
useState
<
Array
<
string
>>
([]);
const
getTree
=
useCallback
(()
=>
{
if
(
fileToken
&&
projectId
)
{
...
...
@@ -79,7 +62,7 @@ const MoveFile = (props: any) => {
)?.
then
((
res
)
=>
{
if
(
Array
.
isArray
(
res
.
data
))
{
let
arr
=
res
.
data
;
const
d
elete
RepeatFolder
=
(
folderTree
:
any
)
=>
{
const
d
isabled
RepeatFolder
=
(
folderTree
:
any
)
=>
{
folderTree
.
forEach
((
item
:
any
,
index
:
number
)
=>
{
if
(
moveFolderPathArr
.
indexOf
(
...
...
@@ -91,12 +74,12 @@ const MoveFile = (props: any) => {
}
else
{
item
.
disabled
=
false
;
if
(
item
.
subdirs
.
length
>
0
)
{
d
elete
RepeatFolder
(
item
.
subdirs
);
d
isabled
RepeatFolder
(
item
.
subdirs
);
}
}
});
};
d
elete
RepeatFolder
(
arr
);
d
isabled
RepeatFolder
(
arr
);
setTreeData
(
arr
);
}
else
{
setTreeData
([]);
...
...
@@ -105,12 +88,35 @@ const MoveFile = (props: any) => {
}
},
[
fileToken
,
projectId
,
moveFolderPathArr
]);
let
moveFileDialogRef
:
any
=
React
.
createRef
();
useEffect
(()
=>
{
let
moveFolderArr
:
any
=
[];
let
pathArr
=
[];
if
(
currentOperateFile
)
{
if
(
currentOperateFile
.
type
===
"directory"
)
{
moveFolderArr
=
[
currentOperateFile
];
}
else
{
moveFolderArr
=
[];
}
}
else
{
moveFolderArr
=
showList
.
filter
((
item
:
any
)
=>
{
return
selectIds
.
indexOf
(
item
.
name
)
!==
-
1
&&
item
.
type
===
"directory"
;
});
}
pathArr
=
moveFolderArr
.
map
((
item
:
any
)
=>
{
return
path
===
"/"
?
`/
${
item
.
name
}
`
:
`
${
path
}
/
${
item
.
name
}
`
;
});
setMoveFolderPathArr
(
pathArr
);
},
[
selectIds
,
showList
,
currentOperateFile
,
path
]);
useEffect
(()
=>
{
if
(
moveFolderPathArr
.
length
>
0
)
{
getTree
();
}
},
[
moveFolderPathArr
,
getTree
]);
const
showDialog
=
()
=>
{
moveFileDialogRef
.
current
.
handleClickOpen
();
setTreeData
([]);
getTree
();
};
useImperativeHandle
(
props
.
onRef
,
()
=>
{
...
...
src/views/Project/ProjectData/index.tsx
View file @
6efbcfe3
...
...
@@ -89,7 +89,7 @@ const ProjectData = observer(() => {
useEffect
(()
=>
{
const
locationInfo
:
any
=
location
?.
state
;
setPath
(
locationInfo
?.
pathName
||
""
);
setPath
(
locationInfo
?.
pathName
||
"
/
"
);
},
[
location
]);
// 列表展示的数据
...
...
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