Commit 8546c12ee7e75eb0bb42633937ba1d48ab8a9656
1 parent
81339a3c
计划池导出
Showing
2 changed files
with
30 additions
and
3 deletions
src/pages/pms/entity.ts
... | ... | @@ -201,3 +201,20 @@ export const typeSenderObj: {[key: string]: string} = { |
201 | 201 | '调出锁定': '', |
202 | 202 | '': '', |
203 | 203 | }; |
204 | + | |
205 | +export function getUrl(url: string, obj: object): string { | |
206 | + if (!Object.keys(obj).length) { | |
207 | + return url; | |
208 | + } | |
209 | + const pa: string[] = []; | |
210 | + for (let k in obj) { | |
211 | + if (obj[k]) { | |
212 | + pa.push(`${k}=${obj[k]}`); | |
213 | + } | |
214 | + } | |
215 | + const st = pa.join("&"); | |
216 | + if (st) { | |
217 | + return `${url}?${st}`; | |
218 | + } | |
219 | + return ''; | |
220 | +} | ... | ... |
src/pages/pms/partPlan/PlanPool/components/Filter.tsx
1 | -import React from 'react'; | |
1 | +import React, { useEffect, useState } from 'react'; | |
2 | 2 | import { Input } from 'antd'; |
3 | 3 | import { useStore } from '../index'; |
4 | 4 | import debounce from 'lodash/debounce'; |
5 | -import {planPoolTypeData} from '@/pages/pms/entity'; | |
5 | +import { planPoolTypeData, getUrl } from '@/pages/pms/entity'; | |
6 | 6 | import usePagination from "@/hooks/usePagination"; |
7 | 7 | import {getStoragePage} from "@/pages/pms/storage/StorageManage/api"; |
8 | 8 | import useInitail from "@/hooks/useInitail"; |
... | ... | @@ -15,13 +15,18 @@ export default function Filter() { |
15 | 15 | const { list: storages } = usePagination<PartStorageSpace.PageVO>(getStoragePage, {pageSize: 1000}); |
16 | 16 | const { data: shops } = useInitail<PmsStoragePartShop.Option[], {}>(api.getShopApi, [], {}); |
17 | 17 | const { dfParams, setDfParams, partTypeData } = useStore(); |
18 | + const [url, setUrl] = useState('/api/pms/erp/plan/pool/export'); | |
19 | + | |
20 | + useEffect(() => { | |
21 | + setUrl(getUrl('/api/pms/erp/plan/pool/export', dfParams)); | |
22 | + }, [dfParams]); | |
18 | 23 | |
19 | 24 | const handleChangeKeywords = debounce((value: string) => { |
20 | 25 | setDfParams({ ...dfParams, current: 1, keywords: value }); |
21 | 26 | }, 500); |
22 | 27 | |
23 | 28 | return ( |
24 | - <div style={{display: 'flex', flexWrap: 'wrap', justifyContent: 'flex-start', marginBottom: 10}}> | |
29 | + <div style={{display: 'flex', flexWrap: 'wrap', justifyContent: 'flex-start', marginBottom: 10, alignItems: 'center'}}> | |
25 | 30 | <PmsSelect |
26 | 31 | style={{ width: 200, marginRight: 10}} |
27 | 32 | allowClear |
... | ... | @@ -71,6 +76,11 @@ export default function Filter() { |
71 | 76 | placeholder="配件编码|名称" |
72 | 77 | onSearch={v => handleChangeKeywords(v)} |
73 | 78 | /> |
79 | + <a | |
80 | + href={url} | |
81 | + > | |
82 | + 导出计划池表格 | |
83 | + </a> | |
74 | 84 | </div> |
75 | 85 | ); |
76 | 86 | } | ... | ... |