Commit b412162f950396a6686e2140e28a5f3613bb15af

Authored by jiangwei
1 parent d52cf601

服务站配件调整

config/routers/pms.ts
... ... @@ -44,6 +44,10 @@ export default [
44 44 component: './pms/storage/partShop'
45 45 },
46 46 {
  47 + path: '/pms/storage/fwStockPartShop', // 服务站配件(霏微(库存))
  48 + component: './pms/storage/partShop'
  49 + },
  50 + {
47 51 path: '/pms/storage/areaStorage', // 区域库设置
48 52 component: './pms/storage/areaStorageSetting'
49 53 },
... ...
src/pages/pms/storage/partShop/api.ts
... ... @@ -8,8 +8,12 @@ export function getPartShopPageApi(params: PmsStoragePartShop.QueryParams): http
8 8 }
9 9  
10 10 /** 编辑服务站配件 */
11   -export function savePartShopApi(params: PmsStoragePartShop.Params): http.PromiseResp<string> {
12   - return request.post(`${PMS_HOST}/erp/part/shop/save`, { ...params });
  11 +export function savePartStockApi(params: PmsStoragePartShop.Params): http.PromiseResp<string> {
  12 + return request.post(`${PMS_HOST}/erp/part/shop/update/stock`, { ...params });
  13 +}
  14 +/** 编辑服务站配件价格 */
  15 +export function savePartPriceApi(params: PmsStoragePartShop.Params): http.PromiseResp<string> {
  16 + return request.post(`${PMS_HOST}/erp/part/shop/update/price`, { ...params });
13 17 }
14 18  
15 19 /** 获取服务站列表 */
... ...
src/pages/pms/storage/partShop/components/List.tsx
... ... @@ -9,7 +9,7 @@ import LockFlowModal from &#39;./LockFlowModal&#39;;
9 9 const { Column } = Table;
10 10  
11 11 export default function Filter() {
12   - const { setParams, loading, paginationConfig, list, setVisible, setItem, item, fw, setIsprice} = useStore();
  12 + const { setParams, loading, paginationConfig, list, setVisible, setItem, item, fw, setIsprice, fwS} = useStore();
13 13 const [visibleLockDetail, setVisibleLockDetail] = useState(false);
14 14 const [visibleFlowDetail, setVisibleFlowDetail] = useState(false);
15 15 const [visibleLockFlow, setVisibleLockFlow] = useState(false);
... ... @@ -59,19 +59,16 @@ export default function Filter() {
59 59 render={(text, _item: PartRepertorySpace.Item) => (
60 60 <div style={{display: 'flex', alignItems: 'center'}}>
61 61 <a onClick={() => { setVisible(true); setItem(_item); }}>修改</a>
62   - <Divider type="vertical" />
63   - <a onClick={() => { setVisible(true); setItem(_item); setIsprice(true); }}>修改价格</a>
  62 + {fwS ? null : (
  63 + <>
  64 + <Divider type="vertical" />
  65 + <a onClick={() => { setVisible(true); setItem(_item); setIsprice(true); }}>修改价格</a>
  66 + </>
  67 + )}
64 68 </div>
65 69 )}
66 70 />
67   - ) : (
68   - <Column
69   - title="操作"
70   - render={(text, _item: PartRepertorySpace.Item) => (
71   - <a onClick={() => { setVisible(true); setItem(_item); setIsprice(true); }}>修改价格</a>
72   - )}
73   - />
74   - )}
  71 + ) : null}
75 72 </Table>
76 73 <LockDetailModal item={item} visible={visibleLockDetail} onCancel={() => setVisibleLockDetail(false)} />
77 74 <FlowDetailModal item={item} visible={visibleFlowDetail} onCancel={() => setVisibleFlowDetail(false)} />
... ...
src/pages/pms/storage/partShop/components/PartShopModal.tsx
1 1 import React, { useEffect, useState } from 'react';
2   -import { Modal, Button, Form, Select, InputNumber, message, Input } from 'antd';
  2 +import { Modal, Button, Form, Select, InputNumber, message, Input, MessageArgsProps } from 'antd';
3 3 import { useStore } from '../index';
4 4 import ChoosePart from './ChoosePart';
5   -import { savePartShopApi } from '../api';
  5 +import { savePartStockApi, savePartPriceApi } from '../api';
6 6  
7 7 const { Item } = Form;
8 8 const { Option } = Select;
9 9  
  10 +const apiObj: { [key: number]: any } = {
  11 + 1: savePartPriceApi,
  12 + 0: savePartStockApi
  13 +};
10 14 export default function PartShopModal() {
11 15 const { visible, setVisible, shops, setLoading, item = {}, setItem, isprice, setIsprice, isadd, setIsadd, fw } = useStore();
12 16 const [form] = Form.useForm();
... ... @@ -37,7 +41,7 @@ export default function PartShopModal() {
37 41 type: isadd ? 1 : isprice ? 3 : 2
38 42 };
39 43 setConfirmLoading(true);
40   - savePartShopApi(params).then(res => {
  44 + apiObj[Number(isprice)](params).then((res: { success: any; result: {} | null | undefined; }) => {
41 45 if (res.success) {
42 46 message.success(res.result);
43 47 setVisible(false);
... ... @@ -47,7 +51,7 @@ export default function PartShopModal() {
47 51 setConfirmLoading(false);
48 52 message.error(res.result);
49 53 }
50   - }).catch(error => {
  54 + }).catch((error: { message: boolean | React.ReactChild | React.ReactFragment | React.ReactPortal | MessageArgsProps | null | undefined; }) => {
51 55 setConfirmLoading(false);
52 56 message.error(error.message);
53 57 });
... ...
src/pages/pms/storage/partShop/index.tsx
... ... @@ -13,14 +13,14 @@ import StorageFlowModal from &#39;./components/StorageFlowModal&#39;;
13 13 export const { Provider, useStore } = createStore(store);
14 14  
15 15 function PartShop() {
16   - const { setImportVisible, fw, setVisible, setIsadd } = useStore();
  16 + const { setImportVisible, fw, setVisible, setIsadd, fwS } = useStore();
17 17 const [more, setMore] = useState(false);
18 18 const [stock, setStock] = useState(false);
19 19 const [islock, setIslock] = useState(false);
20 20 const [storageFlowVisible, setStorageFlowVisible] = useState(false);
21 21  
22 22 return (
23   - <PageHeaderWrapper title={`服务站配件${fw ? '(霏微)': ''}`}>
  23 + <PageHeaderWrapper title={`服务站配件${fw ? `(霏微${fwS ? '(库存)' : ''})`: ''}`}>
24 24 <Card>
25 25 <div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'flex-start', marginBottom: 20 }}>
26 26 <Filter />
... ...
src/pages/pms/storage/partShop/store.ts
... ... @@ -29,7 +29,8 @@ export default function useStore() {
29 29 const [releaseVisible, setReleaseVisible] = useState(false);
30 30 const [override, setOverride] = useState(false);
31 31 const [item, setItem] = useState<PmsStoragePartShop.Item>({});
32   - const [fw] = useState(location.href.includes('fwPartShop'));
  32 + const [fw] = useState(location.href.includes('fw'));
  33 + const [fwS] = useState(location.href.includes('fwStock'));
33 34 const [isprice, setIsprice] = useState<boolean>(false);
34 35 const [isadd, setIsadd] = useState<boolean>(false);
35 36  
... ... @@ -55,6 +56,7 @@ export default function useStore() {
55 56 override,
56 57 setOverride,
57 58 fw,
  59 + fwS,
58 60 isprice,
59 61 setIsprice,
60 62 isadd,
... ...