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
e44927b1
Commit
e44927b1
authored
Jul 27, 2022
by
chenshouchao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ui: 数据管理中的项目数据表格页样式优化
parent
8fb30dd9
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
73 deletions
+69
-73
MyButton.tsx
src/components/mui/MyButton.tsx
+26
-7
MyInput.tsx
src/components/mui/MyInput.tsx
+9
-4
index.tsx
src/views/Project/ProjectData/index.tsx
+34
-62
No files found.
src/components/mui/MyButton.tsx
View file @
e44927b1
...
@@ -12,9 +12,10 @@ import {
...
@@ -12,9 +12,10 @@ import {
}
from
"@mui/material"
;
}
from
"@mui/material"
;
import
ArrowDropDownIcon
from
"@mui/icons-material/ArrowDropDown"
;
import
ArrowDropDownIcon
from
"@mui/icons-material/ArrowDropDown"
;
interface
ButtonTagProps
extends
Omit
<
ExtendButtonBase
<
ButtonTypeMap
<
{},
"button"
>>
,
'text'
>
{
interface
ButtonTagProps
startIcon
?:
React
.
ReactNode
;
/** 开始Icon */
extends
Omit
<
ExtendButtonBase
<
ButtonTypeMap
<
{},
"button"
>>
,
"text"
>
{
endIcon
?:
React
.
ReactNode
;
/** 结束Icon */
startIcon
?:
React
.
ReactNode
/** 开始Icon */
;
endIcon
?:
React
.
ReactNode
/** 结束Icon */
;
text
:
string
;
//文本内容
text
:
string
;
//文本内容
variant
?:
"text"
|
"contained"
|
"outlined"
;
//按钮样式
variant
?:
"text"
|
"contained"
|
"outlined"
;
//按钮样式
onClick
?:
any
;
//点击事件
onClick
?:
any
;
//点击事件
...
@@ -22,13 +23,20 @@ interface ButtonTagProps extends Omit<ExtendButtonBase<ButtonTypeMap<{}, "butto
...
@@ -22,13 +23,20 @@ interface ButtonTagProps extends Omit<ExtendButtonBase<ButtonTypeMap<{}, "butto
fontSize
?:
string
;
//按钮文字大小
fontSize
?:
string
;
//按钮文字大小
dropValue
?:
boolean
;
//选择的值
dropValue
?:
boolean
;
//选择的值
drop
?:
boolean
;
//是否开启选择
drop
?:
boolean
;
//是否开启选择
color
?:
"inherit"
|
"primary"
|
"secondary"
|
'success'
|
'error'
|
'info'
|
'warning'
;
//按钮颜色风格
color
?:
|
"inherit"
|
"primary"
|
"secondary"
|
"success"
|
"error"
|
"info"
|
"warning"
;
//按钮颜色风格
size
?:
"large"
|
"medium"
|
"small"
;
//按钮尺寸
size
?:
"large"
|
"medium"
|
"small"
;
//按钮尺寸
disabled
?:
boolean
;
//是否禁用
disabled
?:
boolean
;
//是否禁用
style
?:
any
;
//按钮自定义样式
style
?:
any
;
//按钮自定义样式
img
?:
JSX
.
Element
;
//图标按钮中的图标
img
?:
JSX
.
Element
;
//图标按钮中的图标
selectCallBack
?:
(
item
:
any
,
key
:
number
)
=>
void
;
//选择按钮的回调
selectCallBack
?:
(
item
:
any
,
key
:
number
)
=>
void
;
//选择按钮的回调
}
;
}
const
theme
=
createTheme
({
const
theme
=
createTheme
({
components
:
{
components
:
{
...
@@ -36,6 +44,9 @@ const theme = createTheme({
...
@@ -36,6 +44,9 @@ const theme = createTheme({
styleOverrides
:
{
styleOverrides
:
{
root
:
{
root
:
{
minWidth
:
"48px"
,
minWidth
:
"48px"
,
"&.MuiButton-textError"
:
{
color
:
"rgba(255, 78, 78, 1)"
,
},
},
},
contained
:
{
contained
:
{
backgroundColor
:
"#1370FF"
,
backgroundColor
:
"#1370FF"
,
...
@@ -78,7 +89,6 @@ const theme = createTheme({
...
@@ -78,7 +89,6 @@ const theme = createTheme({
color
:
"#FF4E4E"
,
color
:
"#FF4E4E"
,
"&:hover"
:
{
backgroundColor
:
"#FFEDED "
},
"&:hover"
:
{
backgroundColor
:
"#FFEDED "
},
},
},
sizeSmall
:
{
sizeSmall
:
{
"& p"
:
{
fontSize
:
"12px"
},
"& p"
:
{
fontSize
:
"12px"
},
height
:
"28px"
,
height
:
"28px"
,
...
@@ -113,7 +123,16 @@ const theme = createTheme({
...
@@ -113,7 +123,16 @@ const theme = createTheme({
});
});
const
ButtonComponent
=
(
props
:
ButtonTagProps
)
=>
{
const
ButtonComponent
=
(
props
:
ButtonTagProps
)
=>
{
const
{
size
,
disabled
,
variant
,
color
,
img
,
select
,
selectCallBack
,
...
other
}
=
props
;
const
{
size
,
disabled
,
variant
,
color
,
img
,
select
,
selectCallBack
,
...
other
}
=
props
;
const
{
classes
,
cx
}
=
useStyles
({});
const
{
classes
,
cx
}
=
useStyles
({});
const
[
anchorEl
,
setAnchorEl
]
=
React
.
useState
(
null
);
const
[
anchorEl
,
setAnchorEl
]
=
React
.
useState
(
null
);
...
...
src/components/mui/MyInput.tsx
View file @
e44927b1
...
@@ -34,9 +34,13 @@ const MyInput = (props: MyInputProps) => {
...
@@ -34,9 +34,13 @@ const MyInput = (props: MyInputProps) => {
styleOverrides
:
{
styleOverrides
:
{
root
:
{
root
:
{
height
:
"36px"
,
height
:
"36px"
,
// width: "40px",
fontSize
:
"14px"
,
// boxSizing: "border-box",
"&.MuiInputBase-sizeSmall"
:
{
// padding: "0",
height
:
"32px"
,
"& .MuiOutlinedInput-notchedOutline"
:
{
height
:
"34px"
,
},
},
},
},
},
},
},
},
...
@@ -53,6 +57,7 @@ const MyInput = (props: MyInputProps) => {
...
@@ -53,6 +57,7 @@ const MyInput = (props: MyInputProps) => {
root
:
{
root
:
{
height
:
"36px"
,
height
:
"36px"
,
lineHeight
:
"36px"
,
lineHeight
:
"36px"
,
paddingRight
:
"12px"
,
":hover"
:
{
":hover"
:
{
"& .MuiOutlinedInput-notchedOutline"
:
error
"& .MuiOutlinedInput-notchedOutline"
:
error
?
{}
?
{}
...
@@ -62,7 +67,7 @@ const MyInput = (props: MyInputProps) => {
...
@@ -62,7 +67,7 @@ const MyInput = (props: MyInputProps) => {
},
},
},
},
input
:
{
input
:
{
padding
:
"6.5px 1
4
px"
,
padding
:
"6.5px 1
2
px"
,
verticalAlign
:
"middle"
,
verticalAlign
:
"middle"
,
},
},
notchedOutline
:
{
notchedOutline
:
{
...
...
src/views/Project/ProjectData/index.tsx
View file @
e44927b1
import
React
,
{
useState
,
useCallback
,
useEffect
,
useMemo
}
from
"react"
;
import
React
,
{
useState
,
useCallback
,
useEffect
,
useMemo
}
from
"react"
;
import
style
from
"./index.module.css"
;
import
style
from
"./index.module.css"
;
import
classnames
from
"classnames"
;
import
classnames
from
"classnames"
;
import
{
InputBase
,
IconButton
}
from
"@mui/material"
;
import
{
IconButton
}
from
"@mui/material"
;
import
{
createTheme
,
ThemeProvider
}
from
"@mui/material/styles"
;
import
SearchIcon
from
"@mui/icons-material/Search"
;
import
SearchIcon
from
"@mui/icons-material/Search"
;
import
RefreshIcon
from
"@mui/icons-material/Refresh"
;
import
RefreshIcon
from
"@mui/icons-material/Refresh"
;
import
MyTable
from
"@/components/mui/MyTable"
;
import
MyTable
from
"@/components/mui/MyTable"
;
...
@@ -27,32 +26,9 @@ import { useLocation } from "react-router-dom";
...
@@ -27,32 +26,9 @@ import { useLocation } from "react-router-dom";
import
RadioGroupOfButtonStyle
from
"@/components/CommonComponents/RadioGroupOfButtonStyle"
;
import
RadioGroupOfButtonStyle
from
"@/components/CommonComponents/RadioGroupOfButtonStyle"
;
import
SeeDataset
from
"./SeeDataset"
;
import
SeeDataset
from
"./SeeDataset"
;
import
{
getDataFind
,
getDataFileSearch
}
from
"@/api/project_api"
;
import
{
getDataFind
,
getDataFileSearch
}
from
"@/api/project_api"
;
import
MyInput
from
"@/components/mui/MyInput"
;
import
MyButton
from
"@/components/mui/MyButton"
;
import
MyButton
from
"@/components/mui/MyButton"
;
const
theme
=
createTheme
({
palette
:
{
neutral
:
{
main
:
"#1370FF"
,
contrastText
:
"#fff"
,
},
},
});
declare
module
"@mui/material/styles"
{
interface
Palette
{
neutral
:
Palette
[
"primary"
];
}
interface
PaletteOptions
{
neutral
?:
PaletteOptions
[
"primary"
];
}
}
declare
module
"@mui/material/Button"
{
interface
ButtonPropsColorOverrides
{
neutral
:
true
;
}
}
const
ProjectData
=
observer
(()
=>
{
const
ProjectData
=
observer
(()
=>
{
const
isPass
=
usePass
();
const
isPass
=
usePass
();
const
{
currentProjectStore
}
=
useStores
();
const
{
currentProjectStore
}
=
useStores
();
...
@@ -391,10 +367,10 @@ const ProjectData = observer(() => {
...
@@ -391,10 +367,10 @@ const ProjectData = observer(() => {
<
span
style=
{
{
whiteSpace
:
"nowrap"
}
}
>
<
span
style=
{
{
whiteSpace
:
"nowrap"
}
}
>
{
!
isAllDirectory
&&
(
{
!
isAllDirectory
&&
(
<
MyButton
<
MyButton
text=
'下载'
text=
"下载"
style=
{
{
style=
{
{
position
:
"relative"
,
position
:
"relative"
,
left
:
"-
4
px"
,
left
:
"-
16
px"
,
minWidth
:
"10px"
,
minWidth
:
"10px"
,
marginRight
:
"10px"
,
marginRight
:
"10px"
,
visibility
:
visibility
:
...
@@ -403,22 +379,21 @@ const ProjectData = observer(() => {
...
@@ -403,22 +379,21 @@ const ProjectData = observer(() => {
:
"hidden"
,
:
"hidden"
,
}
}
}
}
variant=
"text"
variant=
"text"
size=
"
small
"
size=
"
medium
"
disabled=
{
selectIds
.
length
>
0
||
!
isPass
(
"PROJECT_DATA_DOWNLOAD"
)
}
disabled=
{
selectIds
.
length
>
0
||
!
isPass
(
"PROJECT_DATA_DOWNLOAD"
)
}
onClick=
{
()
=>
hanleDownloadFile
(
item
)
}
onClick=
{
()
=>
hanleDownloadFile
(
item
)
}
/>
/>
)
}
)
}
<
MyButton
<
MyButton
text=
'移动至'
text=
"移动至"
style=
{
{
style=
{
{
position
:
"relative"
,
position
:
"relative"
,
left
:
"-
4
px"
,
left
:
"-
16
px"
,
minWidth
:
"10px"
,
minWidth
:
"10px"
,
marginRight
:
"10px"
,
marginRight
:
"10px"
,
}
}
}
}
variant=
"text"
variant=
"text"
size=
"
small
"
size=
"
medium
"
onClick=
{
()
=>
{
onClick=
{
()
=>
{
setCurrentOperateFile
(
item
);
setCurrentOperateFile
(
item
);
setMoveDialogOpen
(
true
);
setMoveDialogOpen
(
true
);
...
@@ -429,15 +404,15 @@ const ProjectData = observer(() => {
...
@@ -429,15 +404,15 @@ const ProjectData = observer(() => {
/>
/>
<
MyButton
<
MyButton
text=
'删除'
text=
"删除"
style=
{
{
style=
{
{
position
:
"relative"
,
position
:
"relative"
,
left
:
"-
4
px"
,
left
:
"-
16
px"
,
minWidth
:
"10px"
,
minWidth
:
"10px"
,
marginRight
:
"10px"
,
marginRight
:
"10px"
,
}
}
}
}
variant=
"text"
variant=
"text"
size=
"
small
"
size=
"
medium
"
color=
"error"
color=
"error"
onClick=
{
()
=>
{
onClick=
{
()
=>
{
setCurrentOperateFile
(
item
);
setCurrentOperateFile
(
item
);
...
@@ -532,7 +507,6 @@ const ProjectData = observer(() => {
...
@@ -532,7 +507,6 @@ const ProjectData = observer(() => {
if
(
currentProjectStore
.
currentProjectInfo
.
name
)
{
if
(
currentProjectStore
.
currentProjectInfo
.
name
)
{
return
(
return
(
<
ThemeProvider
theme=
{
theme
}
>
<
div
className=
{
style
.
projectData
}
>
<
div
className=
{
style
.
projectData
}
>
<
div
className=
{
style
.
projectDataStickyTop
}
>
<
div
className=
{
style
.
projectDataStickyTop
}
>
<
div
className=
{
style
.
projectDataTitle
}
>
项目数据
</
div
>
<
div
className=
{
style
.
projectDataTitle
}
>
项目数据
</
div
>
...
@@ -540,8 +514,7 @@ const ProjectData = observer(() => {
...
@@ -540,8 +514,7 @@ const ProjectData = observer(() => {
<
div
className=
{
style
.
projectDataButtonAndSearch
}
>
<
div
className=
{
style
.
projectDataButtonAndSearch
}
>
<
div
className=
{
style
.
projectDataButtonBox
}
>
<
div
className=
{
style
.
projectDataButtonBox
}
>
<
MyButton
<
MyButton
text=
'上传文件'
text=
"上传文件"
// color="neutral"
variant=
"contained"
variant=
"contained"
size=
"small"
size=
"small"
style=
{
{
marginRight
:
"12px"
}
}
style=
{
{
marginRight
:
"12px"
}
}
...
@@ -561,30 +534,32 @@ const ProjectData = observer(() => {
...
@@ -561,30 +534,32 @@ const ProjectData = observer(() => {
projectId=
{
projectId
as
string
}
projectId=
{
projectId
as
string
}
></
AddFolder
>
></
AddFolder
>
</
div
>
</
div
>
<
div
className=
{
style
.
projectDataSearch
}
>
<
MyInput
<
InputBase
sx=
{
{
className=
{
style
.
searchInput
}
width
:
"340px"
,
placeholder=
"输入关键词搜索"
}
}
inputProps=
{
{
"aria-label"
:
"输入关键词搜索"
}
}
value=
{
keyWord
}
value=
{
keyWord
}
required
size=
"small"
placeholder=
"输入关键词搜索"
onChange=
{
handleKeyWordChange
}
onChange=
{
handleKeyWordChange
}
style=
{
{
width
:
"280px"
,
fontSize
:
"14px"
}
}
onKeyUp=
{
handleKeyWordChangeKeyUp
}
onKeyUp=
{
handleKeyWordChangeKeyUp
}
/>
InputProps=
{
{
<
IconButton
endAdornment
:
(
type=
"submit"
className=
{
style
.
searchButton
}
aria
-
label=
"search"
size=
"small"
style=
{
{
padding
:
"4px"
}
}
onClick=
{
handleRefresh
}
>
<
SearchIcon
<
SearchIcon
className=
{
style
.
searchIcon
}
className=
{
style
.
searchIcon
}
style=
{
{
color
:
"#999"
}
}
style=
{
{
color
:
"#999"
,
cursor
:
"pointer"
,
fontSize
:
"22px"
,
position
:
"relative"
,
left
:
"4px"
,
}
}
onClick=
{
handleRefresh
}
/>
/>
</
IconButton
>
),
</
div
>
}
}
></
MyInput
>
</
div
>
</
div
>
<
div
className=
{
style
.
projectDataPathAndTabs
}
>
<
div
className=
{
style
.
projectDataPathAndTabs
}
>
<
div
className=
{
style
.
projectDataPath
}
>
{
showPath
}
</
div
>
<
div
className=
{
style
.
projectDataPath
}
>
{
showPath
}
</
div
>
...
@@ -604,7 +579,7 @@ const ProjectData = observer(() => {
...
@@ -604,7 +579,7 @@ const ProjectData = observer(() => {
disabled=
{
!
isPass
(
"PROJECT_DATA_REFRESH"
,
"USER"
)
}
disabled=
{
!
isPass
(
"PROJECT_DATA_REFRESH"
,
"USER"
)
}
sx=
{
{
marginLeft
:
"17px"
}
}
sx=
{
{
marginLeft
:
"17px"
}
}
>
>
<
RefreshIcon
/>
<
RefreshIcon
sx=
{
{
fontSize
:
"18px"
}
}
/>
</
IconButton
>
</
IconButton
>
</
div
>
</
div
>
</
div
>
</
div
>
...
@@ -658,12 +633,10 @@ const ProjectData = observer(() => {
...
@@ -658,12 +633,10 @@ const ProjectData = observer(() => {
style=
{
{
marginRight
:
"24px"
}
}
style=
{
{
marginRight
:
"24px"
}
}
onClick=
{
()
=>
{
onClick=
{
()
=>
{
setCurrentOperateFile
(
null
);
setCurrentOperateFile
(
null
);
setDelet
eDialogOpen
(
true
);
setMov
eDialogOpen
(
true
);
}
}
}
}
disabled=
{
!
isPass
(
"PROJECT_DATA_MOVE"
,
"USER"
)
}
disabled=
{
!
isPass
(
"PROJECT_DATA_MOVE"
,
"USER"
)
}
/>
/>
</
div
>
</
div
>
)
}
)
}
{
deleteDialogOpen
&&
(
{
deleteDialogOpen
&&
(
...
@@ -709,7 +682,6 @@ const ProjectData = observer(() => {
...
@@ -709,7 +682,6 @@ const ProjectData = observer(() => {
></
SeeDataset
>
></
SeeDataset
>
)
}
)
}
</
div
>
</
div
>
</
ThemeProvider
>
);
);
}
else
{
}
else
{
return
<
NoProject
/>;
return
<
NoProject
/>;
...
...
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