feat(ai-web): 增加任务和任务模板
This commit is contained in:
95
service-web/client/src/pages/ai/task/FlowTask.tsx
Normal file
95
service-web/client/src/pages/ai/task/FlowTask.tsx
Normal file
@@ -0,0 +1,95 @@
|
||||
import React from 'react'
|
||||
import {amisRender, commonInfo, crudCommonOptions, paginationTemplate,} from '../../../util/amis.tsx'
|
||||
import {useNavigate} from 'react-router'
|
||||
|
||||
const FlowTask: React.FC = () => {
|
||||
const navigate = useNavigate()
|
||||
return (
|
||||
<div className="task-template">
|
||||
{amisRender(
|
||||
{
|
||||
type: 'page',
|
||||
title: '任务记录',
|
||||
body: [
|
||||
{
|
||||
type: 'crud',
|
||||
api: {
|
||||
method: 'post',
|
||||
url: `${commonInfo.baseAiUrl}/flow_task/list`,
|
||||
data: {
|
||||
page: {
|
||||
index: '${page}',
|
||||
size: '${perPage}',
|
||||
}
|
||||
}
|
||||
},
|
||||
...crudCommonOptions(),
|
||||
...paginationTemplate(
|
||||
10,
|
||||
5,
|
||||
[
|
||||
{
|
||||
type: 'action',
|
||||
label: '',
|
||||
icon: 'fa fa-plus',
|
||||
size: 'sm',
|
||||
onEvent: {
|
||||
click: {
|
||||
actions: [
|
||||
{
|
||||
actionType: 'custom',
|
||||
// @ts-ignore
|
||||
script: (context, action, event) => {
|
||||
navigate(`/ai/flow_task/add`)
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
),
|
||||
columns: [
|
||||
{
|
||||
name: 'id',
|
||||
label: '任务ID',
|
||||
width: 200,
|
||||
},
|
||||
{
|
||||
name: 'status',
|
||||
label: '状态',
|
||||
},
|
||||
{
|
||||
type: 'operation',
|
||||
label: '操作',
|
||||
width: 200,
|
||||
buttons: [
|
||||
{
|
||||
type: 'action',
|
||||
label: '重新执行',
|
||||
level: 'link',
|
||||
size: 'sm',
|
||||
},
|
||||
{
|
||||
type: 'action',
|
||||
label: '删除',
|
||||
className: 'text-danger btn-deleted',
|
||||
level: 'link',
|
||||
size: 'sm',
|
||||
actionType: 'ajax',
|
||||
api: `get:${commonInfo.baseAiUrl}/task/remove/\${id}`,
|
||||
confirmText: '确认删除任务记录:${name}',
|
||||
confirmTitle: '删除',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default FlowTask
|
||||
Reference in New Issue
Block a user