Filter.tsx
2.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import React, { useState, useEffect, useCallback } from "react";
import { Table, Row, Input, Select } from "antd";
// import { ApprovalType, Approval_Status } from "../entity";
import _ from "lodash";
import usePagination from "@/hooks/usePagination";
import { systemListApi } from "@/pages/admin/Privilege/api";
const { Option } = Select;
interface Props {
setParams: any;
// tempData: any;
roleList: CommonApi.RoleCodeVO[];
}
export default function Filter({ setParams, roleList }: Props) {
const { list: syslist } = usePagination(systemListApi, {
current: 1,
pageSize: 500,
});
const seachOnchange = useCallback(
_.debounce((param) => {
setParams({ ...param }, true);
}, 800),
[setParams]
);
const enableList = [
{ value: 0, label: "禁用" },
{ value: 1, label: "启用" },
];
//根据系统名称搜索
const _onChangeSys = (value: any) => {
setParams({ ...value, current: 1 }, true);
};
return (
<Row justify="start" style={{ marginBottom: 20 }}>
<Input.Search
allowClear
placeholder="请输入指标名称或编码"
onSearch={(value) => {
setParams({ keyword: value }, true);
}}
onChange={(e) => {
seachOnchange({ keyword: e.target.value });
}}
style={{ width: 250, marginRight: 10, marginBottom: 10 }}
/>
<Select
allowClear
placeholder="请选择角色"
style={{ width: 250, marginRight: 10, marginBottom: 10 }}
onChange={(value) => {
setParams({ roleCode: value }, true);
}}
showSearch
optionFilterProp="children"
>
{roleList.map((item) => (
<Option value={item.roleCode} key={item.roleCode}>
{item.roleName}
</Option>
))}
</Select>
{/* <Select
allowClear
placeholder="选择归属系统"
style={{ width: 260, marginRight: 5 }}
onChange={(value: any) => _onChangeSys({ sysId: value })}
showSearch
optionFilterProp="children"
>
{syslist.map((item) => (
<Select.Option value={item.id!} key={item.id}>
{item.sysName}
</Select.Option>
))}
</Select> */}
<Select
placeholder="筛选禁用与启用"
style={{ width: 250, marginRight: 10, marginBottom: 10 }}
onChange={(value) => {
setParams({ enable: value }, true);
}}
showSearch
optionFilterProp="children"
defaultValue={1}
>
{enableList.map((item) => (
<Option value={item.value} key={item.value}>
{item.label}
</Option>
))}
</Select>
</Row>
);
}