Blame view

src/pages/pms/partPlan/PlanPool/components/SeriesTable.tsx 4.09 KB
f33cc9f7   by1642146903   计划池
1
2
3
4
5
6
  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";
da356727   jiangwei   配件计划调整
7
  import _ from 'lodash';
f33cc9f7   by1642146903   计划池
8
9
10
11
12
13
  
  const { Column } = Table;
  interface Props {
    showAnalyse?: boolean
    // eslint-disable-next-line react/no-unused-prop-types
    type?: number, // 类型1区域库2库房3车系4车型5配件
f33cc9f7   by1642146903   计划池
14
    detailType?: number, // 类型1区域库2库房3车系4车型5配件
48df7798   jiangwei   计划池展示信息优化
15
    // eslint-disable-next-line react/no-unused-prop-types, react/no-unused-prop-types
f33cc9f7   by1642146903   计划池
16
17
18
    id?: number, // 上一个列表ID
  }
  export default function Index(props: Props = {}) {
57b51c35   jiangwei   配件计划池增加查看90天出库详情和...
19
    const { dfParams, key, setItem, setOutVisible, setCustVisible } = useStore();
f33cc9f7   by1642146903   计划池
20
    const {showAnalyse=true} = props;
48df7798   jiangwei   计划池展示信息优化
21
    const { data: parts, setParams, loading } = useInitial(getList, [], {...dfParams, ...props});
f33cc9f7   by1642146903   计划池
22
23
24
25
26
27
28
29
30
31
32
33
34
    const [visible, setVisible] = useState(false);
    // 类型1区域库2库房3车系4车型5配件
    const [detailType, setDetailType] = useState<number>();
    const [id, setId] = useState<number>();
  
    useEffect(() => {
      if (key == props.type) {
        setParams(dfParams, true);
      }
    }, [dfParams, key]);
  
    return (
      <div>
48df7798   jiangwei   计划池展示信息优化
35
        <Table rowKey={(v: ListVO) => `${v.id}`} scroll={{y: 500, x: 2500}} dataSource={parts || []} pagination={false} loading={loading}>
f33cc9f7   by1642146903   计划池
36
          <Column title="车系" dataIndex="name" fixed="left" />
5f69c1aa   jiangwei   样式交互优化
37
          <Column title="本次计划数量(个)" dataIndex="cnt" fixed="left" />
da356727   jiangwei   配件计划调整
38
          <Column title="计划前库销比" dataIndex="ratio" render={t => (t ? t.toFixed(2) : "--")} />
26e33634   jiangwei   库销比展示
39
          <Column title="计划后库销比" dataIndex="planRatio" render={t => (t ? t.toFixed(2) : "--")} />
5f69c1aa   jiangwei   样式交互优化
40
          
f33cc9f7   by1642146903   计划池
41
          <Column title="本次计划金额(元)" dataIndex="thisTimeAmount" />
bef418e5   jiangwei   优化
42
          <Column title="客户订件数量(个)" render={r => (r.buyCnt ? <a onClick={() => { setCustVisible(true); setItem(r); }}>{r.buyCnt}</a> : r.buyCnt)} />
48df7798   jiangwei   计划池展示信息优化
43
          <Column title="客户订件金额(元)" dataIndex="buyAmount" />
48df7798   jiangwei   计划池展示信息优化
44
          <Column title="在途未锁(个)" dataIndex="onTheWayUnlockCnt" />
b63dc2a7   jiangwei   fix
45
          
48df7798   jiangwei   计划池展示信息优化
46
          <Column title="在库未锁(个)" dataIndex="storageUnlockCnt" />
b63dc2a7   jiangwei   fix
47
          <Column title="在库已锁(个)" dataIndex="storageLockedCnt" />
da356727   jiangwei   配件计划调整
48
          <Column title="近90天月均出库(个)" render={r => (r.outStockCnt ? <a onClick={() => { setOutVisible(true); setItem(r); }}>{_.floor(r.outStockCnt/3)}</a> : r.outStockCnt)} />
f33cc9f7   by1642146903   计划池
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
          {showAnalyse && (
            <>
              <Column
                title="区域库分析"
                render={(t, _: ListVO) => (
                  <a onClick={() => {
                    setVisible(true);
                    setId(_.id);
                    setDetailType(1);
                  }}
                  >
                    查看
                  </a>
                )}
              />
              <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(4);
                  }}
                  >
                    查看
                  </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={3}
        />
      </div>
    );
  }