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
88289aac
Commit
88289aac
authored
Jun 14, 2022
by
chenshouchao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 除下载外联调完成
parent
c5517fd8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
501 additions
and
114 deletions
+501
-114
api_manager.ts
src/api/api_manager.ts
+6
-3
project_api.ts
src/api/project_api.ts
+72
-0
Table.jsx
src/components/Material.Ui/Table.jsx
+12
-0
index.module.css
src/views/Project/ProjectData/MoveFile/index.module.css
+3
-0
index.tsx
src/views/Project/ProjectData/MoveFile/index.tsx
+114
-37
index.tsx
src/views/Project/ProjectData/index.tsx
+294
-74
No files found.
src/api/api_manager.ts
View file @
88289aac
...
@@ -18,8 +18,11 @@ const RESTAPI = {
...
@@ -18,8 +18,11 @@ const RESTAPI = {
API_PROJECT_GET
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/project/get`
,
//获取项目信息
API_PROJECT_GET
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/project/get`
,
//获取项目信息
API_CPCE_HPCZONE
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/cpce/hpczone`
,
//获取计算区列表
API_CPCE_HPCZONE
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/cpce/hpczone`
,
//获取计算区列表
API_DATA_FILETOKEN
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/data/filetoken`
,
//获取项目目录的filetoken
API_DATA_FILETOKEN
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/data/filetoken`
,
//获取项目目录的filetoken
API_USER_PERMISSION_LIST
:
`
${
BACKEND_API_URI_PREFIX
}
/uaa/routes/privilege/list`
,
//获取用户包含的权限列表
API_DATA_FIND
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/data/find`
,
//查询某路径下数据集
}
API_DATA_SEARCH
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/data/search`
,
//搜索项目中某路径下的数据集
API_DATA_MOVE
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/data/move`
,
//移动到
API_DATA_DEL
:
`
${
BACKEND_API_URI_PREFIX
}
/cpp/data/del`
,
//删除项目中的数据集
API_USER_PERMISSION_LIST
:
`
${
BACKEND_API_URI_PREFIX
}
/uaa/routes/privilege/list`
,
//获取用户包含的权限列表
};
export
default
RESTAPI
;
export
default
RESTAPI
;
src/api/project_api.ts
View file @
88289aac
...
@@ -99,6 +99,74 @@ const getDataFileToken = (params: getDataFileTokenParams) => {
...
@@ -99,6 +99,74 @@ const getDataFileToken = (params: getDataFileTokenParams) => {
});
});
};
};
type
getDataFindParams
=
{
projectId
:
string
;
path
:
string
;
};
// 查询某路径下数据集
const
getDataFind
=
(
params
:
getDataFindParams
)
=>
{
return
request
({
url
:
Api
.
API_DATA_FIND
,
method
:
"get"
,
params
,
});
};
type
getDataFileSearchParams
=
{
projectId
:
string
;
name
:
string
;
path
?:
string
;
};
// 搜索项目中某路径下的数据集
const
getDataFileSearch
=
(
params
:
getDataFileSearchParams
)
=>
{
return
request
({
url
:
Api
.
API_DATA_SEARCH
,
method
:
"get"
,
params
,
});
};
type
getDataFileMoveParams
=
{
projectId
:
string
;
names
:
string
;
spath
?:
string
;
// 原路径
dpath
?:
string
;
// 目标路径
};
// Content-Type application/x-www-form-urlencoded
// 移动到
const
getDataFileMove
=
(
params
:
getDataFileMoveParams
)
=>
{
return
request
({
url
:
Api
.
API_DATA_MOVE
,
method
:
"put"
,
data
:
params
,
headers
:
{
"Content-Type"
:
"application/x-www-form-urlencoded"
,
},
});
};
type
getDataFileDelParams
=
{
projectId
:
string
;
names
:
string
;
path
?:
string
;
};
// Content-Type application/x-www-form-urlencoded
// 删除项目中的数据集
const
getDataFileDel
=
(
params
:
getDataFileDelParams
)
=>
{
return
request
({
url
:
Api
.
API_DATA_DEL
,
method
:
"delete"
,
params
,
headers
:
{
"Content-Type"
:
"application/x-www-form-urlencoded"
,
},
});
};
export
{
export
{
current
,
current
,
menu
,
menu
,
...
@@ -109,4 +177,8 @@ export {
...
@@ -109,4 +177,8 @@ export {
updateProject
,
updateProject
,
deleteProject
,
deleteProject
,
getDataFileToken
,
getDataFileToken
,
getDataFind
,
getDataFileSearch
,
getDataFileMove
,
getDataFileDel
,
};
};
src/components/Material.Ui/Table.jsx
View file @
88289aac
...
@@ -15,6 +15,7 @@ import EnhancedTableHeadComponent from "./Table/EnhancedTableHead"
...
@@ -15,6 +15,7 @@ import EnhancedTableHeadComponent from "./Table/EnhancedTableHead"
import
{
getComparator
,
stableSort
,
useStyles
}
from
"./Table/function"
;
import
{
getComparator
,
stableSort
,
useStyles
}
from
"./Table/function"
;
import
ActionsComponent
from
"./Table/ActionsComponent"
import
ActionsComponent
from
"./Table/ActionsComponent"
import
{
useEffect
}
from
"react"
;
import
{
useEffect
}
from
"react"
;
import
{
useImperativeHandle
}
from
"react"
;
export
default
function
EnhancedTable
(
props
)
{
export
default
function
EnhancedTable
(
props
)
{
const
classes
=
useStyles
;
const
classes
=
useStyles
;
...
@@ -27,6 +28,17 @@ export default function EnhancedTable(props) {
...
@@ -27,6 +28,17 @@ export default function EnhancedTable(props) {
// const [spin, setSpin] = React.useState(false)
// const [spin, setSpin] = React.useState(false)
const
[
onRow
,
setOnRow
]
=
React
.
useState
(
''
)
const
[
onRow
,
setOnRow
]
=
React
.
useState
(
''
)
// 重置复选框选中选项
const
initSelectedFunc
=
(
e
)
=>
{
setSelected
(
e
)
}
useImperativeHandle
(
props
.
onRef
,
()
=>
{
return
{
initSelectedFunc
:
initSelectedFunc
,
};
});
useEffect
(()
=>
{
useEffect
(()
=>
{
setOnRow
(
defaultRow
)
setOnRow
(
defaultRow
)
},
[
defaultRow
])
},
[
defaultRow
])
...
...
src/views/Project/ProjectData/MoveFile/index.module.css
View file @
88289aac
...
@@ -10,6 +10,9 @@
...
@@ -10,6 +10,9 @@
justify-content
:
flex-start
;
justify-content
:
flex-start
;
align-items
:
center
;
align-items
:
center
;
}
}
.rootTitleActive
{
background-color
:
rgba
(
25
,
118
,
210
,
0.2
);
}
.bigFolderIcon
{
.bigFolderIcon
{
margin
:
0
9px
;
margin
:
0
9px
;
}
}
...
...
src/views/Project/ProjectData/MoveFile/index.tsx
View file @
88289aac
import
React
,
{
import
React
,
{
useState
,
useImperativeHandle
,
useCallback
}
from
"react"
;
useState
,
useImperativeHandle
,
useCallback
,
}
from
"react"
;
import
style
from
"./index.module.css"
;
import
style
from
"./index.module.css"
;
import
MyDialog
from
"@/components/mui/MyDialog"
;
import
MyDialog
from
"@/components/mui/MyDialog"
;
...
@@ -11,11 +7,31 @@ import bigFolderIcon from "@/assets/project/bigFolderIcon.svg";
...
@@ -11,11 +7,31 @@ import bigFolderIcon from "@/assets/project/bigFolderIcon.svg";
import
{
useMessage
}
from
"@/components/MySnackbar"
;
import
{
useMessage
}
from
"@/components/MySnackbar"
;
import
MyTreeView
from
"@/components/mui/MyTreeView"
;
import
MyTreeView
from
"@/components/mui/MyTreeView"
;
import
CloudEController
from
"@/api/fileserver/CloudEController"
;
import
CloudEController
from
"@/api/fileserver/CloudEController"
;
import
{
getDataFileMove
}
from
"@/api/project_api"
;
import
useMyRequest
from
"@/hooks/useMyRequest"
;
import
classNames
from
"classnames"
;
const
MoveFile
=
(
props
:
any
)
=>
{
const
MoveFile
=
(
props
:
any
)
=>
{
const
{
path
,
projectId
,
fileToken
,
currentOperateFile
,
selectIds
,
refresh
}
=
props
;
const
{
path
,
projectId
,
fileToken
,
currentOperateFile
,
selectIds
,
refresh
,
activeTab
,
showList
,
}
=
props
;
const
Message
=
useMessage
();
const
Message
=
useMessage
();
const
[
newPath
,
setNewPath
]
=
useState
(
""
);
const
{
run
:
getDataFileMoveRun
}
=
useMyRequest
(
getDataFileMove
,
{
onSuccess
:
(
res
:
any
)
=>
{
Message
.
success
(
"移动成功!"
);
moveFileDialogRef
.
current
.
handleClose
();
refresh
();
},
});
const
[
newPath
,
setNewPath
]
=
useState
(
"/"
);
const
[
rootActive
,
setRootActive
]
=
useState
(
true
);
const
[
treeData
,
setTreeData
]
=
useState
<
any
>
([]);
const
[
treeData
,
setTreeData
]
=
useState
<
any
>
([]);
...
@@ -53,36 +69,86 @@ const MoveFile = (props: any) => {
...
@@ -53,36 +69,86 @@ const MoveFile = (props: any) => {
if
(
newPath
)
{
if
(
newPath
)
{
if
(
!
currentOperateFile
)
{
if
(
!
currentOperateFile
)
{
// 批量移动
// 批量移动
const
oldPaths
=
selectIds
.
map
((
name
:
any
)
=>
{
if
(
activeTab
===
1
)
{
return
`
${
path
}${
path
===
"/"
?
""
:
"/"
}${
name
}
`
;
const
oldPaths
=
selectIds
.
map
((
name
:
any
)
=>
{
});
return
`
${
path
}${
path
===
"/"
?
""
:
"/"
}${
name
}
`
;
CloudEController
.
JobFileBatchMove
(
});
newPath
,
CloudEController
.
JobFileBatchMove
(
oldPaths
,
newPath
,
""
,
oldPaths
,
fileToken
,
""
,
projectId
fileToken
,
)?.
then
((
res
)
=>
{
projectId
Message
.
success
(
'移动成功!'
)
)?.
then
((
res
)
=>
{
refresh
()
Message
.
success
(
"移动成功!"
);
});
moveFileDialogRef
.
current
.
handleClose
();
refresh
();
});
}
else
{
const
datSetMoveList
=
showList
.
filter
((
item
:
any
)
=>
{
return
(
selectIds
.
indexOf
(
item
.
name
)
!==
-
1
&&
item
.
type
===
"dataSet"
);
});
const
otherMoveList
=
showList
.
filter
((
item
:
any
)
=>
{
return
(
selectIds
.
indexOf
(
item
.
name
)
!==
-
1
&&
item
.
type
!==
"dataSet"
);
});
if
(
datSetMoveList
.
length
>
0
)
{
const
oldPaths
=
`
${
path
}${
path
===
"/"
?
""
:
"/"
}
`
;
getDataFileMoveRun
({
projectId
:
projectId
as
string
,
names
:
datSetMoveList
.
map
((
item
:
any
)
=>
item
.
name
).
join
(
","
),
spath
:
oldPaths
,
dpath
:
newPath
===
"/"
?
"/"
:
`
${
newPath
}
/`
,
});
}
if
(
otherMoveList
.
length
>
0
)
{
const
oldPaths
=
otherMoveList
.
map
((
item
:
any
)
=>
{
return
`
${
path
}${
path
===
"/"
?
""
:
"/"
}${
item
.
name
}
`
;
});
CloudEController
.
JobFileBatchMove
(
newPath
,
oldPaths
,
""
,
fileToken
,
projectId
)?.
then
((
res
)
=>
{
Message
.
success
(
"移动成功!"
);
moveFileDialogRef
.
current
.
handleClose
();
refresh
();
});
}
}
}
else
{
}
else
{
const
oldPath
=
`
${
path
}${
path
===
"/"
?
""
:
"/"
}${
if
(
currentOperateFile
.
type
===
"dataSet"
)
{
currentOperateFile
.
name
const
oldPaths
=
`
${
path
}${
path
===
"/"
?
""
:
"/"
}
`
;
}
`
;
getDataFileMoveRun
({
if
(
oldPath
===
newPath
)
{
projectId
:
projectId
as
string
,
Message
.
info
(
"当前目录和目标目录一致,请重新选择目标目录"
);
names
:
currentOperateFile
.
name
,
return
;
spath
:
oldPaths
,
dpath
:
newPath
===
"/"
?
"/"
:
`
${
newPath
}
/`
,
});
}
else
{
const
oldPath
=
`
${
path
}${
path
===
"/"
?
""
:
"/"
}${
currentOperateFile
.
name
}
`
;
if
(
oldPath
===
newPath
)
{
Message
.
info
(
"当前目录和目标目录一致,请重新选择目标目录"
);
return
;
}
CloudEController
.
JobFileMove
(
newPath
,
oldPath
,
""
,
fileToken
,
projectId
)?.
then
((
res
)
=>
{
Message
.
success
(
"移动成功!"
);
moveFileDialogRef
.
current
.
handleClose
();
});
}
}
CloudEController
.
JobFileMove
(
newPath
,
oldPath
,
""
,
fileToken
,
projectId
)?.
then
((
res
)
=>
{
console
.
log
(
res
);
});
}
}
}
else
{
}
else
{
Message
.
error
(
"请选择移动到哪个目录"
);
Message
.
error
(
"请选择移动到哪个目录"
);
...
@@ -99,8 +165,13 @@ const MoveFile = (props: any) => {
...
@@ -99,8 +165,13 @@ const MoveFile = (props: any) => {
};
};
const
onNodeSelect
=
(
a
:
any
,
b
:
any
)
=>
{
const
onNodeSelect
=
(
a
:
any
,
b
:
any
)
=>
{
console
.
log
(
"onNodeSelect"
,
a
,
b
);
setNewPath
(
b
);
setNewPath
(
b
);
setRootActive
(
false
);
};
const
handleRoot
=
()
=>
{
setNewPath
(
"/"
);
setRootActive
(
true
);
};
};
const
moveFileSubmitloading
=
false
;
const
moveFileSubmitloading
=
false
;
...
@@ -116,7 +187,13 @@ const MoveFile = (props: any) => {
...
@@ -116,7 +187,13 @@ const MoveFile = (props: any) => {
title=
"移动至"
title=
"移动至"
submitloading=
{
moveFileSubmitloading
}
submitloading=
{
moveFileSubmitloading
}
>
>
<
div
className=
{
style
.
rootTitle
}
>
<
div
className=
{
classNames
({
[
style
.
rootTitle
]:
true
,
[
style
.
rootTitleActive
]:
rootActive
,
})
}
onClick=
{
handleRoot
}
>
<
img
className=
{
style
.
bigFolderIcon
}
src=
{
bigFolderIcon
}
alt=
""
/>
<
img
className=
{
style
.
bigFolderIcon
}
src=
{
bigFolderIcon
}
alt=
""
/>
ProjectData
ProjectData
</
div
>
</
div
>
...
...
src/views/Project/ProjectData/index.tsx
View file @
88289aac
...
@@ -31,6 +31,11 @@ import DialogContent from "@mui/material/DialogContent";
...
@@ -31,6 +31,11 @@ import DialogContent from "@mui/material/DialogContent";
import
DialogContentText
from
"@mui/material/DialogContentText"
;
import
DialogContentText
from
"@mui/material/DialogContentText"
;
import
DialogTitle
from
"@mui/material/DialogTitle"
;
import
DialogTitle
from
"@mui/material/DialogTitle"
;
import
usePass
from
"@/hooks/usePass"
;
import
usePass
from
"@/hooks/usePass"
;
import
{
getDataFind
,
getDataFileSearch
,
getDataFileDel
,
}
from
"@/api/project_api"
;
const
theme
=
createTheme
({
const
theme
=
createTheme
({
palette
:
{
palette
:
{
...
@@ -58,62 +63,111 @@ declare module "@mui/material/Button" {
...
@@ -58,62 +63,111 @@ declare module "@mui/material/Button" {
const
ProjectData
=
observer
(()
=>
{
const
ProjectData
=
observer
(()
=>
{
const
isPass
=
usePass
();
const
isPass
=
usePass
();
const
Message
=
useMessage
()
const
Message
=
useMessage
()
;
const
{
currentProjectStore
}
=
useStores
();
const
{
currentProjectStore
}
=
useStores
();
const
projectId
=
useMemo
(()
=>
{
return
toJS
(
currentProjectStore
.
currentProjectInfo
.
id
);
},
[
currentProjectStore
]);
const
[
tableLoadding
,
setTableLoadding
]
=
useState
(
false
);
const
[
tableLoadding
,
setTableLoadding
]
=
useState
(
false
);
const
[
deleteDialogOpen
,
setDeleteDialogOpen
]
=
useState
(
false
);
const
[
deleteDialogOpen
,
setDeleteDialogOpen
]
=
useState
(
false
);
const
[
currentOperateFile
,
setCurrentOperateFile
]
=
useState
<
any
>
(
null
);
const
[
currentOperateFile
,
setCurrentOperateFile
]
=
useState
<
any
>
(
null
);
const
[
deleteloading
,
setDeleteloading
]
=
useState
(
false
);
const
[
deleteloading
,
setDeleteloading
]
=
useState
(
false
);
const
[
path
,
setPath
]
=
useState
(
"/"
);
const
[
path
,
setPath
]
=
useState
(
"/"
);
const
showPath
=
useMemo
(()
=>
{
if
(
path
===
"/"
)
{
// return "ProjectData";
return
<
span
className=
{
style
.
showPathSpan
}
>
ProjectData
</
span
>
}
else
{
console
.
log
(
path
)
console
.
log
(
path
.
split
(
'/'
))
const
pathArr
=
path
.
split
(
'/'
)
if
(
pathArr
.
length
<=
4
)
{
return
(
pathArr
.
map
((
item
,
index
)
=>
{
return
(<
span
onClick=
{
()
=>
setPath
(
pathArr
.
slice
(
0
,
index
+
1
).
join
(
'/'
)
===
''
?
''
:
pathArr
.
slice
(
0
,
index
+
1
).
join
(
'/'
))
}
className=
{
classnames
({
[
style
.
showPathSpan
]:
true
,
[
style
.
showPathSpanActive
]:
index
===
pathArr
.
length
-
1
})
}
>
{
index
===
0
?
'ProjectData'
:
item
}
{
index
===
pathArr
.
length
-
1
?
null
:
<
i
className=
{
style
.
showPathI
}
>
{
'>'
}
</
i
>
}
</
span
>)
}))
}
else
{
return
(
pathArr
.
map
((
item
,
index
)
=>
{
return
(<
span
onClick=
{
()
=>
setPath
(
pathArr
.
slice
(
0
,
index
+
1
).
join
(
'/'
)
===
''
?
''
:
pathArr
.
slice
(
0
,
index
+
1
).
join
(
'/'
))
}
className=
{
classnames
({
[
style
.
showPathSpan
]:
true
,
[
style
.
showPathSpanActive
]:
index
===
pathArr
.
length
-
1
})
}
>
{
index
===
0
?
'ProjectData'
:
index
>
pathArr
.
length
-
4
?
item
:
''
}
{
/* && index > pathArr.length - 4 */
}
{
index
===
pathArr
.
length
-
1
||
(
index
<=
pathArr
.
length
-
4
&&
index
>
0
)
?
null
:
<
i
className=
{
style
.
showPathI
}
>
{
'>'
}
</
i
>
}
{
index
===
1
&&
'...'
}{
index
===
1
&&
<
i
className=
{
style
.
showPathI
}
>
{
'>'
}
</
i
>
}
</
span
>)
}))
}
}
},
[
path
]);
const
[
activeTab
,
setActiveTab
]
=
useState
(
1
);
const
[
activeTab
,
setActiveTab
]
=
useState
(
1
);
const
[
selectIds
,
setSelectIds
]
=
useState
<
Array
<
string
>>
([]);
let
tableRef
:
any
=
React
.
createRef
();
useEffect
(()
=>
{
setSelectIds
([]);
},
[
activeTab
]);
const
[
keyWord
,
setKeyWord
]
=
useState
(
""
);
const
[
keyWord
,
setKeyWord
]
=
useState
(
""
);
const
[
fileToken
,
setFileToken
]
=
useState
(
""
);
const
[
fileToken
,
setFileToken
]
=
useState
(
""
);
// 文件列表
const
[
list
,
setList
]
=
useState
<
any
>
([]);
const
[
list
,
setList
]
=
useState
<
any
>
([]);
// 数据集列表 不带文件
const
[
dataSetList
,
setDataSetList
]
=
useState
<
any
>
([]);
const
showList
=
useMemo
(()
=>
{
if
(
activeTab
===
1
)
{
return
list
;
}
else
{
const
folderList
=
list
.
filter
((
item
:
any
)
=>
{
return
item
.
type
===
"directory"
;
});
return
[...
folderList
,
...
dataSetList
];
}
},
[
list
,
dataSetList
,
activeTab
]);
const
{
run
:
getDataFileTokenRun
}
=
useMyRequest
(
getDataFileToken
,
{
const
{
run
:
getDataFileTokenRun
}
=
useMyRequest
(
getDataFileToken
,
{
onSuccess
:
(
res
:
any
)
=>
{
onSuccess
:
(
res
:
any
)
=>
{
console
.
log
(
"res"
,
res
);
setFileToken
(
res
.
data
);
setFileToken
(
res
.
data
);
},
},
});
});
const
projectId
=
useMemo
(()
=>
{
const
{
run
:
getDataFileSearchRun
}
=
useMyRequest
(
getDataFileSearch
,
{
return
toJS
(
currentProjectStore
.
currentProjectInfo
.
id
);
onSuccess
:
(
res
:
any
)
=>
{
},
[
currentProjectStore
]);
const
dataSetList
=
res
.
data
.
map
((
item
:
any
)
=>
{
return
{
...
item
,
type
:
"dataSet"
,
};
});
setDataSetList
(
dataSetList
);
setSelectIds
([]);
tableRef
?.
current
?.
initSelectedFunc
([]);
},
});
// useEffect(() => {
// if (activeTab === 2) {
// getDataFileSearchRun()
// }
// }, [activeTab, getDataFileSearchRun]);
const
{
run
:
getDataFindRun
}
=
useMyRequest
(
getDataFind
,
{
onSuccess
:
(
res
:
any
)
=>
{
const
dataSetList
=
res
.
data
.
map
((
item
:
any
)
=>
{
return
{
...
item
,
type
:
"dataSet"
,
};
});
setDataSetList
(
dataSetList
);
setSelectIds
([]);
tableRef
?.
current
?.
initSelectedFunc
([]);
},
});
const
getDataSetList
=
useCallback
(()
=>
{
if
(
keyWord
)
{
return
;
}
else
{
return
getDataFindRun
({
projectId
:
projectId
as
string
,
path
:
path
===
"/"
?
"/"
:
`
${
path
}
/`
,
});
}
},
[
keyWord
,
path
,
projectId
,
getDataFindRun
]);
const
getDataSetListSearch
=
useCallback
(()
=>
{
if
(
keyWord
)
{
return
getDataFileSearchRun
({
projectId
:
projectId
as
string
,
name
:
keyWord
,
});
}
else
{
return
getDataSetList
();
}
},
[
keyWord
,
projectId
,
getDataFileSearchRun
,
getDataSetList
]);
useEffect
(()
=>
{
getDataSetList
();
},
[
getDataSetList
]);
const
getList
=
useCallback
(()
=>
{
const
getList
=
useCallback
(()
=>
{
if
(
fileToken
&&
projectId
)
{
if
(
keyWord
)
{
return
;
}
else
if
(
fileToken
&&
projectId
)
{
setTableLoadding
(
true
);
setTableLoadding
(
true
);
return
CloudEController
.
JobOutFileList
(
return
CloudEController
.
JobOutFileList
(
path
,
path
,
...
@@ -127,20 +181,26 @@ const ProjectData = observer(() => {
...
@@ -127,20 +181,26 @@ const ProjectData = observer(() => {
}
else
{
}
else
{
setList
([]);
setList
([]);
}
}
setSelectIds
([]);
});
});
}
}
},
[
fileToken
,
path
,
projectId
]);
},
[
fileToken
,
path
,
projectId
,
keyWord
]);
useEffect
(()
=>
{
useEffect
(()
=>
{
getList
();
getList
();
},
[
getList
]);
},
[
getList
]);
// 全局搜索文件列表
// 全局搜索文件列表
const
searchFileList
=
useCallback
(()
=>
{
const
searchFileList
=
useCallback
(()
=>
{
if
(
fileToken
&&
projectId
)
{
if
(
!
keyWord
)
{
setTableLoadding
(
true
);
getList
();
}
else
{
if
(
fileToken
&&
projectId
)
{
setTableLoadding
(
true
);
setPath
(
"/"
);
return
CloudEController
.
JobSearchFileList
(
return
CloudEController
.
JobSearchFileList
(
keyWord
,
keyWord
,
path
,
"/"
,
fileToken
,
fileToken
,
projectId
,
projectId
,
false
false
...
@@ -151,17 +211,22 @@ const ProjectData = observer(() => {
...
@@ -151,17 +211,22 @@ const ProjectData = observer(() => {
}
else
{
}
else
{
setList
([]);
setList
([]);
}
}
setSelectIds
([]);
});
});
}
}
}
},
[
fileToken
,
p
ath
,
projectId
,
keyWord
]);
},
[
fileToken
,
p
rojectId
,
keyWord
,
getList
]);
const
handleRefresh
=
()
=>
{
const
handleRefresh
=
()
=>
{
tableRef
?.
current
?.
initSelectedFunc
([]);
setSelectIds
([]);
if
(
keyWord
)
{
if
(
keyWord
)
{
searchFileList
()
searchFileList
();
getDataSetListSearch
();
}
else
{
}
else
{
getList
();
getList
();
getDataSetList
();
}
}
setSelectIds
([])
};
};
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -172,19 +237,17 @@ const ProjectData = observer(() => {
...
@@ -172,19 +237,17 @@ const ProjectData = observer(() => {
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
()
;
console
.
log
(
'搜索'
)
getDataSetListSearch
();
}
}
}
};
const
[
selectIds
,
setSelectIds
]
=
useState
([]);
const
versionsHeadCells
=
[
const
versionsHeadCells
=
[
{
id
:
"checkbox"
},
{
id
:
"checkbox"
},
...
@@ -202,8 +265,8 @@ const ProjectData = observer(() => {
...
@@ -202,8 +265,8 @@ const ProjectData = observer(() => {
const
handleViewFolders
=
(
item
:
any
)
=>
{
const
handleViewFolders
=
(
item
:
any
)
=>
{
console
.
log
(
"handleViewFolders"
);
console
.
log
(
"handleViewFolders"
);
console
.
log
(
item
);
console
.
log
(
item
);
if
(
path
===
'/'
)
{
if
(
path
===
"/"
)
{
setPath
(
`/
${
item
.
name
}
`
)
setPath
(
`/
${
item
.
name
}
`
)
;
}
else
{
}
else
{
setPath
(
`
${
path
}
/
${
item
.
name
}
`
);
setPath
(
`
${
path
}
/
${
item
.
name
}
`
);
}
}
...
@@ -225,6 +288,13 @@ const ProjectData = observer(() => {
...
@@ -225,6 +288,13 @@ const ProjectData = observer(() => {
{
item
.
name
}
{
item
.
name
}
</
span
>
</
span
>
);
);
}
else
if
(
item
.
type
===
"dataSet"
)
{
return
(
<
span
className=
{
style
.
folderIconBox
}
>
<
img
className=
{
style
.
folderIcon
}
src=
{
dataSetIcon
}
alt=
""
/>
{
item
.
name
}
</
span
>
);
}
else
{
}
else
{
return
(
return
(
<
span
className=
{
style
.
folderIconBox
}
>
<
span
className=
{
style
.
folderIconBox
}
>
...
@@ -236,6 +306,9 @@ const ProjectData = observer(() => {
...
@@ -236,6 +306,9 @@ const ProjectData = observer(() => {
};
};
const
renderSize
=
(
item
:
any
)
=>
{
const
renderSize
=
(
item
:
any
)
=>
{
if
(
item
.
type
===
"dataSet"
)
{
return
<
span
>
{
item
.
size
}
条
</
span
>;
}
return
<
span
>
{
item
.
size
?
`${item.size}b`
:
"-"
}
</
span
>;
return
<
span
>
{
item
.
size
?
`${item.size}b`
:
"-"
}
</
span
>;
};
};
...
@@ -300,28 +373,98 @@ const ProjectData = observer(() => {
...
@@ -300,28 +373,98 @@ const ProjectData = observer(() => {
setDeleteDialogOpen
(
false
);
setDeleteDialogOpen
(
false
);
};
};
const
{
run
:
getDataFileDelRun
}
=
useMyRequest
(
getDataFileDel
,
{
onSuccess
:
(
res
:
any
)
=>
{
Message
.
success
(
"删除成功"
);
setDeleteloading
(
false
);
setDeleteDialogOpen
(
false
);
handleRefresh
();
},
});
const
handleDelete
=
()
=>
{
const
handleDelete
=
()
=>
{
let
deletePath
=
''
let
deletePath
=
""
;
if
(
currentOperateFile
)
{
if
(
currentOperateFile
)
{
deletePath
=
deletePath
=
path
===
"/"
path
===
"/"
?
`
${
path
}${
currentOperateFile
.
name
}
`
?
`
${
path
}${
currentOperateFile
.
name
}
`
:
`
${
path
}
/
${
currentOperateFile
.
name
}
`
;
:
`
${
path
}
/
${
currentOperateFile
.
name
}
`
;
}
else
{
}
else
{
deletePath
=
selectIds
.
map
((
name
:
any
)
=>
{
deletePath
=
selectIds
return
`
${
path
}${
path
===
"/"
?
""
:
"/"
}${
name
}
`
;
.
map
((
name
:
any
)
=>
{
}).
join
(
' '
);
return
`
${
path
}${
path
===
"/"
?
""
:
"/"
}${
name
}
`
;
})
.
join
(
" "
);
}
if
(
activeTab
===
2
)
{
deletePath
=
path
===
"/"
?
"/"
:
`
${
path
}
/`
;
if
(
currentOperateFile
)
{
if
(
currentOperateFile
.
type
===
"dataSet"
)
{
getDataFileDelRun
({
projectId
:
projectId
as
string
,
names
:
currentOperateFile
.
name
,
path
:
deletePath
,
});
}
else
{
deletePath
=
path
===
"/"
?
`
${
path
}${
currentOperateFile
.
name
}
`
:
`
${
path
}
/
${
currentOperateFile
.
name
}
`
;
CloudEController
.
JobOutFileDel
(
deletePath
,
fileToken
,
projectId
as
string
)?.
then
((
res
)
=>
{
Message
.
success
(
"删除成功"
);
setDeleteloading
(
false
);
setDeleteDialogOpen
(
false
);
handleRefresh
();
});
}
}
else
{
const
datSetDeleteList
=
showList
.
filter
((
item
:
any
)
=>
{
return
selectIds
.
indexOf
(
item
.
name
)
!==
-
1
&&
item
.
type
===
"dataSet"
;
});
const
otherDeleteList
=
showList
.
filter
((
item
:
any
)
=>
{
return
selectIds
.
indexOf
(
item
.
name
)
!==
-
1
&&
item
.
type
!==
"dataSet"
;
});
if
(
datSetDeleteList
.
length
>
0
)
{
getDataFileDelRun
({
projectId
:
projectId
as
string
,
names
:
datSetDeleteList
.
map
((
item
:
any
)
=>
item
.
name
).
join
(
","
),
path
:
deletePath
,
});
}
if
(
otherDeleteList
.
length
>
0
)
{
deletePath
=
otherDeleteList
.
map
((
item
:
any
)
=>
{
return
`
${
path
}${
path
===
"/"
?
""
:
"/"
}${
item
.
name
}
`
;
})
.
join
(
" "
);
CloudEController
.
JobOutFileDel
(
deletePath
,
fileToken
,
projectId
as
string
)?.
then
((
res
)
=>
{
Message
.
success
(
"删除成功"
);
setDeleteloading
(
false
);
setDeleteDialogOpen
(
false
);
handleRefresh
();
});
}
}
}
else
{
CloudEController
.
JobOutFileDel
(
deletePath
,
fileToken
,
projectId
as
string
)?.
then
((
res
)
=>
{
Message
.
success
(
"删除成功"
);
setDeleteloading
(
false
);
setDeleteDialogOpen
(
false
);
handleRefresh
();
});
}
}
CloudEController
.
JobOutFileDel
(
deletePath
,
fileToken
,
projectId
as
string
)?.
then
((
res
)
=>
{
Message
.
success
(
'删除成功'
)
setDeleteloading
(
false
);
setDeleteDialogOpen
(
false
);
handleRefresh
();
});
};
};
const
handleBatchMove
=
()
=>
{
const
handleBatchMove
=
()
=>
{
...
@@ -331,8 +474,73 @@ const ProjectData = observer(() => {
...
@@ -331,8 +474,73 @@ const ProjectData = observer(() => {
const
handleBatchDelete
=
()
=>
{
const
handleBatchDelete
=
()
=>
{
setCurrentOperateFile
(
null
);
setCurrentOperateFile
(
null
);
setDeleteDialogOpen
(
true
)
setDeleteDialogOpen
(
true
);
}
};
const
showPath
=
useMemo
(()
=>
{
if
(
path
===
"/"
)
{
return
<
span
className=
{
style
.
showPathSpan
}
>
ProjectData
</
span
>;
}
else
{
const
pathArr
=
path
.
split
(
"/"
);
if
(
pathArr
.
length
<=
4
)
{
return
pathArr
.
map
((
item
,
index
)
=>
{
return
(
<
span
key=
{
index
}
onClick=
{
()
=>
setPath
(
pathArr
.
slice
(
0
,
index
+
1
).
join
(
"/"
)
===
""
?
"/"
:
pathArr
.
slice
(
0
,
index
+
1
).
join
(
"/"
)
)
}
className=
{
classnames
({
[
style
.
showPathSpan
]:
true
,
[
style
.
showPathSpanActive
]:
index
===
pathArr
.
length
-
1
,
})
}
>
{
index
===
0
?
"ProjectData"
:
item
}{
" "
}
{
index
===
pathArr
.
length
-
1
?
null
:
(
<
i
className=
{
style
.
showPathI
}
>
{
">"
}
</
i
>
)
}
</
span
>
);
});
}
else
{
return
pathArr
.
map
((
item
,
index
)
=>
{
return
(
<
span
key=
{
index
}
onClick=
{
()
=>
setPath
(
pathArr
.
slice
(
0
,
index
+
1
).
join
(
"/"
)
===
""
?
"/"
:
pathArr
.
slice
(
0
,
index
+
1
).
join
(
"/"
)
)
}
className=
{
classnames
({
[
style
.
showPathSpan
]:
true
,
[
style
.
showPathSpanActive
]:
index
===
pathArr
.
length
-
1
,
})
}
>
{
index
===
0
?
"ProjectData"
:
index
>
pathArr
.
length
-
4
?
item
:
""
}
{
/* && index > pathArr.length - 4 */
}
{
index
===
pathArr
.
length
-
1
||
(
index
<=
pathArr
.
length
-
4
&&
index
>
0
)
?
null
:
(
<
i
className=
{
style
.
showPathI
}
>
{
">"
}
</
i
>
)
}
{
index
===
1
&&
"..."
}
{
index
===
1
&&
<
i
className=
{
style
.
showPathI
}
>
{
">"
}
</
i
>
}
</
span
>
);
});
}
}
},
[
path
]);
return
(
return
(
<
ThemeProvider
theme=
{
theme
}
>
<
ThemeProvider
theme=
{
theme
}
>
...
@@ -348,7 +556,9 @@ const ProjectData = observer(() => {
...
@@ -348,7 +556,9 @@ const ProjectData = observer(() => {
size=
"small"
size=
"small"
style=
{
{
marginRight
:
"12px"
}
}
style=
{
{
marginRight
:
"12px"
}
}
onClick=
{
hanleShowUpLoaderFileDialog
}
onClick=
{
hanleShowUpLoaderFileDialog
}
disabled=
{
selectIds
.
length
!==
0
||
!
isPass
(
"PROJECT_DATA_UPLOAD"
)
}
disabled=
{
selectIds
.
length
!==
0
||
!
isPass
(
"PROJECT_DATA_UPLOAD"
)
}
>
>
{
/* todo 项目权限 */
}
{
/* todo 项目权限 */
}
上传文件
上传文件
...
@@ -358,8 +568,10 @@ const ProjectData = observer(() => {
...
@@ -358,8 +568,10 @@ const ProjectData = observer(() => {
variant=
"outlined"
variant=
"outlined"
size=
"small"
size=
"small"
onClick=
{
hanleShowAddFolderDialog
}
onClick=
{
hanleShowAddFolderDialog
}
disabled=
{
selectIds
.
length
!==
0
||
!
isPass
(
"PROJECT_DATA_ADDDIR"
)
}
disabled=
{
>
selectIds
.
length
!==
0
||
!
isPass
(
"PROJECT_DATA_ADDDIR"
)
}
>
{
/* todo 项目权限 */
}
{
/* todo 项目权限 */
}
新建文件夹
新建文件夹
</
Button
>
</
Button
>
...
@@ -380,6 +592,7 @@ const ProjectData = observer(() => {
...
@@ -380,6 +592,7 @@ const ProjectData = observer(() => {
aria
-
label=
"search"
aria
-
label=
"search"
size=
"small"
size=
"small"
style=
{
{
padding
:
"4px"
}
}
style=
{
{
padding
:
"4px"
}
}
onClick=
{
searchFileList
}
>
>
<
SearchIcon
<
SearchIcon
className=
{
style
.
searchIcon
}
className=
{
style
.
searchIcon
}
...
@@ -428,7 +641,7 @@ const ProjectData = observer(() => {
...
@@ -428,7 +641,7 @@ const ProjectData = observer(() => {
// param="name"
// param="name"
rowHover=
{
true
}
rowHover=
{
true
}
stickyheader=
{
true
}
stickyheader=
{
true
}
rows=
{
l
ist
.
map
((
item
:
any
)
=>
({
rows=
{
showL
ist
.
map
((
item
:
any
)
=>
({
...
item
,
...
item
,
id
:
item
.
name
,
id
:
item
.
name
,
name
:
renderName
(
item
),
name
:
renderName
(
item
),
...
@@ -441,6 +654,8 @@ const ProjectData = observer(() => {
...
@@ -441,6 +654,8 @@ const ProjectData = observer(() => {
headCells=
{
versionsHeadCells
}
headCells=
{
versionsHeadCells
}
nopadding=
{
true
}
nopadding=
{
true
}
footer=
{
false
}
footer=
{
false
}
initSelected=
{
selectIds
}
onRef=
{
tableRef
}
></
Table
>
></
Table
>
</
div
>
</
div
>
{
selectIds
.
length
>
1
&&
(
{
selectIds
.
length
>
1
&&
(
...
@@ -474,7 +689,10 @@ const ProjectData = observer(() => {
...
@@ -474,7 +689,10 @@ 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
.
name
:
selectIds
.
join
(
'”,“'
)
}
确认要删除“
{
currentOperateFile
?
currentOperateFile
.
name
:
selectIds
.
join
(
"”,“"
)
}
”吗?
”吗?
</
DialogContentText
>
</
DialogContentText
>
</
DialogContent
>
</
DialogContent
>
...
@@ -520,6 +738,8 @@ const ProjectData = observer(() => {
...
@@ -520,6 +738,8 @@ const ProjectData = observer(() => {
currentOperateFile=
{
currentOperateFile
}
currentOperateFile=
{
currentOperateFile
}
selectIds=
{
selectIds
}
selectIds=
{
selectIds
}
refresh=
{
handleRefresh
}
refresh=
{
handleRefresh
}
activeTab=
{
activeTab
}
showList=
{
showList
}
></
MoveFile
>
></
MoveFile
>
</
div
>
</
div
>
</
ThemeProvider
>
</
ThemeProvider
>
...
...
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