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
753e61ad
Commit
753e61ad
authored
Jul 07, 2022
by
吴永生#A02208
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 版本字段修改
parent
b9a6c048
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
247 additions
and
247 deletions
+247
-247
index.tsx
src/views/Project/ProjectSubmitWork/index.tsx
+247
-247
No files found.
src/views/Project/ProjectSubmitWork/index.tsx
View file @
753e61ad
...
...
@@ -2,7 +2,7 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-06-21 20:03:56
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-07-0
6 11:55:03
* @LastEditTime: 2022-07-0
7 10:53:41
* @FilePath: /bkunyun/src/views/Project/ProjectSubmitWork/index.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
...
...
@@ -31,262 +31,262 @@ import MyPopconfirm from "@/components/mui/MyPopconfirm";
import
styles
from
"./index.module.css"
;
const
ProjectSubmitWork
=
()
=>
{
const
Message
=
useMessage
();
const
{
currentProjectStore
}
=
useStores
();
const
projectId
=
toJS
(
currentProjectStore
.
currentProjectInfo
.
id
);
const
[
templateConfigInfo
,
setTemplateConfigInfo
]
=
useState
<
ITemplateConfig
>
();
const
location
:
any
=
useLocation
();
const
navigate
=
useNavigate
();
let
configFormRef
:
any
=
React
.
createRef
();
/** 是否全屏 */
const
[
fullScreenShow
,
setFullScreenShow
]
=
useState
<
boolean
>
(
false
);
const
[
selectedNodeId
,
setSelectedNodeId
]
=
useState
<
string
>
(
""
);
const
Message
=
useMessage
();
const
{
currentProjectStore
}
=
useStores
();
const
projectId
=
toJS
(
currentProjectStore
.
currentProjectInfo
.
id
);
const
[
templateConfigInfo
,
setTemplateConfigInfo
]
=
useState
<
ITemplateConfig
>
();
const
location
:
any
=
useLocation
();
const
navigate
=
useNavigate
();
let
configFormRef
:
any
=
React
.
createRef
();
/** 是否全屏 */
const
[
fullScreenShow
,
setFullScreenShow
]
=
useState
<
boolean
>
(
false
);
const
[
selectedNodeId
,
setSelectedNodeId
]
=
useState
<
string
>
(
""
);
// 前往工作台
const
goToWorkbench
=
(
toWorkbenchList
=
false
)
=>
{
navigate
(
"/product/cadd/projectWorkbench"
,
{
state
:
{
type
:
toWorkbenchList
?
"workbenchList"
:
""
},
});
};
// 前往工作台
const
goToWorkbench
=
(
toWorkbenchList
=
false
)
=>
{
navigate
(
"/product/cadd/projectWorkbench"
,
{
state
:
{
type
:
toWorkbenchList
?
"workbenchList"
:
""
},
});
};
// 返回
const
handleGoBack
=
()
=>
{
goToWorkbench
();
};
// 返回
const
handleGoBack
=
()
=>
{
goToWorkbench
();
};
if
(
!
location
?.
state
?.
id
)
{
goToWorkbench
();
}
if
(
!
location
?.
state
?.
id
)
{
goToWorkbench
();
}
/** 获取模版数据 */
const
{
run
}
=
useMyRequest
(
fetchTemplateConfigInfo
,
{
onSuccess
:
(
res
:
IResponse
<
ITemplateConfig
>
)
=>
{
// setTemplateConfigInfo(templateConfigJson as ITemplateConfig);
res
.
data
.
tasks
.
forEach
((
task
)
=>
{
task
.
parameters
.
forEach
((
parameter
)
=>
{
let
value
:
any
=
undefined
;
if
(
parameter
.
defaultValue
)
{
if
(
parameter
.
domType
.
toLowerCase
()
===
"multipleselect"
||
parameter
.
domType
.
toLowerCase
()
===
"checkbox"
)
{
value
=
parameter
.
defaultValue
.
split
(
","
);
}
else
{
value
=
parameter
.
defaultValue
;
}
}
else
if
(
parameter
.
domType
.
toLowerCase
()
===
"multipleselect"
||
parameter
.
domType
.
toLowerCase
()
===
"checkbox"
)
{
value
=
[];
}
else
{
value
=
""
;
}
parameter
.
value
=
value
;
});
});
setTemplateConfigInfo
(
res
.
data
);
configFormRef
.
current
.
setInitName
(
res
.
data
.
title
);
},
onError
:
()
=>
{
// setTemplateConfigInfo(templateConfigJson as ITemplateConfig);
},
});
/** 获取模版数据 */
const
{
run
}
=
useMyRequest
(
fetchTemplateConfigInfo
,
{
onSuccess
:
(
res
:
IResponse
<
ITemplateConfig
>
)
=>
{
// setTemplateConfigInfo(templateConfigJson as ITemplateConfig);
res
.
data
.
tasks
.
forEach
((
task
)
=>
{
task
.
parameters
.
forEach
((
parameter
)
=>
{
let
value
:
any
=
undefined
;
if
(
parameter
.
defaultValue
)
{
if
(
parameter
.
domType
.
toLowerCase
()
===
"multipleselect"
||
parameter
.
domType
.
toLowerCase
()
===
"checkbox"
)
{
value
=
parameter
.
defaultValue
.
split
(
","
);
}
else
{
value
=
parameter
.
defaultValue
;
}
}
else
if
(
parameter
.
domType
.
toLowerCase
()
===
"multipleselect"
||
parameter
.
domType
.
toLowerCase
()
===
"checkbox"
)
{
value
=
[];
}
else
{
value
=
""
;
}
parameter
.
value
=
value
;
});
});
setTemplateConfigInfo
(
res
.
data
);
configFormRef
.
current
.
setInitName
(
res
.
data
.
title
);
},
onError
:
()
=>
{
// setTemplateConfigInfo(templateConfigJson as ITemplateConfig);
},
});
const
{
run
:
submitWorkFlowRun
}
=
useMyRequest
(
submitWorkFlow
,
{
onSuccess
:
(
res
)
=>
{
Message
.
success
(
"提交成功"
);
goToWorkbench
(
true
);
},
});
const
{
run
:
submitWorkFlowRun
}
=
useMyRequest
(
submitWorkFlow
,
{
onSuccess
:
(
res
)
=>
{
Message
.
success
(
"提交成功"
);
goToWorkbench
(
true
);
},
});
useEffect
(()
=>
{
run
({
id
:
location
?.
state
?.
id
,
});
},
[
location
?.
state
?.
id
,
run
]);
useEffect
(()
=>
{
run
({
id
:
location
?.
state
?.
id
,
});
},
[
location
?.
state
?.
id
,
run
]);
const
setParameter
=
(
value
:
any
,
taskId
:
string
,
parameterName
:
string
)
=>
{
const
result
:
ITemplateConfig
=
_
.
cloneDeep
(
templateConfigInfo
);
result
.
tasks
.
forEach
((
tack
)
=>
{
if
(
tack
.
id
===
taskId
)
{
let
isCheck
=
true
;
tack
.
parameters
.
filter
((
parameter
)
=>
parameter
.
hidden
===
false
)
.
forEach
((
parameter
)
=>
{
if
(
parameter
.
name
===
parameterName
)
{
parameter
.
value
=
value
;
const
checkResult
=
getCheckResult
(
parameter
,
value
);
parameter
.
error
=
checkResult
.
error
;
parameter
.
helperText
=
checkResult
.
helperText
;
}
if
(
getCheckResult
(
parameter
,
parameter
.
value
).
error
===
true
)
{
isCheck
=
false
;
}
});
tack
.
isCheck
=
isCheck
;
}
else
{
return
;
}
});
setTemplateConfigInfo
(
result
);
};
const
setParameter
=
(
value
:
any
,
taskId
:
string
,
parameterName
:
string
)
=>
{
const
result
:
ITemplateConfig
=
_
.
cloneDeep
(
templateConfigInfo
);
result
.
tasks
.
forEach
((
tack
)
=>
{
if
(
tack
.
id
===
taskId
)
{
let
isCheck
=
true
;
tack
.
parameters
.
filter
((
parameter
)
=>
parameter
.
hidden
===
false
)
.
forEach
((
parameter
)
=>
{
if
(
parameter
.
name
===
parameterName
)
{
parameter
.
value
=
value
;
const
checkResult
=
getCheckResult
(
parameter
,
value
);
parameter
.
error
=
checkResult
.
error
;
parameter
.
helperText
=
checkResult
.
helperText
;
}
if
(
getCheckResult
(
parameter
,
parameter
.
value
).
error
===
true
)
{
isCheck
=
false
;
}
});
tack
.
isCheck
=
isCheck
;
}
else
{
return
;
}
});
setTemplateConfigInfo
(
result
);
};
const
handleSubmitForm
=
()
=>
{
let
check
=
true
;
const
{
name
,
outputPath
,
nameAndOutputPathCheck
}
=
configFormRef
.
current
.
getNameAndPath
();
if
(
!
nameAndOutputPathCheck
)
{
check
=
false
;
}
const
result
:
ITemplateConfig
=
_
.
cloneDeep
(
templateConfigInfo
);
result
.
tasks
.
forEach
((
tack
)
=>
{
tack
.
parameters
.
filter
((
parameter
)
=>
parameter
.
hidden
===
false
)
.
forEach
((
parameter
)
=>
{
const
checkResult
=
getCheckResult
(
parameter
,
parameter
.
value
);
parameter
.
error
=
checkResult
.
error
;
parameter
.
helperText
=
checkResult
.
helperText
;
if
(
checkResult
.
error
)
{
check
=
false
;
}
});
});
setTemplateConfigInfo
(
result
);
if
(
check
)
{
let
promotedParameters
:
any
=
{};
result
.
tasks
.
forEach
((
tack
)
=>
{
tack
.
parameters
.
filter
((
parameter
)
=>
parameter
.
hidden
===
false
)
.
forEach
((
parameter
)
=>
{
let
value
:
string
=
""
;
if
(
Array
.
isArray
(
parameter
.
value
))
{
value
=
parameter
.
value
.
join
(
","
);
}
else
{
value
=
parameter
.
value
;
}
if
(
parameter
.
domType
.
toLowerCase
()
===
"path"
||
parameter
.
domType
.
toLowerCase
()
===
"dataset"
||
parameter
.
domType
.
toLowerCase
()
===
"file"
)
{
if
(
value
===
"ProjectData"
)
{
value
=
"/home/cloudam"
;
}
else
{
value
=
`/home/cloudam
${
value
.
slice
(
11
)}
`
;
}
}
promotedParameters
[
parameter
.
name
]
=
{
[
parameter
.
classTypeName
]:
value
,
};
});
});
submitWorkFlowRun
({
name
,
outputPath
:
outputPath
===
"ProjectData"
?
"/home/cloudam"
:
`/home/cloudam
${
outputPath
.
slice
(
11
)}
`
,
projectId
:
projectId
as
string
,
specId
:
templateConfigInfo
?.
id
as
string
,
promotedParameters
,
});
}
else
{
Message
.
error
(
"请完善左侧表单再提交"
);
}
};
const
handleSubmitForm
=
()
=>
{
let
check
=
true
;
const
{
name
,
outputPath
,
nameAndOutputPathCheck
}
=
configFormRef
.
current
.
getNameAndPath
();
if
(
!
nameAndOutputPathCheck
)
{
check
=
false
;
}
const
result
:
ITemplateConfig
=
_
.
cloneDeep
(
templateConfigInfo
);
result
.
tasks
.
forEach
((
tack
)
=>
{
tack
.
parameters
.
filter
((
parameter
)
=>
parameter
.
hidden
===
false
)
.
forEach
((
parameter
)
=>
{
const
checkResult
=
getCheckResult
(
parameter
,
parameter
.
value
);
parameter
.
error
=
checkResult
.
error
;
parameter
.
helperText
=
checkResult
.
helperText
;
if
(
checkResult
.
error
)
{
check
=
false
;
}
});
});
setTemplateConfigInfo
(
result
);
if
(
check
)
{
let
promotedParameters
:
any
=
{};
result
.
tasks
.
forEach
((
tack
)
=>
{
tack
.
parameters
.
filter
((
parameter
)
=>
parameter
.
hidden
===
false
)
.
forEach
((
parameter
)
=>
{
let
value
:
string
=
""
;
if
(
Array
.
isArray
(
parameter
.
value
))
{
value
=
parameter
.
value
.
join
(
","
);
}
else
{
value
=
parameter
.
value
;
}
if
(
parameter
.
domType
.
toLowerCase
()
===
"path"
||
parameter
.
domType
.
toLowerCase
()
===
"dataset"
||
parameter
.
domType
.
toLowerCase
()
===
"file"
)
{
if
(
value
===
"ProjectData"
)
{
value
=
"/home/cloudam"
;
}
else
{
value
=
`/home/cloudam
${
value
.
slice
(
11
)}
`
;
}
}
promotedParameters
[
parameter
.
name
]
=
{
[
parameter
.
classTypeName
]:
value
,
};
});
});
submitWorkFlowRun
({
name
,
outputPath
:
outputPath
===
"ProjectData"
?
"/home/cloudam"
:
`/home/cloudam
${
outputPath
.
slice
(
11
)}
`
,
projectId
:
projectId
as
string
,
specId
:
templateConfigInfo
?.
id
as
string
,
promotedParameters
,
});
}
else
{
Message
.
error
(
"请完善左侧表单再提交"
);
}
};
return
(
<
div
className=
{
styles
.
swBox
}
>
{
fullScreenShow
?
null
:
(
<
div
className=
{
styles
.
swHeader
}
>
<
div
className=
{
styles
.
swHeaderLeft
}
>
<
MyPopconfirm
title=
"返回后,当前页面已填写内容将不保存,确认返回吗?"
onConfirm=
{
handleGoBack
}
>
<
IconButton
color=
"primary"
// onClick=
{()
=
>
handleGoBack()}
aria-label="upload picture"
component="span"
size="small"
>
<
ArrowBackIosNewIcon
sx=
{
{
color
:
"rgba(194, 198, 204, 1)"
,
width
:
"12px"
,
height
:
"12px"
,
}
}
/>
</
IconButton
>
</
MyPopconfirm
>
return
(
<
div
className=
{
styles
.
swBox
}
>
{
fullScreenShow
?
null
:
(
<
div
className=
{
styles
.
swHeader
}
>
<
div
className=
{
styles
.
swHeaderLeft
}
>
<
MyPopconfirm
title=
"返回后,当前页面已填写内容将不保存,确认返回吗?"
onConfirm=
{
handleGoBack
}
>
<
IconButton
color=
"primary"
// onClick=
{()
=
>
handleGoBack()}
aria-label="upload picture"
component="span"
size="small"
>
<
ArrowBackIosNewIcon
sx=
{
{
color
:
"rgba(194, 198, 204, 1)"
,
width
:
"12px"
,
height
:
"12px"
,
}
}
/>
</
IconButton
>
</
MyPopconfirm
>
<
div
className=
{
styles
.
swTemplateTitle
}
>
{
templateConfigInfo
?.
title
}
</
div
>
<
div
className=
{
styles
.
swTemplateVersionBox
}
>
<
span
className=
{
styles
.
swHeaderLable
}
>
版本:
</
span
>
<
span
className=
{
styles
.
swHeaderValue
}
>
{
templateConfigInfo
?.
languageV
ersion
}
</
span
>
</
div
>
<
div
className=
{
styles
.
swTemplateUpdateTimeBox
}
>
<
span
className=
{
styles
.
swHeaderLable
}
>
更新时间:
</
span
>
<
span
className=
{
styles
.
swHeaderValue
}
>
{
templateConfigInfo
?.
updateTime
?
moment
(
templateConfigInfo
?.
updateTime
).
format
(
"YYYY-MM-DD HH:mm:ss"
)
:
"-"
}
</
span
>
</
div
>
<
div
className=
{
styles
.
swHeaderGoback
}
></
div
>
</
div
>
<
div
className=
{
styles
.
swHeaderRight
}
>
<
MyPopconfirm
title=
"提交前请先确认参数填写无误,确认提交吗?"
onConfirm=
{
handleSubmitForm
}
>
<
ButtonComponent
text=
"提交任务"
// click=
{
handleSubmitForm
}
></
ButtonComponent
>
</
MyPopconfirm
>
</
div
>
</
div
>
)
}
<
div
className=
{
styles
.
swContent
}
>
{
fullScreenShow
?
null
:
(
<
div
className=
{
styles
.
swFormBox
}
>
<
ConfigForm
onRef=
{
configFormRef
}
templateConfigInfo=
{
templateConfigInfo
}
setParameter=
{
setParameter
}
setSelectedNodeId=
{
setSelectedNodeId
}
/>
</
div
>
)
}
<
div
className=
{
styles
.
swFlowBox
}
style=
{
fullScreenShow
?
{
height
:
"100vh"
}
:
undefined
}
>
<
WorkFlow
templateConfigInfo=
{
templateConfigInfo
}
setSelectedNodeId=
{
setSelectedNodeId
}
selectedNodeId=
{
selectedNodeId
}
/>
</
div
>
</
div
>
<
img
className=
{
styles
.
fullScreenBox
}
src=
{
fullScreenShow
?
partialScreen
:
fullScreen
}
onClick=
{
()
=>
setFullScreenShow
(
!
fullScreenShow
)
}
alt=
"全屏"
/>
</
div
>
);
<
div
className=
{
styles
.
swTemplateTitle
}
>
{
templateConfigInfo
?.
title
}
</
div
>
<
div
className=
{
styles
.
swTemplateVersionBox
}
>
<
span
className=
{
styles
.
swHeaderLable
}
>
版本:
</
span
>
<
span
className=
{
styles
.
swHeaderValue
}
>
{
templateConfigInfo
?.
v
ersion
}
</
span
>
</
div
>
<
div
className=
{
styles
.
swTemplateUpdateTimeBox
}
>
<
span
className=
{
styles
.
swHeaderLable
}
>
更新时间:
</
span
>
<
span
className=
{
styles
.
swHeaderValue
}
>
{
templateConfigInfo
?.
updateTime
?
moment
(
templateConfigInfo
?.
updateTime
).
format
(
"YYYY-MM-DD HH:mm:ss"
)
:
"-"
}
</
span
>
</
div
>
<
div
className=
{
styles
.
swHeaderGoback
}
></
div
>
</
div
>
<
div
className=
{
styles
.
swHeaderRight
}
>
<
MyPopconfirm
title=
"提交前请先确认参数填写无误,确认提交吗?"
onConfirm=
{
handleSubmitForm
}
>
<
ButtonComponent
text=
"提交任务"
// click=
{
handleSubmitForm
}
></
ButtonComponent
>
</
MyPopconfirm
>
</
div
>
</
div
>
)
}
<
div
className=
{
styles
.
swContent
}
>
{
fullScreenShow
?
null
:
(
<
div
className=
{
styles
.
swFormBox
}
>
<
ConfigForm
onRef=
{
configFormRef
}
templateConfigInfo=
{
templateConfigInfo
}
setParameter=
{
setParameter
}
setSelectedNodeId=
{
setSelectedNodeId
}
/>
</
div
>
)
}
<
div
className=
{
styles
.
swFlowBox
}
style=
{
fullScreenShow
?
{
height
:
"100vh"
}
:
undefined
}
>
<
WorkFlow
templateConfigInfo=
{
templateConfigInfo
}
setSelectedNodeId=
{
setSelectedNodeId
}
selectedNodeId=
{
selectedNodeId
}
/>
</
div
>
</
div
>
<
img
className=
{
styles
.
fullScreenBox
}
src=
{
fullScreenShow
?
partialScreen
:
fullScreen
}
onClick=
{
()
=>
setFullScreenShow
(
!
fullScreenShow
)
}
alt=
"全屏"
/>
</
div
>
);
};
export
default
ProjectSubmitWork
;
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