Commit 57b51c35fe5be4c8201bb4fc5153c6b9d34dfd07

Authored by jiangwei
1 parent 79d4a3b6

配件计划池增加查看90天出库详情和客户订件详情功能

src/pages/pms/partPlan/PlanManage/subpages/Apply/index.tsx
... ... @@ -171,7 +171,7 @@ export default function Index() {
171 171 }));
172 172 const type = isSave ? 1 : 2;
173 173 apiObj[type]({
174   - planId: planId?.planId,
  174 + planId: Number(planId?.planId),
175 175 ...dfParams,
176 176 suppliers
177 177 // suppliers: suppliers.map(i => ({
... ... @@ -333,20 +333,14 @@ export default function Index() {
333 333 />
334 334 </div>
335 335 <div style={{display: 'flex', justifyContent: 'center'}}>
336   - <Popconfirm
337   - title="确定取消"
338   - onConfirm={() => history.goBack()}
339   - okText="确定"
340   - cancelText="取消"
  336 + <Button
  337 + disabled={loading}
  338 + loading={loading}
  339 + style={{marginRight: 20}}
  340 + onClick={() => history.goBack()}
341 341 >
342   - <Button
343   - disabled={loading}
344   - loading={loading}
345   - style={{marginRight: 20}}
346   - >
347   - 取消
348   - </Button>
349   - </Popconfirm>
  342 + 取消
  343 + </Button>
350 344 <Button
351 345 disabled={loading}
352 346 loading={loading}
... ...
src/pages/pms/partPlan/PlanPool/api.ts
1 1 import { http } from '@/typing/http';
2 2 import request from '@/utils/request';
3 3 import { PMS_HOST } from '@/utils/host';
  4 +import { PartVO } from '@/pages/pms/partPlan/CustBuyPlan/api';
4 5  
5 6 export interface Params {
6 7 brandId?: number, // 品牌ID
... ... @@ -18,6 +19,7 @@ export interface Params {
18 19  
19 20 export interface ListVO {
20 21 poolId: number; // 计划池id
  22 + poolIds?: string,
21 23 id?: number;
22 24 name?: string; // 名称
23 25 code?: string; // 编码
... ... @@ -61,7 +63,60 @@ export interface ListVO {
61 63 unit?: string; // 采购规格(配件展示)
62 64 splitUnit?: string; // 拆分件规格(配件展示)
63 65 splitCnt?: number; // 拆分件数量(配件展示)
64   - partType?:number
  66 + partType?:number,
  67 + planWaitListIds?:string
  68 +}
  69 +
  70 +export interface OutItem{
  71 + /**
  72 + * 配件ID
  73 + */
  74 +partId?:number;
  75 +/**
  76 + * 配件编码
  77 + */
  78 +partCode?:string;
  79 +/**
  80 + * 配件名称
  81 + */
  82 +partName?:string;
  83 +/**
  84 + * 出库数量
  85 + */
  86 +partCnt?:number;
  87 +/**
  88 + * 成本价
  89 + */
  90 +costPrice?:number;
  91 +/**
  92 + * 出库类型1工单2装潢
  93 + */
  94 +type?:number;
  95 +/**
  96 + * 出库类型ID
  97 + */
  98 +typeId?:string;
  99 +/**
  100 + * 服务站id
  101 + */
  102 +shopId?:number;
  103 +/**
  104 + * 服务站名称
  105 + */
  106 +shopName?:string;
  107 +/**
  108 + * 集团ID
  109 + */
  110 +groupId?:number;
  111 +/**
  112 + * 出库时间
  113 + */
  114 +outTime?:string;
  115 +
  116 +/**
  117 + * 类型名称
  118 + */
  119 +typeName?:string;
65 120 }
66 121  
67 122 /**
... ... @@ -74,6 +129,15 @@ export function getList(params: Params): http.PromiseResp&lt;ListVO[]&gt; {
74 129 export function deleteApi(params: {poolId: number}) {
75 130 return request.post(`${PMS_HOST}/erp/plan/pool/delete/plan`, {...params});
76 131 }
  132 +
77 133 export function editApi(params: { poolId?: number, partCnt?: number}) {
78 134 return request.post(`${PMS_HOST}/erp/plan/pool/update/plan`, {...params});
79 135 }
  136 +
  137 +export function outFlowApi(params: { poolIds?: any, planId?: number, current?: number, pageSize?:number}):http.PromisePageResp<OutItem> {
  138 + return request.get(`${PMS_HOST}/erp/storage/out/list`, {params});
  139 +}
  140 +
  141 +export function custBuyApi(params: { planWaitListIds?: any}):http.PromiseResp<PartVO[]> {
  142 + return request.get(`${PMS_HOST}/erp/cus/buy/part/get/buy/part/list`, {params});
  143 +}
... ...
src/pages/pms/partPlan/PlanPool/components/AreaTable.tsx
... ... @@ -14,7 +14,7 @@ interface Props {
14 14 id?: number, // 上一个列表ID
15 15 }
16 16 export default function Index(props: Props = {}) {
17   - const { dfParams, key } = useStore();
  17 + const { dfParams, key, setItem, setOutVisible, setCustVisible } = useStore();
18 18 const {showAnalyse=true} = props;
19 19 const { data: parts, setParams, loading } = useInitial(getList, [], {...dfParams, ...props});
20 20 const [visible, setVisible] = useState(false);
... ... @@ -23,7 +23,6 @@ export default function Index(props: Props = {}) {
23 23 const [id, setId] = useState<number>();
24 24  
25 25 useEffect(() => {
26   - console.log('dfParams11', dfParams, key, props);
27 26 if (key == props.type) {
28 27 setParams(dfParams, true);
29 28 }
... ... @@ -37,13 +36,13 @@ export default function Index(props: Props = {}) {
37 36 <Column title="计划前库销比" dataIndex="ratio" render={t => (t || 0).toFixed(2)} />
38 37 <Column title="计划后库销比" dataIndex="planeRatio" render={t => (t || 0).toFixed(2)} />
39 38 <Column title="本次计划金额(元)" dataIndex="thisTimeAmount" />
40   - <Column title="客户订件数量(个)" dataIndex="buyCnt" />
  39 + <Column title="客户订件数量(个)" render={r => <a onClick={() => { setCustVisible(true); setItem(r); }}>{r.buyCnt}</a>} />
41 40 <Column title="客户订件金额(元)" dataIndex="buyAmount" />
42 41 <Column title="在途未锁(个)" dataIndex="onTheWayUnlockCnt" />
43 42  
44 43 <Column title="在库未锁(个)" dataIndex="storageUnlockCnt" />
45 44 <Column title="在库已锁(个)" dataIndex="storageLockedCnt" />
46   - <Column title="滚动90天出库(个)" dataIndex="outStockCnt" />
  45 + <Column title="滚动90天出库(个)" render={r => <a onClick={() => { setOutVisible(true); setItem(r); }}>{r.outStockCnt}</a>} />
47 46 {showAnalyse && (
48 47 <>
49 48 <Column
... ...
src/pages/pms/partPlan/PlanPool/components/CustBuyModal.tsx 0 → 100644
  1 +import React, { useEffect, useState } from 'react';
  2 +import { Button, Modal, Table } from 'antd';
  3 +import { useStore } from '../index';
  4 +import { custBuyApi } from '../api';
  5 +import { PartVO } from '@/pages/pms/partPlan/CustBuyPlan/api';
  6 +import useInitial from '@/hooks/useInitail';
  7 +
  8 +const { Column } = Table;
  9 +
  10 +export default function Index() {
  11 + const { custVisible, setCustVisible, item } = useStore();
  12 + const [delay, setDelay] = useState(true);
  13 + const { data, setParams, loading } = useInitial(custBuyApi, [], {}, delay);
  14 +
  15 + useEffect(() => {
  16 + if (custVisible && item?.planWaitListIds) {
  17 + setParams({ planWaitListIds: item.planWaitListIds }, true);
  18 + setDelay(false);
  19 + }
  20 + }, [custVisible]);
  21 +
  22 + return (
  23 + <Modal
  24 + title="客户订件详情"
  25 + width={1100}
  26 + visible={custVisible}
  27 + maskClosable={false}
  28 + onCancel={() => setCustVisible(false)}
  29 + footer={[
  30 + <Button onClick={() => setCustVisible(false)}>取消</Button>
  31 + ]}
  32 + >
  33 + <Table
  34 + rowKey={(v: PartVO) => `${v.waitListIds}`}
  35 + dataSource={data}
  36 + pagination={false}
  37 + loading={loading}
  38 + scroll={{x: 1400, y: 500}}
  39 + >
  40 + <Column title="时间" dataIndex="planTime" />
  41 + <Column title="VIN" dataIndex="typeId" />
  42 + <Column title="工单号" dataIndex="remark" />
  43 + <Column title="车牌号" dataIndex="plateNo" />
  44 + <Column title="配件编码" dataIndex="partCode" />
  45 + <Column title="配件名称" dataIndex="partName" />
  46 + <Column title="接车服务顾问" dataIndex="userName" />
  47 + <Column title="门店名称" dataIndex="shopName" />
  48 + <Column title="库房名称" dataIndex="storageName" />
  49 + <Column title="订件数量" dataIndex="splitCnt" />
  50 + <Column title="采购单价" dataIndex="price" />
  51 + <Column title="采购数量" dataIndex="cnt" />
  52 + </Table>
  53 + </Modal>
  54 + );
  55 +}
0 56 \ No newline at end of file
... ...
src/pages/pms/partPlan/PlanPool/components/OutFlowModal.tsx 0 → 100644
  1 +import React, { useEffect, useState } from 'react';
  2 +import {Button, Modal, Table} from 'antd';
  3 +import {useStore} from '../index';
  4 +import { outFlowApi, OutItem } from '../api';
  5 +import usePagination from '@/hooks/usePagination';
  6 +
  7 +const {Column} = Table;
  8 +
  9 +export default function Index() {
  10 + const {outVisible, setOutVisible, item} = useStore();
  11 + const [delay, setDelay]= useState(true);
  12 + const { list, setParams, loading, paginationConfig } = usePagination(outFlowApi, [], {delay});
  13 +
  14 + useEffect(() => {
  15 + if (outVisible && item?.poolIds) {
  16 + setParams({poolIds: item.poolIds}, true);
  17 + setDelay(false);
  18 + }
  19 + }, [outVisible]);
  20 +
  21 + return (
  22 + <Modal
  23 + title={`${item?.partName}滚动90天出库流水`}
  24 + width={1000}
  25 + visible={outVisible}
  26 + maskClosable={false}
  27 + onCancel={() => setOutVisible(false)}
  28 + footer={[
  29 + <Button onClick={() => setOutVisible(false)}>取消</Button>
  30 + ]}
  31 + >
  32 + <Table
  33 + dataSource={list}
  34 + loading={loading}
  35 + pagination={paginationConfig}
  36 + rowKey={(v: OutItem) => `${v.partId}`}
  37 + >
  38 + <Column title="配件编码" dataIndex="partCode" />
  39 + <Column title="配件名称" dataIndex="partName" />
  40 + <Column title="出库数量" dataIndex="partCnt" />
  41 + <Column title="出库类型" dataIndex="typeName" />
  42 + <Column title="服务站名称" dataIndex="shopName" />
  43 + <Column title="出库时间" dataIndex="outTime" />
  44 + </Table>
  45 + </Modal>
  46 + );
  47 +}
0 48 \ No newline at end of file
... ...
src/pages/pms/partPlan/PlanPool/components/PartTable.tsx
... ... @@ -16,7 +16,7 @@ interface Props {
16 16 id?: number, // 上一个列表ID
17 17 }
18 18 export default function Index(props: Props = {}) {
19   - const { dfParams, key } = useStore();
  19 + const { dfParams, key, setItem, setOutVisible, setCustVisible } = useStore();
20 20 const {showAnalyse=true} = props;
21 21 const { data: parts, setParams, loading } = useInitial(getList, [], {...dfParams, ...props});
22 22 const [visible, setVisible] = useState(false);
... ... @@ -43,13 +43,13 @@ export default function Index(props: Props = {}) {
43 43 <Column title="计划后库销比" dataIndex="planeRatio" render={t => (t || 0).toFixed(2)} />
44 44  
45 45 <Column title="本次计划金额(元)" dataIndex="thisTimeAmount" />
46   - <Column title="客户订件数量(个)" dataIndex="buyCnt" />
  46 + <Column title="客户订件数量(个)" render={r => <a onClick={() => { setCustVisible(true); setItem(r); }}>{r.buyCnt}</a>} />
47 47 <Column title="客户订件金额(元)" dataIndex="buyAmount" />
48 48 <Column title="在途未锁(个)" dataIndex="onTheWayUnlockCnt" />
49 49  
50 50 <Column title="在库未锁(个)" dataIndex="storageUnlockCnt" />
51 51 <Column title="在库已锁(个)" dataIndex="storageLockedCnt" />
52   - <Column title="滚动90天出库(个)" dataIndex="outStockCnt" />
  52 + <Column title="滚动90天出库(个)" render={r => <a onClick={() => { setOutVisible(true); setItem(r); }}>{r.outStockCnt}</a>} />
53 53 {showAnalyse && (
54 54 <>
55 55 <Column
... ...
src/pages/pms/partPlan/PlanPool/components/SeriesTable.tsx
... ... @@ -15,7 +15,7 @@ interface Props {
15 15 id?: number, // 上一个列表ID
16 16 }
17 17 export default function Index(props: Props = {}) {
18   - const { dfParams, key } = useStore();
  18 + const { dfParams, key, setItem, setOutVisible, setCustVisible } = useStore();
19 19 const {showAnalyse=true} = props;
20 20 const { data: parts, setParams, loading } = useInitial(getList, [], {...dfParams, ...props});
21 21 const [visible, setVisible] = useState(false);
... ... @@ -38,13 +38,13 @@ export default function Index(props: Props = {}) {
38 38 <Column title="计划后库销比" dataIndex="planeRatio" render={t => (t || 0).toFixed(2)} />
39 39  
40 40 <Column title="本次计划金额(元)" dataIndex="thisTimeAmount" />
41   - <Column title="客户订件数量(个)" dataIndex="buyCnt" />
  41 + <Column title="客户订件数量(个)" render={r => <a onClick={() => { setCustVisible(true); setItem(r); }}>{r.buyCnt}</a>} />
42 42 <Column title="客户订件金额(元)" dataIndex="buyAmount" />
43 43 <Column title="在途未锁(个)" dataIndex="onTheWayUnlockCnt" />
44 44  
45 45 <Column title="在库未锁(个)" dataIndex="storageUnlockCnt" />
46 46 <Column title="在库已锁(个)" dataIndex="storageLockedCnt" />
47   - <Column title="滚动90天出库(个)" dataIndex="outStockCnt" />
  47 + <Column title="滚动90天出库(个)" render={r => <a onClick={() => { setOutVisible(true); setItem(r); }}>{r.outStockCnt}</a>} />
48 48 {showAnalyse && (
49 49 <>
50 50 <Column
... ...
src/pages/pms/partPlan/PlanPool/components/StoragePartTable.tsx
... ... @@ -12,11 +12,11 @@ interface Props {
12 12 type?: number, // 类型1区域库2库房3车系4车型5配件
13 13 }
14 14 export default function Index(props: Props = {}) {
15   - const { dfParams, key } = useStore();
  15 + const { dfParams, key, setItem, setOutVisible, setCustVisible } = useStore();
16 16 const [form] = Form.useForm();
17 17 const { data: parts, setParams, loading } = useInitial(getList, [], dfParams);
18 18 const [visible, setVisible] = useState(false);
19   - const [item, setItem] = useState<ListVO>();
  19 + const [itemPrice, setItemPrice] = useState<ListVO>();
20 20  
21 21 useEffect(() => {
22 22 if (key == props.type) {
... ... @@ -25,8 +25,8 @@ export default function Index(props: Props = {}) {
25 25 }, [dfParams, key]);
26 26  
27 27 useEffect(() => {
28   - if (visible && item?.poolId) {
29   - form.setFieldsValue({cnt: item.cnt});
  28 + if (visible && itemPrice?.poolId) {
  29 + form.setFieldsValue({ cnt: itemPrice.cnt});
30 30 } else {
31 31 form.resetFields;
32 32 }
... ... @@ -43,7 +43,7 @@ export default function Index(props: Props = {}) {
43 43 fixed="left"
44 44 render={r => (
45 45 <>
46   - <a onClick={() => { setVisible(true); setItem(r); }}>编辑</a>
  46 + <a onClick={() => { setVisible(true); setItemPrice(r); }}>编辑</a>
47 47 <Divider type="vertical" />
48 48 <Popconfirm
49 49 title="确认删除?"
... ... @@ -68,12 +68,12 @@ export default function Index(props: Props = {}) {
68 68 <Column title="计划后库销比" dataIndex="planeRatio" render={t => (t || 0).toFixed(2)} />
69 69  
70 70 <Column title="本次计划金额(元)" dataIndex="thisTimeAmount" />
71   - <Column title="客户订件数量(个)" dataIndex="buyCnt" />
  71 + <Column title="客户订件数量(个)" render={r => <a onClick={() => { setCustVisible(true); setItem(r); }}>{r.buyCnt}</a>} />
72 72 <Column title="客户订件金额(元)" dataIndex="buyAmount" />
73 73 <Column title="在途未锁(个)" dataIndex="onTheWayUnlockCnt" />
74 74 <Column title="在库未锁(个)" dataIndex="storageUnlockCnt" />
75 75 <Column title="在库已锁(个)" dataIndex="storageLockedCnt" />
76   - <Column title="滚动90天出库(个)" dataIndex="outStockCnt" />
  76 + <Column title="滚动90天出库(个)" render={r => <a onClick={() => { setOutVisible(true); setItem(r); }}>{r.outStockCnt}</a>} />
77 77  
78 78 </Table>
79 79 <Modal
... ... @@ -90,7 +90,7 @@ export default function Index(props: Props = {}) {
90 90 htmlType="submit"
91 91 onClick={() => {
92 92 form.validateFields().then(fields => {
93   - editApi({poolId: item?.poolId, partCnt: fields.cnt}).then(res => {
  93 + editApi({ poolId: itemPrice?.poolId, partCnt: fields.cnt}).then(res => {
94 94 setVisible(false);
95 95 message.success("操作成功");
96 96 setParams({}, true);
... ...
src/pages/pms/partPlan/PlanPool/components/StorageTable.tsx
... ... @@ -14,7 +14,7 @@ interface Props {
14 14 id?: number, // 上一个列表ID
15 15 }
16 16 export default function Index(props: Props = {}) {
17   - const { dfParams, key } = useStore();
  17 + const { dfParams, key, setItem, setOutVisible, setCustVisible } = useStore();
18 18 const {showAnalyse=true} = props;
19 19 const { data: parts, setParams, loading } = useInitial(getList, [], {...dfParams, ...props});
20 20 const [visible, setVisible] = useState(false);
... ... @@ -37,12 +37,12 @@ export default function Index(props: Props = {}) {
37 37 <Column title="计划后库销比" dataIndex="planeRatio" render={t => (t || 0).toFixed(2)} />
38 38  
39 39 <Column title="本次计划金额(元)" dataIndex="thisTimeAmount" />
40   - <Column title="客户订件数量(个)" dataIndex="buyCnt" />
  40 + <Column title="客户订件数量(个)" render={r => <a onClick={() => { setCustVisible(true); setItem(r); }}>{r.buyCnt}</a>} />
41 41 <Column title="客户订件金额(元)" dataIndex="buyAmount" />
42 42 <Column title="在途未锁(个)" dataIndex="onTheWayUnlockCnt" />
43 43 <Column title="在库未锁(个)" dataIndex="storageUnlockCnt" />
44 44 <Column title="在库已锁(个)" dataIndex="storageLockedCnt" />
45   - <Column title="滚动90天出库(个)" dataIndex="outStockCnt" />
  45 + <Column title="滚动90天出库(个)" render={r => <a onClick={() => { setOutVisible(true); setItem(r); }}>{r.outStockCnt}</a>} />
46 46 {showAnalyse && (
47 47 <>
48 48 <Column
... ...
src/pages/pms/partPlan/PlanPool/index.tsx
... ... @@ -11,6 +11,8 @@ import st from &quot;@/pages/pms/partPlan/PlanShipping/style.less&quot;;
11 11 import Filter from './components/Filter';
12 12 import {createStore} from "@/hooks/moz";
13 13 import store from "./useStore";
  14 +import OutFlowModal from './components/OutFlowModal';
  15 +import CustBuyModal from './components/CustBuyModal';
14 16  
15 17 export const { Provider, useStore } = createStore(store);
16 18  
... ... @@ -38,6 +40,8 @@ function Index() {
38 40 <StoragePartTable type={6} />
39 41 </Tabs.TabPane>
40 42 </Tabs>
  43 + <OutFlowModal />
  44 + <CustBuyModal />
41 45 </Card>
42 46 </ConfigProvider>
43 47 </PageHeaderWrapper>
... ...
src/pages/pms/partPlan/PlanPool/useStore.ts
1 1 import { useState } from 'react';
2 2 import useInitail from "@/hooks/useInitail";
3 3 import { getPartTypeApi } from '@/pages/pms/part/Repertory/api';
  4 +import {ListVO} from './api';
4 5  
5 6 export default function useStore() {
6 7 const [dfParams, setDfParams] = useState<any>({});
7 8 const [key, setKey] = useState<any>('1');
8 9 const { data: partTypeData } = useInitail(getPartTypeApi, [], {});
  10 + const [outVisible, setOutVisible] = useState(false);
  11 + const [custVisible, setCustVisible] = useState(false);
  12 + const [item, setItem] = useState<ListVO>();
9 13  
10 14 return {
11 15 dfParams,
12 16 setDfParams,
13 17 key,
14 18 setKey,
15   - partTypeData
  19 + partTypeData,
  20 + outVisible,
  21 + setOutVisible,
  22 + item,
  23 + setItem,
  24 + custVisible,
  25 + setCustVisible,
16 26 };
17 27 }
... ...