1
0
Files
leopard/leopard-web/src/pages/stock/StockCollectionList.tsx

104 lines
3.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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)