105 lines
3.0 KiB
TypeScript
105 lines
3.0 KiB
TypeScript
import React from 'react'
|
|
import {amisRender, commonInfo, crudCommonOptions, paginationTemplate, remoteMappings, time} from '../../util/amis.tsx'
|
|
import {useNavigate} from 'react-router'
|
|
|
|
function TaskList() {
|
|
const navigate = useNavigate()
|
|
return (
|
|
<div className="task-list">
|
|
{amisRender(
|
|
{
|
|
type: 'page',
|
|
title: '任务列表',
|
|
body: [
|
|
{
|
|
type: 'crud',
|
|
api: {
|
|
method: 'post',
|
|
url: `${commonInfo.baseUrl}/task/list`,
|
|
data: {
|
|
page: {
|
|
index: '${page}',
|
|
size: '${perPage}',
|
|
},
|
|
},
|
|
},
|
|
...crudCommonOptions(),
|
|
...paginationTemplate(15),
|
|
columns: [
|
|
{
|
|
name: 'name',
|
|
label: '简称',
|
|
width: 150,
|
|
},
|
|
{
|
|
name: 'description',
|
|
label: '描述',
|
|
},
|
|
{
|
|
name: 'status',
|
|
label: '状态',
|
|
width: 100,
|
|
...remoteMappings('task_status', 'status'),
|
|
},
|
|
{
|
|
name: 'step',
|
|
label: '进度',
|
|
type: 'progress',
|
|
showLabel: false,
|
|
},
|
|
{
|
|
label: '耗时',
|
|
type: 'tpl',
|
|
align: 'center',
|
|
width: 150,
|
|
tpl: "${IF(costText, costText, '/')}",
|
|
},
|
|
{
|
|
name: 'launchedTime',
|
|
label: '启动时间',
|
|
width: 150,
|
|
align: 'center',
|
|
...time('launchedTime'),
|
|
},
|
|
{
|
|
name: 'finishedTime',
|
|
label: '结束时间',
|
|
width: 150,
|
|
align: 'center',
|
|
...time('finishedTime'),
|
|
},
|
|
{
|
|
type: 'operation',
|
|
label: '操作',
|
|
width: 100,
|
|
buttons: [
|
|
{
|
|
type: 'action',
|
|
label: '详情',
|
|
level: 'link',
|
|
onEvent: {
|
|
click: {
|
|
actions: [
|
|
{
|
|
actionType: 'custom',
|
|
// @ts-ignore
|
|
script: (context, action, event) => {
|
|
navigate(`/task/detail/${context.props.data['id']}`)
|
|
},
|
|
},
|
|
],
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
)}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default React.memo(TaskList) |