Blame view

src/pages/pms/partPlan/PlanPool/components/AreaTable.tsx 3.55 KB
f33cc9f7   by1642146903   计划池
1
2
3
4
5
6
7
8
9
10
  import {Table} from 'antd';
  import React, {useEffect, useState} from 'react';
  import useInitial from "@/hooks/useInitail";
  import {getList, ListVO} from "@/pages/pms/partPlan/PlanPool/api";
  import DetailModal from './DetailModal';
  import {useStore} from "@/pages/pms/partPlan/PlanPool";
  
  const { Column } = Table;
  interface Props {
    showAnalyse?: boolean
f33cc9f7   by1642146903   计划池
11
12
13
    type?: number, // 类型1区域库2库房3车系4车型5配件
    // eslint-disable-next-line react/no-unused-prop-types
    detailType?: number, // 类型1区域库2库房3车系4车型5配件
f33cc9f7   by1642146903   计划池
14
15
16
    id?: number, // 上一个列表ID
  }
  export default function Index(props: Props = {}) {
57b51c35   jiangwei   配件计划池增加查看90天出库详情和...
17
    const { dfParams, key, setItem, setOutVisible, setCustVisible } = useStore();
f33cc9f7   by1642146903   计划池
18
    const {showAnalyse=true} = props;
48df7798   jiangwei   计划池展示信息优化
19
    const { data: parts, setParams, loading } = useInitial(getList, [], {...dfParams, ...props});
f33cc9f7   by1642146903   计划池
20
21
22
23
24
25
    const [visible, setVisible] = useState(false);
    // 类型1区域库2库房3车系4车型5配件
    const [detailType, setDetailType] = useState<number>();
    const [id, setId] = useState<number>();
  
    useEffect(() => {
f33cc9f7   by1642146903   计划池
26
27
28
29
30
31
32
      if (key == props.type) {
        setParams(dfParams, true);
      }
    }, [dfParams, key]);
  
    return (
      <div>
48df7798   jiangwei   计划池展示信息优化
33
        <Table rowKey={(v: ListVO) => `${v.id}`} scroll={{y: 500, x: 2500}} dataSource={parts || []} pagination={false} loading={loading}>
f33cc9f7   by1642146903   计划池
34
          <Column title="区域库" dataIndex="name" fixed="left" />
5f69c1aa   jiangwei   样式交互优化
35
          <Column title="本次计划数量(个)" dataIndex="cnt" fixed="left" />
48df7798   jiangwei   计划池展示信息优化
36
37
          <Column title="计划前库销比" dataIndex="ratio" render={t => (t || 0).toFixed(2)} />
          <Column title="计划后库销比" dataIndex="planeRatio" render={t => (t || 0).toFixed(2)} />
f33cc9f7   by1642146903   计划池
38
          <Column title="本次计划金额(元)" dataIndex="thisTimeAmount" />
57b51c35   jiangwei   配件计划池增加查看90天出库详情和...
39
          <Column title="客户订件数量(个)" render={r => <a onClick={() => { setCustVisible(true); setItem(r); }}>{r.buyCnt}</a>} />
48df7798   jiangwei   计划池展示信息优化
40
          <Column title="客户订件金额(元)" dataIndex="buyAmount" />
48df7798   jiangwei   计划池展示信息优化
41
          <Column title="在途未锁(个)" dataIndex="onTheWayUnlockCnt" />
b63dc2a7   jiangwei   fix
42
          
48df7798   jiangwei   计划池展示信息优化
43
          <Column title="在库未锁(个)" dataIndex="storageUnlockCnt" />
b63dc2a7   jiangwei   fix
44
          <Column title="在库已锁(个)" dataIndex="storageLockedCnt" />
57b51c35   jiangwei   配件计划池增加查看90天出库详情和...
45
          <Column title="滚动90天出库(个)" render={r => <a onClick={() => { setOutVisible(true); setItem(r); }}>{r.outStockCnt}</a>} />
f33cc9f7   by1642146903   计划池
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
          {showAnalyse && (
            <>
              <Column
                title="库房分析"
                render={(t, _: ListVO) => (
                  <a onClick={() => {
                    setVisible(true);
                    setId(_.id);
                    setDetailType(2);
                  }}
                  >
                    查看
                  </a>
                )}
              />
              <Column
                title="车系分析"
                render={(t, _: ListVO) => (
                  <a onClick={() => {
                    setVisible(true);
                    setId(_.id);
                    setDetailType(3);
                  }}
                  >
                    查看
                  </a>
                )}
              />
              <Column
                title="配件分析"
                render={(t, _: ListVO) => (
                  <a onClick={() => {
                    setVisible(true);
                    setId(_.id);
                    setDetailType(5);
                  }}
                  >
                    查看
                  </a>
                )}
              />
            </>
          )}
        </Table>
        <DetailModal
          visible={visible}
          onCancel={() => setVisible(false)}
          id={id}
          detailType={detailType}
          type={1}
        />
      </div>
    );
  }