Commit c02f5da2d816f55800253d691a7fd2b216aae4ce
Merge remote-tracking branch 'origin/master' into wasm-for-update
Showing
6 changed files
with
36 additions
and
19 deletions
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,9 +8,17 @@ export function getPartShopPageApi(params: PmsStoragePartShop.QueryParams): http |
8 | 8 | } |
9 | 9 | |
10 | 10 | /** 编辑服务站配件 */ |
11 | -export function savePartShopApi(params: PmsStoragePartShop.Params): http.PromiseResp<string> { | |
11 | +export function savePartShopeApi(params: PmsStoragePartShop.Params): http.PromiseResp<string> { | |
12 | 12 | return request.post(`${PMS_HOST}/erp/part/shop/save`, { ...params }); |
13 | 13 | } |
14 | +/** 编辑服务站配件 */ | |
15 | +export function savePartStockApi(params: PmsStoragePartShop.Params): http.PromiseResp<string> { | |
16 | + return request.post(`${PMS_HOST}/erp/part/shop/update/stock`, { ...params }); | |
17 | +} | |
18 | +/** 编辑服务站配件价格 */ | |
19 | +export function savePartPriceApi(params: PmsStoragePartShop.Params): http.PromiseResp<string> { | |
20 | + return request.post(`${PMS_HOST}/erp/part/shop/update/price`, { ...params }); | |
21 | +} | |
14 | 22 | |
15 | 23 | /** 获取服务站列表 */ |
16 | 24 | export function getShopApi(): http.PromiseResp<PmsStoragePartShop.Option[]> { | ... | ... |
src/pages/pms/storage/partShop/components/List.tsx
... | ... | @@ -9,7 +9,7 @@ import LockFlowModal from './LockFlowModal'; |
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, savePartShopeApi } from '../api'; | |
6 | 6 | |
7 | 7 | const { Item } = Form; |
8 | 8 | const { Option } = Select; |
9 | 9 | |
10 | +const apiObj: { [key: number]: any } = { | |
11 | + 1: savePartShopeApi, | |
12 | + 2: savePartStockApi, | |
13 | + 3: savePartPriceApi | |
14 | +}; | |
10 | 15 | export default function PartShopModal() { |
11 | 16 | const { visible, setVisible, shops, setLoading, item = {}, setItem, isprice, setIsprice, isadd, setIsadd, fw } = useStore(); |
12 | 17 | const [form] = Form.useForm(); |
13 | 18 | const [confirmLoading, setConfirmLoading] = useState(false); |
19 | + const apiType = isadd ? 1 : isprice ? 3 : 2; | |
14 | 20 | |
15 | 21 | useEffect(() => { |
16 | 22 | if (visible) { |
... | ... | @@ -37,7 +43,7 @@ export default function PartShopModal() { |
37 | 43 | type: isadd ? 1 : isprice ? 3 : 2 |
38 | 44 | }; |
39 | 45 | setConfirmLoading(true); |
40 | - savePartShopApi(params).then(res => { | |
46 | + apiObj[apiType](params).then((res: { success: any; result: {} | null | undefined; }) => { | |
41 | 47 | if (res.success) { |
42 | 48 | message.success(res.result); |
43 | 49 | setVisible(false); |
... | ... | @@ -47,7 +53,7 @@ export default function PartShopModal() { |
47 | 53 | setConfirmLoading(false); |
48 | 54 | message.error(res.result); |
49 | 55 | } |
50 | - }).catch(error => { | |
56 | + }).catch((error: { message: boolean | React.ReactChild | React.ReactFragment | React.ReactPortal | MessageArgsProps | null | undefined; }) => { | |
51 | 57 | setConfirmLoading(false); |
52 | 58 | message.error(error.message); |
53 | 59 | }); | ... | ... |
src/pages/pms/storage/partShop/index.tsx
... | ... | @@ -13,14 +13,14 @@ import StorageFlowModal from './components/StorageFlowModal'; |
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, | ... | ... |