Blame view

src/pages/pms/partPlan/PlanPool/components/PartTable.tsx 3.98 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
14
15
16
17
18
19
  
  const { Column } = Table;
  interface Props {
    showAnalyse?: boolean
    // eslint-disable-next-line react/no-unused-prop-types
    type?: number, // 类型1区域库2库房3车系4车型5配件
    // eslint-disable-next-line react/no-unused-prop-types
    detailType?: number, // 类型1区域库2库房3车系4车型5配件
    // eslint-disable-next-line react/no-unused-prop-types
    id?: number, // 上一个列表ID
  }
  export default function Index(props: Props = {}) {
57b51c35   jiangwei   配件计划池增加查看90天出库详情和...
20
    const { dfParams, key, setItem, setOutVisible, setCustVisible } = useStore();
f33cc9f7   by1642146903   计划池
21
    const {showAnalyse=true} = props;
48df7798   jiangwei   计划池展示信息优化
22
    const { data: parts, setParams, loading } = useInitial(getList, [], {...dfParams, ...props});
f33cc9f7   by1642146903   计划池
23
24
25
26
27
28
29
30
31
32
33
34
35
    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   计划池展示信息优化
36
        <Table rowKey={(v: ListVO) => `${v.id}`} scroll={{y: 500, x: 3000}} dataSource={parts || []} pagination={false} loading={loading}>
f33cc9f7   by1642146903   计划池
37
          <Column title="配件编码" dataIndex="code" fixed="left" />
5f69c1aa   jiangwei   样式交互优化
38
39
          <Column title="配件名称" dataIndex="name" fixed="left" />
          <Column title="本次计划数量(个)" dataIndex="cnt" fixed="left" />
67c1c3e7   jiangwei   配件外采计划池筛选条件
40
          <Column title="来源类型" dataIndex="typeName" />
c8dc9e64   jiangwei   配件类型
41
          <Column title="配件类型" dataIndex="partTypeName" />
5f69c1aa   jiangwei   样式交互优化
42
          
da356727   jiangwei   配件计划调整
43
          <Column title="计划前库销比" dataIndex="ratio" render={t => (t ? t.toFixed(2) : "--")} />
26e33634   jiangwei   库销比展示
44
          <Column title="计划后库销比" dataIndex="planRatio" render={t => (t ? t.toFixed(2) : "--")} />
5f69c1aa   jiangwei   样式交互优化
45
          
48df7798   jiangwei   计划池展示信息优化
46
          <Column title="本次计划金额(元)" dataIndex="thisTimeAmount" />
bef418e5   jiangwei   优化
47
          <Column title="客户订件数量(个)" render={r => (r.buyCnt ? <a onClick={() => { setCustVisible(true); setItem(r); }}>{r.buyCnt}</a> : r.buyCnt)} />
48df7798   jiangwei   计划池展示信息优化
48
          <Column title="客户订件金额(元)" dataIndex="buyAmount" />
48df7798   jiangwei   计划池展示信息优化
49
          <Column title="在途未锁(个)" dataIndex="onTheWayUnlockCnt" />
b63dc2a7   jiangwei   fix
50
         
48df7798   jiangwei   计划池展示信息优化
51
          <Column title="在库未锁(个)" dataIndex="storageUnlockCnt" />
b63dc2a7   jiangwei   fix
52
          <Column title="在库已锁(个)" dataIndex="storageLockedCnt" />
da356727   jiangwei   配件计划调整
53
          <Column title="近90天月均出库(个)" render={r => (r.outStockCnt ? <a onClick={() => { setOutVisible(true); setItem(r); }}>{_.floor(r.outStockCnt/3)}</a> : r.outStockCnt)} />
f33cc9f7   by1642146903   计划池
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
          {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(3);
                  }}
                  >
                    查看
                  </a>
                )}
              />
f33cc9f7   by1642146903   计划池
95
96
97
98
99
100
101
102
103
104
105
106
107
            </>
          )}
        </Table>
        <DetailModal
          visible={visible}
          onCancel={() => setVisible(false)}
          id={id}
          detailType={detailType}
          type={5}
        />
      </div>
    );
  }