import React from 'react' import {useNavigate} from 'react-router' import {amisRender, commonInfo, crudCommonOptions, paginationTemplate} from '../../../../util/amis.tsx' const FlowTaskTemplate: React.FC = () => { const navigate = useNavigate() return (
{amisRender( { type: 'page', title: '任务模板', body: [ { type: 'crud', api: { method: 'post', url: `${commonInfo.baseAiUrl}/flow_task/template/list`, data: { page: { index: '${page}', size: '${perPage}', }, }, }, ...crudCommonOptions(), ...paginationTemplate( 10, 5, [ { type: 'action', label: '', icon: 'fa fa-plus', tooltip: '新增', tooltipPlacement: 'top', size: 'sm', onEvent: { click: { actions: [ { actionType: 'custom', // @ts-ignore script: (context, action, event) => { navigate(`/ai/flow_task_template/edit/-1`) }, }, ], }, }, }, ], ), columns: [ { name: 'name', label: '名称', width: 200, }, { name: 'description', label: '描述', }, { type: 'operation', label: '操作', width: 200, buttons: [ { type: 'action', label: '编辑', level: 'link', size: 'sm', onEvent: { click: { actions: [ { actionType: 'custom', // @ts-ignore script: (context, action, event) => { navigate(`/ai/flow_task_template/edit/${context.props.data['id']}`) }, }, ], }, }, }, { type: 'action', label: '编辑流程', level: 'link', size: 'sm', onEvent: { click: { actions: [ { actionType: 'custom', // @ts-ignore script: (context, doAction, event) => { navigate(`/ai/flow_task_template/flow/edit/${context.props.data['id']}`) }, }, ], }, }, }, { type: 'action', label: '删除', className: 'text-danger btn-deleted', level: 'link', size: 'sm', actionType: 'ajax', api: `get:${commonInfo.baseAiUrl}/flow_task/template/remove/\${id}`, confirmText: '确认删除任务模板:${name}', confirmTitle: '删除', }, ], }, ], }, ], }, )}
) } export default FlowTaskTemplate