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
ba102be9
Commit
ba102be9
authored
Jul 12, 2022
by
chenshouchao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 编辑联调
parent
1378e838
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
11 deletions
+44
-11
index.tsx
...kbench/workbenchTemplate/components/AddTemplate/index.tsx
+14
-4
index.tsx
src/views/WorkFlowEdit/index.tsx
+30
-7
No files found.
src/views/Project/ProjectWorkbench/workbenchTemplate/components/AddTemplate/index.tsx
View file @
ba102be9
...
@@ -110,6 +110,14 @@ const AddTemplate = observer((props: IAddTemplateProps) => {
...
@@ -110,6 +110,14 @@ const AddTemplate = observer((props: IAddTemplateProps) => {
});
});
};
};
// 编辑模板
const
handleEditTemplate
=
(
item
:
any
)
=>
{
setCustomTemplateInfo
({
show
:
true
,
id
:
item
.
id
,
});
};
// 获取模板列表
// 获取模板列表
const
getAddTemplateListFun
=
useCallback
(()
=>
{
const
getAddTemplateListFun
=
useCallback
(()
=>
{
const
userName
=
JSON
.
parse
(
localStorage
.
getItem
(
"userInfo"
)
||
"{}"
)?.
name
;
const
userName
=
JSON
.
parse
(
localStorage
.
getItem
(
"userInfo"
)
||
"{}"
)?.
name
;
...
@@ -117,13 +125,13 @@ const AddTemplate = observer((props: IAddTemplateProps) => {
...
@@ -117,13 +125,13 @@ const AddTemplate = observer((props: IAddTemplateProps) => {
setAddTemplateList
([]);
setAddTemplateList
([]);
if
(
templateType
===
"public"
)
{
if
(
templateType
===
"public"
)
{
getAddTemplateList
({
getAddTemplateList
({
projectId
:
projectId
as
string
,
//
projectId: projectId as string,
productId
:
productId
as
string
,
productId
:
productId
as
string
,
title
,
title
,
});
});
}
else
{
}
else
{
getAddTemplateList
({
getAddTemplateList
({
projectId
:
projectId
as
string
,
//
projectId: projectId as string,
productId
:
productId
as
string
,
productId
:
productId
as
string
,
creator
:
userName
,
creator
:
userName
,
title
,
title
,
...
@@ -132,11 +140,12 @@ const AddTemplate = observer((props: IAddTemplateProps) => {
...
@@ -132,11 +140,12 @@ const AddTemplate = observer((props: IAddTemplateProps) => {
},
[
},
[
setSelectTemplateData
,
setSelectTemplateData
,
getAddTemplateList
,
getAddTemplateList
,
projectId
,
productId
,
productId
,
templateType
,
templateType
,
title
,
title
,
]);
]);
// projectId,
// title,
useEffect
(()
=>
{
useEffect
(()
=>
{
getAddTemplateListFun
();
getAddTemplateListFun
();
...
@@ -286,7 +295,7 @@ const AddTemplate = observer((props: IAddTemplateProps) => {
...
@@ -286,7 +295,7 @@ const AddTemplate = observer((props: IAddTemplateProps) => {
{
templateType
!==
"public"
&&
(
{
templateType
!==
"public"
&&
(
<
div
className=
{
style
.
templateLiEditBox
}
>
<
div
className=
{
style
.
templateLiEditBox
}
>
<
Button
<
Button
click=
{
handleAddTemplate
}
click=
{
()
=>
handleEditTemplate
(
item
)
}
size=
{
"small"
}
size=
{
"small"
}
style=
{
{
style=
{
{
height
:
"32px"
,
height
:
"32px"
,
...
@@ -316,6 +325,7 @@ const AddTemplate = observer((props: IAddTemplateProps) => {
...
@@ -316,6 +325,7 @@ const AddTemplate = observer((props: IAddTemplateProps) => {
</
div
>
</
div
>
{
customTemplateInfo
?.
show
?
(
{
customTemplateInfo
?.
show
?
(
<
WorkFlowEdit
<
WorkFlowEdit
id=
{
customTemplateInfo
.
id
||
""
}
onBack=
{
()
=>
{
onBack=
{
()
=>
{
setCustomTemplateInfo
({
setCustomTemplateInfo
({
id
:
""
,
id
:
""
,
...
...
src/views/WorkFlowEdit/index.tsx
View file @
ba102be9
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
* @FilePath: /bkunyun/src/views/Project/ProjectSubmitWork/index.tsx
* @FilePath: /bkunyun/src/views/Project/ProjectSubmitWork/index.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
*/
import
React
,
{
useCallback
,
useState
}
from
"react"
;
import
React
,
{
useCallback
,
use
Effect
,
use
State
}
from
"react"
;
import
ArrowBackIosNewIcon
from
"@mui/icons-material/ArrowBackIosNew"
;
import
ArrowBackIosNewIcon
from
"@mui/icons-material/ArrowBackIosNew"
;
import
IconButton
from
"@mui/material/IconButton"
;
import
IconButton
from
"@mui/material/IconButton"
;
...
@@ -19,6 +19,7 @@ import ParameterSetting from "./components/ParameterSetting";
...
@@ -19,6 +19,7 @@ import ParameterSetting from "./components/ParameterSetting";
import
{
useMessage
}
from
"@/components/MySnackbar"
;
import
{
useMessage
}
from
"@/components/MySnackbar"
;
import
{
ITask
}
from
"../Project/ProjectSubmitWork/interface"
;
import
{
ITask
}
from
"../Project/ProjectSubmitWork/interface"
;
import
_
from
"lodash"
;
import
_
from
"lodash"
;
import
{
fetchTemplateConfigInfo
}
from
"@/api/project_api"
;
import
{
saveUserSpec
}
from
"@/api/workbench_api"
;
import
{
saveUserSpec
}
from
"@/api/workbench_api"
;
import
useMyRequest
from
"@/hooks/useMyRequest"
;
import
useMyRequest
from
"@/hooks/useMyRequest"
;
import
MyDialog
from
"@/components/mui/Dialog"
;
import
MyDialog
from
"@/components/mui/Dialog"
;
...
@@ -44,21 +45,17 @@ const radioOptions = [
...
@@ -44,21 +45,17 @@ const radioOptions = [
interface
IProps
{
interface
IProps
{
onBack
?:
()
=>
void
;
onBack
?:
()
=>
void
;
id
?:
string
;
}
}
const
WorkFlowEdit
=
observer
((
props
:
IProps
)
=>
{
const
WorkFlowEdit
=
observer
((
props
:
IProps
)
=>
{
const
{
onBack
}
=
props
;
const
{
onBack
,
id
}
=
props
;
const
{
currentProjectStore
}
=
useStores
();
const
{
currentProjectStore
}
=
useStores
();
const
Message
=
useMessage
();
const
Message
=
useMessage
();
const
[
templateConfigInfo
,
setTemplateConfigInfo
]
=
useState
<
ITask
[]
>
([]);
const
[
templateConfigInfo
,
setTemplateConfigInfo
]
=
useState
<
ITask
[]
>
([]);
// const projectId = toJS(currentProjectStore.currentProjectInfo.id);
// const projectId = toJS(currentProjectStore.currentProjectInfo.id);
const
productId
=
toJS
(
currentProjectStore
.
currentProductInfo
.
id
);
const
productId
=
toJS
(
currentProjectStore
.
currentProductInfo
.
id
);
const
[
saveFormDialog
,
setSaveFormDialog
]
=
useState
(
false
);
const
[
saveFormDialog
,
setSaveFormDialog
]
=
useState
(
false
);
// const [formValue, setFormValue] = useState({
// title: "",
// version: "1.0.0",
// description: "",
// });
const
[
showFlow
,
setShowFlow
]
=
useState
(
true
);
const
[
showFlow
,
setShowFlow
]
=
useState
(
true
);
const
[
title
,
setTitle
]
=
useState
(
""
);
const
[
title
,
setTitle
]
=
useState
(
""
);
const
[
version
,
setVersion
]
=
useState
(
"1.0.0"
);
const
[
version
,
setVersion
]
=
useState
(
"1.0.0"
);
...
@@ -76,6 +73,30 @@ const WorkFlowEdit = observer((props: IProps) => {
...
@@ -76,6 +73,30 @@ const WorkFlowEdit = observer((props: IProps) => {
"返回后,当前页面已填写内容将不保存,确认返回吗?"
"返回后,当前页面已填写内容将不保存,确认返回吗?"
);
);
const
{
run
:
fetchTemplateConfigInfoRun
}
=
useMyRequest
(
fetchTemplateConfigInfo
,
{
onSuccess
:
(
res
:
any
)
=>
{
console
.
log
(
res
);
if
(
res
.
data
)
{
setTemplateConfigInfo
(
res
.
data
.
tasks
);
setTitle
(
res
.
data
.
title
);
let
version
=
res
.
data
.
version
;
let
arr
=
version
.
split
(
"."
);
arr
[
2
]
=
String
(
Number
(
arr
[
2
])
+
1
);
setVersion
(
arr
.
join
(
"."
));
setDescription
(
res
.
data
.
description
);
}
},
}
);
useEffect
(()
=>
{
if
(
id
)
{
fetchTemplateConfigInfoRun
({
id
});
}
},
[
id
,
fetchTemplateConfigInfoRun
]);
const
checkTitle
=
(
title
:
string
)
=>
{
const
checkTitle
=
(
title
:
string
)
=>
{
if
(
!
title
)
{
if
(
!
title
)
{
setTitleHelper
({
setTitleHelper
({
...
@@ -216,11 +237,13 @@ const WorkFlowEdit = observer((props: IProps) => {
...
@@ -216,11 +237,13 @@ const WorkFlowEdit = observer((props: IProps) => {
};
};
const
handleCloseDialog
=
()
=>
{
const
handleCloseDialog
=
()
=>
{
setShowFlow
(
true
);
setSaveFormDialog
(
false
);
setSaveFormDialog
(
false
);
};
};
const
handleOncofirm
=
()
=>
{
const
handleOncofirm
=
()
=>
{
checkTitle
(
title
);
checkTitle
(
title
);
setShowFlow
(
true
);
checkVersion
(
version
);
checkVersion
(
version
);
if
(
!
titleHelper
.
error
&&
!
versionHelper
.
error
)
{
if
(
!
titleHelper
.
error
&&
!
versionHelper
.
error
)
{
saveUserSpecRun
({
saveUserSpecRun
({
...
...
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