Commit 1db60f17 authored by mayongxin's avatar mayongxin

fix:搜索返回null处理

parent 146f216e
Pipeline #25627 passed with stages
in 21 minutes 49 seconds
......@@ -4,7 +4,7 @@ import SiteModal from '@/components/Modal/SiteModa';
import classnames from 'classnames'
import styles from './UserModal.less';
import lodash, { clone } from 'lodash';
import { Card, Empty, Pagination, Checkbox,notification } from 'antd'
import { Card, Empty, Pagination, Checkbox, notification, Input,Row,Col } from 'antd'
import {
getWebModuleTree,
chooseUserToStation,
......@@ -21,6 +21,8 @@ import {
} from '@ant-design/icons';
import qs from 'qs';
const { Search } = Input;
const placeholder = '请输入机构名称';
const UserModal = props => {
const [dataList, setdataList] = useState([]);
......@@ -30,10 +32,10 @@ const UserModal = props => {
const [updatePageUser, setUpdatePageUser] = useState(1);//
const [updateCheck, setUpdateCheck] = useState(1);
const [name, setName] = useState('');
const { itemObj,confirmModal } = props
const { itemObj, confirmModal } = props
const isAllChecked = index =>
dataList[index].Users.filter(item => item.isChecked).length ===
dataList[index].Users.length;
dataList[index].Users.filter(item => item.isChecked).length ===
dataList[index].Users.length;
//切换站点,点击分页按钮,提交
......@@ -94,7 +96,7 @@ const UserModal = props => {
}).then(
res => {
let list = []
if (res.data.length > 0) {
if (res.data&&res.data.length > 0) {
res.data.map((item, index) => {
list.push({
......@@ -253,6 +255,11 @@ const UserModal = props => {
setSelectList(lodash.cloneDeep(selectList));
setdataList(lodash.cloneDeep(dataList));
};
// 获取搜索框的值
const handleSearch = value => {
setName(value);
getList(value);
};
return (
<SiteModal
{...props}
......@@ -272,6 +279,19 @@ const UserModal = props => {
[styles.cardBoxR]: true,
})}
>
<Row align="middle">
<Col span={1}>搜索</Col>
<Col span={8}>
<Search
allowClear
placeholder={placeholder}
onSearch={handleSearch}
// onChange={handleChange}
enterButton
/>
</Col>
</Row>
{dataList.length > 0 ? (
<>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment