StorageTable.tsx
1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import React from 'react';
import { Table } from 'antd';
import {useStore} from '../index';
import {PoolItem} from '../api';
const {Column} = Table;
export default function Index(props: {out?:boolean}) {
const {out} = props;
const {data, loading, setListItem, setAnalysisVisible} = useStore();
const analysis = (r:PoolItem, dt:number) => {
setListItem({type: out ? 6 : 7, detailType: dt, _item: r});
setAnalysisVisible(true);
};
return (
<>
<Table
dataSource={data}
loading={loading}
pagination={false}
rowKey={r => `${r.id}`}
scroll={{y: 500}}
>
<Column title={out ? "调出库房" : "调入库房"} dataIndex="name" />
<Column title="动态库销比" dataIndex="ratio" render={t => (t ? t.toFixed(2) : '--')} />
<Column title="调出池配件品种" dataIndex="transferKind" />
<Column title="调出池配件数量" dataIndex="transferCnt" />
{out ?
<Column title="调入库房分析" render={(r:PoolItem) => <a onClick={() => analysis(r, 7)}>查看</a>} />
:
<Column title="调出库房分析" render={(r:PoolItem) => <a onClick={() => analysis(r, 6)}>查看</a>} />}
<Column title="配件分析" render={(r:PoolItem) => <a onClick={() => analysis(r, 5)}>查看</a>} />
<Column title="车系分析" render={(r:PoolItem) => <a onClick={() => analysis(r, 3)}>查看</a>} />
<Column title="工单分析" render={(r:PoolItem) => <a onClick={() => analysis(r, 8)}>查看</a>} />
</Table>
</>
);
}