#
luxiaotao1123
2024-02-15 ce70c5d88bdcd8e263cfad913efdf4a75200ec6a
#
2个文件已修改
35 ■■■■ 已修改文件
zy-asrs-flow/src/components/TableSearch/index.jsx 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-flow/src/pages/system/role/index.jsx 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-flow/src/components/TableSearch/index.jsx
@@ -1,11 +1,14 @@
import React from 'react';
import { Input, Button, Space, Select } from 'antd';
const NONE_OPTION = -9999;
const TextFilter = (props) => {
    return (
        <div style={{ padding: 8 }}>
            <Input
                style={{ width: 188, marginBottom: 8, display: 'block' }}
                placeholder="请输入"
                value={props.selectedKeys[0]}
                onChange={e => {
                    props.setSelectedKeys(e.target.value ? [e.target.value] : [])
@@ -40,13 +43,20 @@
}
const SelectFilter = (props) => {
    const NONE_OPTION = -9999;
    const [currentOption, setCurrentOption] = React.useState();
    return (
        <div style={{ padding: 8 }}>
            <div>
            <Select
                style={{ width: 188, marginBottom: 8 }}
                placeholder="选择一个选项"
                value={props.selectedKeys[0]}
                onChange={value => props.setSelectedKeys(value ? [value] : [])}
                    style={{ width: 188, marginBottom: 8, display: 'block' }}
                    placeholder="请选择"
                    value={currentOption === NONE_OPTION ? undefined : currentOption}
                    onChange={value => {
                        setCurrentOption(value)
                        props.setSelectedKeys(value !== undefined && value !== null ? [value] : []);
                    }}
            >
                {props.data.map(item => (
                    <Select.Option key={item.value} value={item.value}>
@@ -54,15 +64,24 @@
                    </Select.Option>
                ))}
            </Select>
            </div>
            <Space>
                <Button
                    type="primary"
                    onClick={() => {
                        props.confirm();
                        if (currentOption === NONE_OPTION) {
                            props.setSearchParam(prevState => {
                                const state = { ...prevState };
                                delete state[props.name];
                                return state;
                            })
                        } else {
                        props.setSearchParam(prevState => ({
                            ...prevState,
                            [props.name]: props.selectedKeys[0]
                                [props.name]: currentOption
                        }));
                        }
                        props.actionRef.current?.reload();
                    }}
                    size="small"
@@ -72,8 +91,9 @@
                </Button>
                <Button
                    onClick={() => {
                        setSelectedKeys([]);
                        clearFilters();
                        setCurrentOption(NONE_OPTION)
                        props.setSelectedKeys([]);
                        props.clearFilters();
                    }}
                    size="small"
                    style={{ width: 90 }}
zy-asrs-flow/src/pages/system/role/index.jsx
@@ -149,7 +149,6 @@
                    { label: '禁用', value: 0 },
                ]}
            />,
        },
        {
            title: '修改时间',