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
aadd57cf
Commit
aadd57cf
authored
Jun 14, 2022
by
rocosen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
权限增加
parent
6d7a74d6
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
168 additions
and
187 deletions
+168
-187
usePass.ts
src/hooks/usePass.ts
+61
-20
index.tsx
src/index.tsx
+21
-7
currentProject.ts
src/store/modules/currentProject.ts
+1
-0
index.tsx
src/views/Project/ProjectWorkbench/index.tsx
+2
-2
addTemplate.tsx
...ectWorkbench/workbenchTemplate/components/addTemplate.tsx
+2
-52
simpleDialog.tsx
...ctWorkbench/workbenchTemplate/components/simpleDialog.tsx
+0
-17
templateBox.tsx
...ectWorkbench/workbenchTemplate/components/templateBox.tsx
+24
-49
index.module.css
...oject/ProjectWorkbench/workbenchTemplate/index.module.css
+26
-0
index.tsx
...iews/Project/ProjectWorkbench/workbenchTemplate/index.tsx
+31
-40
No files found.
src/hooks/usePass.ts
View file @
aadd57cf
...
@@ -2,33 +2,74 @@ import { operation, route } from "@/router";
...
@@ -2,33 +2,74 @@ import { operation, route } from "@/router";
import
{
useStores
}
from
"@/store"
;
import
{
useStores
}
from
"@/store"
;
import
{
useCallback
}
from
"react"
;
import
{
useCallback
}
from
"react"
;
const
roleList
:
any
[]
=
[
{
VIEWER
:
1
},
{
USER
:
2
},
{
MANAGER
:
3
},
{
OWNER
:
4
}
]
const
usePass
=
()
=>
{
const
usePass
=
()
=>
{
const
{
permissionStore
}
=
useStores
();
const
{
permissionStore
}
=
useStores
();
const
{
currentProjectStore
}
=
useStores
();
const
isPass
=
useCallback
(
const
isPass
=
useCallback
(
(
key
:
string
,
routes
?:
Array
<
route
|
operation
>
):
boolean
=>
{
(
key
:
string
,
role
?:
"VIEWER"
|
"USER"
|
"MANAGER"
|
"OWNER"
,
routes
?:
Array
<
route
|
operation
>
):
boolean
=>
{
if
(
routes
)
{
let
code
=
currentProjectStore
&&
currentProjectStore
.
currentProjectInfo
.
projectRole
for
(
let
item
of
routes
)
{
if
(
role
)
{
if
(
item
.
id
===
key
)
{
if
(
code
&&
roleList
.
filter
(
e
=>
e
[
role
])[
0
][
role
]
<=
roleList
.
filter
(
e
=>
e
[
code
as
string
])[
0
][
code
])
{
return
true
;
if
(
routes
)
{
}
else
if
(
for
(
let
item
of
routes
)
{
item
.
type
===
"page"
&&
if
(
item
.
id
===
key
)
{
item
.
children
?.
length
&&
return
true
;
isPass
(
key
,
item
.
children
)
}
else
if
(
)
{
item
.
type
===
"page"
&&
return
true
;
item
.
children
?.
length
&&
isPass
(
key
,
role
,
item
.
children
)
)
{
return
true
;
}
}
}
else
{
for
(
let
item
of
permissionStore
.
allRoutes
)
{
if
(
item
.
type
!==
"navigate"
&&
item
.
id
===
key
)
{
return
true
;
}
else
if
(
item
.
type
===
"page"
&&
item
.
children
?.
length
&&
isPass
(
key
,
role
,
item
.
children
)
)
{
return
true
;
}
}
}
}
}
else
{
return
false
}
}
}
else
{
}
else
{
for
(
let
item
of
permissionStore
.
allRoutes
)
{
if
(
routes
)
{
if
(
item
.
type
!==
"navigate"
&&
item
.
id
===
key
)
{
for
(
let
item
of
routes
)
{
return
true
;
if
(
item
.
id
===
key
)
{
}
else
if
(
return
true
;
item
.
type
===
"page"
&&
}
else
if
(
item
.
children
?.
length
&&
item
.
type
===
"page"
&&
isPass
(
key
,
item
.
children
)
item
.
children
?.
length
&&
)
{
isPass
(
key
,
role
,
item
.
children
)
return
true
;
)
{
return
true
;
}
}
}
else
{
for
(
let
item
of
permissionStore
.
allRoutes
)
{
if
(
item
.
type
!==
"navigate"
&&
item
.
id
===
key
)
{
return
true
;
}
else
if
(
item
.
type
===
"page"
&&
item
.
children
?.
length
&&
isPass
(
key
,
role
,
item
.
children
)
)
{
return
true
;
}
}
}
}
}
}
}
...
...
src/index.tsx
View file @
aadd57cf
...
@@ -8,19 +8,33 @@ import { stores } from "@/store/index";
...
@@ -8,19 +8,33 @@ import { stores } from "@/store/index";
import
{
MySnackbarProvider
}
from
"@/components/MySnackbar"
;
import
{
MySnackbarProvider
}
from
"@/components/MySnackbar"
;
import
"@/mocks/index"
;
import
"@/mocks/index"
;
import
'./assets/style/public.css'
import
'./assets/style/public.css'
import
{
createTheme
,
ThemeProvider
,
styled
}
from
'@mui/material/styles'
;
const
root
=
ReactDOM
.
createRoot
(
const
root
=
ReactDOM
.
createRoot
(
document
.
getElementById
(
"root"
)
as
HTMLElement
document
.
getElementById
(
"root"
)
as
HTMLElement
);
);
const
theme
=
createTheme
({
typography
:
{
fontFamily
:
[
'Roboto'
,
'Helvetica'
,
'Tahoma'
,
'Arial'
,
'"PingFang SC"'
,
'"Hiragino Sans GB"'
,
'"Heiti SC"'
,
'"WenQuanYi Micro Hei"'
,
'sans-serif'
,
'"Apple Color Emoji"'
,
'"Segoe UI Emoji"'
,
'"Segoe UI Symbol"'
].
join
(
','
),
},
palette
:
{
primary
:
{
main
:
'#136EFA'
},
secondary
:
{
main
:
'#4EB9FB'
}
}
});
root
.
render
(
root
.
render
(
<
React
.
StrictMode
>
<
React
.
StrictMode
>
<
Provider
{
...
stores
}
>
<
ThemeProvider
theme=
{
theme
}
>
<
MySnackbarProvider
<
Provider
{
...
stores
}
>
alertSx=
{
{
boxShadow
:
"0px 2px 4px 0px rgb(0 0 0 / 8%)"
}
}
<
MySnackbarProvider
>
alertSx=
{
{
boxShadow
:
"0px 2px 4px 0px rgb(0 0 0 / 8%)"
}
}
<
MyRouter
></
MyRouter
>
>
</
MySnackbarProvider
>
<
MyRouter
></
MyRouter
>
</
Provider
>
</
MySnackbarProvider
>
</
Provider
>
</
ThemeProvider
>
</
React
.
StrictMode
>
</
React
.
StrictMode
>
);
);
...
...
src/store/modules/currentProject.ts
View file @
aadd57cf
...
@@ -3,6 +3,7 @@ type projectInfo = {
...
@@ -3,6 +3,7 @@ type projectInfo = {
id
?:
string
;
id
?:
string
;
name
?:
string
;
name
?:
string
;
desc
?:
string
;
desc
?:
string
;
projectRole
?:
string
;
};
};
type
productInfo
=
{
type
productInfo
=
{
...
...
src/views/Project/ProjectWorkbench/index.tsx
View file @
aadd57cf
...
@@ -23,9 +23,9 @@ const ProjectWorkbench = observer(() => {
...
@@ -23,9 +23,9 @@ const ProjectWorkbench = observer(() => {
const
isPass
=
usePass
();
const
isPass
=
usePass
();
const
[
value
,
setValue
]
=
useState
(
"workbenchTemplate"
);
const
[
value
,
setValue
]
=
useState
(
"workbenchTemplate"
);
useEffect
(()
=>
{
useEffect
(()
=>
{
console
.
log
(
isPass
(
"PROJECT_WORKBENCH_FLOES
"
),
"11111111111"
);
console
.
log
(
isPass
(
"PROJECT_WORKBENCH_FLOES
_USE"
,
'USER'
),
"11111111111"
);
},
[])
},
[])
const
tabList
=
useMemo
(()
=>
{
const
tabList
=
useMemo
(()
=>
{
...
...
src/views/Project/ProjectWorkbench/workbenchTemplate/components/addTemplate.tsx
View file @
aadd57cf
import
{
memo
,
useCallback
,
useEffect
,
useMemo
,
useState
}
from
"react"
;
import
{
memo
,
useCallback
,
useEffect
,
useMemo
,
useState
}
from
"react"
;
import
styles
from
"../index.module.css"
;
import
styles
from
"../index.module.css"
;
import
{
Box
,
Typography
}
from
"@mui/material"
;
import
{
Box
,
Typography
}
from
"@mui/material"
;
import
Button
from
"@mui/material/Button"
;
import
Button
from
"@mui/material/Button"
;
...
@@ -9,39 +7,22 @@ import Dialog from "@/components/mui/Dialog";
...
@@ -9,39 +7,22 @@ import Dialog from "@/components/mui/Dialog";
import
OutlinedInput
from
"@mui/material/OutlinedInput"
;
import
OutlinedInput
from
"@mui/material/OutlinedInput"
;
import
SearchIcon
from
"@mui/icons-material/Search"
;
import
SearchIcon
from
"@mui/icons-material/Search"
;
import
Checkbox
from
'@mui/material/Checkbox'
;
import
Checkbox
from
'@mui/material/Checkbox'
;
import
CloseOutlinedIcon
from
'@mui/icons-material/CloseOutlined'
;
import
CloseOutlinedIcon
from
'@mui/icons-material/CloseOutlined'
;
import
_
from
"lodash"
;
import
_
from
"lodash"
;
const
AddTemplate
=
(
props
:
any
)
=>
{
const
AddTemplate
=
(
props
:
any
)
=>
{
const
{
openAddTemplate
,
closeAddTemplateBlock
,
addTemplateList
,
templateSelectCallback
,
selectTemplateData
,
addTemplateCallback
,
searchTemplateNameCallback
}
=
props
;
const
{
openAddTemplate
,
closeAddTemplateBlock
,
addTemplateList
,
templateSelectCallback
,
selectTemplateData
,
addTemplateCallback
,
searchTemplateNameCallback
}
=
props
;
useEffect
(()
=>
{
},
[]);
// if (!openAddTemplate) return ""
return
(
return
(
<
Box
className=
{
styles
.
addTemplateMask
}
sx=
{
{
display
:
openAddTemplate
?
'flex'
:
'none'
}
}
>
<
Box
className=
{
styles
.
addTemplateMask
}
sx=
{
{
display
:
openAddTemplate
?
'flex'
:
'none'
}
}
>
<
Box
sx=
{
{
height
:
'50px'
,
display
:
'flex'
,
alignItems
:
'center'
}
}
>
<
Box
sx=
{
{
height
:
'50px'
,
display
:
'flex'
,
alignItems
:
'center'
}
}
>
<
CloseOutlinedIcon
sx=
{
{
color
:
"#ffffff"
,
marginRight
:
"10px"
,
cursor
:
"pointer"
}
}
onClick=
{
()
=>
{
<
CloseOutlinedIcon
sx=
{
{
color
:
"#ffffff"
,
marginRight
:
"10px"
,
cursor
:
"pointer"
}
}
onClick=
{
()
=>
{
closeAddTemplateBlock
()
closeAddTemplateBlock
()
}
}
/>
}
}
/>
</
Box
>
</
Box
>
<
Box
className=
{
styles
.
addTemplateBlock
}
>
<
Box
className=
{
styles
.
addTemplateBlock
}
>
<
Box
sx=
{
{
padding
:
"24px 32px"
}
}
>
<
Box
sx=
{
{
padding
:
"24px 32px"
}
}
>
<
Typography
sx=
{
{
fontSize
:
'18px'
,
fontWeight
:
'600'
,
color
:
"#1E2633"
}
}
>
添加工作流模版
</
Typography
>
<
Typography
sx=
{
{
fontSize
:
'18px'
,
fontWeight
:
'600'
,
color
:
"#1E2633"
}
}
>
添加工作流模版
</
Typography
>
<
Box
sx=
{
{
display
:
'flex'
,
justifyContent
:
'space-between'
,
alignItems
:
'center'
,
marginBottom
:
"20px"
}
}
>
<
Box
sx=
{
{
display
:
'flex'
,
justifyContent
:
'space-between'
,
alignItems
:
'center'
,
marginBottom
:
"20px"
}
}
>
<
OutlinedInput
<
OutlinedInput
onChange=
{
(
e
:
any
)
=>
{
onChange=
{
(
e
:
any
)
=>
{
...
@@ -73,53 +54,22 @@ const AddTemplate = (props: any) => {
...
@@ -73,53 +54,22 @@ const AddTemplate = (props: any) => {
}
}
}
}
sx=
{
{
border
:
selectTemplateData
.
includes
(
item
.
id
)
?
'1px solid #1370FF'
:
"1px solid #EBEDF0;"
}
}
sx=
{
{
border
:
selectTemplateData
.
includes
(
item
.
id
)
?
'1px solid #1370FF'
:
"1px solid #EBEDF0;"
}
}
>
>
<
Box
sx=
{
{
display
:
'flex'
,
justifyContent
:
'space-between'
,
alignItems
:
'center'
,
}
}
>
<
Box
sx=
{
{
display
:
'flex'
,
justifyContent
:
'space-between'
,
alignItems
:
'center'
,
}
}
>
<
Typography
sx=
{
{
fontSize
:
'14px'
,
fontWeight
:
'600'
,
color
:
'#1E2633'
,
marginBottom
:
"4px"
,
overflow
:
'hidden'
,
textOverflow
:
'ellipsis'
}
}
>
{
item
.
title
}
</
Typography
>
<
Typography
sx=
{
{
fontSize
:
'14px'
,
fontWeight
:
'600'
,
color
:
'#1E2633'
,
marginBottom
:
"4px"
}
}
>
{
item
.
title
}
</
Typography
>
<
Checkbox
size=
"small"
sx=
{
{
padding
:
"0px"
}
}
checked=
{
selectTemplateData
.
includes
(
item
.
id
)
}
/>
<
Checkbox
size=
"small"
sx=
{
{
padding
:
"0px"
}
}
checked=
{
selectTemplateData
.
includes
(
item
.
id
)
}
/>
</
Box
>
</
Box
>
<
Box
sx=
{
{
display
:
'flex'
,
marginBottom
:
"8px"
}
}
>
<
Box
sx=
{
{
display
:
'flex'
,
marginBottom
:
"8px"
}
}
>
<
Typography
sx=
{
{
fontSize
:
'12px'
,
fontWeight
:
'400'
,
color
:
'#1370FF'
,
marginRight
:
"24px"
}
}
>
版本:
{
item
.
version
}
</
Typography
>
<
Typography
sx=
{
{
fontSize
:
'12px'
,
fontWeight
:
'400'
,
color
:
'#1370FF'
,
marginRight
:
"24px"
}
}
>
版本:
{
item
.
version
}
</
Typography
>
<
Typography
sx=
{
{
fontSize
:
'12px'
,
fontWeight
:
'400'
,
color
:
'#1370FF'
}
}
>
更新时间:
{
item
.
updateTime
}
</
Typography
>
<
Typography
sx=
{
{
fontSize
:
'12px'
,
fontWeight
:
'400'
,
color
:
'#1370FF'
}
}
>
更新时间:
{
item
.
updateTime
}
</
Typography
>
</
Box
>
</
Box
>
<
Typography
className=
{
styles
.
templateDescText
}
>
{
item
.
description
}
</
Typography
>
<
Typography
sx=
{
{
fontSize
:
'12px'
,
fontWeight
:
'400'
,
color
:
'#8A9099'
}
}
>
{
item
.
description
}
</
Typography
>
</
Box
>
</
Box
>
)
)
})
})
}
}
</
Box
>
</
Box
>
</
Box
>
</
Box
>
{
/* */
}
</
Box
>
</
Box
>
</
Box
>
</
Box
>
);
);
};
};
...
...
src/views/Project/ProjectWorkbench/workbenchTemplate/components/simpleDialog.tsx
View file @
aadd57cf
import
{
memo
,
useCallback
,
useEffect
,
useMemo
,
useState
}
from
"react"
;
import
{
memo
,
useCallback
,
useEffect
,
useMemo
,
useState
}
from
"react"
;
import
styles
from
"../index.module.css"
;
import
styles
from
"../index.module.css"
;
import
{
Box
,
Typography
}
from
"@mui/material"
;
import
{
Box
,
Typography
}
from
"@mui/material"
;
import
Button
from
"@mui/material/Button"
;
import
Button
from
"@mui/material/Button"
;
import
Dialog
from
"@/components/mui/Dialog"
;
import
Dialog
from
"@/components/mui/Dialog"
;
const
SimpleDialog
=
(
props
:
any
)
=>
{
const
SimpleDialog
=
(
props
:
any
)
=>
{
const
{
openDialog
,
closeDialog
,
onConfirm
,
text
,
title
}
=
props
;
const
{
openDialog
,
closeDialog
,
onConfirm
,
text
,
title
}
=
props
;
useEffect
(()
=>
{
},
[]);
return
(
return
(
<
>
<
>
<
Dialog
<
Dialog
open=
{
openDialog
}
open=
{
openDialog
}
onClose=
{
closeDialog
}
onClose=
{
closeDialog
}
...
@@ -33,10 +20,6 @@ const SimpleDialog = (props: any) => {
...
@@ -33,10 +20,6 @@ const SimpleDialog = (props: any) => {
<
Typography
sx=
{
{
fontSize
:
'14px'
,
fontWeight
:
'400'
}
}
>
{
text
}
</
Typography
>
<
Typography
sx=
{
{
fontSize
:
'14px'
,
fontWeight
:
'400'
}
}
>
{
text
}
</
Typography
>
</
Box
>
</
Box
>
</
Dialog
>
</
Dialog
>
</>
</>
);
);
};
};
...
...
src/views/Project/ProjectWorkbench/workbenchTemplate/components/templateBox.tsx
View file @
aadd57cf
import
{
memo
,
useCallback
,
useEffect
,
useMemo
,
useState
}
from
"react"
;
import
{
memo
,
useCallback
,
useEffect
,
useMemo
,
useState
}
from
"react"
;
import
styles
from
"../index.module.css"
;
import
styles
from
"../index.module.css"
;
import
{
Box
,
Typography
}
from
"@mui/material"
;
import
{
Box
,
Typography
}
from
"@mui/material"
;
import
Button
from
"@mui/material/Button"
;
import
Button
from
"@mui/material/Button"
;
import
usePass
from
"@/hooks/usePass"
;
const
TemplateBox
=
(
props
:
any
)
=>
{
const
TemplateBox
=
(
props
:
any
)
=>
{
// const deleteTemplate props
const
info
=
props
.
data
const
info
=
props
.
data
const
isPass
=
usePass
();
useEffect
(()
=>
{
},
[]);
return
(
return
(
<
Box
className=
{
styles
.
templateBlock
}
>
<
Box
className=
{
styles
.
templateBlock
}
>
<
Box
>
<
Box
>
<
Typography
sx=
{
{
fontSize
:
'14px'
,
fontWeight
:
'600'
,
color
:
'#1E2633'
,
marginBottom
:
"4px"
}
}
>
{
info
.
title
}
</
Typography
>
<
Typography
sx=
{
{
fontSize
:
'14px'
,
fontWeight
:
'600'
,
color
:
'#1E2633'
,
marginBottom
:
"4px"
,
overflow
:
'hidden'
,
textOverflow
:
'ellipsis'
}
}
>
{
info
.
title
}
</
Typography
>
<
Box
sx=
{
{
display
:
'flex'
,
marginBottom
:
"8px"
}
}
>
<
Box
sx=
{
{
display
:
'flex'
,
marginBottom
:
"8px"
}
}
>
<
Typography
sx=
{
{
fontSize
:
'12px'
,
fontWeight
:
'400'
,
color
:
'#1370FF'
,
marginRight
:
"24px"
}
}
>
版本:
{
info
.
version
}
</
Typography
>
<
Typography
sx=
{
{
fontSize
:
'12px'
,
fontWeight
:
'400'
,
color
:
'#1370FF'
,
marginRight
:
"24px"
}
}
>
版本:
{
info
.
version
}
</
Typography
>
<
Typography
sx=
{
{
fontSize
:
'12px'
,
fontWeight
:
'400'
,
color
:
'#1370FF'
}
}
>
更新时间:
{
info
.
updateTime
}
</
Typography
>
<
Typography
sx=
{
{
fontSize
:
'12px'
,
fontWeight
:
'400'
,
color
:
'#1370FF'
}
}
>
更新时间:
{
info
.
updateTime
}
</
Typography
>
</
Box
>
</
Box
>
<
Typography
className=
{
styles
.
templateDescText
}
>
{
info
.
description
}
</
Typography
>
<
Typography
sx=
{
{
fontSize
:
'12px'
,
fontWeight
:
'400'
,
color
:
'#8A9099'
}
}
>
{
info
.
description
}
</
Typography
>
</
Box
>
</
Box
>
<
Box
sx=
{
{
<
Box
sx=
{
{
display
:
'flex'
,
justifyContent
:
'end'
display
:
'flex'
,
justifyContent
:
'end'
}
}
>
}
}
>
<
Button
{
style=
{
{
backgroundColor
:
"#F0F2F5"
,
color
:
"#565C66"
}
}
isPass
(
"PROJECT_WORKBENCH_FLOES_USE"
,
'MANAGER'
)
&&
<
Button
variant=
"contained"
style=
{
{
backgroundColor
:
"#F0F2F5"
,
color
:
"#565C66"
}
}
onClick=
{
()
=>
{
props
.
startDialog
(
info
.
id
)
}
}
variant=
"contained"
size=
"small"
onClick=
{
()
=>
{
props
.
startDialog
(
info
.
id
)
}
}
>
size=
"small"
删除模版
>
</
Button
>
删除模版
</
Button
>
<
Button
}
style=
{
{
backgroundColor
:
"#1370FF"
,
marginLeft
:
"12px"
}
}
{
variant=
"contained"
isPass
(
"PROJECT_WORKBENCH_FLOES_USE"
,
'USER'
)
&&
<
Button
// onClick={addTemplateBlock}
style=
{
{
backgroundColor
:
"#1370FF"
,
marginLeft
:
"12px"
}
}
size=
"small"
variant=
"contained"
>
// onClick=
{
addTemplateBlock
}
使用模版
size=
"small"
</
Button
>
>
使用模版
</
Button
>
}
</
Box
>
</
Box
>
</
Box
>
</
Box
>
);
);
};
};
...
...
src/views/Project/ProjectWorkbench/workbenchTemplate/index.module.css
View file @
aadd57cf
...
@@ -66,4 +66,29 @@
...
@@ -66,4 +66,29 @@
.addTemplateBox
:hover
{
.addTemplateBox
:hover
{
box-shadow
:
6px
8px
22px
0px
rgba
(
0
,
24
,
57
,
0.08
);
box-shadow
:
6px
8px
22px
0px
rgba
(
0
,
24
,
57
,
0.08
);
}
.templateDescText
{
overflow
:
hidden
;
text-overflow
:
ellipsis
;
-webkit-box-orient
:
vertical
;
-webkit-line-clamp
:
3
;
display
:
-webkit-box
;
height
:
54px
;
font-size
:
12px
!important
;
font-weight
:
400
!important
;
color
:
#8A9099
!important
;
}
.addNewTemplate
{
width
:
380px
;
height
:
194px
;
background
:
#FFFFFF
;
border-radius
:
4px
;
border
:
1px
solid
#EBEDF0
;
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
flex-direction
:
column
;
cursor
:
pointer
;
}
}
\ No newline at end of file
src/views/Project/ProjectWorkbench/workbenchTemplate/index.tsx
View file @
aadd57cf
...
@@ -13,34 +13,26 @@ import OutlinedInput from "@mui/material/OutlinedInput";
...
@@ -13,34 +13,26 @@ import OutlinedInput from "@mui/material/OutlinedInput";
import
SearchIcon
from
"@mui/icons-material/Search"
;
import
SearchIcon
from
"@mui/icons-material/Search"
;
// import Button from "@/components/mui/Button";
// import Button from "@/components/mui/Button";
import
Button
from
"@mui/material/Button"
;
import
Button
from
"@mui/material/Button"
;
import
Add
from
"@mui/icons-material/Add"
;
import
Add
from
"@mui/icons-material/Add"
;
import
useMyRequest
from
"@/hooks/useMyRequest"
;
import
useMyRequest
from
"@/hooks/useMyRequest"
;
import
TemplateBox
from
"./components/templateBox"
import
TemplateBox
from
"./components/templateBox"
import
SimpleDialog
from
"./components/simpleDialog"
import
SimpleDialog
from
"./components/simpleDialog"
import
AddTemplate
from
"./components/addTemplate"
import
AddTemplate
from
"./components/addTemplate"
import
noData
from
'../../../../assets/project/noTemplate.svg'
import
noData
from
'../../../../assets/project/noTemplate.svg'
import
{
import
{
getWorkbenchTemplate
,
getWorkbenchTemplate
,
deleteWorkbenchTemplate
,
deleteWorkbenchTemplate
,
getAddWorkbenchTemplate
,
getAddWorkbenchTemplate
,
addWorkbenchTemplate
addWorkbenchTemplate
}
from
"@/api/workbench_api"
;
}
from
"@/api/workbench_api"
;
import
_
from
"lodash"
;
import
_
from
"lodash"
;
import
{
IResponse
,
useHttp
}
from
"@/api/http"
;
import
{
IResponse
,
useHttp
}
from
"@/api/http"
;
import
{
useStores
}
from
"@/store"
;
import
{
useStores
}
from
"@/store"
;
import
usePass
from
"@/hooks/usePass"
;
const
ProjectMembers
=
()
=>
{
const
ProjectMembers
=
()
=>
{
const
{
currentProjectStore
}
=
useStores
();
const
{
currentProjectStore
}
=
useStores
();
const
isPass
=
usePass
();
/** 搜索模板名称 */
/** 搜索模板名称 */
const
[
templateName
,
setTemplateName
]
=
useState
(
""
);
const
[
templateName
,
setTemplateName
]
=
useState
(
""
);
...
@@ -57,8 +49,6 @@ const ProjectMembers = () => {
...
@@ -57,8 +49,6 @@ const ProjectMembers = () => {
/** 已选择增加的模板列表 */
/** 已选择增加的模板列表 */
const
[
selectTemplateData
,
setSelectTemplateData
]
=
useState
<
string
[]
>
([]);
const
[
selectTemplateData
,
setSelectTemplateData
]
=
useState
<
string
[]
>
([]);
// 获取模板列表
// 获取模板列表
const
{
run
:
getTemplateInfo
}
=
useMyRequest
(
getWorkbenchTemplate
,
{
const
{
run
:
getTemplateInfo
}
=
useMyRequest
(
getWorkbenchTemplate
,
{
onSuccess
:
(
result
:
any
)
=>
{
onSuccess
:
(
result
:
any
)
=>
{
...
@@ -96,18 +86,12 @@ const ProjectMembers = () => {
...
@@ -96,18 +86,12 @@ const ProjectMembers = () => {
},
},
});
});
useEffect
(()
=>
{
useEffect
(()
=>
{
getTemplateInfo
({
getTemplateInfo
({
projectId
:
currentProjectStore
.
currentProjectInfo
.
id
as
string
,
projectId
:
currentProjectStore
.
currentProjectInfo
.
id
as
string
,
});
});
},
[
currentProjectStore
.
currentProjectInfo
.
id
,
getTemplateInfo
]);
},
[
currentProjectStore
.
currentProjectInfo
.
id
,
getTemplateInfo
]);
/** 点击添加工作流模版 */
/** 点击添加工作流模版 */
const
onAddMember
=
()
=>
{
const
onAddMember
=
()
=>
{
// setAddMemberDialog(true);
// setAddMemberDialog(true);
...
@@ -175,7 +159,6 @@ const ProjectMembers = () => {
...
@@ -175,7 +159,6 @@ const ProjectMembers = () => {
}
}
useEffect
(()
=>
{
useEffect
(()
=>
{
getTemplateInfo
({
getTemplateInfo
({
projectId
:
currentProjectStore
.
currentProjectInfo
.
id
as
string
,
projectId
:
currentProjectStore
.
currentProjectInfo
.
id
as
string
,
...
@@ -183,7 +166,6 @@ const ProjectMembers = () => {
...
@@ -183,7 +166,6 @@ const ProjectMembers = () => {
});
});
},
[
templateName
]);
},
[
templateName
]);
return
(
return
(
<
Box
className=
{
styles
.
headerBox
}
>
<
Box
className=
{
styles
.
headerBox
}
>
...
@@ -200,20 +182,22 @@ const ProjectMembers = () => {
...
@@ -200,20 +182,22 @@ const ProjectMembers = () => {
endAdornment=
{
<
SearchIcon
style=
{
{
color
:
"#8A9099"
}
}
/>
}
endAdornment=
{
<
SearchIcon
style=
{
{
color
:
"#8A9099"
}
}
/>
}
/>
/>
<
Button
{
style=
{
{
backgroundColor
:
"#1370FF "
}
}
templateList
.
length
>
0
&&
isPass
(
"PROJECT_WORKBENCH_FLOES_ADD"
,
'MANAGER'
)
&&
<
Button
variant=
"contained"
style=
{
{
backgroundColor
:
"#1370FF "
}
}
onClick=
{
addTemplateBlock
}
variant=
"contained"
startIcon=
{
<
Add
/>
}
onClick=
{
addTemplateBlock
}
size=
"small"
startIcon=
{
<
Add
/>
}
>
size=
"small"
添加工作流模版
>
</
Button
>
添加工作流模版
</
Button
>
}
</
Box
>
</
Box
>
{
{
templateList
.
length
===
0
&&
templateList
.
length
===
0
&&
!
isPass
(
"PROJECT_WORKBENCH_FLOES_ADD"
,
'MANAGER'
)
&&
<
Box
sx=
{
{
<
Box
sx=
{
{
display
:
'flex'
,
alignItems
:
'center'
,
flexDirection
:
'column'
,
minHeight
:
'calc(100vh - 376px)'
,
display
:
'flex'
,
alignItems
:
'center'
,
flexDirection
:
'column'
,
minHeight
:
'calc(100vh - 376px)'
,
justifyContent
:
'center'
justifyContent
:
'center'
...
@@ -222,15 +206,23 @@ const ProjectMembers = () => {
...
@@ -222,15 +206,23 @@ const ProjectMembers = () => {
<
Typography
sx=
{
{
fontSize
:
'12px'
,
fontWeight
:
'400'
,
color
:
'#8A9099'
}
}
>
暂未开启模版
</
Typography
>
<
Typography
sx=
{
{
fontSize
:
'12px'
,
fontWeight
:
'400'
,
color
:
'#8A9099'
}
}
>
暂未开启模版
</
Typography
>
</
Box
>
</
Box
>
}
}
{
<
Box
sx=
{
{
display
:
"flex"
,
flexWrap
:
'wrap'
,
marginLeft
:
"-8px"
}
}
>
templateList
.
length
>
0
&&
<
Box
sx=
{
{
display
:
"flex"
,
flexWrap
:
'wrap'
,
marginLeft
:
"-8px"
}
}
>
{
{
templateList
&&
templateList
.
length
>
0
&&
templateList
.
map
((
item
,
key
)
=>
{
templateList
&&
templateList
.
length
>
0
&&
templateList
.
map
((
item
,
key
)
=>
{
return
<
TemplateBox
data=
{
item
}
startDialog=
{
startDialog
}
/>
return
<
TemplateBox
data=
{
item
}
startDialog=
{
startDialog
}
/>
})
})
}
}
</
Box
>
</
Box
>
}
{
templateList
.
length
===
0
&&
isPass
(
"PROJECT_WORKBENCH_FLOES_ADD"
,
'MANAGER'
)
&&
<
Box
className=
{
styles
.
addNewTemplate
}
onClick=
{
addTemplateBlock
}
>
<
Add
sx=
{
{
color
:
"#565C66"
,
fontSize
:
"20px"
,
width
:
"30px"
,
height
:
'30px'
}
}
/>
<
Typography
sx=
{
{
fontSize
:
'14px'
,
fontWeight
:
'400'
,
color
:
'#8A9099'
,
marginTop
:
"15px"
}
}
>
添加工作流模版
</
Typography
>
</
Box
>
}
<
AddTemplate
<
AddTemplate
openAddTemplate=
{
openAddTemplate
}
openAddTemplate=
{
openAddTemplate
}
...
@@ -242,7 +234,6 @@ const ProjectMembers = () => {
...
@@ -242,7 +234,6 @@ const ProjectMembers = () => {
searchTemplateNameCallback=
{
searchTemplateNameCallback
}
searchTemplateNameCallback=
{
searchTemplateNameCallback
}
/>
/>
<
SimpleDialog
<
SimpleDialog
text=
{
'确认移除该模板吗?'
}
text=
{
'确认移除该模板吗?'
}
title=
{
'删除模板'
}
title=
{
'删除模板'
}
...
...
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