Commit c02f5da2d816f55800253d691a7fd2b216aae4ce

Authored by 张志伟
2 parents 68110698 1521db5f

Merge remote-tracking branch 'origin/master' into wasm-for-update

config/routers/pms.ts
@@ -44,6 +44,10 @@ export default [ @@ -44,6 +44,10 @@ export default [
44 component: './pms/storage/partShop' 44 component: './pms/storage/partShop'
45 }, 45 },
46 { 46 {
  47 + path: '/pms/storage/fwStockPartShop', // 服务站配件(霏微(库存))
  48 + component: './pms/storage/partShop'
  49 + },
  50 + {
47 path: '/pms/storage/areaStorage', // 区域库设置 51 path: '/pms/storage/areaStorage', // 区域库设置
48 component: './pms/storage/areaStorageSetting' 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,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 return request.post(`${PMS_HOST}/erp/part/shop/save`, { ...params }); 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 export function getShopApi(): http.PromiseResp<PmsStoragePartShop.Option[]> { 24 export function getShopApi(): http.PromiseResp<PmsStoragePartShop.Option[]> {
src/pages/pms/storage/partShop/components/List.tsx
@@ -9,7 +9,7 @@ import LockFlowModal from &#39;./LockFlowModal&#39;; @@ -9,7 +9,7 @@ import LockFlowModal from &#39;./LockFlowModal&#39;;
9 const { Column } = Table; 9 const { Column } = Table;
10 10
11 export default function Filter() { 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 const [visibleLockDetail, setVisibleLockDetail] = useState(false); 13 const [visibleLockDetail, setVisibleLockDetail] = useState(false);
14 const [visibleFlowDetail, setVisibleFlowDetail] = useState(false); 14 const [visibleFlowDetail, setVisibleFlowDetail] = useState(false);
15 const [visibleLockFlow, setVisibleLockFlow] = useState(false); 15 const [visibleLockFlow, setVisibleLockFlow] = useState(false);
@@ -59,19 +59,16 @@ export default function Filter() { @@ -59,19 +59,16 @@ export default function Filter() {
59 render={(text, _item: PartRepertorySpace.Item) => ( 59 render={(text, _item: PartRepertorySpace.Item) => (
60 <div style={{display: 'flex', alignItems: 'center'}}> 60 <div style={{display: 'flex', alignItems: 'center'}}>
61 <a onClick={() => { setVisible(true); setItem(_item); }}>修改</a> 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 </div> 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 </Table> 72 </Table>
76 <LockDetailModal item={item} visible={visibleLockDetail} onCancel={() => setVisibleLockDetail(false)} /> 73 <LockDetailModal item={item} visible={visibleLockDetail} onCancel={() => setVisibleLockDetail(false)} />
77 <FlowDetailModal item={item} visible={visibleFlowDetail} onCancel={() => setVisibleFlowDetail(false)} /> 74 <FlowDetailModal item={item} visible={visibleFlowDetail} onCancel={() => setVisibleFlowDetail(false)} />
src/pages/pms/storage/partShop/components/PartShopModal.tsx
1 import React, { useEffect, useState } from 'react'; 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 import { useStore } from '../index'; 3 import { useStore } from '../index';
4 import ChoosePart from './ChoosePart'; 4 import ChoosePart from './ChoosePart';
5 -import { savePartShopApi } from '../api'; 5 +import { savePartStockApi, savePartPriceApi, savePartShopeApi } from '../api';
6 6
7 const { Item } = Form; 7 const { Item } = Form;
8 const { Option } = Select; 8 const { Option } = Select;
9 9
  10 +const apiObj: { [key: number]: any } = {
  11 + 1: savePartShopeApi,
  12 + 2: savePartStockApi,
  13 + 3: savePartPriceApi
  14 +};
10 export default function PartShopModal() { 15 export default function PartShopModal() {
11 const { visible, setVisible, shops, setLoading, item = {}, setItem, isprice, setIsprice, isadd, setIsadd, fw } = useStore(); 16 const { visible, setVisible, shops, setLoading, item = {}, setItem, isprice, setIsprice, isadd, setIsadd, fw } = useStore();
12 const [form] = Form.useForm(); 17 const [form] = Form.useForm();
13 const [confirmLoading, setConfirmLoading] = useState(false); 18 const [confirmLoading, setConfirmLoading] = useState(false);
  19 + const apiType = isadd ? 1 : isprice ? 3 : 2;
14 20
15 useEffect(() => { 21 useEffect(() => {
16 if (visible) { 22 if (visible) {
@@ -37,7 +43,7 @@ export default function PartShopModal() { @@ -37,7 +43,7 @@ export default function PartShopModal() {
37 type: isadd ? 1 : isprice ? 3 : 2 43 type: isadd ? 1 : isprice ? 3 : 2
38 }; 44 };
39 setConfirmLoading(true); 45 setConfirmLoading(true);
40 - savePartShopApi(params).then(res => { 46 + apiObj[apiType](params).then((res: { success: any; result: {} | null | undefined; }) => {
41 if (res.success) { 47 if (res.success) {
42 message.success(res.result); 48 message.success(res.result);
43 setVisible(false); 49 setVisible(false);
@@ -47,7 +53,7 @@ export default function PartShopModal() { @@ -47,7 +53,7 @@ export default function PartShopModal() {
47 setConfirmLoading(false); 53 setConfirmLoading(false);
48 message.error(res.result); 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 setConfirmLoading(false); 57 setConfirmLoading(false);
52 message.error(error.message); 58 message.error(error.message);
53 }); 59 });
src/pages/pms/storage/partShop/index.tsx
@@ -13,14 +13,14 @@ import StorageFlowModal from &#39;./components/StorageFlowModal&#39;; @@ -13,14 +13,14 @@ import StorageFlowModal from &#39;./components/StorageFlowModal&#39;;
13 export const { Provider, useStore } = createStore(store); 13 export const { Provider, useStore } = createStore(store);
14 14
15 function PartShop() { 15 function PartShop() {
16 - const { setImportVisible, fw, setVisible, setIsadd } = useStore(); 16 + const { setImportVisible, fw, setVisible, setIsadd, fwS } = useStore();
17 const [more, setMore] = useState(false); 17 const [more, setMore] = useState(false);
18 const [stock, setStock] = useState(false); 18 const [stock, setStock] = useState(false);
19 const [islock, setIslock] = useState(false); 19 const [islock, setIslock] = useState(false);
20 const [storageFlowVisible, setStorageFlowVisible] = useState(false); 20 const [storageFlowVisible, setStorageFlowVisible] = useState(false);
21 21
22 return ( 22 return (
23 - <PageHeaderWrapper title={`服务站配件${fw ? '(霏微)': ''}`}> 23 + <PageHeaderWrapper title={`服务站配件${fw ? `${fwS ? '(库存)' : '(霏微)'}`: ''}`}>
24 <Card> 24 <Card>
25 <div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'flex-start', marginBottom: 20 }}> 25 <div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'flex-start', marginBottom: 20 }}>
26 <Filter /> 26 <Filter />
src/pages/pms/storage/partShop/store.ts
@@ -29,7 +29,8 @@ export default function useStore() { @@ -29,7 +29,8 @@ export default function useStore() {
29 const [releaseVisible, setReleaseVisible] = useState(false); 29 const [releaseVisible, setReleaseVisible] = useState(false);
30 const [override, setOverride] = useState(false); 30 const [override, setOverride] = useState(false);
31 const [item, setItem] = useState<PmsStoragePartShop.Item>({}); 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 const [isprice, setIsprice] = useState<boolean>(false); 34 const [isprice, setIsprice] = useState<boolean>(false);
34 const [isadd, setIsadd] = useState<boolean>(false); 35 const [isadd, setIsadd] = useState<boolean>(false);
35 36
@@ -55,6 +56,7 @@ export default function useStore() { @@ -55,6 +56,7 @@ export default function useStore() {
55 override, 56 override,
56 setOverride, 57 setOverride,
57 fw, 58 fw,
  59 + fwS,
58 isprice, 60 isprice,
59 setIsprice, 61 setIsprice,
60 isadd, 62 isadd,