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
2cfbf2e2
Commit
2cfbf2e2
authored
Jul 06, 2022
by
吴永生#A02208
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 算子列表开发
parent
82b14568
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
1179 additions
and
1032 deletions
+1179
-1032
index.tsx
src/views/Project/ProjectJobDetail/index.tsx
+525
-526
index.tsx
...iews/Project/ProjectWorkbench/workbenchTemplate/index.tsx
+229
-223
interface.tsx
.../Project/ProjectWorkbench/workbenchTemplate/interface.tsx
+13
-0
index.tsx
src/views/Project/components/Flow/index.tsx
+300
-279
index.module.css
...ews/WorkFlowEdit/components/OperatorList/index.module.css
+35
-0
index.tsx
src/views/WorkFlowEdit/components/OperatorList/index.tsx
+60
-0
interface.ts
src/views/WorkFlowEdit/components/OperatorList/interface.ts
+12
-0
index.module.css
src/views/WorkFlowEdit/index.module.css
+2
-2
index.tsx
src/views/WorkFlowEdit/index.tsx
+3
-2
No files found.
src/views/Project/ProjectJobDetail/index.tsx
View file @
2cfbf2e2
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-06-21 20:03:56
* @Date: 2022-06-21 20:03:56
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-07-06 1
1:01:44
* @LastEditTime: 2022-07-06 1
7:05:13
* @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
*/
*/
...
@@ -39,560 +39,559 @@ import { storageUnitFromB } from "@/utils/util";
...
@@ -39,560 +39,559 @@ import { storageUnitFromB } from "@/utils/util";
import
styles
from
"./index.module.css"
;
import
styles
from
"./index.module.css"
;
const
stateMap
=
{
const
stateMap
=
{
RUNNING
:
"正在运行"
,
RUNNING
:
"正在运行"
,
ABORTED
:
"运行终止"
,
ABORTED
:
"运行终止"
,
FAILED
:
"运行失败"
,
FAILED
:
"运行失败"
,
SUCCEEDED
:
"运行成功"
,
SUCCEEDED
:
"运行成功"
,
};
};
const
statusMap
=
{
const
statusMap
=
{
Done
:
"运行完成"
,
Done
:
"运行完成"
,
Running
:
"正在运行"
,
Running
:
"正在运行"
,
Failed
:
"运行失败"
,
Failed
:
"运行失败"
,
Pending
:
"等待运行"
,
Pending
:
"等待运行"
,
};
};
type
IStatus
=
"Done"
|
"Running"
|
"Failed"
|
"Pending"
;
type
IStatus
=
"Done"
|
"Running"
|
"Failed"
|
"Pending"
;
let
randerOutputs
:
Array
<
any
>
=
[];
let
randerOutputs
:
Array
<
any
>
=
[];
const
ProjectSubmitWork
=
observer
(()
=>
{
const
ProjectSubmitWork
=
observer
(()
=>
{
const
{
currentProjectStore
}
=
useStores
();
const
{
currentProjectStore
}
=
useStores
();
const
fileToken
=
toJS
(
currentProjectStore
.
currentProjectInfo
.
filetoken
);
const
fileToken
=
toJS
(
currentProjectStore
.
currentProjectInfo
.
filetoken
);
const
projectId
=
toJS
(
currentProjectStore
.
currentProjectInfo
.
id
);
const
projectId
=
toJS
(
currentProjectStore
.
currentProjectInfo
.
id
);
const
[
workFlowJobInfo
,
setWorkFlowJobInfo
]
=
useState
<
ITaskInfo
>
();
const
[
workFlowJobInfo
,
setWorkFlowJobInfo
]
=
useState
<
ITaskInfo
>
();
const
[
patchInfo
,
setPatchInfo
]
=
useState
<
any
>
();
const
[
patchInfo
,
setPatchInfo
]
=
useState
<
any
>
();
const
[
activePatchId
,
setActivePatchId
]
=
useState
<
string
>
(
""
);
const
[
activePatchId
,
setActivePatchId
]
=
useState
<
string
>
(
""
);
const
[
overviewActive
,
setOverviewActive
]
=
useState
(
true
);
const
[
overviewActive
,
setOverviewActive
]
=
useState
(
true
);
const
[
activeFlowIndex
,
setActiveFlowIndex
]
=
useState
<
number
>
(
0
);
const
[
activeFlowIndex
,
setActiveFlowIndex
]
=
useState
<
number
>
(
0
);
const
[
showOptions
,
setShowOptions
]
=
useState
<
boolean
>
(
false
);
const
[
showOptions
,
setShowOptions
]
=
useState
<
boolean
>
(
false
);
const
[
randerOutputs1
,
setRanderOutputs
]
=
useState
<
Array
<
any
>>
([]);
const
[
randerOutputs1
,
setRanderOutputs
]
=
useState
<
Array
<
any
>>
([]);
const
location
:
any
=
useLocation
();
const
location
:
any
=
useLocation
();
const
navigate
=
useNavigate
();
const
navigate
=
useNavigate
();
const
message
=
useMessage
();
const
message
=
useMessage
();
const
[
fullScreenShow
,
setFullScreenShow
]
=
useState
<
boolean
>
(
false
);
const
[
fullScreenShow
,
setFullScreenShow
]
=
useState
<
boolean
>
(
false
);
const
{
name
,
state
}
=
workFlowJobInfo
||
{};
const
{
name
,
state
}
=
workFlowJobInfo
||
{};
/** 获取模版数据 */
/** 获取模版数据 */
const
{
run
}
=
useMyRequest
(
fetchWorkFlowJob
,
{
const
{
run
}
=
useMyRequest
(
fetchWorkFlowJob
,
{
pollingInterval
:
1000
*
60
,
pollingInterval
:
1000
*
60
,
pollingWhenHidden
:
false
,
pollingWhenHidden
:
false
,
onSuccess
:
(
res
:
IResponse
<
ITaskInfo
>
)
=>
{
onSuccess
:
(
res
:
IResponse
<
ITaskInfo
>
)
=>
{
getOutouts
(
res
.
data
.
outputs
);
getOutouts
(
res
.
data
.
outputs
);
setWorkFlowJobInfo
(
res
.
data
);
setWorkFlowJobInfo
(
res
.
data
);
},
},
});
});
useEffect
(()
=>
{
useEffect
(()
=>
{
const
locationInfo
:
any
=
location
?.
state
;
const
locationInfo
:
any
=
location
?.
state
;
console
.
log
(
333
)
run
({
run
({
id
:
locationInfo
.
taskId
,
id
:
locationInfo
.
taskId
,
});
});
},
[
location
?.
state
,
run
]);
},
[
location
?.
state
,
run
]);
const
{
run
:
getworkFlowTaskInfoRun
}
=
useMyRequest
(
getworkFlowTaskInfo
,
{
const
{
run
:
getworkFlowTaskInfoRun
}
=
useMyRequest
(
getworkFlowTaskInfo
,
{
onSuccess
:
(
res
)
=>
{
onSuccess
:
(
res
)
=>
{
setPatchInfo
(
res
.
data
);
setPatchInfo
(
res
.
data
);
},
},
});
});
const
goToProjectData
=
(
path
:
string
)
=>
{
const
goToProjectData
=
(
path
:
string
)
=>
{
path
=
path
.
slice
(
13
);
path
=
path
.
slice
(
13
);
if
(
path
)
{
if
(
path
)
{
navigate
(
`/product/cadd/projectData`
,
{
navigate
(
`/product/cadd/projectData`
,
{
state
:
{
pathName
:
path
},
state
:
{
pathName
:
path
},
});
});
}
}
};
};
/** 返回事件 */
/** 返回事件 */
const
onBack
=
useCallback
(()
=>
{
const
onBack
=
useCallback
(()
=>
{
navigate
(
'/product/cadd/projectWorkbench'
,
{
navigate
(
"/product/cadd/projectWorkbench"
,
{
state
:
{
type
:
'workbenchList'
}
state
:
{
type
:
"workbenchList"
},
})
});
},[
navigate
])
},
[
navigate
]);
const
outputPathTransform
=
(
path
:
string
)
=>
{
const
outputPathTransform
=
(
path
:
string
)
=>
{
path
=
path
.
slice
(
13
);
path
=
path
.
slice
(
13
);
return
`ProjectData
${
path
}
`
;
return
`ProjectData
${
path
}
`
;
};
};
const
getOutouts
=
(
outputs
:
any
)
=>
{
const
getOutouts
=
(
outputs
:
any
)
=>
{
if
(
outputs
)
{
if
(
outputs
)
{
let
result
=
Object
.
keys
(
outputs
);
let
result
=
Object
.
keys
(
outputs
);
let
arr
=
result
.
map
((
item
)
=>
{
let
arr
=
result
.
map
((
item
)
=>
{
let
type
=
"file"
;
let
type
=
"file"
;
if
(
outputs
[
item
].
indexOf
(
"dataset"
)
!==
-
1
)
{
if
(
outputs
[
item
].
indexOf
(
"dataset"
)
!==
-
1
)
{
type
=
"dataset"
;
type
=
"dataset"
;
}
}
return
{
return
{
name
:
item
,
name
:
item
,
type
,
type
,
path
:
outputs
[
item
],
path
:
outputs
[
item
],
size
:
0
,
size
:
0
,
};
};
});
});
arr
.
forEach
(
async
(
item
,
index
)
=>
{
arr
.
forEach
(
async
(
item
,
index
)
=>
{
if
(
item
.
type
===
"dataset"
)
{
if
(
item
.
type
===
"dataset"
)
{
await
getDataSetSize
(
item
,
index
);
await
getDataSetSize
(
item
,
index
);
}
else
{
}
else
{
await
getFileSize
(
item
,
index
);
await
getFileSize
(
item
,
index
);
}
}
});
});
randerOutputs
=
arr
;
randerOutputs
=
arr
;
setRanderOutputs
([...
randerOutputs
]);
setRanderOutputs
([...
randerOutputs
]);
}
else
{
}
else
{
randerOutputs
=
[];
randerOutputs
=
[];
setRanderOutputs
([]);
setRanderOutputs
([]);
}
}
};
};
const
getDataSetSize
=
async
(
item
:
any
,
index
:
number
)
=>
{
const
getDataSetSize
=
async
(
item
:
any
,
index
:
number
)
=>
{
let
path
=
item
.
path
.
slice
(
13
);
let
path
=
item
.
path
.
slice
(
13
);
const
lastIndex
=
path
.
lastIndexOf
(
"/"
);
const
lastIndex
=
path
.
lastIndexOf
(
"/"
);
if
(
lastIndex
===
-
1
)
{
if
(
lastIndex
===
-
1
)
{
path
=
"/"
;
path
=
"/"
;
}
else
{
}
else
{
path
=
path
.
slice
(
0
,
lastIndex
+
1
);
path
=
path
.
slice
(
0
,
lastIndex
+
1
);
}
}
const
res
=
await
getDataFind
({
const
res
=
await
getDataFind
({
projectId
:
projectId
as
string
,
projectId
:
projectId
as
string
,
path
:
path
,
path
:
path
,
});
});
res
.
data
.
forEach
((
item1
:
any
)
=>
{
res
.
data
.
forEach
((
item1
:
any
)
=>
{
if
(
item1
.
name
===
item
.
path
.
slice
(
item
.
path
.
lastIndexOf
(
"/"
)
+
1
))
{
if
(
item1
.
name
===
item
.
path
.
slice
(
item
.
path
.
lastIndexOf
(
"/"
)
+
1
))
{
randerOutputs
[
index
].
size
=
`
${
item1
.
size
}
条`
;
randerOutputs
[
index
].
size
=
`
${
item1
.
size
}
条`
;
setRanderOutputs
([...
randerOutputs
]);
setRanderOutputs
([...
randerOutputs
]);
}
}
});
});
};
};
const
getFileSize
=
(
item
:
any
,
index
:
number
)
=>
{
const
getFileSize
=
(
item
:
any
,
index
:
number
)
=>
{
let
path
=
item
.
path
.
slice
(
13
);
let
path
=
item
.
path
.
slice
(
13
);
const
lastIndex
=
path
.
lastIndexOf
(
"/"
);
const
lastIndex
=
path
.
lastIndexOf
(
"/"
);
if
(
lastIndex
===
-
1
)
{
if
(
lastIndex
===
-
1
)
{
path
=
"/"
;
path
=
"/"
;
}
else
{
}
else
{
path
=
path
.
slice
(
0
,
lastIndex
+
1
);
path
=
path
.
slice
(
0
,
lastIndex
+
1
);
}
}
CloudEController
.
JobOutFileList
(
CloudEController
.
JobOutFileList
(
path
,
path
,
fileToken
as
string
,
fileToken
as
string
,
projectId
as
string
,
projectId
as
string
,
false
false
)?.
then
((
res
)
=>
{
)?.
then
((
res
)
=>
{
if
(
Array
.
isArray
(
res
.
data
))
{
if
(
Array
.
isArray
(
res
.
data
))
{
res
.
data
.
forEach
((
item1
)
=>
{
res
.
data
.
forEach
((
item1
)
=>
{
if
(
item1
.
name
===
item
.
path
.
slice
(
item
.
path
.
lastIndexOf
(
"/"
)
+
1
))
{
if
(
item1
.
name
===
item
.
path
.
slice
(
item
.
path
.
lastIndexOf
(
"/"
)
+
1
))
{
randerOutputs
[
index
].
size
=
`
${
randerOutputs
[
index
].
size
=
`
${
item1
.
size
?
storageUnitFromB
(
Number
(
item1
.
size
))
:
"-"
item1
.
size
?
storageUnitFromB
(
Number
(
item1
.
size
))
:
"-"
}
`
;
}
`
;
setRanderOutputs
([...
randerOutputs
]);
setRanderOutputs
([...
randerOutputs
]);
}
}
});
});
}
}
});
});
};
};
// 取消作业
// 取消作业
const
{
run
:
cancelWorkJob
}
=
useMyRequest
(
cancelWorkflowJob
,
{
const
{
run
:
cancelWorkJob
}
=
useMyRequest
(
cancelWorkflowJob
,
{
onSuccess
:
(
res
:
IResponse
<
boolean
>
)
=>
{
onSuccess
:
(
res
:
IResponse
<
boolean
>
)
=>
{
const
{
errorCode
}
=
res
;
const
{
errorCode
}
=
res
;
if
(
errorCode
===
0
)
{
if
(
errorCode
===
0
)
{
message
.
success
(
"操作成功!"
);
message
.
success
(
"操作成功!"
);
}
}
onBack
()
onBack
();
},
},
});
});
// 取消作业
// 取消作业
const
{
run
:
deleteWorkJob
}
=
useMyRequest
(
deleteWorkflowJob
,
{
const
{
run
:
deleteWorkJob
}
=
useMyRequest
(
deleteWorkflowJob
,
{
onSuccess
:
(
res
:
IResponse
<
boolean
>
)
=>
{
onSuccess
:
(
res
:
IResponse
<
boolean
>
)
=>
{
const
{
errorCode
}
=
res
;
const
{
errorCode
}
=
res
;
if
(
errorCode
===
0
)
{
if
(
errorCode
===
0
)
{
message
.
success
(
"操作成功!"
);
message
.
success
(
"操作成功!"
);
}
}
onBack
()
onBack
();
},
},
});
});
const
handleBatch
=
(
id
:
string
)
=>
{
const
handleBatch
=
(
id
:
string
)
=>
{
setActivePatchId
(
id
);
setActivePatchId
(
id
);
if
(
id
)
{
if
(
id
)
{
setActiveFlowIndex
(
0
);
setActiveFlowIndex
(
0
);
getworkFlowTaskInfoRun
({
getworkFlowTaskInfoRun
({
jobId
:
workFlowJobInfo
?.
id
as
string
,
jobId
:
workFlowJobInfo
?.
id
as
string
,
taskId
:
id
,
taskId
:
id
,
});
});
}
}
};
};
const
randerParameters
=
useMemo
(()
=>
{
const
randerParameters
=
useMemo
(()
=>
{
if
(
patchInfo
?.
children
)
{
if
(
patchInfo
?.
children
)
{
if
(
patchInfo
.
children
.
length
>
0
)
{
if
(
patchInfo
.
children
.
length
>
0
)
{
return
patchInfo
.
children
[
activeFlowIndex
].
parameters
;
return
patchInfo
.
children
[
activeFlowIndex
].
parameters
;
}
else
{
}
else
{
return
patchInfo
?.
parameters
;
return
patchInfo
?.
parameters
;
}
}
}
else
{
}
else
{
return
patchInfo
?.
parameters
;
return
patchInfo
?.
parameters
;
}
}
},
[
activeFlowIndex
,
patchInfo
]);
},
[
activeFlowIndex
,
patchInfo
]);
const
handleParams
=
()
=>
{
const
handleParams
=
()
=>
{
setOverviewActive
(
false
);
setOverviewActive
(
false
);
setShowOptions
(
!
showOptions
);
setShowOptions
(
!
showOptions
);
};
};
const
handleDownLoad
=
(
path
:
string
)
=>
{
const
handleDownLoad
=
(
path
:
string
)
=>
{
if
(
path
.
indexOf
(
"/home/cloudam"
)
!==
-
1
)
{
if
(
path
.
indexOf
(
"/home/cloudam"
)
!==
-
1
)
{
path
=
path
.
slice
(
13
);
path
=
path
.
slice
(
13
);
}
}
CloudEController
.
JobFileDownload
(
CloudEController
.
JobFileDownload
(
path
,
path
,
fileToken
as
string
,
fileToken
as
string
,
projectId
as
string
projectId
as
string
);
);
};
};
/** 终止任务 */
/** 终止任务 */
const
onStopJob
=
useCallback
(()
=>
{
const
onStopJob
=
useCallback
(()
=>
{
cancelWorkJob
({
cancelWorkJob
({
jobid
:
workFlowJobInfo
?.
id
||
""
,
jobid
:
workFlowJobInfo
?.
id
||
""
,
});
});
},
[
cancelWorkJob
,
workFlowJobInfo
?.
id
]);
},
[
cancelWorkJob
,
workFlowJobInfo
?.
id
]);
/** 删除任务 */
/** 删除任务 */
const
onDeleteJob
=
useCallback
(()
=>
{
const
onDeleteJob
=
useCallback
(()
=>
{
deleteWorkJob
({
deleteWorkJob
({
id
:
workFlowJobInfo
?.
id
||
""
,
id
:
workFlowJobInfo
?.
id
||
""
,
});
});
},
[
deleteWorkJob
,
workFlowJobInfo
?.
id
]);
},
[
deleteWorkJob
,
workFlowJobInfo
?.
id
]);
return
(
return
(
<
div
className=
{
styles
.
swBox
}
>
<
div
className=
{
styles
.
swBox
}
>
{
fullScreenShow
?
null
:
(
{
fullScreenShow
?
null
:
(
<
div
className=
{
styles
.
swHeader
}
>
<
div
className=
{
styles
.
swHeader
}
>
<
div
className=
{
styles
.
swHeaderLeft
}
>
<
div
className=
{
styles
.
swHeaderLeft
}
>
<
IconButton
<
IconButton
color=
"primary"
color=
"primary"
onClick=
{
onBack
}
onClick=
{
onBack
}
aria
-
label=
"upload picture"
aria
-
label=
"upload picture"
component=
"span"
component=
"span"
size=
"small"
size=
"small"
>
>
<
ArrowBackIosNewIcon
<
ArrowBackIosNewIcon
sx=
{
{
sx=
{
{
color
:
"rgba(194, 198, 204, 1)"
,
color
:
"rgba(194, 198, 204, 1)"
,
width
:
"12px"
,
width
:
"12px"
,
height
:
"12px"
,
height
:
"12px"
,
}
}
}
}
/>
/>
</
IconButton
>
</
IconButton
>
<
div
className=
{
styles
.
swTemplateTitle
}
>
{
name
}
</
div
>
<
div
className=
{
styles
.
swTemplateTitle
}
>
{
name
}
</
div
>
</
div
>
</
div
>
<
div
className=
{
styles
.
swHeaderRight
}
>
<
div
className=
{
styles
.
swHeaderRight
}
>
<
MyPopconfirm
<
MyPopconfirm
title=
{
title=
{
state
===
"RUNNING"
state
===
"RUNNING"
?
"正在运行的任务终止后将无法重新运行,确认继续吗?"
?
"正在运行的任务终止后将无法重新运行,确认继续吗?"
:
"任务被删除后将无法恢复,确认继续吗?"
:
"任务被删除后将无法恢复,确认继续吗?"
}
}
onConfirm=
{
()
=>
{
onConfirm=
{
()
=>
{
state
===
"RUNNING"
?
onStopJob
()
:
onDeleteJob
();
state
===
"RUNNING"
?
onStopJob
()
:
onDeleteJob
();
}
}
}
}
>
>
<
ButtonComponent
<
ButtonComponent
text=
{
state
===
"RUNNING"
?
"终止"
:
"删除"
}
text=
{
state
===
"RUNNING"
?
"终止"
:
"删除"
}
variant=
"outlined"
variant=
"outlined"
color=
"secondary"
color=
"secondary"
// click=
{
onStopJob
}
// click=
{
onStopJob
}
></
ButtonComponent
>
></
ButtonComponent
>
</
MyPopconfirm
>
</
MyPopconfirm
>
</
div
>
</
div
>
</
div
>
</
div
>
)
}
)
}
<
div
className=
{
styles
.
swContent
}
>
<
div
className=
{
styles
.
swContent
}
>
{
fullScreenShow
?
null
:
(
{
fullScreenShow
?
null
:
(
<
div
className=
{
styles
.
swFormBox
}
>
<
div
className=
{
styles
.
swFormBox
}
>
{
!
activePatchId
&&
(
{
!
activePatchId
&&
(
<
div
className=
{
styles
.
taskInfo
}
>
<
div
className=
{
styles
.
taskInfo
}
>
<
div
className=
{
styles
.
title
}
>
任务结果
</
div
>
<
div
className=
{
styles
.
title
}
>
任务结果
</
div
>
{
workFlowJobInfo
?.
outputs
&&
(
{
workFlowJobInfo
?.
outputs
&&
(
<
div
className=
{
styles
.
taskResults
}
>
<
div
className=
{
styles
.
taskResults
}
>
{
randerOutputs1
.
map
((
item
,
index
)
=>
{
{
randerOutputs1
.
map
((
item
,
index
)
=>
{
return
(
return
(
<
div
key=
{
index
}
className=
{
styles
.
outputLi
}
>
<
div
key=
{
index
}
className=
{
styles
.
outputLi
}
>
<
MyPopconfirm
<
MyPopconfirm
title=
"即将跳转至项目数据内该任务的结果目录,确认继续吗?"
title=
"即将跳转至项目数据内该任务的结果目录,确认继续吗?"
onConfirm=
{
()
=>
goToProjectData
(
item
.
path
)
}
onConfirm=
{
()
=>
goToProjectData
(
item
.
path
)
}
>
>
<
div
className=
{
styles
.
outputLiLeft
}
>
<
div
className=
{
styles
.
outputLiLeft
}
>
<
img
<
img
className=
{
styles
.
outputLiLeftImg
}
className=
{
styles
.
outputLiLeftImg
}
src=
{
src=
{
item
.
type
===
"file"
?
fileIcon
:
dataSetIcon
item
.
type
===
"file"
?
fileIcon
:
dataSetIcon
}
}
alt=
""
alt=
""
/>
/>
{
item
.
name
}
{
item
.
name
}
</
div
>
</
div
>
</
MyPopconfirm
>
</
MyPopconfirm
>
<
span
className=
{
styles
.
outputLiRight
}
>
<
span
className=
{
styles
.
outputLiRight
}
>
{
item
.
size
}
{
item
.
size
}
</
span
>
</
span
>
</
div
>
</
div
>
);
);
})
}
})
}
</
div
>
</
div
>
)
}
)
}
{
!
workFlowJobInfo
?.
outputs
&&
(
{
!
workFlowJobInfo
?.
outputs
&&
(
<
div
className=
{
styles
.
notResults
}
>
暂无结果文件
</
div
>
<
div
className=
{
styles
.
notResults
}
>
暂无结果文件
</
div
>
)
}
)
}
<
div
className=
{
styles
.
title
}
>
任务信息
</
div
>
<
div
className=
{
styles
.
title
}
>
任务信息
</
div
>
<
div
className=
{
styles
.
taskInfoLi
}
>
<
div
className=
{
styles
.
taskInfoLi
}
>
<
div
className=
{
styles
.
taskInfoParams
}
>
任务名称
</
div
>
<
div
className=
{
styles
.
taskInfoParams
}
>
任务名称
</
div
>
<
div
className=
{
styles
.
taskInfoValue
}
title=
{
name
}
>
<
div
className=
{
styles
.
taskInfoValue
}
title=
{
name
}
>
{
name
||
"-"
}
{
name
||
"-"
}
</
div
>
</
div
>
</
div
>
</
div
>
<
div
className=
{
styles
.
taskInfoLi
}
>
<
div
className=
{
styles
.
taskInfoLi
}
>
<
div
className=
{
styles
.
taskInfoParams
}
>
任务ID
</
div
>
<
div
className=
{
styles
.
taskInfoParams
}
>
任务ID
</
div
>
<
div
<
div
className=
{
styles
.
taskInfoValue
}
className=
{
styles
.
taskInfoValue
}
title=
{
workFlowJobInfo
?.
id
}
title=
{
workFlowJobInfo
?.
id
}
>
>
{
workFlowJobInfo
?.
id
||
"-"
}
{
workFlowJobInfo
?.
id
||
"-"
}
</
div
>
</
div
>
</
div
>
</
div
>
<
div
className=
{
styles
.
taskInfoLi
}
>
<
div
className=
{
styles
.
taskInfoLi
}
>
<
div
className=
{
styles
.
taskInfoParams
}
>
输出路径
</
div
>
<
div
className=
{
styles
.
taskInfoParams
}
>
输出路径
</
div
>
<
div
<
div
className=
{
classNames
({
className=
{
classNames
({
[
styles
.
taskInfoValue
]:
true
,
[
styles
.
taskInfoValue
]:
true
,
[
styles
.
taskInfoValueClick
]:
true
,
[
styles
.
taskInfoValueClick
]:
true
,
})
}
})
}
onClick=
{
()
=>
onClick=
{
()
=>
goToProjectData
(
workFlowJobInfo
?.
outputPath
as
string
)
goToProjectData
(
workFlowJobInfo
?.
outputPath
as
string
)
}
}
>
>
{
workFlowJobInfo
?.
outputPath
{
workFlowJobInfo
?.
outputPath
?
outputPathTransform
(
workFlowJobInfo
?.
outputPath
)
?
outputPathTransform
(
workFlowJobInfo
?.
outputPath
)
:
"-"
}
:
"-"
}
</
div
>
</
div
>
</
div
>
</
div
>
<
div
className=
{
styles
.
taskInfoLi
}
>
<
div
className=
{
styles
.
taskInfoLi
}
>
<
div
className=
{
styles
.
taskInfoParams
}
>
运行状态
</
div
>
<
div
className=
{
styles
.
taskInfoParams
}
>
运行状态
</
div
>
<
div
className=
{
styles
.
taskInfoValue
}
>
<
div
className=
{
styles
.
taskInfoValue
}
>
{
state
===
"SUCCEEDED"
&&
(
{
state
===
"SUCCEEDED"
&&
(
<
img
<
img
className=
{
styles
.
taskInfoValueIcon
}
className=
{
styles
.
taskInfoValueIcon
}
src=
{
jobSue
}
src=
{
jobSue
}
alt=
""
alt=
""
/>
/>
)
}
)
}
{
state
===
"RUNNING"
&&
(
{
state
===
"RUNNING"
&&
(
<
img
<
img
className=
{
styles
.
taskInfoValueIcon
}
className=
{
styles
.
taskInfoValueIcon
}
src=
{
jobRun
}
src=
{
jobRun
}
alt=
""
alt=
""
/>
/>
)
}
)
}
{
state
===
"ABORTED"
&&
(
{
state
===
"ABORTED"
&&
(
<
img
<
img
className=
{
styles
.
taskInfoValueIcon
}
className=
{
styles
.
taskInfoValueIcon
}
src=
{
jobStop
}
src=
{
jobStop
}
alt=
""
alt=
""
/>
/>
)
}
)
}
{
state
===
"FAILED"
&&
(
{
state
===
"FAILED"
&&
(
<
img
<
img
className=
{
styles
.
taskInfoValueIcon
}
className=
{
styles
.
taskInfoValueIcon
}
src=
{
jobFail
}
src=
{
jobFail
}
alt=
""
alt=
""
/>
/>
)
}
)
}
{
state
?
stateMap
[
state
]
:
"-"
}
{
state
?
stateMap
[
state
]
:
"-"
}
</
div
>
</
div
>
</
div
>
</
div
>
<
div
className=
{
styles
.
taskInfoLi
}
>
<
div
className=
{
styles
.
taskInfoLi
}
>
<
div
className=
{
styles
.
taskInfoParams
}
>
源模板
</
div
>
<
div
className=
{
styles
.
taskInfoParams
}
>
源模板
</
div
>
<
div
className=
{
styles
.
taskInfoValue
}
>
<
div
className=
{
styles
.
taskInfoValue
}
>
{
workFlowJobInfo
?.
specTitle
||
"-"
}
{
workFlowJobInfo
?.
specTitle
||
"-"
}
</
div
>
</
div
>
</
div
>
</
div
>
<
div
className=
{
styles
.
taskInfoLi
}
>
<
div
className=
{
styles
.
taskInfoLi
}
>
<
div
className=
{
styles
.
taskInfoParams
}
>
源模板版本
</
div
>
<
div
className=
{
styles
.
taskInfoParams
}
>
源模板版本
</
div
>
<
div
className=
{
styles
.
taskInfoValue
}
>
<
div
className=
{
styles
.
taskInfoValue
}
>
{
workFlowJobInfo
?.
specVersion
||
"-"
}
{
workFlowJobInfo
?.
specVersion
||
"-"
}
</
div
>
</
div
>
</
div
>
</
div
>
<
div
className=
{
styles
.
taskInfoLi
}
>
<
div
className=
{
styles
.
taskInfoLi
}
>
<
div
className=
{
styles
.
taskInfoParams
}
>
花费(元)
</
div
>
<
div
className=
{
styles
.
taskInfoParams
}
>
花费(元)
</
div
>
<
div
className=
{
styles
.
taskInfoValue
}
>
<
div
className=
{
styles
.
taskInfoValue
}
>
{
workFlowJobInfo
?.
jobCost
||
"-"
}
{
workFlowJobInfo
?.
jobCost
||
"-"
}
</
div
>
</
div
>
</
div
>
</
div
>
<
div
className=
{
styles
.
taskInfoLi
}
>
<
div
className=
{
styles
.
taskInfoLi
}
>
<
div
className=
{
styles
.
taskInfoParams
}
>
创建人
</
div
>
<
div
className=
{
styles
.
taskInfoParams
}
>
创建人
</
div
>
<
div
className=
{
styles
.
taskInfoValue
}
>
<
div
className=
{
styles
.
taskInfoValue
}
>
{
workFlowJobInfo
?.
creator
||
"-"
}
{
workFlowJobInfo
?.
creator
||
"-"
}
</
div
>
</
div
>
</
div
>
</
div
>
<
div
className=
{
styles
.
taskInfoLi
}
>
<
div
className=
{
styles
.
taskInfoLi
}
>
<
div
className=
{
styles
.
taskInfoParams
}
>
创建时间
</
div
>
<
div
className=
{
styles
.
taskInfoParams
}
>
创建时间
</
div
>
<
div
className=
{
styles
.
taskInfoValue
}
>
<
div
className=
{
styles
.
taskInfoValue
}
>
{
workFlowJobInfo
?.
createTime
||
"-"
}
{
workFlowJobInfo
?.
createTime
||
"-"
}
</
div
>
</
div
>
</
div
>
</
div
>
<
div
className=
{
styles
.
taskInfoLi
}
>
<
div
className=
{
styles
.
taskInfoLi
}
>
<
div
className=
{
styles
.
taskInfoParams
}
>
运行时间
</
div
>
<
div
className=
{
styles
.
taskInfoParams
}
>
运行时间
</
div
>
<
div
className=
{
styles
.
taskInfoValue
}
>
<
div
className=
{
styles
.
taskInfoValue
}
>
{
workFlowJobInfo
?.
costTime
||
"-"
}
{
workFlowJobInfo
?.
costTime
||
"-"
}
</
div
>
</
div
>
</
div
>
</
div
>
<
div
className=
{
styles
.
taskInfoLi
}
>
<
div
className=
{
styles
.
taskInfoLi
}
>
<
div
className=
{
styles
.
taskInfoParams
}
>
日志文件
</
div
>
<
div
className=
{
styles
.
taskInfoParams
}
>
日志文件
</
div
>
<
div
className=
{
styles
.
taskInfoValue
}
>
<
div
className=
{
styles
.
taskInfoValue
}
>
{
workFlowJobInfo
?.
logPath
&&
(
{
workFlowJobInfo
?.
logPath
&&
(
<
span
<
span
className=
{
styles
.
taskInfoDownload
}
className=
{
styles
.
taskInfoDownload
}
onClick=
{
()
=>
handleDownLoad
(
workFlowJobInfo
?.
logPath
)
}
onClick=
{
()
=>
handleDownLoad
(
workFlowJobInfo
?.
logPath
)
}
>
>
下载
下载
</
span
>
</
span
>
)
}
)
}
{
!
workFlowJobInfo
?.
logPath
&&
"-"
}
{
!
workFlowJobInfo
?.
logPath
&&
"-"
}
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
)
}
)
}
{
activePatchId
&&
(
{
activePatchId
&&
(
<
div
className=
{
styles
.
suanziInfo
}
>
<
div
className=
{
styles
.
suanziInfo
}
>
<
div
className=
{
styles
.
title
}
>
{
patchInfo
?.
title
}
</
div
>
<
div
className=
{
styles
.
title
}
>
{
patchInfo
?.
title
}
</
div
>
<
div
className=
{
styles
.
tabs
}
>
<
div
className=
{
styles
.
tabs
}
>
<
div
<
div
className=
{
classNames
({
className=
{
classNames
({
[
styles
.
tabLi
]:
true
,
[
styles
.
tabLi
]:
true
,
[
styles
.
tabLiAcitve
]:
overviewActive
,
[
styles
.
tabLiAcitve
]:
overviewActive
,
})
}
})
}
onClick=
{
()
=>
setOverviewActive
(
true
)
}
onClick=
{
()
=>
setOverviewActive
(
true
)
}
>
>
概览
概览
</
div
>
</
div
>
<
div
<
div
className=
{
classNames
({
className=
{
classNames
({
[
styles
.
tabLi
]:
true
,
[
styles
.
tabLi
]:
true
,
[
styles
.
tabLiAcitve
]:
!
overviewActive
,
[
styles
.
tabLiAcitve
]:
!
overviewActive
,
})
}
})
}
// onClick=
{()
=
>
setOverviewActive(false)}
// onClick=
{()
=
>
setOverviewActive(false)}
onClick=
{
()
=>
handleParams
()
}
onClick=
{
()
=>
handleParams
()
}
>
>
{
patchInfo
?.
children
.
length
>
0
{
patchInfo
?.
children
.
length
>
0
?
patchInfo
?.
children
[
activeFlowIndex
].
title
?
patchInfo
?.
children
[
activeFlowIndex
].
title
:
patchInfo
?.
title
}
:
patchInfo
?.
title
}
{
showOptions
&&
patchInfo
?.
children
.
length
>
0
&&
(
{
showOptions
&&
patchInfo
?.
children
.
length
>
0
&&
(
<
div
className=
{
styles
.
options
}
>
<
div
className=
{
styles
.
options
}
>
{
patchInfo
?.
children
.
map
((
item
:
any
,
index
:
number
)
=>
{
{
patchInfo
?.
children
.
map
((
item
:
any
,
index
:
number
)
=>
{
return
(
return
(
<
div
<
div
key=
{
index
}
key=
{
index
}
className=
{
styles
.
option
}
className=
{
styles
.
option
}
onClick=
{
()
=>
setActiveFlowIndex
(
index
)
}
onClick=
{
()
=>
setActiveFlowIndex
(
index
)
}
>
>
{
item
.
title
}
{
item
.
title
}
</
div
>
</
div
>
);
);
})
}
})
}
</
div
>
</
div
>
)
}
)
}
</
div
>
</
div
>
</
div
>
</
div
>
{
overviewActive
&&
(
{
overviewActive
&&
(
<
div
className=
{
styles
.
overview
}
>
<
div
className=
{
styles
.
overview
}
>
<
div
className=
{
styles
.
taskInfoLi
}
>
<
div
className=
{
styles
.
taskInfoLi
}
>
<
div
className=
{
styles
.
taskInfoParams
}
>
描述
</
div
>
<
div
className=
{
styles
.
taskInfoParams
}
>
描述
</
div
>
<
div
<
div
className=
{
classNames
({
className=
{
classNames
({
[
styles
.
taskInfoValue
]:
true
,
[
styles
.
taskInfoValue
]:
true
,
[
styles
.
taskInfoValueShowAll
]:
true
,
[
styles
.
taskInfoValueShowAll
]:
true
,
})
}
})
}
>
>
{
patchInfo
?.
description
}
{
patchInfo
?.
description
}
</
div
>
</
div
>
</
div
>
</
div
>
<
div
className=
{
styles
.
taskInfoLi
}
>
<
div
className=
{
styles
.
taskInfoLi
}
>
<
div
className=
{
styles
.
taskInfoParams
}
>
算子版本
</
div
>
<
div
className=
{
styles
.
taskInfoParams
}
>
算子版本
</
div
>
<
div
className=
{
styles
.
taskInfoValue
}
>
<
div
className=
{
styles
.
taskInfoValue
}
>
{
patchInfo
?.
creator
||
"-"
}
{
patchInfo
?.
creator
||
"-"
}
</
div
>
</
div
>
</
div
>
</
div
>
<
div
className=
{
styles
.
taskInfoLi
}
>
<
div
className=
{
styles
.
taskInfoLi
}
>
<
div
className=
{
styles
.
taskInfoParams
}
>
算子状态
</
div
>
<
div
className=
{
styles
.
taskInfoParams
}
>
算子状态
</
div
>
<
div
className=
{
styles
.
taskInfoValue
}
>
<
div
className=
{
styles
.
taskInfoValue
}
>
{
patchInfo
?.
status
===
"Done"
&&
(
{
patchInfo
?.
status
===
"Done"
&&
(
<
img
<
img
className=
{
styles
.
taskInfoValueIcon
}
className=
{
styles
.
taskInfoValueIcon
}
src=
{
jobSue
}
src=
{
jobSue
}
alt=
""
alt=
""
/>
/>
)
}
)
}
{
patchInfo
?.
status
===
"Running"
&&
(
{
patchInfo
?.
status
===
"Running"
&&
(
<
img
<
img
className=
{
styles
.
taskInfoValueIcon
}
className=
{
styles
.
taskInfoValueIcon
}
src=
{
jobRun
}
src=
{
jobRun
}
alt=
""
alt=
""
/>
/>
)
}
)
}
{
patchInfo
?.
status
===
"Failed"
&&
(
{
patchInfo
?.
status
===
"Failed"
&&
(
<
img
<
img
className=
{
styles
.
taskInfoValueIcon
}
className=
{
styles
.
taskInfoValueIcon
}
src=
{
jobFail
}
src=
{
jobFail
}
alt=
""
alt=
""
/>
/>
)
}
)
}
{
statusMap
[
patchInfo
?.
status
as
IStatus
]
}
{
statusMap
[
patchInfo
?.
status
as
IStatus
]
}
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
</
div
>
)
}
)
}
{
!
overviewActive
&&
(
{
!
overviewActive
&&
(
<
div
className=
{
styles
.
params
}
>
<
div
className=
{
styles
.
params
}
>
{
randerParameters
.
map
((
parameter
:
any
)
=>
{
{
randerParameters
.
map
((
parameter
:
any
)
=>
{
return
(
return
(
<
div
className=
{
styles
.
taskInfoLi
}
key=
{
parameter
.
name
}
>
<
div
className=
{
styles
.
taskInfoLi
}
key=
{
parameter
.
name
}
>
<
div
className=
{
styles
.
taskInfoParams
}
>
<
div
className=
{
styles
.
taskInfoParams
}
>
{
parameter
.
name
}
{
parameter
.
name
}
</
div
>
</
div
>
<
div
className=
{
styles
.
taskInfoValue
}
>
<
div
className=
{
styles
.
taskInfoValue
}
>
{
parameter
.
value
||
"-"
}
{
parameter
.
value
||
"-"
}
</
div
>
</
div
>
</
div
>
</
div
>
);
);
})
}
})
}
</
div
>
</
div
>
)
}
)
}
</
div
>
</
div
>
)
}
)
}
</
div
>
</
div
>
)
}
)
}
<
div
<
div
className=
{
styles
.
swFlowBox
}
className=
{
styles
.
swFlowBox
}
style=
{
fullScreenShow
?
{
height
:
"100vh"
}
:
undefined
}
style=
{
fullScreenShow
?
{
height
:
"100vh"
}
:
undefined
}
>
>
<
Flow
tasks=
{
workFlowJobInfo
?.
tasks
}
onBatchClick=
{
handleBatch
}
/>
<
Flow
tasks=
{
workFlowJobInfo
?.
tasks
}
onBatchClick=
{
handleBatch
}
/>
</
div
>
</
div
>
</
div
>
</
div
>
<
img
<
img
className=
{
styles
.
fullScreenBox
}
className=
{
styles
.
fullScreenBox
}
src=
{
fullScreenShow
?
partialScreen
:
fullScreen
}
src=
{
fullScreenShow
?
partialScreen
:
fullScreen
}
onClick=
{
()
=>
setFullScreenShow
(
!
fullScreenShow
)
}
onClick=
{
()
=>
setFullScreenShow
(
!
fullScreenShow
)
}
alt=
"全屏"
alt=
"全屏"
/>
/>
</
div
>
</
div
>
);
);
});
});
export
default
ProjectSubmitWork
;
export
default
ProjectSubmitWork
;
src/views/Project/ProjectWorkbench/workbenchTemplate/index.tsx
View file @
2cfbf2e2
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-05-31 10:18:13
* @Date: 2022-05-31 10:18:13
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-07-0
5 18:06:17
* @LastEditTime: 2022-07-0
6 17:32:50
* @FilePath: /bkunyun/src/views/Project/ProjectSetting/index.tsx
* @FilePath: /bkunyun/src/views/Project/ProjectSetting/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
*/
*/
...
@@ -22,259 +22,265 @@ import SimpleDialog from "./components/simpleDialog";
...
@@ -22,259 +22,265 @@ 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
React
FlowEdit
from
"@/views/WorkFlowEdit"
;
import
Work
FlowEdit
from
"@/views/WorkFlowEdit"
;
import
{
useStores
}
from
"@/store"
;
import
{
useStores
}
from
"@/store"
;
import
{
ICustomTemplate
}
from
"./interface"
;
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
);
const
isPass
=
usePass
();
const
isPass
=
usePass
();
/** 搜索模板名称 */
/** 搜索模板名称 */
const
[
templateName
,
setTemplateName
]
=
useState
(
""
);
const
[
templateName
,
setTemplateName
]
=
useState
(
""
);
/** 模板列表 */
/** 模板列表 */
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
);
/** 增加模板 */
/** 增加模板 */
const
[
openAddTemplate
,
setOpenAddTemplate
]
=
useState
(
false
);
const
[
openAddTemplate
,
setOpenAddTemplate
]
=
useState
(
false
);
/** 可增加模板列表 */
/** 可增加模板列表 */
const
[
addTemplateList
,
setAddTemplateList
]
=
useState
([]);
const
[
addTemplateList
,
setAddTemplateList
]
=
useState
([]);
/** 已选择增加的模板列表 */
/** 已选择增加的模板列表 */
const
[
selectTemplateData
,
setSelectTemplateData
]
=
useState
<
string
[]
>
([]);
const
[
selectTemplateData
,
setSelectTemplateData
]
=
useState
<
string
[]
>
([]);
// 获取模板列表
/** 是否显示自定义模版编辑并带有参数 */
const
{
run
:
getTemplateInfo
}
=
useMyRequest
(
getWorkbenchTemplate
,
{
const
[
customTemplateInfo
,
setCustomTemplateInfo
]
=
useState
<
ICustomTemplate
>
(
onSuccess
:
(
result
:
any
)
=>
{
{
setTemplateList
(
result
.
data
);
show
:
false
,
},
}
}
);
);
// 删除模板
// 获取模板列表
const
{
run
:
delTemplate
}
=
useMyRequest
(
deleteWorkbenchTemplate
,
{
const
{
run
:
getTemplateInfo
}
=
useMyRequest
(
getWorkbenchTemplate
,
{
onSuccess
:
(
result
:
any
)
=>
{
onSuccess
:
(
result
:
any
)
=>
{
setOpenDialog
(
false
);
setTemplateList
(
result
.
data
);
getTemplateInfo
({
},
projectId
:
currentProjectStore
.
currentProjectInfo
.
id
as
string
,
});
title
:
templateName
,
});
},
});
// 添加工作流模板-获取模板列表
// 删除模板
const
{
run
:
getAddTemplateList
}
=
useMyRequest
(
getAddWorkbenchTemplate
,
{
const
{
run
:
delTemplate
}
=
useMyRequest
(
deleteWorkbenchTemplate
,
{
onSuccess
:
(
result
:
any
)
=>
{
onSuccess
:
(
result
:
any
)
=>
{
setAddTemplateList
(
result
.
data
);
setOpenDialog
(
false
);
setOpenAddTemplate
(
true
);
getTemplateInfo
({
},
projectId
:
currentProjectStore
.
currentProjectInfo
.
id
as
string
,
});
title
:
templateName
,
});
},
});
// 项目管理员-添加工作流模板-提交
// 添加工作流模板-获取模板列表
const
{
run
:
addTemplate
}
=
useMyRequest
(
addWorkbenchTemplate
,
{
const
{
run
:
getAddTemplateList
}
=
useMyRequest
(
getAddWorkbenchTemplate
,
{
onSuccess
:
(
result
:
any
)
=>
{
onSuccess
:
(
result
:
any
)
=>
{
setOpenAddTemplate
(
false
);
setAddTemplateList
(
result
.
data
);
getTemplateInfo
({
setOpenAddTemplate
(
true
);
projectId
:
currentProjectStore
.
currentProjectInfo
.
id
as
string
,
},
});
});
setSelectTemplateData
([]);
},
});
useEffect
(()
=>
{
// 项目管理员-添加工作流模板-提交
getTemplateInfo
({
const
{
run
:
addTemplate
}
=
useMyRequest
(
addWorkbenchTemplate
,
{
projectId
:
currentProjectStore
.
currentProjectInfo
.
id
as
string
,
onSuccess
:
(
result
:
any
)
=>
{
});
setOpenAddTemplate
(
false
);
},
[
currentProjectStore
.
currentProjectInfo
.
id
,
getTemplateInfo
]);
getTemplateInfo
({
projectId
:
currentProjectStore
.
currentProjectInfo
.
id
as
string
,
});
setSelectTemplateData
([]);
},
});
useEffect
(()
=>
{
useEffect
(()
=>
{
console
.
log
(
"projectIdData: "
,
projectIdData
);
getTemplateInfo
({
},
[
projectIdData
]);
projectId
:
currentProjectStore
.
currentProjectInfo
.
id
as
string
,
});
},
[
currentProjectStore
.
currentProjectInfo
.
id
,
getTemplateInfo
]);
/** 删除模板 */
useEffect
(()
=>
{
const
deleteTemplate
=
()
=>
{
console
.
log
(
"projectIdData: "
,
projectIdData
);
delTemplate
({
},
[
projectIdData
]);
projectId
:
currentProjectStore
.
currentProjectInfo
.
id
as
string
,
workflowSpecId
:
templateId
,
});
};
/** 打开弹窗 */
/** 删除模板 */
const
startDialog
=
(
id
:
string
)
=>
{
const
deleteTemplate
=
()
=>
{
setTemplateId
(
id
);
delTemplate
({
setOpenDialog
(
true
);
projectId
:
currentProjectStore
.
currentProjectInfo
.
id
as
string
,
};
workflowSpecId
:
templateId
,
});
};
/** 关闭弹窗 */
/** 打开弹窗 */
const
closeDialog
=
()
=>
{
const
startDialog
=
(
id
:
string
)
=>
{
setOpenDialog
(
false
);
setTemplateId
(
id
);
};
setOpenDialog
(
true
);
};
/** 增加模板 */
/** 关闭弹窗 */
const
addTemplateBlock
=
()
=>
{
const
closeDialog
=
()
=>
{
getAddTemplateList
({
setOpenDialog
(
false
);
projectId
:
currentProjectStore
.
currentProjectInfo
.
id
as
string
,
};
productId
:
"cadd"
,
});
};
/** 关闭增加模板 */
/** 增加模板 */
const
closeAddTemplateBlock
=
()
=>
{
const
addTemplateBlock
=
()
=>
{
setOpenAddTemplate
(
false
);
getAddTemplateList
({
setSelectTemplateData
([]);
projectId
:
currentProjectStore
.
currentProjectInfo
.
id
as
string
,
};
productId
:
"cadd"
,
});
};
/** 增加模板操作 */
/** 关闭增加模板 */
const
addTemplateCallback
=
()
=>
{
const
closeAddTemplateBlock
=
()
=>
{
addTemplate
({
setOpenAddTemplate
(
false
);
projectId
:
currentProjectStore
.
currentProjectInfo
.
id
as
string
,
setSelectTemplateData
([]);
workflowSpecIds
:
selectTemplateData
,
};
});
};
/** 搜索模板 */
/** 增加模板操作 */
const
searchTemplateNameCallback
=
(
data
:
any
)
=>
{
const
addTemplateCallback
=
()
=>
{
getAddTemplateList
({
addTemplate
({
projectId
:
currentProjectStore
.
currentProjectInfo
.
id
as
string
,
projectId
:
currentProjectStore
.
currentProjectInfo
.
id
as
string
,
productId
:
"cadd"
,
workflowSpecIds
:
selectTemplateData
,
title
:
data
,
});
});
};
};
const
templateSelectCallback
=
(
data
:
string
)
=>
{
/** 搜索模板 */
let
list
:
string
[]
=
[...
selectTemplateData
];
const
searchTemplateNameCallback
=
(
data
:
any
)
=>
{
if
(
selectTemplateData
.
filter
((
e
)
=>
e
===
data
).
length
>
0
)
{
getAddTemplateList
({
list
=
list
.
filter
((
e
)
=>
e
!==
data
);
projectId
:
currentProjectStore
.
currentProjectInfo
.
id
as
string
,
setSelectTemplateData
(
list
);
productId
:
"cadd"
,
}
else
{
title
:
data
,
list
.
push
(
data
);
});
setSelectTemplateData
(
list
);
};
}
};
const
searchChange
=
(
data
:
any
)
=>
{
const
templateSelectCallback
=
(
data
:
string
)
=>
{
setTemplateName
(
data
.
length
>
30
?
data
.
slice
(
0
,
30
)
:
data
);
let
list
:
string
[]
=
[...
selectTemplateData
];
};
if
(
selectTemplateData
.
filter
((
e
)
=>
e
===
data
).
length
>
0
)
{
list
=
list
.
filter
((
e
)
=>
e
!==
data
);
setSelectTemplateData
(
list
);
}
else
{
list
.
push
(
data
);
setSelectTemplateData
(
list
);
}
};
useEffect
(()
=>
{
const
searchChange
=
(
data
:
any
)
=>
{
setTimeout
(()
=>
{
setTemplateName
(
data
.
length
>
30
?
data
.
slice
(
0
,
30
)
:
data
);
getTemplateInfo
({
};
projectId
:
currentProjectStore
.
currentProjectInfo
.
id
as
string
,
title
:
templateName
,
});
},
300
);
},
[
templateName
]);
return
(
useEffect
(()
=>
{
<
Box
className=
{
styles
.
headerBox
}
>
setTimeout
(()
=>
{
<
Box
className=
{
styles
.
tabBox
}
>
getTemplateInfo
({
<
OutlinedInput
projectId
:
currentProjectStore
.
currentProjectInfo
.
id
as
string
,
onChange=
{
(
e
:
any
)
=>
{
title
:
templateName
,
searchChange
(
e
.
target
.
value
);
});
}
}
},
300
);
value=
{
templateName
}
},
[
templateName
]);
placeholder=
"输入关键词搜索"
size=
"small"
sx=
{
{
width
:
340
,
height
:
32
}
}
endAdornment=
{
<
SearchIcon
style=
{
{
color
:
"#8A9099"
}
}
/>
}
/>
{
templateList
.
length
>
0
&&
return
(
isPass
(
"PROJECT_WORKBENCH_FLOES_ADD"
,
"MANAGER"
)
&&
(
<
Box
className=
{
styles
.
headerBox
}
>
<
Button
<
Box
className=
{
styles
.
tabBox
}
>
text=
{
"添加工作流模版"
}
<
OutlinedInput
img=
{
<
Add
/>
}
onChange=
{
(
e
:
any
)
=>
{
click=
{
addTemplateBlock
}
searchChange
(
e
.
target
.
value
);
size=
{
"small"
}
}
}
/>
value=
{
templateName
}
)
}
placeholder=
"输入关键词搜索"
</
Box
>
size=
"small"
sx=
{
{
width
:
340
,
height
:
32
}
}
endAdornment=
{
<
SearchIcon
style=
{
{
color
:
"#8A9099"
}
}
/>
}
/>
{
templateList
.
length
===
0
&&
templateName
.
length
>
0
&&
(
{
templateList
.
length
>
0
&&
<
Box
isPass
(
"PROJECT_WORKBENCH_FLOES_ADD"
,
"MANAGER"
)
&&
(
sx=
{
{
<
Button
display
:
"flex"
,
text=
{
"添加工作流模版"
}
alignItems
:
"center"
,
img=
{
<
Add
/>
}
flexDirection
:
"column"
,
click=
{
addTemplateBlock
}
minHeight
:
"calc(100vh - 376px)"
,
size=
{
"small"
}
justifyContent
:
"center"
,
/>
}
}
)
}
>
</
Box
>
<
img
alt=
""
src=
{
noData
}
/>
<
Typography
sx=
{
{
fontSize
:
"12px"
,
fontWeight
:
"400"
,
color
:
"#8A9099"
}
}
>
暂未开启模版
</
Typography
>
</
Box
>
)
}
{
templateList
.
length
>
0
&&
(
<
Box
sx=
{
{
display
:
"flex"
,
flexWrap
:
"wrap"
,
marginLeft
:
"-8px"
}
}
>
{
templateList
&&
templateList
.
length
>
0
&&
templateList
.
map
((
item
,
key
)
=>
{
return
(
<
TemplateBox
data=
{
item
}
startDialog=
{
startDialog
}
key=
{
key
}
/>
);
})
}
</
Box
>
)
}
{
templateList
.
length
===
0
&&
templateName
.
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
{
templateList
.
length
===
0
&&
templateName
.
length
>
0
&&
(
openAddTemplate=
{
openAddTemplate
}
<
Box
closeAddTemplateBlock=
{
closeAddTemplateBlock
}
sx=
{
{
addTemplateList=
{
addTemplateList
}
display
:
"flex"
,
templateSelectCallback=
{
templateSelectCallback
}
alignItems
:
"center"
,
selectTemplateData=
{
selectTemplateData
}
flexDirection
:
"column"
,
addTemplateCallback=
{
addTemplateCallback
}
minHeight
:
"calc(100vh - 376px)"
,
searchTemplateNameCallback=
{
searchTemplateNameCallback
}
justifyContent
:
"center"
,
/>
}
}
>
<
img
alt=
""
src=
{
noData
}
/>
<
Typography
sx=
{
{
fontSize
:
"12px"
,
fontWeight
:
"400"
,
color
:
"#8A9099"
}
}
>
暂未开启模版
</
Typography
>
</
Box
>
)
}
{
templateList
.
length
>
0
&&
(
<
Box
sx=
{
{
display
:
"flex"
,
flexWrap
:
"wrap"
,
marginLeft
:
"-8px"
}
}
>
{
templateList
&&
templateList
.
length
>
0
&&
templateList
.
map
((
item
,
key
)
=>
{
return
<
TemplateBox
data=
{
item
}
startDialog=
{
startDialog
}
/>;
})
}
</
Box
>
)
}
{
templateList
.
length
===
0
&&
templateName
.
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
>
)
}
{
/* <ReactFlowEdit/> */
}
<
AddTemplate
openAddTemplate=
{
openAddTemplate
}
closeAddTemplateBlock=
{
closeAddTemplateBlock
}
addTemplateList=
{
addTemplateList
}
templateSelectCallback=
{
templateSelectCallback
}
selectTemplateData=
{
selectTemplateData
}
addTemplateCallback=
{
addTemplateCallback
}
searchTemplateNameCallback=
{
searchTemplateNameCallback
}
/>
<
SimpleDialog
{
customTemplateInfo
?.
show
?
<
WorkFlowEdit
/>
:
null
}
text=
{
"确认移除该模板吗?"
}
title=
{
"删除模板"
}
<
SimpleDialog
openDialog=
{
openDialog
}
text=
{
"确认移除该模板吗?"
}
closeDialog=
{
closeDialog
}
title=
{
"删除模板"
}
onConfirm=
{
deleteTemplate
}
openDialog=
{
openDialog
}
/>
closeDialog=
{
closeDialog
}
</
Box
>
onConfirm=
{
deleteTemplate
}
);
/>
</
Box
>
);
});
});
export
default
memo
(
ProjectMembers
);
export
default
memo
(
ProjectMembers
);
src/views/Project/ProjectWorkbench/workbenchTemplate/interface.tsx
0 → 100644
View file @
2cfbf2e2
/*
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-07-06 14:44:13
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-07-06 14:47:28
* @FilePath: /bkunyun/src/views/Project/ProjectWorkbench/workbenchTemplate/interface.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
export
interface
ICustomTemplate
{
show
?:
boolean
;
id
?:
string
;
}
\ No newline at end of file
src/views/Project/components/Flow/index.tsx
View file @
2cfbf2e2
import
ReactFlow
,
{
import
ReactFlow
,
{
Controls
,
Controls
,
Background
,
Background
,
useNodesState
,
useNodesState
,
useEdgesState
,
useEdgesState
,
Handle
,
Handle
,
Position
,
Position
,
ReactFlowProps
,
ReactFlowProps
,
Node
,
Node
,
}
from
"react-flow-renderer"
;
}
from
"react-flow-renderer"
;
import
{
useCallback
,
useEffect
,
useMemo
,
useState
}
from
"react"
;
import
{
useCallback
,
useEffect
,
useMemo
,
useState
}
from
"react"
;
import
classNames
from
"classnames"
;
import
classNames
from
"classnames"
;
...
@@ -14,7 +14,11 @@ import classNames from "classnames";
...
@@ -14,7 +14,11 @@ import classNames from "classnames";
import
jobFail
from
"@/assets/project/jobFail.svg"
;
import
jobFail
from
"@/assets/project/jobFail.svg"
;
import
jobRun
from
"@/assets/project/jobRun.svg"
;
import
jobRun
from
"@/assets/project/jobRun.svg"
;
import
jobSue
from
"@/assets/project/jobSue.svg"
;
import
jobSue
from
"@/assets/project/jobSue.svg"
;
import
{
IEdge
,
IExecutionStatus
,
ITask
}
from
"../../ProjectSubmitWork/interface"
;
import
{
IEdge
,
IExecutionStatus
,
ITask
,
}
from
"../../ProjectSubmitWork/interface"
;
import
{
IBatchNode
,
ILine
}
from
"./interface"
;
import
{
IBatchNode
,
ILine
}
from
"./interface"
;
import
styles
from
"./index.module.css"
;
import
styles
from
"./index.module.css"
;
...
@@ -27,300 +31,317 @@ import styles from "./index.module.css";
...
@@ -27,300 +31,317 @@ import styles from "./index.module.css";
* @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
*/
*/
interface
IProps
extends
ReactFlowProps
{
interface
IProps
extends
ReactFlowProps
{
tasks
?:
ITask
[];
tasks
?:
ITask
[];
/** 点击batch事件 */
/** 点击batch事件 */
onBatchClick
?:
(
val
:
string
)
=>
void
;
onBatchClick
?:
(
val
:
string
)
=>
void
;
setSelectedNodeId
?:
(
val
:
string
)
=>
void
;
setSelectedNodeId
?:
(
val
:
string
)
=>
void
;
selectedNodeId
?:
string
;
selectedNodeId
?:
string
;
}
}
/** 获取imgUrl */
/** 获取imgUrl */
const
getImgUrl
=
(
type
:
IExecutionStatus
)
=>
{
const
getImgUrl
=
(
type
:
IExecutionStatus
)
=>
{
if
(
type
===
'Done'
)
{
if
(
type
===
"Done"
)
{
return
jobSue
return
jobSue
;
}
}
if
(
type
===
'Failed'
)
{
if
(
type
===
"Failed"
)
{
return
jobFail
return
jobFail
;
}
}
if
(
type
===
'Running'
)
{
if
(
type
===
"Running"
)
{
return
jobRun
return
jobRun
;
}
}
return
undefined
return
undefined
;
}
};
/** 自定义batch节点 */
/** 自定义batch节点 */
const
BatchNode
=
(
props
:
IBatchNode
)
=>
{
const
BatchNode
=
(
props
:
IBatchNode
)
=>
{
const
{
data
}
=
props
;
const
{
data
}
=
props
;
const
{
dotStatus
,
style
,
isFlowNode
,
label
,
selectedStatus
}
=
data
;
const
{
dotStatus
,
style
,
isFlowNode
,
label
,
selectedStatus
}
=
data
;
return
(
return
(
<
div
<
div
className=
{
classNames
({
className=
{
classNames
({
[
styles
.
batchNode
]:
true
,
[
styles
.
batchNode
]:
true
,
[
styles
.
selectedBatchBox
]:
selectedStatus
,
[
styles
.
selectedBatchBox
]:
selectedStatus
,
[
styles
.
selectBatchNode
]:
selectedStatus
,
[
styles
.
selectBatchNode
]:
selectedStatus
,
})
}
})
}
style=
{
style
}
style=
{
style
}
>
>
{
dotStatus
?.
isInput
?
(
{
dotStatus
?.
isInput
?
(
<
Handle
<
Handle
style=
{
{
background
:
"#fff "
,
border
:
"1px solid #D1D6DE"
,
left
:
20
}
}
style=
{
{
background
:
"#fff "
,
border
:
"1px solid #D1D6DE"
,
left
:
20
}
}
type=
"target"
type=
"target"
position=
{
Position
.
Top
}
position=
{
Position
.
Top
}
/>
/>
)
:
null
}
)
:
null
}
<
div
<
div
className=
{
classNames
({
className=
{
classNames
({
[
styles
.
batchRotate
]:
isFlowNode
,
[
styles
.
batchRotate
]:
isFlowNode
,
})
}
})
}
>
>
{
label
||
""
}
{
label
||
""
}
{
data
.
isCheck
&&
<
span
className=
{
styles
.
successDot
}
></
span
>
}
{
data
.
isCheck
&&
<
span
className=
{
styles
.
successDot
}
></
span
>
}
</
div
>
</
div
>
{
dotStatus
?.
isOutput
?
(
{
dotStatus
?.
isOutput
?
(
<
Handle
<
Handle
style=
{
{
background
:
"#fff "
,
border
:
"1px solid #D1D6DE"
,
left
:
20
}
}
style=
{
{
background
:
"#fff "
,
border
:
"1px solid #D1D6DE"
,
left
:
20
}
}
type=
"source"
type=
"source"
position=
{
Position
.
Bottom
}
position=
{
Position
.
Bottom
}
/>
/>
)
:
null
}
)
:
null
}
</
div
>
</
div
>
);
);
};
};
/** 自定义flow节点 */
/** 自定义flow节点 */
const
FlowNode
=
(
props
:
any
)
=>
{
const
FlowNode
=
(
props
:
any
)
=>
{
const
{
data
}
=
props
;
const
{
data
}
=
props
;
return
(
return
(
<
div
<
div
className=
{
classNames
({
className=
{
classNames
({
[
styles
.
flowNode
]:
true
,
[
styles
.
flowNode
]:
true
,
})
}
})
}
>
>
{
data
?.
dotStatus
?.
isInput
?
(
{
data
?.
dotStatus
?.
isInput
?
(
<
Handle
<
Handle
style=
{
{
background
:
"#C2C6CC "
,
left
:
12
}
}
style=
{
{
background
:
"#C2C6CC "
,
left
:
12
}
}
type=
"target"
type=
"target"
position=
{
Position
.
Top
}
position=
{
Position
.
Top
}
/>
/>
)
:
null
}
)
:
null
}
<
div
style=
{
{
display
:
"flex"
,
alignItems
:
"center"
}
}
>
<
div
style=
{
{
display
:
"flex"
,
alignItems
:
"center"
}
}
>
{
data
?.
label
||
""
}
{
data
?.
label
||
""
}
{
data
.
isCheck
&&
<
span
className=
{
styles
.
successDot
}
></
span
>
}
{
data
.
isCheck
&&
<
span
className=
{
styles
.
successDot
}
></
span
>
}
{
getImgUrl
(
data
.
executionStatus
)
&&
<
img
style=
{
{
marginLeft
:
"6px"
}
}
src=
{
getImgUrl
(
data
.
executionStatus
)
}
alt=
""
/>
}
{
getImgUrl
(
data
.
executionStatus
)
&&
(
</
div
>
<
img
{
data
?.
dotStatus
?.
isOutput
?
(
style=
{
{
marginLeft
:
"6px"
}
}
<
Handle
src=
{
getImgUrl
(
data
.
executionStatus
)
}
style=
{
{
background
:
"#C2C6CC "
,
left
:
12
}
}
alt=
""
type=
"source"
/>
position=
{
Position
.
Bottom
}
)
}
id=
"a"
</
div
>
/>
{
data
?.
dotStatus
?.
isOutput
?
(
)
:
null
}
<
Handle
</
div
>
style=
{
{
background
:
"#C2C6CC "
,
left
:
12
}
}
);
type=
"source"
position=
{
Position
.
Bottom
}
id=
"a"
/>
)
:
null
}
</
div
>
);
};
};
const
Flow
=
(
props
:
IProps
)
=>
{
const
Flow
=
(
props
:
IProps
)
=>
{
const
{
tasks
,
onBatchClick
,
setSelectedNodeId
,
selectedNodeId
}
=
props
;
const
{
tasks
,
onBatchClick
,
setSelectedNodeId
,
selectedNodeId
}
=
props
;
/** 自定义的节点类型 */
/** 自定义的节点类型 */
const
nodeTypes
=
useMemo
(()
=>
{
const
nodeTypes
=
useMemo
(()
=>
{
return
{
batchNode
:
BatchNode
,
flowNode
:
FlowNode
};
return
{
batchNode
:
BatchNode
,
flowNode
:
FlowNode
};
},
[]);
},
[]);
/** 内部维护的选择的节点Id */
const
[
inSideNodeId
,
setInSideNodeId
]
=
useState
<
string
>
(
""
);
/** 获取是否有输入节点或者是否有输出节点 */
/** 获取是否有输入节点或者是否有输出节点 */
const
nodesInputAndOutputStatus
=
useCallback
(
const
nodesInputAndOutputStatus
=
useCallback
(
(
id
:
string
)
=>
{
(
id
:
string
)
=>
{
/** 所有的连线 */
/** 所有的连线 */
const
lineArr
:
IEdge
[]
=
[];
const
lineArr
:
IEdge
[]
=
[];
tasks
?.
length
&&
tasks
?.
length
&&
tasks
.
forEach
((
item
)
=>
{
tasks
.
forEach
((
item
)
=>
{
lineArr
.
push
(...
item
.
edges
);
lineArr
.
push
(...
item
.
edges
);
});
});
/** 所有的输入节点ID */
/** 所有的输入节点ID */
const
isInput
=
lineArr
?.
some
((
item
)
=>
item
.
target
===
id
);
const
isInput
=
lineArr
?.
some
((
item
)
=>
item
.
target
===
id
);
/** 所有的输出节点ID */
/** 所有的输出节点ID */
const
isOutput
=
lineArr
?.
some
((
item
)
=>
item
.
source
===
id
);
const
isOutput
=
lineArr
?.
some
((
item
)
=>
item
.
source
===
id
);
return
{
return
{
isInput
,
isInput
,
isOutput
,
isOutput
,
};
};
},
},
[
tasks
]
[
tasks
]
);
);
/** 获取是否有流节点 */
/** 获取是否有流节点 */
const
isFlowNode
=
useCallback
(
const
isFlowNode
=
useCallback
(
(
id
:
string
)
=>
{
(
id
:
string
)
=>
{
return
(
return
(
tasks
?.
length
&&
tasks
?.
length
&&
tasks
?.
some
((
item
)
=>
{
tasks
?.
some
((
item
)
=>
{
return
item
.
parentNode
===
id
;
return
item
.
parentNode
===
id
;
})
})
);
);
},
},
[
tasks
]
[
tasks
]
);
);
/** 通过子flow节点计算batch节点的样式 */
/** 通过子flow节点计算batch节点的样式 */
const
getBatchStyle
=
useCallback
(
const
getBatchStyle
=
useCallback
(
(
value
:
ITask
)
=>
{
(
value
:
ITask
)
=>
{
const
positionXArr
:
number
[]
=
[];
const
positionXArr
:
number
[]
=
[];
const
positionYArr
:
number
[]
=
[];
const
positionYArr
:
number
[]
=
[];
tasks
?.
length
&&
tasks
?.
length
&&
tasks
?.
forEach
((
item
)
=>
{
tasks
?.
forEach
((
item
)
=>
{
if
(
item
.
parentNode
===
value
.
id
)
{
if
(
item
.
parentNode
===
value
.
id
)
{
positionXArr
.
push
(
item
.
position
?.
x
||
0
);
positionXArr
.
push
(
item
.
position
?.
x
||
0
);
positionYArr
.
push
(
item
.
position
?.
y
||
0
);
positionYArr
.
push
(
item
.
position
?.
y
||
0
);
}
}
});
});
positionXArr
.
sort
((
a
,
b
)
=>
{
positionXArr
.
sort
((
a
,
b
)
=>
{
return
a
-
b
;
return
a
-
b
;
});
});
positionYArr
.
sort
((
a
,
b
)
=>
{
positionYArr
.
sort
((
a
,
b
)
=>
{
return
a
-
b
;
return
a
-
b
;
});
});
let
width
=
176
,
let
width
=
176
,
height
=
22
;
height
=
22
;
if
(
positionXArr
?.
length
)
{
if
(
positionXArr
?.
length
)
{
const
val
=
positionXArr
[
positionXArr
.
length
-
1
]
+
150
;
const
val
=
positionXArr
[
positionXArr
.
length
-
1
]
+
150
;
width
=
val
>
176
?
val
:
width
;
width
=
val
>
176
?
val
:
width
;
}
}
if
(
positionYArr
?.
length
)
{
if
(
positionYArr
?.
length
)
{
const
val
=
positionYArr
[
positionYArr
.
length
-
1
];
const
val
=
positionYArr
[
positionYArr
.
length
-
1
];
height
=
val
>
22
?
val
:
height
;
height
=
val
>
22
?
val
:
height
;
}
}
return
{
return
{
width
,
width
,
height
,
height
,
};
};
},
},
[
tasks
]
[
tasks
]
);
);
/** 生成初始化node节点 */
/** 生成初始化node节点 */
const
initialNodes
=
useMemo
(()
=>
{
const
initialNodes
=
useMemo
(()
=>
{
const
val
:
any
=
[];
const
val
:
any
=
[];
tasks
?.
length
&&
tasks
?.
length
&&
tasks
.
forEach
((
item
)
=>
{
tasks
.
forEach
((
item
)
=>
{
val
.
push
({
val
.
push
({
id
:
item
.
id
,
id
:
item
.
id
,
type
:
item
.
type
===
"BATCH"
?
"batchNode"
:
"flowNode"
,
type
:
item
.
type
===
"BATCH"
?
"batchNode"
:
"flowNode"
,
data
:
{
data
:
{
label
:
item
.
title
||
""
,
label
:
item
.
title
||
""
,
...(
item
.
type
===
"BATCH"
...(
item
.
type
===
"BATCH"
?
{
?
{
/** 是否有流节点 */
/** 是否有流节点 */
isFlowNode
:
isFlowNode
(
item
.
id
),
isFlowNode
:
isFlowNode
(
item
.
id
),
/** 选中状态 */
/** 选中状态 */
selectedStatus
:
selectedNodeId
===
item
.
id
,
selectedStatus
:
selectedNodeId
}
?
selectedNodeId
===
item
.
id
:
{}),
:
inSideNodeId
===
item
.
id
,
isCheck
:
item
.
isCheck
,
}
executionStatus
:
item
.
executionStatus
,
:
{}),
/** 输入输出圆点状态 */
isCheck
:
item
.
isCheck
,
dotStatus
:
nodesInputAndOutputStatus
(
item
.
id
),
executionStatus
:
item
.
executionStatus
,
/** 样式 */
/** 输入输出圆点状态 */
style
:
{
dotStatus
:
nodesInputAndOutputStatus
(
item
.
id
),
...
getBatchStyle
(
item
),
/** 样式 */
padding
:
isFlowNode
(
item
.
id
)
?
"20px"
:
"12px 20px"
,
style
:
{
},
...
getBatchStyle
(
item
),
},
padding
:
isFlowNode
(
item
.
id
)
?
"20px"
:
"12px 20px"
,
position
:
{
x
:
Number
(
item
.
position
.
x
),
y
:
Number
(
item
.
position
.
y
)
},
},
...(
item
.
type
===
"BATCH"
?
{
style
:
{
zIndex
:
-
1
}
}
:
{}),
},
...(
item
.
parentNode
?
{
parentNode
:
item
.
parentNode
}
:
{}),
position
:
{
x
:
Number
(
item
.
position
.
x
),
y
:
Number
(
item
.
position
.
y
)
},
...(
item
.
type
===
"BATCH"
?
{
extent
:
"parent"
}
:
{}),
...(
item
.
type
===
"BATCH"
?
{
style
:
{
zIndex
:
-
1
}
}
:
{}),
});
...(
item
.
parentNode
?
{
parentNode
:
item
.
parentNode
}
:
{}),
});
...(
item
.
type
===
"BATCH"
?
{
extent
:
"parent"
}
:
{}),
return
val
;
});
},
[
});
tasks
,
return
val
;
isFlowNode
,
},
[
selectedNodeId
,
tasks
,
nodesInputAndOutputStatus
,
isFlowNode
,
getBatchStyle
,
selectedNodeId
,
]);
inSideNodeId
,
nodesInputAndOutputStatus
,
getBatchStyle
,
]);
/** 生成初始化的连线节点 */
/** 生成初始化的连线节点 */
const
initialEdges
=
useMemo
(()
=>
{
const
initialEdges
=
useMemo
(()
=>
{
const
val
:
ILine
[]
=
[];
const
val
:
ILine
[]
=
[];
tasks
?.
length
&&
tasks
?.
length
&&
tasks
.
forEach
((
item
)
=>
{
tasks
.
forEach
((
item
)
=>
{
item
.
edges
.
forEach
((
every
)
=>
{
item
.
edges
.
forEach
((
every
)
=>
{
const
newLine
=
{
const
newLine
=
{
...
every
,
...
every
,
batchId
:
item
.
parentNode
?
item
.
parentNode
:
item
.
id
,
batchId
:
item
.
parentNode
?
item
.
parentNode
:
item
.
id
,
};
};
val
.
push
(
newLine
);
val
.
push
(
newLine
);
},
[]);
},
[]);
});
});
return
val
.
map
((
item
:
ILine
)
=>
{
return
val
.
map
((
item
:
ILine
)
=>
{
return
{
const
newSelectId
=
selectedNodeId
?
selectedNodeId
:
inSideNodeId
;
id
:
item
.
id
,
return
{
source
:
item
.
source
,
id
:
item
.
id
,
target
:
item
.
target
,
source
:
item
.
source
,
type
:
"smoothstep"
,
target
:
item
.
target
,
...(
item
?.
batchId
===
selectedNodeId
type
:
"smoothstep"
,
?
{
style
:
{
stroke
:
"#1370FF"
},
animated
:
true
}
...(
item
?.
batchId
===
newSelectId
:
{}),
?
{
style
:
{
stroke
:
"#1370FF"
},
animated
:
true
}
labelStyle
:
{
fill
:
"#8A9099"
},
:
{}),
labelBgStyle
:
{
fill
:
"#F7F8FA "
},
labelStyle
:
{
fill
:
"#8A9099"
},
label
:
item
.
label
?
`(
${
item
.
label
}
)`
:
""
,
labelBgStyle
:
{
fill
:
"#F7F8FA "
},
};
label
:
item
.
label
?
`(
${
item
.
label
}
)`
:
""
,
});
};
},
[
selectedNodeId
,
tasks
]);
});
},
[
inSideNodeId
,
selectedNodeId
,
tasks
]);
/** flowNode点击事件 */
/** flowNode点击事件 */
const
onNodeClick
=
(
e
:
any
,
node
:
Node
)
=>
{
const
onNodeClick
=
(
e
:
any
,
node
:
Node
)
=>
{
tasks
?.
forEach
((
item
)
=>
{
tasks
?.
forEach
((
item
)
=>
{
if
(
item
.
id
===
node
.
id
)
{
if
(
item
.
id
===
node
.
id
)
{
if
(
item
.
parentNode
)
{
if
(
item
.
parentNode
)
{
setSelectedNodeId
setSelectedNodeId
&&
setSelectedNodeId
(
item
.
parentNode
);
?
setSelectedNodeId
(
item
.
parentNode
)
onBatchClick
&&
onBatchClick
(
item
.
parentNode
);
:
setInSideNodeId
(
item
.
parentNode
);
document
.
getElementById
(
`point
${
item
.
parentNode
}
`
)?.
scrollIntoView
(
true
)
onBatchClick
&&
onBatchClick
(
item
.
parentNode
);
}
else
{
document
setSelectedNodeId
&&
setSelectedNodeId
(
node
.
id
);
.
getElementById
(
`point
${
item
.
parentNode
}
`
)
onBatchClick
&&
onBatchClick
(
node
.
id
||
""
);
?.
scrollIntoView
(
true
);
document
.
getElementById
(
`point
${
node
.
id
}
`
)?.
scrollIntoView
(
true
)
}
else
{
}
setSelectedNodeId
}
?
setSelectedNodeId
(
node
.
id
)
});
:
setInSideNodeId
(
node
.
id
);
};
onBatchClick
&&
onBatchClick
(
node
.
id
||
""
);
document
.
getElementById
(
`point
${
node
.
id
}
`
)?.
scrollIntoView
(
true
);
}
}
});
};
const
handlePaneClick
=
()
=>
{
const
handlePaneClick
=
()
=>
{
setSelectedNodeId
&&
setSelectedNodeId
(
''
);
setSelectedNodeId
?
setSelectedNodeId
(
""
)
:
setInSideNodeId
(
""
);
onBatchClick
&&
onBatchClick
(
''
);
onBatchClick
&&
onBatchClick
(
""
);
}
};
/** node节点 */
/** node节点 */
const
[
nodes
,
setNodes
]
=
useNodesState
(
initialNodes
);
const
[
nodes
,
setNodes
]
=
useNodesState
(
initialNodes
);
/** 连线数组 */
/** 连线数组 */
const
[
edges
,
setEdges
]
=
useEdgesState
(
initialEdges
);
const
[
edges
,
setEdges
]
=
useEdgesState
(
initialEdges
);
useEffect
(()
=>
{
useEffect
(()
=>
{
setEdges
(
initialEdges
);
setEdges
(
initialEdges
);
},
[
initialEdges
,
setEdges
]);
},
[
initialEdges
,
setEdges
]);
useEffect
(()
=>
{
useEffect
(()
=>
{
setNodes
(
initialNodes
);
setNodes
(
initialNodes
);
},
[
initialNodes
,
setNodes
]);
},
[
initialNodes
,
setNodes
]);
return
(
return
(
<
ReactFlow
<
ReactFlow
nodes=
{
nodes
}
nodes=
{
nodes
}
edges=
{
edges
}
edges=
{
edges
}
fitView
fitView
proOptions=
{
{
hideAttribution
:
true
,
account
:
""
}
}
proOptions=
{
{
hideAttribution
:
true
,
account
:
""
}
}
nodeTypes=
{
nodeTypes
}
nodeTypes=
{
nodeTypes
}
onPaneClick=
{
handlePaneClick
}
onPaneClick=
{
handlePaneClick
}
onNodeClick=
{
onNodeClick
}
onNodeClick=
{
onNodeClick
}
{
...
props
}
{
...
props
}
>
>
<
Controls
/>
<
Controls
/>
<
Background
color=
"#aaa"
gap=
{
16
}
/>
<
Background
color=
"#aaa"
gap=
{
16
}
/>
</
ReactFlow
>
</
ReactFlow
>
);
);
};
};
export
default
Flow
;
export
default
Flow
;
src/views/WorkFlowEdit/components/OperatorList/index.module.css
0 → 100644
View file @
2cfbf2e2
.operatorItemBox
{
background-color
:
#fff
;
border-radius
:
4px
;
cursor
:
grab
;
padding
:
16px
0
;
border-bottom
:
1px
solid
#f0f2f5
;
}
.operatorItemTitle
{
user-select
:
none
;
font-size
:
14px
;
color
:
#1e2633
;
}
.operatorItemText
{
color
:
#8a9099
;
margin
:
8px
0
;
font-size
:
12px
;
user-select
:
none
;
display
:
-webkit-box
;
-webkit-line-clamp
:
3
;
-webkit-box-orient
:
vertical
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
}
.labelBox
{
user-select
:
none
;
display
:
inline-block
;
border-radius
:
2px
;
font-size
:
12px
;
padding
:
2px
8px
;
}
.footerBx
{
display
:
flex
;
align-items
:
center
;
}
src/views/WorkFlowEdit/components/OperatorList/index.tsx
0 → 100644
View file @
2cfbf2e2
import
{
IOperatorItemProps
}
from
"./interface"
;
import
{
OutlinedInput
}
from
"@mui/material"
;
import
SearchIcon
from
"@mui/icons-material/Search"
;
import
styles
from
"./index.module.css"
;
/*
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-07-06 15:16:01
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-07-06 16:27:16
* @FilePath: /bkunyun/src/views/WorkFlowEdit/components/OperatorList/index.tsx
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
const
OperatorItem
=
(
props
:
IOperatorItemProps
)
=>
{
const
{
info
}
=
props
;
return
(
<
div
className=
{
styles
.
operatorItemBox
}
>
<
h2
className=
{
styles
.
operatorItemTitle
}
>
说什么呢啊
</
h2
>
<
div
className=
{
styles
.
operatorItemText
}
>
STU utility
是一个R-packa标处理目标处理,目标处理目标处理标处理目标处理后期委屈好委屈农,博啊发布丢我被欺安度切换阿斯顿几切换,i的亲戚我好奇你eqeqeweqeqeeqeqeqeqeq。
</
div
>
<
div
className=
{
styles
.
footerBx
}
>
<
span
className=
{
styles
.
labelBox
}
style=
{
{
background
:
true
?
"#EBF3FF"
:
"#E3FAEC"
,
color
:
true
?
"#1370FF"
:
"#02AB83"
,
}
}
>
公共平台
</
span
>
<
OutlinedInput
onChange=
{
(
e
:
any
)
=>
{
console
.
log
(
e
.
target
.
value
);
}
}
// value={templateName}
placeholder=
"输入关键词搜索"
size=
"small"
sx=
{
{
flex
:
1
,
height
:
32
}
}
endAdornment=
{
<
SearchIcon
style=
{
{
color
:
"#8A9099"
}
}
/>
}
/>
</
div
>
</
div
>
);
};
const
OperatorList
=
()
=>
{
const
arr
=
[
222
,
3333
,
339
];
return
(
<>
{
arr
.
map
((
item
)
=>
{
return
<
OperatorItem
key=
{
item
}
info=
{
item
}
/>;
})
}
</>
);
};
export
default
OperatorList
;
src/views/WorkFlowEdit/components/OperatorList/interface.ts
0 → 100644
View file @
2cfbf2e2
/*
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-07-06 15:32:11
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-07-06 15:32:42
* @FilePath: /bkunyun/src/views/WorkFlowEdit/components/OperatorList/interface.ts
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
export
interface
IOperatorItemProps
{
info
:
any
}
\ No newline at end of file
src/views/WorkFlowEdit/index.module.css
View file @
2cfbf2e2
...
@@ -32,10 +32,10 @@
...
@@ -32,10 +32,10 @@
.swFormBox
{
.swFormBox
{
background-color
:
#fff
;
background-color
:
#fff
;
border-right
:
1
xp
solid
rgba
(
235
,
237
,
240
,
1
);
border-right
:
1
xp
solid
rgba
(
235
,
237
,
240
,
1
);
width
:
608
px
;
width
:
360
px
;
overflow-y
:
scroll
;
overflow-y
:
scroll
;
box-sizing
:
border-box
;
box-sizing
:
border-box
;
padding
:
36
px
;
padding
:
24
px
;
}
}
.swFlowBox
{
.swFlowBox
{
flex
:
1
;
flex
:
1
;
...
...
src/views/WorkFlowEdit/index.tsx
View file @
2cfbf2e2
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Author: 吴永生#A02208 yongsheng.wu@wholion.com
* @Date: 2022-06-21 20:03:56
* @Date: 2022-06-21 20:03:56
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditors: 吴永生#A02208 yongsheng.wu@wholion.com
* @LastEditTime: 2022-07-0
5 16:31:28
* @LastEditTime: 2022-07-0
6 15:21:55
* @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
*/
*/
...
@@ -14,6 +14,7 @@ import { useLocation, useNavigate } from "react-router-dom";
...
@@ -14,6 +14,7 @@ import { useLocation, useNavigate } from "react-router-dom";
import
MyPopconfirm
from
"@/components/mui/MyPopconfirm"
;
import
MyPopconfirm
from
"@/components/mui/MyPopconfirm"
;
import
ButtonComponent
from
"@/components/mui/Button"
;
import
ButtonComponent
from
"@/components/mui/Button"
;
import
{
ITemplateConfig
}
from
"../Project/ProjectSubmitWork/interface"
;
import
{
ITemplateConfig
}
from
"../Project/ProjectSubmitWork/interface"
;
import
OperatorList
from
"./components/OperatorList"
;
import
styles
from
'./index.module.css'
import
styles
from
'./index.module.css'
...
@@ -64,7 +65,7 @@ const WorkFlowEdit = () => {
...
@@ -64,7 +65,7 @@ const WorkFlowEdit = () => {
</
div
>
</
div
>
<
div
className=
{
styles
.
swContent
}
>
<
div
className=
{
styles
.
swContent
}
>
<
div
className=
{
styles
.
swFormBox
}
>
<
div
className=
{
styles
.
swFormBox
}
>
左侧
<
OperatorList
/>
</
div
>
</
div
>
<
div
className=
{
styles
.
swFlowBox
}
>
<
div
className=
{
styles
.
swFlowBox
}
>
右侧
右侧
...
...
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