1
0

feat: 增加任务模板的增删改查

This commit is contained in:
2025-09-05 19:58:12 +08:00
parent 1fc8d3160c
commit 028a578896
15 changed files with 527 additions and 99 deletions

View File

@@ -0,0 +1,113 @@
import React from 'react'
import {amisRender, commonInfo, crudCommonOptions, paginationTemplate, remoteMappings} from '../../util/amis.tsx'
import {useNavigate} from 'react-router'
function TaskTemplateList() {
const navigate = useNavigate()
return (
<div className="task-template-list">
{amisRender(
{
type: 'page',
title: '任务模板',
body: [
{
type: 'crud',
api: {
method: 'post',
url: `${commonInfo.baseUrl}/task_template/list`,
data: {
page: {
index: '${page}',
size: '${perPage}',
},
},
},
...crudCommonOptions(),
...paginationTemplate(
15,
undefined,
[
{
type: 'action',
label: '',
icon: 'fa fa-plus',
tooltip: '添加模板',
tooltipPlacement: 'top',
onEvent: {
click: {
actions: [
{
actionType: 'custom',
// @ts-ignore
script: (context, action, event) => {
navigate('/task/template/save/-1')
},
},
],
},
},
},
],
),
columns: [
{
name: 'name',
label: '名称',
width: 150,
},
{
name: 'description',
label: '描述',
},
{
name: 'type',
label: '类型',
width: 100,
...remoteMappings('task_template_type', 'type'),
},
{
type: 'operation',
label: '操作',
width: 100,
buttons: [
{
type: 'action',
label: '详情',
level: 'link',
onEvent: {
click: {
actions: [
{
actionType: 'custom',
// @ts-ignore
script: (context, action, event) => {
navigate(`/task/template/save/${context.props.data['id']}`)
},
},
],
},
},
},
{
className: 'text-danger',
type: 'action',
label: '删除',
level: 'link',
actionType: 'ajax',
api: `get:${commonInfo.baseUrl}/task_template/remove/\${id}`,
confirmText: '确认删除模板[${name}]',
confirmTitle: "删除",
}
],
},
],
},
],
},
)}
</div>
)
}
export default React.memo(TaskTemplateList)