Blame view

src/pages/pms/storage/partShop/components/Filter.tsx 3.28 KB
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
1
  import React from 'react';
b4b59dc8   jiangwei   配件系统选择器增加搜索功能
2
  import { Input } from 'antd';
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
3
4
  import { useStore } from '../index';
  import debounce from 'lodash/debounce';
6e99691c   jiangwei   配件系统配件类型数据来源更改
5
6
  import {getPartTypeApi} from '@/pages/pms/part/Repertory/api';
  import useInitail from '@/hooks/useInitail';
b4b59dc8   jiangwei   配件系统选择器增加搜索功能
7
  import PmsSelect from '@/pages/pms/comonents/PmsSelect';
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
8
  
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
9
10
11
  const { Search } = Input;
  
  export default function Filter() {
d860f07b   jiangwei   服务站配件调整
12
    const { shops, setParams, storages, innerParams } = useStore();
6e99691c   jiangwei   配件系统配件类型数据来源更改
13
    const { data: partTypeData } = useInitail(getPartTypeApi, [], {});
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
14
15
  
    const handleChangeKeywords = debounce((value: string) => {
07e28cc7   baiyun   fix
16
      setParams({ current: 1, keyword: value }, true);
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
17
18
    }, 500);
  
dfc8ef65   jiangwei   样式调整
19
    const isStock = (v:any) => {
dfc8ef65   jiangwei   样式调整
20
21
      if (v == undefined) {
        setParams({current: 1, pageSize: 10, haveStock: undefined }, true);
dfc8ef65   jiangwei   样式调整
22
23
24
25
26
27
28
29
30
31
        return;
      }
      const param = Boolean(v);
      setParams({current: 1, pageSize: 10, haveStock: param }, true);
    };
  
    const isSorter = (v:any) => {
      setParams({current: 1, pageSize: 10, orderBy: v }, true);
    };
  
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
32
    return (
2e42af24   jiangwei   指定计划ui
33
      <div>
20eca3bb   jiangwei   fix
34
        <Search
71a2ef45   jiangwei   样式优化
35
          style={{ width: 180, marginRight: 10, marginBottom: 10 }}
20eca3bb   jiangwei   fix
36
          allowClear
9ca4d316   jiangwei   搜索优化
37
          enterButton
20eca3bb   jiangwei   fix
38
39
          placeholder="配件编码|名称"
          onSearch={v => handleChangeKeywords(v)}
20eca3bb   jiangwei   fix
40
        />
b4b59dc8   jiangwei   配件系统选择器增加搜索功能
41
        <PmsSelect
71a2ef45   jiangwei   样式优化
42
          style={{ width: 180, marginRight: 10, marginBottom: 10 }}
e7724aa1   baiyun   库房和门店选择关联
43
44
45
46
47
48
49
          allowClear
          value={innerParams.shopId}
          onChange={value => {
            const st: any = storages.find(it => it.shopId == value) || {};
            setParams({ current: 1, shopId: value, storageId: st.id }, true);
          }}
          placeholder="请选择服务站"
b4b59dc8   jiangwei   配件系统选择器增加搜索功能
50
          options={shops
e7724aa1   baiyun   库房和门店选择关联
51
          .filter(it => (innerParams.shopId && it.id == innerParams.shopId) || !innerParams.shopId)
b4b59dc8   jiangwei   配件系统选择器增加搜索功能
52
53
54
          .map((item: PmsStoragePartShop.Option) => ({value: item.id, label: item.name}))}
        />
        <PmsSelect
71a2ef45   jiangwei   样式优化
55
          style={{ width: 180, marginRight: 10, marginBottom: 10 }}
e7724aa1   baiyun   库房和门店选择关联
56
57
58
59
60
61
62
          allowClear
          value={innerParams.storageId}
          onChange={value => {
            const st: any = storages.find(it => it.id == value) || {};
            setParams({ current: 1, storageId: value, shopId: st.shopId }, true);
          }}
          placeholder="请选择库房"
b4b59dc8   jiangwei   配件系统选择器增加搜索功能
63
          options={storages
e7724aa1   baiyun   库房和门店选择关联
64
          .filter(it => (innerParams.shopId && it.shopId == innerParams.shopId) || !innerParams.shopId)
b4b59dc8   jiangwei   配件系统选择器增加搜索功能
65
66
67
          .map((item: PartStorageSpace.PageVO) => ({value: item.id, label: item.storageName}))}
        />
        <PmsSelect
8a0d58e1   baiyun   fix
68
          allowClear
71a2ef45   jiangwei   样式优化
69
          style={{ width: 180, marginRight: 10, marginBottom: 10 }}
8a0d58e1   baiyun   fix
70
71
72
73
          onChange={(type) => {
            setParams({ ...innerParams, current: 1, type }, true);
          }}
          placeholder="请选择配件类型"
b4b59dc8   jiangwei   配件系统选择器增加搜索功能
74
75
          options={partTypeData.map((item: any) => ({value: item.value, label: item.label}))}
        />
b4b59dc8   jiangwei   配件系统选择器增加搜索功能
76
        <PmsSelect
d860f07b   jiangwei   服务站配件调整
77
78
79
          allowClear
          placeholder="有无库存筛选"
          onChange={v => isStock(v)}
71a2ef45   jiangwei   样式优化
80
          style={{ width: 180, marginRight: 10, marginBottom: 10 }}
b4b59dc8   jiangwei   配件系统选择器增加搜索功能
81
82
83
84
85
86
          options={[
            {value: 1, label: "有库存"},
            {value: 0, label: "无库存"},
          ]}
        />
        <PmsSelect
d860f07b   jiangwei   服务站配件调整
87
88
89
          placeholder="排序方式"
          defaultValue={18}
          onChange={v => isSorter(v)}
71a2ef45   jiangwei   样式优化
90
          style={{ width: 180 }}
b4b59dc8   jiangwei   配件系统选择器增加搜索功能
91
92
93
94
95
          options={[
            {value: 18, label: "总库存降序"},
            {value: 21, label: "锁定库存降序"},
          ]}
        />
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
96
      </div>
9fe058df   baiyun   库存库房查询
97
    );
cc26d1fc   张志伟   🎉 重新构建项目,解决项目过大的问题
98
  }