diff --git a/config/routers/pms.ts b/config/routers/pms.ts index e71c830..c99e8ec 100644 --- a/config/routers/pms.ts +++ b/config/routers/pms.ts @@ -44,6 +44,10 @@ export default [ component: './pms/storage/partShop' }, { + path: '/pms/storage/fwStockPartShop', // 服务站配件(霏微(库存)) + component: './pms/storage/partShop' + }, + { path: '/pms/storage/areaStorage', // 区域库设置 component: './pms/storage/areaStorageSetting' }, diff --git a/src/pages/pms/storage/partShop/api.ts b/src/pages/pms/storage/partShop/api.ts index 215ca83..ab1e1b9 100644 --- a/src/pages/pms/storage/partShop/api.ts +++ b/src/pages/pms/storage/partShop/api.ts @@ -8,9 +8,17 @@ export function getPartShopPageApi(params: PmsStoragePartShop.QueryParams): http } /** 编辑服务站配件 */ -export function savePartShopApi(params: PmsStoragePartShop.Params): http.PromiseResp { +export function savePartShopeApi(params: PmsStoragePartShop.Params): http.PromiseResp { return request.post(`${PMS_HOST}/erp/part/shop/save`, { ...params }); } +/** 编辑服务站配件 */ +export function savePartStockApi(params: PmsStoragePartShop.Params): http.PromiseResp { + return request.post(`${PMS_HOST}/erp/part/shop/update/stock`, { ...params }); +} +/** 编辑服务站配件价格 */ +export function savePartPriceApi(params: PmsStoragePartShop.Params): http.PromiseResp { + return request.post(`${PMS_HOST}/erp/part/shop/update/price`, { ...params }); +} /** 获取服务站列表 */ export function getShopApi(): http.PromiseResp { diff --git a/src/pages/pms/storage/partShop/components/List.tsx b/src/pages/pms/storage/partShop/components/List.tsx index bdbb818..cbc1621 100644 --- a/src/pages/pms/storage/partShop/components/List.tsx +++ b/src/pages/pms/storage/partShop/components/List.tsx @@ -9,7 +9,7 @@ import LockFlowModal from './LockFlowModal'; const { Column } = Table; export default function Filter() { - const { setParams, loading, paginationConfig, list, setVisible, setItem, item, fw, setIsprice} = useStore(); + const { setParams, loading, paginationConfig, list, setVisible, setItem, item, fw, setIsprice, fwS} = useStore(); const [visibleLockDetail, setVisibleLockDetail] = useState(false); const [visibleFlowDetail, setVisibleFlowDetail] = useState(false); const [visibleLockFlow, setVisibleLockFlow] = useState(false); @@ -59,19 +59,16 @@ export default function Filter() { render={(text, _item: PartRepertorySpace.Item) => ( )} /> - ) : ( - ( - { setVisible(true); setItem(_item); setIsprice(true); }}>修改价格 - )} - /> - )} + ) : null} setVisibleLockDetail(false)} /> setVisibleFlowDetail(false)} /> diff --git a/src/pages/pms/storage/partShop/components/PartShopModal.tsx b/src/pages/pms/storage/partShop/components/PartShopModal.tsx index 9223318..614bfee 100644 --- a/src/pages/pms/storage/partShop/components/PartShopModal.tsx +++ b/src/pages/pms/storage/partShop/components/PartShopModal.tsx @@ -1,16 +1,22 @@ import React, { useEffect, useState } from 'react'; -import { Modal, Button, Form, Select, InputNumber, message, Input } from 'antd'; +import { Modal, Button, Form, Select, InputNumber, message, Input, MessageArgsProps } from 'antd'; import { useStore } from '../index'; import ChoosePart from './ChoosePart'; -import { savePartShopApi } from '../api'; +import { savePartStockApi, savePartPriceApi, savePartShopeApi } from '../api'; const { Item } = Form; const { Option } = Select; +const apiObj: { [key: number]: any } = { + 1: savePartShopeApi, + 2: savePartStockApi, + 3: savePartPriceApi +}; export default function PartShopModal() { const { visible, setVisible, shops, setLoading, item = {}, setItem, isprice, setIsprice, isadd, setIsadd, fw } = useStore(); const [form] = Form.useForm(); const [confirmLoading, setConfirmLoading] = useState(false); + const apiType = isadd ? 1 : isprice ? 3 : 2; useEffect(() => { if (visible) { @@ -37,7 +43,7 @@ export default function PartShopModal() { type: isadd ? 1 : isprice ? 3 : 2 }; setConfirmLoading(true); - savePartShopApi(params).then(res => { + apiObj[apiType](params).then((res: { success: any; result: {} | null | undefined; }) => { if (res.success) { message.success(res.result); setVisible(false); @@ -47,7 +53,7 @@ export default function PartShopModal() { setConfirmLoading(false); message.error(res.result); } - }).catch(error => { + }).catch((error: { message: boolean | React.ReactChild | React.ReactFragment | React.ReactPortal | MessageArgsProps | null | undefined; }) => { setConfirmLoading(false); message.error(error.message); }); diff --git a/src/pages/pms/storage/partShop/index.tsx b/src/pages/pms/storage/partShop/index.tsx index 6c85dab..1c35d79 100644 --- a/src/pages/pms/storage/partShop/index.tsx +++ b/src/pages/pms/storage/partShop/index.tsx @@ -13,14 +13,14 @@ import StorageFlowModal from './components/StorageFlowModal'; export const { Provider, useStore } = createStore(store); function PartShop() { - const { setImportVisible, fw, setVisible, setIsadd } = useStore(); + const { setImportVisible, fw, setVisible, setIsadd, fwS } = useStore(); const [more, setMore] = useState(false); const [stock, setStock] = useState(false); const [islock, setIslock] = useState(false); const [storageFlowVisible, setStorageFlowVisible] = useState(false); return ( - +
diff --git a/src/pages/pms/storage/partShop/store.ts b/src/pages/pms/storage/partShop/store.ts index 89e719e..06a70be 100644 --- a/src/pages/pms/storage/partShop/store.ts +++ b/src/pages/pms/storage/partShop/store.ts @@ -29,7 +29,8 @@ export default function useStore() { const [releaseVisible, setReleaseVisible] = useState(false); const [override, setOverride] = useState(false); const [item, setItem] = useState({}); - const [fw] = useState(location.href.includes('fwPartShop')); + const [fw] = useState(location.href.includes('fw')); + const [fwS] = useState(location.href.includes('fwStock')); const [isprice, setIsprice] = useState(false); const [isadd, setIsadd] = useState(false); @@ -55,6 +56,7 @@ export default function useStore() { override, setOverride, fw, + fwS, isprice, setIsprice, isadd,