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
4af3d4d3
Commit
4af3d4d3
authored
Jul 12, 2022
by
chenshouchao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 完成参数设置文件夹选择功能
parent
79073268
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
23 deletions
+44
-23
index.tsx
src/views/WorkFlowEdit/components/ParameterSetting/index.tsx
+0
-0
index.tsx
src/views/WorkFlowEdit/index.tsx
+34
-15
util.ts
src/views/WorkFlowEdit/util.ts
+10
-8
No files found.
src/views/WorkFlowEdit/components/ParameterSetting/index.tsx
View file @
4af3d4d3
This diff is collapsed.
Click to expand it.
src/views/WorkFlowEdit/index.tsx
View file @
4af3d4d3
...
...
@@ -16,7 +16,10 @@ import ButtonComponent from "@/components/mui/Button";
import
OperatorList
from
"./components/OperatorList"
;
import
Flow
from
"../Project/components/Flow"
;
import
ParameterSetting
from
"./components/ParameterSetting"
;
import
{
useMessage
}
from
"@/components/MySnackbar"
;
import
{
ITask
}
from
"../Project/ProjectSubmitWork/interface"
;
import
_
from
"lodash"
;
import
{
getCustomTemplateParameterCheckResult
}
from
"./util"
;
import
styles
from
"./index.module.css"
;
...
...
@@ -37,6 +40,7 @@ interface IProps {
const
WorkFlowEdit
=
(
props
:
IProps
)
=>
{
const
{
onBack
}
=
props
;
const
Message
=
useMessage
();
const
[
templateConfigInfo
,
setTemplateConfigInfo
]
=
useState
<
ITask
[]
>
([]);
const
[
leftContentType
,
setLeftContentType
]
=
useState
(
"list"
);
...
...
@@ -57,8 +61,34 @@ const WorkFlowEdit = (props: IProps) => {
const
handleConfirm
=
()
=>
{
if
(
popperTitle
===
"返回后,当前页面已填写内容将不保存,确认返回吗?"
)
{
onBack
&&
onBack
();
}
};
const
handlePreserve
=
()
=>
{
console
.
log
(
"提交"
);
console
.
log
(
templateConfigInfo
);
// 校验
if
(
templateConfigInfo
.
length
===
0
)
{
Message
.
error
(
"工作流不能为空!"
);
return
;
}
let
templateConfigInfoClone
:
ITask
[]
=
_
.
cloneDeep
(
templateConfigInfo
);
let
check
=
true
;
templateConfigInfoClone
.
forEach
((
task
)
=>
{
task
.
parameters
.
forEach
((
parameter
)
=>
{
const
checkResult
=
getCustomTemplateParameterCheckResult
(
parameter
);
parameter
.
error
=
checkResult
.
error
;
parameter
.
helperText
=
checkResult
.
helperText
;
if
(
checkResult
.
error
)
{
check
=
false
;
}
});
});
setTemplateConfigInfo
(
templateConfigInfoClone
);
if
(
!
check
)
{
Message
.
error
(
"工作流校验未通过,请检查!"
);
}
else
{
console
.
log
(
"
提交
"
);
console
.
log
(
"
弹表单窗
"
);
}
};
...
...
@@ -74,10 +104,6 @@ const WorkFlowEdit = (props: IProps) => {
<
div
className=
{
styles
.
swBox
}
>
<
div
className=
{
styles
.
swHeader
}
>
<
div
className=
{
styles
.
swHeaderLeft
}
>
{
/* <MyPopconfirm
title="返回后,当前页面已填写内容将不保存,确认返回吗?"
onConfirm={onBack}
> */
}
<
IconButton
color=
"primary"
aria
-
label=
"upload picture"
...
...
@@ -98,20 +124,12 @@ const WorkFlowEdit = (props: IProps) => {
}
}
/>
</
IconButton
>
{
/* </MyPopconfirm> */
}
</
div
>
<
div
className=
{
styles
.
swHeaderRight
}
>
{
/* <MyPopconfirm
title="提交前请先确认参数填写无误,确认提交吗?"
onConfirm={() => console.log(2)}
> */
}
<
ButtonComponent
text=
"保存"
click=
{
(
e
:
any
)
=>
handleShowPopper
(
e
,
"提交前请先确认参数填写无误,确认提交吗?"
)
}
click=
{
()
=>
handlePreserve
}
></
ButtonComponent
>
{
/* </MyPopconfirm> */
}
</
div
>
</
div
>
<
div
className=
{
styles
.
swContent
}
>
...
...
@@ -140,7 +158,8 @@ const WorkFlowEdit = (props: IProps) => {
{
leftContentType
!==
"list"
&&
(
<
ParameterSetting
templateConfigInfo=
{
templateConfigInfo
}
taskId=
{
""
}
setTemplateConfigInfo=
{
setTemplateConfigInfo
}
taskId=
{
selectTaskId
||
""
}
/>
)
}
</
div
>
...
...
src/views/WorkFlowEdit/util.ts
View file @
4af3d4d3
...
...
@@ -28,14 +28,16 @@ export const getCustomTemplateParameterCheckResult = (
helperText
,
};
}
if
(
parameter
.
validators
.
length
>
0
)
{
parameter
.
validators
.
forEach
((
validator
)
=>
{
const
reg
=
new
RegExp
(
validator
.
regex
);
if
(
!
reg
.
test
(
parameter
.
defaultValue
))
{
error
=
true
;
helperText
=
validator
.
message
;
}
});
if
(
Array
.
isArray
(
parameter
.
validators
))
{
if
(
parameter
.
validators
.
length
>
0
)
{
parameter
.
validators
.
forEach
((
validator
)
=>
{
const
reg
=
new
RegExp
(
validator
.
regex
);
if
(
!
reg
.
test
(
parameter
.
defaultValue
))
{
error
=
true
;
helperText
=
validator
.
message
;
}
});
}
}
return
{
error
,
...
...
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