104 lines
3.3 KiB
TypeScript
104 lines
3.3 KiB
TypeScript
import React from "react"
|
||
import {amisRender, commonInfo, crudCommonOptions, paginationTemplate, time} from '../../util/amis.tsx'
|
||
import {useNavigate} from 'react-router'
|
||
|
||
function StockCollectionList() {
|
||
const navigate = useNavigate()
|
||
return (
|
||
<div className="stock-collection-list">
|
||
{amisRender(
|
||
{
|
||
type: 'page',
|
||
title: '股票列表',
|
||
body: [
|
||
{
|
||
type: 'crud',
|
||
api: {
|
||
method: 'post',
|
||
url: `${commonInfo.baseUrl}/stock_collection/list`,
|
||
data: {
|
||
sort: [
|
||
{
|
||
column: 'createdTime',
|
||
direction: 'DESC',
|
||
},
|
||
],
|
||
},
|
||
},
|
||
...crudCommonOptions(),
|
||
...paginationTemplate(15, undefined, ['filter-toggler']),
|
||
columns: [
|
||
{
|
||
name: 'name',
|
||
label: '名称',
|
||
width: 200,
|
||
},
|
||
{
|
||
name: 'description',
|
||
label: '描述',
|
||
},
|
||
{
|
||
name: 'count',
|
||
label: '股票数量',
|
||
align: 'center',
|
||
width: 100,
|
||
},
|
||
{
|
||
name: 'createdTime',
|
||
label: '创建时间',
|
||
width: 150,
|
||
align: 'center',
|
||
...time('createdTime'),
|
||
},
|
||
{
|
||
name: 'modifiedTime',
|
||
label: '更新时间',
|
||
width: 150,
|
||
align: 'center',
|
||
...time('modifiedTime'),
|
||
},
|
||
{
|
||
type: 'operation',
|
||
label: '操作',
|
||
width: 100,
|
||
buttons: [
|
||
{
|
||
type: 'action',
|
||
label: '详情',
|
||
level: 'link',
|
||
onEvent: {
|
||
click: {
|
||
actions: [
|
||
{
|
||
actionType: 'custom',
|
||
// @ts-ignore
|
||
script: (context, action, event) => {
|
||
navigate(`/stock/collection/detail/${context.props.data['id']}`)
|
||
},
|
||
},
|
||
],
|
||
},
|
||
},
|
||
},
|
||
{
|
||
className: 'text-danger btn-deleted',
|
||
type: 'action',
|
||
label: '删除',
|
||
level: 'link',
|
||
actionType: 'ajax',
|
||
api: `get:${commonInfo.baseUrl}/stock_collection/remove/\${id}`,
|
||
confirmText: '确认删除股票集<span class="text-lg font-bold mx-2">${name}</span>?',
|
||
confirmTitle: '删除',
|
||
},
|
||
],
|
||
},
|
||
],
|
||
},
|
||
],
|
||
},
|
||
)}
|
||
</div>
|
||
)
|
||
}
|
||
|
||
export default React.memo(StockCollectionList) |