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'; ...@@ -4,7 +4,7 @@ import SiteModal from '@/components/Modal/SiteModa';
import classnames from 'classnames' import classnames from 'classnames'
import styles from './UserModal.less'; import styles from './UserModal.less';
import lodash, { clone } from 'lodash'; 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 { import {
getWebModuleTree, getWebModuleTree,
chooseUserToStation, chooseUserToStation,
...@@ -21,6 +21,8 @@ import { ...@@ -21,6 +21,8 @@ import {
} from '@ant-design/icons'; } from '@ant-design/icons';
import qs from 'qs'; import qs from 'qs';
const { Search } = Input;
const placeholder = '请输入机构名称';
const UserModal = props => { const UserModal = props => {
const [dataList, setdataList] = useState([]); const [dataList, setdataList] = useState([]);
...@@ -30,7 +32,7 @@ const UserModal = props => { ...@@ -30,7 +32,7 @@ const UserModal = props => {
const [updatePageUser, setUpdatePageUser] = useState(1);// const [updatePageUser, setUpdatePageUser] = useState(1);//
const [updateCheck, setUpdateCheck] = useState(1); const [updateCheck, setUpdateCheck] = useState(1);
const [name, setName] = useState(''); const [name, setName] = useState('');
const { itemObj,confirmModal } = props const { itemObj, confirmModal } = props
const isAllChecked = index => const isAllChecked = index =>
dataList[index].Users.filter(item => item.isChecked).length === dataList[index].Users.filter(item => item.isChecked).length ===
dataList[index].Users.length; dataList[index].Users.length;
...@@ -94,7 +96,7 @@ const UserModal = props => { ...@@ -94,7 +96,7 @@ const UserModal = props => {
}).then( }).then(
res => { res => {
let list = [] let list = []
if (res.data.length > 0) { if (res.data&&res.data.length > 0) {
res.data.map((item, index) => { res.data.map((item, index) => {
list.push({ list.push({
...@@ -253,6 +255,11 @@ const UserModal = props => { ...@@ -253,6 +255,11 @@ const UserModal = props => {
setSelectList(lodash.cloneDeep(selectList)); setSelectList(lodash.cloneDeep(selectList));
setdataList(lodash.cloneDeep(dataList)); setdataList(lodash.cloneDeep(dataList));
}; };
// 获取搜索框的值
const handleSearch = value => {
setName(value);
getList(value);
};
return ( return (
<SiteModal <SiteModal
{...props} {...props}
...@@ -272,6 +279,19 @@ const UserModal = props => { ...@@ -272,6 +279,19 @@ const UserModal = props => {
[styles.cardBoxR]: true, [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 ? ( {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