import React, { useEffect, useState } from 'react'; import { Input } from 'antd'; import { useStore } from '../index'; import debounce from 'lodash/debounce'; import { planPoolTypeData, getUrl } from '@/pages/pms/entity'; import usePagination from "@/hooks/usePagination"; import {getStoragePage} from "@/pages/pms/storage/StorageManage/api"; import useInitail from "@/hooks/useInitail"; import * as api from "@/pages/pms/storage/partShop/api"; import PmsSelect from '@/pages/pms/comonents/PmsSelect'; const { Search } = Input; export default function Filter() { const { list: storages } = usePagination(getStoragePage, {pageSize: 1000}); const { data: shops } = useInitail(api.getShopApi, [], {}); const { dfParams, setDfParams, partTypeData } = useStore(); const [url, setUrl] = useState('/api/pms/erp/plan/pool/export'); useEffect(() => { setUrl(getUrl('/api/pms/erp/plan/pool/export', dfParams)); }, [dfParams]); const handleChangeKeywords = debounce((value: string) => { setDfParams({ ...dfParams, current: 1, keywords: value }); }, 500); return (
{ const st: any = storages.find(it => it.shopId == value) || {}; setDfParams({ ...dfParams, current: 1, shopId: value, storageId: st.id }); }} placeholder="请选择服务站" options={shops .filter(it => (dfParams.shopId && it.id == dfParams.shopId) || !dfParams.shopId) .map((item: PmsStoragePartShop.Option) => ({value: item.id, label: item.name}))} /> { const st: any = storages.find(it => it.id == value) || {}; setDfParams({ ...dfParams, current: 1, storageId: value, shopId: st.shopId }); }} placeholder="请选择库房" options={storages .filter(it => (dfParams.shopId && it.shopId == dfParams.shopId) || !dfParams.shopId) .map((item: PartStorageSpace.PageVO) => ({value: item.id, label: item.storageName}))} /> { setDfParams({ ...dfParams, current: 1, poolType }); }} placeholder="请选择来源类型" options={planPoolTypeData.map(i => ({value: i.value, label: i.label}))} /> setDfParams({ ...dfParams, current: 1, partType })} placeholder="请选择配件类型" options={partTypeData.map(i => ({value: i.value, label: i.label}))} /> handleChangeKeywords(v)} /> 导出计划池表格
); }