feat(ai-web): 完成执行任务的创建(提交漏的文件)

This commit is contained in:
v-zhangjc9
2025-07-05 14:48:53 +08:00
parent 64ef5514b4
commit 051b3dbad2
5 changed files with 282 additions and 23 deletions

View File

@@ -1,6 +1,21 @@
import React from 'react'
import {amisRender, commonInfo, crudCommonOptions, paginationTemplate,} from '../../../util/amis.tsx'
import {useNavigate} from 'react-router'
import {
amisRender,
commonInfo,
crudCommonOptions,
mappingField,
mappingItem,
paginationTemplate,
readOnlyDialogOptions,
} from '../../../util/amis.tsx'
import {generateInputForm} from './InputSchema.tsx'
const statusMapping = [
mappingItem('完成', 'FINISHED', 'label-success'),
mappingItem('执行中', 'RUNNING', 'label-warning'),
mappingItem('错误', 'ERROR', 'label-danger'),
]
const FlowTask: React.FC = () => {
const navigate = useNavigate()
@@ -20,8 +35,8 @@ const FlowTask: React.FC = () => {
page: {
index: '${page}',
size: '${perPage}',
}
}
},
},
},
...crudCommonOptions(),
...paginationTemplate(
@@ -55,15 +70,67 @@ const FlowTask: React.FC = () => {
label: '任务ID',
width: 200,
},
{
name: 'templateName',
label: '模板',
},
{
name: 'status',
label: '状态',
width: 50,
align: 'center',
...mappingField('status', statusMapping),
},
{
type: 'operation',
label: '操作',
width: 200,
buttons: [
{
type: 'action',
label: '查看',
level: 'link',
size: 'sm',
actionType: 'dialog',
dialog: {
title: '查看',
size: 'md',
...readOnlyDialogOptions(),
body: [
{
type: 'service',
schemaApi: {
method: 'get',
url: `${commonInfo.baseAiUrl}/flow_task/template/input_schema/\${templateId}`,
// @ts-ignore
adaptor: (payload, response, api, context) => {
return {
...payload,
data: {
...generateInputForm(payload.data, undefined, false),
id: 'db8a4d10-0c47-4e27-b1a4-d0f2e1c15992',
initApi: {
method: 'get',
url: `${commonInfo.baseAiUrl}/flow_task/input_data/\${id}`,
// @ts-ignore
adaptor: (payload, response, api, context) => {
return {
...payload,
data: {
inputData: payload.data,
}
}
}
},
static: true,
},
}
},
},
},
],
},
},
{
type: 'action',
label: '重新执行',