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
ca9eacba
Commit
ca9eacba
authored
Jun 15, 2022
by
chenshouchao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 单位换算优化 上传文件表格表头固定
parent
5ae002f7
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
17 deletions
+27
-17
raysyncApi.ts
src/api/fileserver/raysyncApi.ts
+1
-0
util.ts
src/utils/util.ts
+17
-0
index.module.css
src/views/Project/ProjectData/UpLoaderFile/index.module.css
+2
-2
index.tsx
src/views/Project/ProjectData/UpLoaderFile/index.tsx
+5
-5
index.tsx
src/views/Project/ProjectData/index.tsx
+2
-5
project.ts
src/views/Project/project.ts
+0
-5
No files found.
src/api/fileserver/raysyncApi.ts
View file @
ca9eacba
...
...
@@ -116,6 +116,7 @@ export {
getType
,
};
// mock 数据
// const raysyncAddr = {
// bandwidth: null
// capacity: 10485760
...
...
src/utils/util.ts
View file @
ca9eacba
...
...
@@ -60,3 +60,20 @@ export const checkIsNumberLetterChinese = (string: string) => {
export
const
getMbfromB
=
(
b
:
number
)
=>
{
return
Math
.
floor
(
b
/
1048576
);
};
// 内存单位转换
export
const
storageUnitFromB
=
(
b
:
number
)
=>
{
if
(
b
<=
0
)
{
return
"0B"
;
}
else
if
(
b
<
1024
)
{
return
`
${
b
}
B`
;
}
else
if
(
b
<
1024
*
1024
)
{
return
`
${(
b
/
1024
).
toFixed
(
2
)}
KB`
;
}
else
if
(
b
<
1024
*
1024
*
1024
)
{
return
`
${(
b
/
(
1024
*
1024
)).
toFixed
(
2
)}
MB`
;
}
else
if
(
b
<
1024
*
1024
*
1024
*
1024
)
{
return
`
${(
b
/
(
1024
*
1024
*
1024
)).
toFixed
(
2
)}
G`
;
}
else
{
return
`
${(
b
/
(
1024
*
1024
*
1024
*
1024
)).
toFixed
(
2
)}
t`
;
}
};
src/views/Project/ProjectData/UpLoaderFile/index.module.css
View file @
ca9eacba
...
...
@@ -45,10 +45,10 @@
box-sizing
:
border-box
;
position
:
relative
;
}
.tableBox
{
/*
.tableBox {
height: 300px;
overflow: scroll;
}
}
*/
.fileIconBox
{
display
:
flex
;
justify-content
:
flex-start
;
...
...
src/views/Project/ProjectData/UpLoaderFile/index.tsx
View file @
ca9eacba
...
...
@@ -11,7 +11,7 @@ import fileIcon from "@/assets/project/fileIcon.svg";
import
noFile
from
"@/assets/project/noFile.svg"
;
import
uploaderIcon
from
"@/assets/project/uploaderIcon.svg"
;
import
classnames
from
"classnames"
;
import
{
getMbf
romB
}
from
"@/utils/util"
;
import
{
storageUnitF
romB
}
from
"@/utils/util"
;
import
{
observer
}
from
"mobx-react"
;
import
{
useStores
}
from
"@/store"
;
import
{
toJS
}
from
"mobx"
;
...
...
@@ -98,9 +98,7 @@ const UpLoaderFile = observer((props: any) => {
};
// 1,048,576
const
renderSize
=
(
item
:
any
)
=>
{
return
(
<
span
>
{
item
.
size
?
`${getMbfromB(Number(item.size))}MB`
:
"-"
}
</
span
>
);
return
<
span
>
{
item
.
size
?
storageUnitFromB
(
Number
(
item
.
size
))
:
"-"
}
</
span
>;
};
const
handleRowDelete
=
(
index
:
number
)
=>
{
...
...
@@ -183,12 +181,14 @@ const UpLoaderFile = observer((props: any) => {
fontSize
:
"12px"
,
lineHeight
:
"20px"
,
color
:
"#8A9099"
,
// padding: "12px 24px",
}
}
tableBoySx=
{
{
backgroundColor
:
fileList
.
length
>=
10
?
"rgba(255, 0, 0, 0.6)"
:
""
,
}
}
tableContainerStyle=
{
{
maxHeight
:
"300px"
,
}
}
></
Table
>
</
div
>
{
fileList
.
length
===
0
&&
(
...
...
src/views/Project/ProjectData/index.tsx
View file @
ca9eacba
...
...
@@ -30,6 +30,7 @@ import DialogContentText from "@mui/material/DialogContentText";
import
DialogTitle
from
"@mui/material/DialogTitle"
;
import
NoProject
from
"@/components/NoProject"
;
import
usePass
from
"@/hooks/usePass"
;
import
{
storageUnitFromB
}
from
"@/utils/util"
;
import
{
getDataFind
,
getDataFileSearch
,
...
...
@@ -66,9 +67,7 @@ const ProjectData = observer(() => {
const
{
currentProjectStore
}
=
useStores
();
// const [fileToken, setFileToken] = useState("");
const
fileToken
=
toJS
(
currentProjectStore
.
currentProjectInfo
.
filetoken
);
console
.
log
(
fileToken
);
const
projectId
=
toJS
(
currentProjectStore
.
currentProjectInfo
.
id
);
console
.
log
(
projectId
);
// const projectId = useMemo(() => {
// console.log(
// toJS(currentProjectStore.currentProjectInfo.id),
...
...
@@ -359,9 +358,7 @@ const ProjectData = observer(() => {
if
(
item
.
type
===
"dataSet"
)
{
return
`
${
item
.
size
}
条`
;
}
return
`
${
item
.
size
?
String
((
Number
(
item
.
size
)
/
1048576
).
toFixed
(
2
))
+
"MB"
:
"-"
}
`
;
return
`
${
item
.
size
?
storageUnitFromB
(
Number
(
item
.
size
))
:
"-"
}
`
;
};
// table配置
...
...
src/views/Project/project.ts
View file @
ca9eacba
...
...
@@ -22,10 +22,5 @@ export const setFileServerEndPointLocalStorage = async (zoneId: string) => {
// 根据项目id获取文件token
export
const
getFiletokenAccordingToId
=
async
(
projectId
:
string
)
=>
{
const
res
=
await
getDataFileToken
({
id
:
projectId
});
console
.
log
(
res
,
"getFiletokenAccordingToId"
);
return
res
.
data
;
// if (res) {
// } else {
// return false;
// }
};
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