增加计划详细页
parent
54170a21e8
commit
e5ebfbd7dd
@ -0,0 +1,94 @@
|
|||||||
|
import { useParams } from "react-router-dom";
|
||||||
|
import { useEffect } from 'react';
|
||||||
|
import { observer } from "mobx-react";
|
||||||
|
import { toJS } from "mobx";
|
||||||
|
import moment from "moment";
|
||||||
|
import { Row, Col, Space, Button, Table, Tag, Typography, DatePicker } from 'antd';
|
||||||
|
import { useStore } from '../../stores/StoreContext.js';
|
||||||
|
|
||||||
|
const { Title } = Typography;
|
||||||
|
|
||||||
|
const planListColumns = [
|
||||||
|
{
|
||||||
|
title: 'Name',
|
||||||
|
dataIndex: 'name',
|
||||||
|
key: 'name',
|
||||||
|
render: (text) => <a>{text}</a>,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Age',
|
||||||
|
dataIndex: 'age',
|
||||||
|
key: 'age',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Address',
|
||||||
|
dataIndex: 'address',
|
||||||
|
key: 'address',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Tags',
|
||||||
|
key: 'tags',
|
||||||
|
dataIndex: 'tags',
|
||||||
|
render: (_, { tags }) => (
|
||||||
|
<>
|
||||||
|
{tags.map((tag) => {
|
||||||
|
let color = tag.length > 5 ? 'geekblue' : 'green';
|
||||||
|
if (tag === 'loser') {
|
||||||
|
color = 'volcano';
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<Tag color={color} key={tag}>
|
||||||
|
{tag.toUpperCase()}
|
||||||
|
</Tag>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Action',
|
||||||
|
key: 'action',
|
||||||
|
render: (_, record) => (
|
||||||
|
<Space size="middle">
|
||||||
|
<a>Invite {record.name}</a>
|
||||||
|
<a>Delete</a>
|
||||||
|
</Space>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
function Detail() {
|
||||||
|
const { planId } = useParams();
|
||||||
|
const { plan } = useStore();
|
||||||
|
const { planList } = plan;
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
console.info('Detail.useEffect: ' + planId);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Space direction="vertical" style={{ width: '100%' }}>
|
||||||
|
<Title level={3}>Plan Detail</Title>
|
||||||
|
<Row gutter={{ md: 24 }} justify="end">
|
||||||
|
<Col span={6}>
|
||||||
|
<Space direction="horizontal" style={{ width: '100%' }}>
|
||||||
|
Group Date:
|
||||||
|
<DatePicker.RangePicker
|
||||||
|
allowClear={false}
|
||||||
|
/>
|
||||||
|
</Space>
|
||||||
|
</Col>
|
||||||
|
<Col span={12}>
|
||||||
|
<Button type='primary' onClick={() => plan.fetchRecent()}>Search</Button>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
<Row>
|
||||||
|
<Col span={24}>
|
||||||
|
<Table columns={planListColumns} dataSource={toJS(planList)} />
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</Space>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default observer(Detail);
|
Loading…
Reference in New Issue