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
90965ac8
Commit
90965ac8
authored
Jul 06, 2022
by
chenshouchao
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat-20220705-customTemplate' into 'release'
feat: 新增按钮样式的单选组组件 See merge request
!81
parents
61b7dc0e
82b14568
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
349 additions
and
115 deletions
+349
-115
index.module.css
...CommonComponents/RadioGroupOfButtonStyle/index.module.css
+29
-0
index.tsx
...onents/CommonComponents/RadioGroupOfButtonStyle/index.tsx
+39
-0
index.tsx
src/views/Project/ProjectSubmitWork/index.tsx
+24
-7
addTemplate.tsx
...ectWorkbench/workbenchTemplate/components/addTemplate.tsx
+161
-37
index.tsx
...iews/Project/ProjectWorkbench/workbenchTemplate/index.tsx
+96
-71
No files found.
src/components/CommonComponents/RadioGroupOfButtonStyle/index.module.css
0 → 100644
View file @
90965ac8
.RadiosBox
{
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
border
:
1px
solid
#e6e8eb
;
border-radius
:
4px
;
background-color
:
#e6e8eb
;
cursor
:
pointer
;
height
:
32px
;
box-sizing
:
border-box
;
padding
:
2px
;
}
.radio
{
height
:
28px
;
box-sizing
:
border-box
;
font-size
:
14px
;
color
:
#565c66
;
border-radius
:
4px
;
line-height
:
20px
;
padding
:
3px
18px
;
background-color
:
#e6e8eb
;
display
:
flex
;
align-items
:
center
;
}
.radioActive
{
color
:
#1370ff
;
background-color
:
#fff
;
border
:
1px
solid
#e6e8eb
;
}
src/components/CommonComponents/RadioGroupOfButtonStyle/index.tsx
0 → 100644
View file @
90965ac8
// 按钮样式的单选组
import
classnames
from
"classnames"
;
import
style
from
"./index.module.css"
;
type
radioOption
=
{
value
:
string
;
label
:
string
;
};
type
IRadioGroupOfButtonStyleProps
=
{
radioOptions
:
Array
<
radioOption
>
;
value
:
string
;
handleRadio
:
any
;
};
const
RadioGroupOfButtonStyle
=
(
props
:
IRadioGroupOfButtonStyleProps
)
=>
{
const
{
radioOptions
,
value
,
handleRadio
}
=
props
;
return
(
<
div
className=
{
style
.
RadiosBox
}
>
{
radioOptions
.
map
((
options
)
=>
{
return
(
<
div
key=
{
options
.
value
}
className=
{
classnames
({
[
style
.
radio
]:
true
,
[
style
.
radioActive
]:
value
===
options
.
value
,
})
}
onClick=
{
()
=>
handleRadio
(
options
.
value
)
}
>
{
options
.
label
}
</
div
>
);
})
}
</
div
>
);
};
export
default
RadioGroupOfButtonStyle
;
src/views/Project/ProjectSubmitWork/index.tsx
View file @
90965ac8
...
@@ -30,7 +30,6 @@ import MyPopconfirm from "@/components/mui/MyPopconfirm";
...
@@ -30,7 +30,6 @@ import MyPopconfirm from "@/components/mui/MyPopconfirm";
import
styles
from
"./index.module.css"
;
import
styles
from
"./index.module.css"
;
const
ProjectSubmitWork
=
()
=>
{
const
ProjectSubmitWork
=
()
=>
{
const
Message
=
useMessage
();
const
Message
=
useMessage
();
const
{
currentProjectStore
}
=
useStores
();
const
{
currentProjectStore
}
=
useStores
();
...
@@ -68,7 +67,14 @@ const ProjectSubmitWork = () => {
...
@@ -68,7 +67,14 @@ const ProjectSubmitWork = () => {
task
.
parameters
.
forEach
((
parameter
)
=>
{
task
.
parameters
.
forEach
((
parameter
)
=>
{
let
value
:
any
=
undefined
;
let
value
:
any
=
undefined
;
if
(
parameter
.
defaultValue
)
{
if
(
parameter
.
defaultValue
)
{
if
(
parameter
.
domType
.
toLowerCase
()
===
"multipleselect"
||
parameter
.
domType
.
toLowerCase
()
===
"checkbox"
)
{
value
=
parameter
.
defaultValue
.
split
(
","
);
}
else
{
value
=
parameter
.
defaultValue
;
value
=
parameter
.
defaultValue
;
}
}
else
if
(
}
else
if
(
parameter
.
domType
.
toLowerCase
()
===
"multipleselect"
||
parameter
.
domType
.
toLowerCase
()
===
"multipleselect"
||
parameter
.
domType
.
toLowerCase
()
===
"checkbox"
parameter
.
domType
.
toLowerCase
()
===
"checkbox"
...
@@ -193,7 +199,8 @@ const ProjectSubmitWork = () => {
...
@@ -193,7 +199,8 @@ const ProjectSubmitWork = () => {
return
(
return
(
<
div
className=
{
styles
.
swBox
}
>
<
div
className=
{
styles
.
swBox
}
>
{
fullScreenShow
?
null
:
<
div
className=
{
styles
.
swHeader
}
>
{
fullScreenShow
?
null
:
(
<
div
className=
{
styles
.
swHeader
}
>
<
div
className=
{
styles
.
swHeaderLeft
}
>
<
div
className=
{
styles
.
swHeaderLeft
}
>
<
MyPopconfirm
<
MyPopconfirm
title=
"返回后,当前页面已填写内容将不保存,确认返回吗?"
title=
"返回后,当前页面已填写内容将不保存,确认返回吗?"
...
@@ -248,18 +255,28 @@ const ProjectSubmitWork = () => {
...
@@ -248,18 +255,28 @@ const ProjectSubmitWork = () => {
></
ButtonComponent
>
></
ButtonComponent
>
</
MyPopconfirm
>
</
MyPopconfirm
>
</
div
>
</
div
>
</
div
>
}
</
div
>
)
}
<
div
className=
{
styles
.
swContent
}
>
<
div
className=
{
styles
.
swContent
}
>
{
fullScreenShow
?
null
:
<
div
className=
{
styles
.
swFormBox
}
>
{
fullScreenShow
?
null
:
(
<
div
className=
{
styles
.
swFormBox
}
>
<
ConfigForm
<
ConfigForm
onRef=
{
configFormRef
}
onRef=
{
configFormRef
}
templateConfigInfo=
{
templateConfigInfo
}
templateConfigInfo=
{
templateConfigInfo
}
setParameter=
{
setParameter
}
setParameter=
{
setParameter
}
setSelectedNodeId=
{
setSelectedNodeId
}
setSelectedNodeId=
{
setSelectedNodeId
}
/>
/>
</
div
>
}
</
div
>
<
div
className=
{
styles
.
swFlowBox
}
style=
{
fullScreenShow
?
{
height
:
"100vh"
}
:
undefined
}
>
)
}
<
WorkFlow
templateConfigInfo=
{
templateConfigInfo
}
setSelectedNodeId=
{
setSelectedNodeId
}
selectedNodeId=
{
selectedNodeId
}
/>
<
div
className=
{
styles
.
swFlowBox
}
style=
{
fullScreenShow
?
{
height
:
"100vh"
}
:
undefined
}
>
<
WorkFlow
templateConfigInfo=
{
templateConfigInfo
}
setSelectedNodeId=
{
setSelectedNodeId
}
selectedNodeId=
{
selectedNodeId
}
/>
</
div
>
</
div
>
</
div
>
</
div
>
<
img
<
img
...
...
src/views/Project/ProjectWorkbench/workbenchTemplate/components/addTemplate.tsx
View file @
90965ac8
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
"@/components/mui/Button"
;
import
Button
from
"@/components/mui/Button"
;
import
Dialog
from
"@/components/mui/Dialog"
;
import
Dialog
from
"@/components/mui/Dialog"
;
import
OutlinedInput
from
"@mui/material/OutlinedInput"
;
import
OutlinedInput
from
"@mui/material/OutlinedInput"
;
import
RadioGroupOfButtonStyle
from
"@/components/CommonComponents/RadioGroupOfButtonStyle"
;
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
noData
from
'../../../../../assets/project/noTemplate.svg'
import
noData
from
"../../../../../assets/project/noTemplate.svg"
;
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
;
const
[
templateType
,
setTemplateType
]
=
useState
(
"public"
);
const
radioOptions
=
[
{
value
:
"public"
,
label
:
"公共"
,
},
{
value
:
"custom"
,
label
:
"自定义"
,
},
];
const
handleRadio
=
(
value
:
string
)
=>
{
setTemplateType
(
value
);
};
return
(
return
(
<
Box
className=
{
styles
.
addTemplateMask
}
sx=
{
{
display
:
openAddTemplate
?
'flex'
:
'none'
}
}
>
<
Box
<
Box
sx=
{
{
height
:
'50px'
,
display
:
'flex'
,
alignItems
:
'center'
}
}
>
className=
{
styles
.
addTemplateMask
}
<
CloseOutlinedIcon
sx=
{
{
color
:
"#ffffff"
,
marginRight
:
"10px"
,
cursor
:
"pointer"
}
}
onClick=
{
()
=>
{
sx=
{
{
display
:
openAddTemplate
?
"flex"
:
"none"
}
}
closeAddTemplateBlock
()
>
}
}
/>
<
Box
sx=
{
{
height
:
"50px"
,
display
:
"flex"
,
alignItems
:
"center"
}
}
>
<
CloseOutlinedIcon
sx=
{
{
color
:
"#ffffff"
,
marginRight
:
"10px"
,
cursor
:
"pointer"
}
}
onClick=
{
()
=>
{
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
<
Box
sx=
{
{
display
:
'flex'
,
justifyContent
:
'space-between'
,
alignItems
:
'center'
,
marginBottom
:
"20px"
}
}
>
sx=
{
{
fontSize
:
"18px"
,
fontWeight
:
"600"
,
color
:
"#1E2633"
}
}
>
添加工作流模版
</
Typography
>
<
Box
sx=
{
{
display
:
"flex"
,
justifyContent
:
"space-between"
,
alignItems
:
"center"
,
marginBottom
:
"20px"
,
}
}
>
<
OutlinedInput
<
OutlinedInput
onChange=
{
(
e
:
any
)
=>
{
onChange=
{
(
e
:
any
)
=>
{
_
.
debounce
(()
=>
{
_
.
debounce
(()
=>
{
searchTemplateNameCallback
(
e
.
target
.
value
)
searchTemplateNameCallback
(
e
.
target
.
value
);
},
200
)();
},
200
)();
}
}
}
}
placeholder=
"输入关键词搜索"
placeholder=
"输入关键词搜索"
...
@@ -36,45 +77,128 @@ const AddTemplate = (props: any) => {
...
@@ -36,45 +77,128 @@ const AddTemplate = (props: any) => {
sx=
{
{
width
:
340
,
height
:
32
,
marginTop
:
"20px"
}
}
sx=
{
{
width
:
340
,
height
:
32
,
marginTop
:
"20px"
}
}
endAdornment=
{
<
SearchIcon
style=
{
{
color
:
"#8A9099"
}
}
/>
}
endAdornment=
{
<
SearchIcon
style=
{
{
color
:
"#8A9099"
}
}
/>
}
/>
/>
<
Box
sx=
{
{
display
:
"flex"
,
justifyContent
:
"flex-end"
,
alignItems
:
"center"
,
}
}
>
<
RadioGroupOfButtonStyle
value=
{
templateType
}
radioOptions=
{
radioOptions
}
handleRadio=
{
handleRadio
}
></
RadioGroupOfButtonStyle
>
<
Button
<
Button
click=
{
addTemplateCallback
}
click=
{
addTemplateCallback
}
size=
{
"small"
}
size=
{
"small"
}
text=
{
'添加模版'
+
(
selectTemplateData
.
length
===
0
?
""
:
`(${selectTemplateData.length})`
)
}
style=
{
{
marginLeft
:
"12px"
,
}
}
text=
{
"添加模版"
+
(
selectTemplateData
.
length
===
0
?
""
:
`(${selectTemplateData.length})`
)
}
/>
/>
</
Box
>
</
Box
>
</
Box
>
{
{
addTemplateList
.
length
===
0
&&
(
addTemplateList
.
length
===
0
&&
<
Box
sx=
{
{
<
Box
display
:
'flex'
,
alignItems
:
'center'
,
flexDirection
:
'column'
,
minHeight
:
'calc(100vh - 376px)'
,
sx=
{
{
justifyContent
:
'center'
display
:
"flex"
,
}
}
>
alignItems
:
"center"
,
flexDirection
:
"column"
,
minHeight
:
"calc(100vh - 376px)"
,
justifyContent
:
"center"
,
}
}
>
<
img
alt=
""
src=
{
noData
}
/>
<
img
alt=
""
src=
{
noData
}
/>
<
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'
,
overflowX
:
'hidden'
,
overflowY
:
'overlay'
,
marginLeft
:
'-8px'
}
}
>
<
Box
{
sx=
{
{
addTemplateList
.
map
((
item
:
any
,
key
:
any
)
=>
{
display
:
"flex"
,
flexWrap
:
"wrap"
,
overflowX
:
"hidden"
,
overflowY
:
"overlay"
,
marginLeft
:
"-8px"
,
}
}
>
{
addTemplateList
.
map
((
item
:
any
,
key
:
any
)
=>
{
return
(
return
(
<
Box
className=
{
styles
.
addTemplateBox
}
onClick=
{
()
=>
{
<
Box
templateSelectCallback
(
item
.
id
)
className=
{
styles
.
addTemplateBox
}
onClick=
{
()
=>
{
templateSelectCallback
(
item
.
id
);
}
}
sx=
{
{
border
:
selectTemplateData
.
includes
(
item
.
id
)
?
"1px solid #1370FF"
:
"1px solid #EBEDF0;"
,
}
}
key=
{
item
.
id
}
>
<
Box
sx=
{
{
display
:
"flex"
,
justifyContent
:
"space-between"
,
alignItems
:
"center"
,
}
}
>
<
Typography
sx=
{
{
fontSize
:
"14px"
,
fontWeight
:
"600"
,
color
:
"#1E2633"
,
marginBottom
:
"4px"
,
overflow
:
"hidden"
,
textOverflow
:
"ellipsis"
,
}
}
}
}
sx=
{
{
border
:
selectTemplateData
.
includes
(
item
.
id
)
?
'1px solid #1370FF'
:
"1px solid #EBEDF0;"
}
}
>
>
<
Box
sx=
{
{
display
:
'flex'
,
justifyContent
:
'space-between'
,
alignItems
:
'center'
,
}
}
>
{
item
.
title
}
<
Typography
sx=
{
{
fontSize
:
'14px'
,
fontWeight
:
'600'
,
color
:
'#1E2633'
,
marginBottom
:
"4px"
,
overflow
:
'hidden'
,
textOverflow
:
'ellipsis'
}
}
>
{
item
.
title
}
</
Typography
>
</
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
<
Typography
sx=
{
{
fontSize
:
'12px'
,
fontWeight
:
'400'
,
color
:
'#1370FF'
}
}
>
更新时间:
{
item
.
updateTime
}
</
Typography
>
sx=
{
{
fontSize
:
"12px"
,
fontWeight
:
"400"
,
color
:
"#1370FF"
,
marginRight
:
"24px"
,
}
}
>
版本:
{
item
.
version
}
</
Typography
>
<
Typography
sx=
{
{
fontSize
:
"12px"
,
fontWeight
:
"400"
,
color
:
"#1370FF"
,
}
}
>
更新时间:
{
item
.
updateTime
}
</
Typography
>
</
Box
>
</
Box
>
<
Typography
className=
{
styles
.
templateDescText
}
>
{
item
.
description
}
</
Typography
>
<
Typography
className=
{
styles
.
templateDescText
}
>
{
item
.
description
}
</
Typography
>
</
Box
>
</
Box
>
)
);
})
})
}
}
</
Box
>
</
Box
>
</
Box
>
</
Box
>
</
Box
>
</
Box
>
...
...
src/views/Project/ProjectWorkbench/workbenchTemplate/index.tsx
View file @
90965ac8
...
@@ -17,23 +17,22 @@ import Add from "@mui/icons-material/Add";
...
@@ -17,23 +17,22 @@ import Add from "@mui/icons-material/Add";
import
Button
from
"@/components/mui/Button"
;
import
Button
from
"@/components/mui/Button"
;
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
usePass
from
"@/hooks/usePass"
;
import
usePass
from
"@/hooks/usePass"
;
import
ReactFlowEdit
from
'@/views/WorkFlowEdit'
import
ReactFlowEdit
from
"@/views/WorkFlowEdit"
;
import
{
useStores
}
from
"@/store"
;
import
{
useStores
}
from
"@/store"
;
import
styles
from
"./index.module.css"
;
import
styles
from
"./index.module.css"
;
const
ProjectMembers
=
observer
(()
=>
{
const
ProjectMembers
=
observer
(()
=>
{
const
{
currentProjectStore
}
=
useStores
();
const
{
currentProjectStore
}
=
useStores
();
const
projectIdData
=
toJS
(
currentProjectStore
.
currentProjectInfo
.
id
);
const
projectIdData
=
toJS
(
currentProjectStore
.
currentProjectInfo
.
id
);
...
@@ -45,7 +44,7 @@ const ProjectMembers = observer(() => {
...
@@ -45,7 +44,7 @@ const ProjectMembers = observer(() => {
/** 模板列表 */
/** 模板列表 */
const
[
templateList
,
setTemplateList
]
=
useState
([]);
const
[
templateList
,
setTemplateList
]
=
useState
([]);
/** 选中的模板id */
/** 选中的模板id */
const
[
templateId
,
setTemplateId
]
=
useState
(
''
);
const
[
templateId
,
setTemplateId
]
=
useState
(
""
);
/** 简单弹窗(删除模板) */
/** 简单弹窗(删除模板) */
const
[
openDialog
,
setOpenDialog
]
=
useState
(
false
);
const
[
openDialog
,
setOpenDialog
]
=
useState
(
false
);
/** 增加模板 */
/** 增加模板 */
...
@@ -68,7 +67,7 @@ const ProjectMembers = observer(() => {
...
@@ -68,7 +67,7 @@ const ProjectMembers = observer(() => {
setOpenDialog
(
false
);
setOpenDialog
(
false
);
getTemplateInfo
({
getTemplateInfo
({
projectId
:
currentProjectStore
.
currentProjectInfo
.
id
as
string
,
projectId
:
currentProjectStore
.
currentProjectInfo
.
id
as
string
,
title
:
templateName
title
:
templateName
,
});
});
},
},
});
});
...
@@ -76,7 +75,7 @@ const ProjectMembers = observer(() => {
...
@@ -76,7 +75,7 @@ const ProjectMembers = observer(() => {
// 添加工作流模板-获取模板列表
// 添加工作流模板-获取模板列表
const
{
run
:
getAddTemplateList
}
=
useMyRequest
(
getAddWorkbenchTemplate
,
{
const
{
run
:
getAddTemplateList
}
=
useMyRequest
(
getAddWorkbenchTemplate
,
{
onSuccess
:
(
result
:
any
)
=>
{
onSuccess
:
(
result
:
any
)
=>
{
setAddTemplateList
(
result
.
data
)
setAddTemplateList
(
result
.
data
);
setOpenAddTemplate
(
true
);
setOpenAddTemplate
(
true
);
},
},
});
});
...
@@ -84,11 +83,11 @@ const ProjectMembers = observer(() => {
...
@@ -84,11 +83,11 @@ const ProjectMembers = observer(() => {
// 项目管理员-添加工作流模板-提交
// 项目管理员-添加工作流模板-提交
const
{
run
:
addTemplate
}
=
useMyRequest
(
addWorkbenchTemplate
,
{
const
{
run
:
addTemplate
}
=
useMyRequest
(
addWorkbenchTemplate
,
{
onSuccess
:
(
result
:
any
)
=>
{
onSuccess
:
(
result
:
any
)
=>
{
setOpenAddTemplate
(
false
)
setOpenAddTemplate
(
false
);
getTemplateInfo
({
getTemplateInfo
({
projectId
:
currentProjectStore
.
currentProjectInfo
.
id
as
string
,
projectId
:
currentProjectStore
.
currentProjectInfo
.
id
as
string
,
});
});
setSelectTemplateData
([])
setSelectTemplateData
([]);
},
},
});
});
...
@@ -98,22 +97,21 @@ const ProjectMembers = observer(() => {
...
@@ -98,22 +97,21 @@ const ProjectMembers = observer(() => {
});
});
},
[
currentProjectStore
.
currentProjectInfo
.
id
,
getTemplateInfo
]);
},
[
currentProjectStore
.
currentProjectInfo
.
id
,
getTemplateInfo
]);
useEffect
(()
=>
{
useEffect
(()
=>
{
console
.
log
(
'projectIdData: '
,
projectIdData
);
console
.
log
(
"projectIdData: "
,
projectIdData
);
},
[
projectIdData
])
},
[
projectIdData
]);
/** 删除模板 */
/** 删除模板 */
const
deleteTemplate
=
()
=>
{
const
deleteTemplate
=
()
=>
{
delTemplate
({
delTemplate
({
projectId
:
currentProjectStore
.
currentProjectInfo
.
id
as
string
,
projectId
:
currentProjectStore
.
currentProjectInfo
.
id
as
string
,
workflowSpecId
:
templateId
,
workflowSpecId
:
templateId
,
})
});
};
};
/** 打开弹窗 */
/** 打开弹窗 */
const
startDialog
=
(
id
:
string
)
=>
{
const
startDialog
=
(
id
:
string
)
=>
{
setTemplateId
(
id
)
setTemplateId
(
id
);
setOpenDialog
(
true
);
setOpenDialog
(
true
);
};
};
...
@@ -126,65 +124,63 @@ const ProjectMembers = observer(() => {
...
@@ -126,65 +124,63 @@ const ProjectMembers = observer(() => {
const
addTemplateBlock
=
()
=>
{
const
addTemplateBlock
=
()
=>
{
getAddTemplateList
({
getAddTemplateList
({
projectId
:
currentProjectStore
.
currentProjectInfo
.
id
as
string
,
projectId
:
currentProjectStore
.
currentProjectInfo
.
id
as
string
,
productId
:
'cadd'
,
productId
:
"cadd"
,
})
});
};
};
/** 关闭增加模板 */
/** 关闭增加模板 */
const
closeAddTemplateBlock
=
()
=>
{
const
closeAddTemplateBlock
=
()
=>
{
setOpenAddTemplate
(
false
);
setOpenAddTemplate
(
false
);
setSelectTemplateData
([])
setSelectTemplateData
([]);
};
};
/** 增加模板操作 */
/** 增加模板操作 */
const
addTemplateCallback
=
()
=>
{
const
addTemplateCallback
=
()
=>
{
addTemplate
({
addTemplate
({
projectId
:
currentProjectStore
.
currentProjectInfo
.
id
as
string
,
projectId
:
currentProjectStore
.
currentProjectInfo
.
id
as
string
,
workflowSpecIds
:
selectTemplateData
workflowSpecIds
:
selectTemplateData
,
})
});
}
};
/** 搜索模板 */
/** 搜索模板 */
const
searchTemplateNameCallback
=
(
data
:
any
)
=>
{
const
searchTemplateNameCallback
=
(
data
:
any
)
=>
{
getAddTemplateList
({
getAddTemplateList
({
projectId
:
currentProjectStore
.
currentProjectInfo
.
id
as
string
,
projectId
:
currentProjectStore
.
currentProjectInfo
.
id
as
string
,
productId
:
'cadd'
,
productId
:
"cadd"
,
title
:
data
title
:
data
,
})
});
}
};
const
templateSelectCallback
=
(
data
:
string
)
=>
{
const
templateSelectCallback
=
(
data
:
string
)
=>
{
let
list
:
string
[]
=
[...
selectTemplateData
]
let
list
:
string
[]
=
[...
selectTemplateData
];
if
(
selectTemplateData
.
filter
(
e
=>
e
===
data
).
length
>
0
)
{
if
(
selectTemplateData
.
filter
((
e
)
=>
e
===
data
).
length
>
0
)
{
list
=
list
.
filter
(
e
=>
e
!==
data
)
list
=
list
.
filter
((
e
)
=>
e
!==
data
);
setSelectTemplateData
(
list
)
setSelectTemplateData
(
list
);
}
else
{
}
else
{
list
.
push
(
data
)
list
.
push
(
data
);
setSelectTemplateData
(
list
)
setSelectTemplateData
(
list
);
}
}
}
};
const
searchChange
=
(
data
:
any
)
=>
{
const
searchChange
=
(
data
:
any
)
=>
{
setTemplateName
(
data
.
length
>
30
?
data
.
slice
(
0
,
30
)
:
data
);
setTemplateName
(
data
.
length
>
30
?
data
.
slice
(
0
,
30
)
:
data
);
}
};
useEffect
(()
=>
{
useEffect
(()
=>
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
getTemplateInfo
({
getTemplateInfo
({
projectId
:
currentProjectStore
.
currentProjectInfo
.
id
as
string
,
projectId
:
currentProjectStore
.
currentProjectInfo
.
id
as
string
,
title
:
templateName
title
:
templateName
,
});
});
},
300
)
},
300
);
},
[
templateName
]);
},
[
templateName
]);
return
(
return
(
<
Box
className=
{
styles
.
headerBox
}
>
<
Box
className=
{
styles
.
headerBox
}
>
<
Box
className=
{
styles
.
tabBox
}
>
<
Box
className=
{
styles
.
tabBox
}
>
<
OutlinedInput
<
OutlinedInput
onChange=
{
(
e
:
any
)
=>
{
onChange=
{
(
e
:
any
)
=>
{
searchChange
(
e
.
target
.
value
)
searchChange
(
e
.
target
.
value
);
}
}
}
}
value=
{
templateName
}
value=
{
templateName
}
placeholder=
"输入关键词搜索"
placeholder=
"输入关键词搜索"
...
@@ -193,40 +189,70 @@ const ProjectMembers = observer(() => {
...
@@ -193,40 +189,70 @@ const ProjectMembers = observer(() => {
endAdornment=
{
<
SearchIcon
style=
{
{
color
:
"#8A9099"
}
}
/>
}
endAdornment=
{
<
SearchIcon
style=
{
{
color
:
"#8A9099"
}
}
/>
}
/>
/>
{
{
templateList
.
length
>
0
&&
templateList
.
length
>
0
&&
isPass
(
"PROJECT_WORKBENCH_FLOES_ADD"
,
'MANAGER'
)
&&
isPass
(
"PROJECT_WORKBENCH_FLOES_ADD"
,
"MANAGER"
)
&&
(
<
Button
text=
{
'添加工作流模版'
}
img=
{
<
Add
/>
}
click=
{
addTemplateBlock
}
size=
{
'small'
}
/>
<
Button
}
text=
{
"添加工作流模版"
}
img=
{
<
Add
/>
}
click=
{
addTemplateBlock
}
size=
{
"small"
}
/>
)
}
</
Box
>
</
Box
>
{
{
templateList
.
length
===
0
&&
templateName
.
length
>
0
&&
(
templateList
.
length
===
0
&&
templateName
.
length
>
0
&&
<
Box
<
Box
sx=
{
{
sx=
{
{
display
:
'flex'
,
alignItems
:
'center'
,
flexDirection
:
'column'
,
minHeight
:
'calc(100vh - 376px)'
,
display
:
"flex"
,
justifyContent
:
'center'
alignItems
:
"center"
,
}
}
>
flexDirection
:
"column"
,
minHeight
:
"calc(100vh - 376px)"
,
justifyContent
:
"center"
,
}
}
>
<
img
alt=
""
src=
{
noData
}
/>
<
img
alt=
""
src=
{
noData
}
/>
<
Typography
sx=
{
{
fontSize
:
'12px'
,
fontWeight
:
'400'
,
color
:
'#8A9099'
}
}
>
暂未开启模版
</
Typography
>
<
Typography
sx=
{
{
fontSize
:
"12px"
,
fontWeight
:
"400"
,
color
:
"#8A9099"
}
}
>
暂未开启模版
</
Typography
>
</
Box
>
</
Box
>
}
)
}
{
{
templateList
.
length
>
0
&&
(
templateList
.
length
>
0
&&
<
Box
sx=
{
{
display
:
"flex"
,
flexWrap
:
'wrap'
,
marginLeft
:
"-8px"
}
}
>
<
Box
sx=
{
{
display
:
"flex"
,
flexWrap
:
"wrap"
,
marginLeft
:
"-8px"
}
}
>
{
{
templateList
&&
templateList
&&
templateList
.
length
>
0
&&
templateList
.
map
((
item
,
key
)
=>
{
templateList
.
length
>
0
&&
return
<
TemplateBox
data=
{
item
}
startDialog=
{
startDialog
}
/>
templateList
.
map
((
item
,
key
)
=>
{
})
return
(
}
<
TemplateBox
data=
{
item
}
startDialog=
{
startDialog
}
key=
{
key
}
/>
);
})
}
</
Box
>
</
Box
>
}
)
}
{
{
templateList
.
length
===
0
&&
templateList
.
length
===
0
&&
templateName
.
length
===
0
&&
isPass
(
"PROJECT_WORKBENCH_FLOES_ADD"
,
'MANAGER'
)
&&
<
Box
className=
{
styles
.
addNewTemplate
}
templateName
.
length
===
0
&&
onClick=
{
addTemplateBlock
}
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"
,
}
}
>
>
<
Add
sx=
{
{
color
:
"#565C66"
,
fontSize
:
"20px"
,
width
:
"30px"
,
height
:
'30px'
}
}
/>
添加工作流模版
<
Typography
sx=
{
{
fontSize
:
'14px'
,
fontWeight
:
'400'
,
color
:
'#8A9099'
,
marginTop
:
"15px"
}
}
>
添加工作流模版
</
Typography
>
</
Typography
>
</
Box
>
</
Box
>
}
)
}
<
AddTemplate
<
AddTemplate
openAddTemplate=
{
openAddTemplate
}
openAddTemplate=
{
openAddTemplate
}
...
@@ -241,13 +267,12 @@ const ProjectMembers = observer(() => {
...
@@ -241,13 +267,12 @@ const ProjectMembers = observer(() => {
{
/* <ReactFlowEdit/> */
}
{
/* <ReactFlowEdit/> */
}
<
SimpleDialog
<
SimpleDialog
text=
{
'确认移除该模板吗?'
}
text=
{
"确认移除该模板吗?"
}
title=
{
'删除模板'
}
title=
{
"删除模板"
}
openDialog=
{
openDialog
}
openDialog=
{
openDialog
}
closeDialog=
{
closeDialog
}
closeDialog=
{
closeDialog
}
onConfirm=
{
deleteTemplate
}
onConfirm=
{
deleteTemplate
}
/>
/>
</
Box
>
</
Box
>
);
);
});
});
...
...
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