Blame view

src/pages/pms/partPlan/PlanPool/components/Filter.tsx 3.24 KB
8546c12e   jiangwei   计划池导出
1
  import React, { useEffect, useState } from 'react';
b4b59dc8   jiangwei   配件系统选择器增加搜索功能
2
  import { Input } from 'antd';
f33cc9f7   by1642146903   计划池
3
4
  import { useStore } from '../index';
  import debounce from 'lodash/debounce';
8546c12e   jiangwei   计划池导出
5
  import { planPoolTypeData, getUrl } from '@/pages/pms/entity';
f33cc9f7   by1642146903   计划池
6
7
8
9
  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";
b4b59dc8   jiangwei   配件系统选择器增加搜索功能
10
  import PmsSelect from '@/pages/pms/comonents/PmsSelect';
f33cc9f7   by1642146903   计划池
11
  
f33cc9f7   by1642146903   计划池
12
13
14
15
16
  const { Search } = Input;
  
  export default function Filter() {
    const { list: storages } = usePagination<PartStorageSpace.PageVO>(getStoragePage, {pageSize: 1000});
    const { data: shops } = useInitail<PmsStoragePartShop.Option[], {}>(api.getShopApi, [], {});
67c1c3e7   jiangwei   配件外采计划池筛选条件
17
    const { dfParams, setDfParams, partTypeData } = useStore();
8546c12e   jiangwei   计划池导出
18
19
20
21
22
    const [url, setUrl] = useState('/api/pms/erp/plan/pool/export');
  
    useEffect(() => {
      setUrl(getUrl('/api/pms/erp/plan/pool/export', dfParams));
    }, [dfParams]);
f33cc9f7   by1642146903   计划池
23
24
25
26
27
28
  
    const handleChangeKeywords = debounce((value: string) => {
      setDfParams({ ...dfParams, current: 1, keywords: value });
    }, 500);
  
    return (
8546c12e   jiangwei   计划池导出
29
      <div style={{display: 'flex', flexWrap: 'wrap', justifyContent: 'flex-start', marginBottom: 10, alignItems: 'center'}}>
b4b59dc8   jiangwei   配件系统选择器增加搜索功能
30
        <PmsSelect
f33cc9f7   by1642146903   计划池
31
32
33
34
35
36
37
38
          style={{ width: 200, marginRight: 10}}
          allowClear
          value={dfParams.shopId}
          onChange={value => {
            const st: any = storages.find(it => it.shopId == value) || {};
            setDfParams({ ...dfParams, current: 1, shopId: value, storageId: st.id });
          }}
          placeholder="请选择服务站"
b4b59dc8   jiangwei   配件系统选择器增加搜索功能
39
          options={shops
f33cc9f7   by1642146903   计划池
40
          .filter(it => (dfParams.shopId && it.id == dfParams.shopId) || !dfParams.shopId)
b4b59dc8   jiangwei   配件系统选择器增加搜索功能
41
42
43
          .map((item: PmsStoragePartShop.Option) => ({value: item.id, label: item.name}))}
        />
        <PmsSelect
f33cc9f7   by1642146903   计划池
44
45
46
47
48
49
50
51
          style={{ width: 200, marginRight: 10}}
          allowClear
          value={dfParams.storageId}
          onChange={value => {
            const st: any = storages.find(it => it.id == value) || {};
            setDfParams({ ...dfParams, current: 1, storageId: value, shopId: st.shopId });
          }}
          placeholder="请选择库房"
b4b59dc8   jiangwei   配件系统选择器增加搜索功能
52
          options={storages
f33cc9f7   by1642146903   计划池
53
          .filter(it => (dfParams.shopId && it.shopId == dfParams.shopId) || !dfParams.shopId)
b4b59dc8   jiangwei   配件系统选择器增加搜索功能
54
55
56
          .map((item: PartStorageSpace.PageVO) => ({value: item.id, label: item.storageName}))}
        />
        <PmsSelect
f33cc9f7   by1642146903   计划池
57
58
59
60
61
62
          allowClear
          style={{ width: 200, marginRight: 10}}
          onChange={(poolType) => {
            setDfParams({ ...dfParams, current: 1, poolType });
          }}
          placeholder="请选择来源类型"
b4b59dc8   jiangwei   配件系统选择器增加搜索功能
63
64
65
          options={planPoolTypeData.map(i => ({value: i.value, label: i.label}))}
        />
        <PmsSelect
67b0c63c   jiangwei   配件计划增加可调出配件查看和外采申请优化
66
          allowClear
9cf77fdb   jiangwei   调拨单号展示
67
          style={{ width: 200, marginRight: 10}}
67b0c63c   jiangwei   配件计划增加可调出配件查看和外采申请优化
68
69
          onChange={(partType) => setDfParams({ ...dfParams, current: 1, partType })}
          placeholder="请选择配件类型"
b4b59dc8   jiangwei   配件系统选择器增加搜索功能
70
71
          options={partTypeData.map(i => ({value: i.value, label: i.label}))}
        />
f33cc9f7   by1642146903   计划池
72
73
74
        <Search
          style={{ width: 200, marginRight: 10}}
          allowClear
9ca4d316   jiangwei   搜索优化
75
          enterButton
f33cc9f7   by1642146903   计划池
76
77
          placeholder="配件编码|名称"
          onSearch={v => handleChangeKeywords(v)}
f33cc9f7   by1642146903   计划池
78
        />
8546c12e   jiangwei   计划池导出
79
80
81
82
83
        <a 
          href={url}
        >
          导出计划池表格
        </a>
f33cc9f7   by1642146903   计划池
84
85
86
      </div>
    );
  }