Commit 2a56353a authored by 皮倩雯's avatar 皮倩雯

添加搜索为空状态提示

parent 5369c2b2
Pipeline #41258 skipped with stages
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
/* eslint-disable no-unused-expressions */ /* eslint-disable no-unused-expressions */
/* eslint-disable no-shadow */ /* eslint-disable no-shadow */
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Modal, Checkbox, Tabs, Input, Button, Pagination } from 'antd'; import { Modal, Checkbox, Tabs, Input, Button, Pagination, Empty } from 'antd';
import { CM_Event_LoadDepartmentAndRoles } from '@/services/standingBook/api'; import { CM_Event_LoadDepartmentAndRoles } from '@/services/standingBook/api';
import styles from './incident.less'; import styles from './incident.less';
...@@ -45,6 +45,7 @@ const ChangeAddFlows = props => { ...@@ -45,6 +45,7 @@ const ChangeAddFlows = props => {
const [listPm, setListPm] = useState([]); const [listPm, setListPm] = useState([]);
const [listSite, setListSite] = useState([]); const [listSite, setListSite] = useState([]);
const [keyValue, setKeyValue] = useState('0'); const [keyValue, setKeyValue] = useState('0');
const [emptyValue, setEmptyValue] = useState(0);
const onSubmit = () => { const onSubmit = () => {
// 没有勾选部门下的选项 // 没有勾选部门下的选项
...@@ -76,14 +77,21 @@ const ChangeAddFlows = props => { ...@@ -76,14 +77,21 @@ const ChangeAddFlows = props => {
saveCheckValue.map((item, index) => { saveCheckValue.map((item, index) => {
data = data.concat(item); data = data.concat(item);
}); });
callBackSubmit({ isType === 'rule'
saveCheckValue, ? callBackSubmit(
str: data.join(','), `${
pickItem, value === '无' || value === '' ? '' : `${value},`
stt: data, }${checkValue.join(',')}`,
title, )
filed22: filed1, : callBackSubmit({
}); saveCheckValue,
str: data.join(','),
pickItem,
stt: data,
title,
filed22: filed1,
isType,
});
setIsCheck(0); setIsCheck(0);
setIsCheck1(0); setIsCheck1(0);
setIsCheck2(0); setIsCheck2(0);
...@@ -156,28 +164,15 @@ const ChangeAddFlows = props => { ...@@ -156,28 +164,15 @@ const ChangeAddFlows = props => {
// 监听分页 // 监听分页
const paginationChange = (page, pageSizes) => { const paginationChange = (page, pageSizes) => {
if (searchWord) { if (keepTabKey == 0) {
if (keepTabKey == 0) { getRoles('角色', searchWord, pageSizes, page);
getRoles('角色', searchWord, pageSizes, page); }
} if (keepTabKey == 1) {
if (keepTabKey == 1) { getRoles('部门', searchWord, pageSizes, page);
getRoles('部门', searchWord, pageSizes, page); }
} if (keepTabKey == 2) {
if (keepTabKey == 2) { getRoles('站点', searchWord, pageSizes, page);
getRoles('站点', searchWord, pageSizes, page);
}
} else {
if (keepTabKey == 0) {
getRoles('角色', '', pageSizes, page);
}
if (keepTabKey == 1) {
getRoles('部门', '', pageSizes, page);
}
if (keepTabKey == 2) {
getRoles('站点', '', pageSizes, page);
}
} }
// 分页时清空复选框
setCurrentPage(page); setCurrentPage(page);
setPageSize(pageSizes); setPageSize(pageSizes);
}; };
...@@ -192,38 +187,14 @@ const ChangeAddFlows = props => { ...@@ -192,38 +187,14 @@ const ChangeAddFlows = props => {
if (res.msg === 'Ok') { if (res.msg === 'Ok') {
setRoleValue(formateArrDataA1(res.data, 'groupType')); setRoleValue(formateArrDataA1(res.data, 'groupType'));
setFiled1(formateArrDataA1(res.data, 'groupType')); setFiled1(formateArrDataA1(res.data, 'groupType'));
let data = []; console.log(res.data.count);
if (type == '角色') {
checkDataRole.forEach(item => {
if (
formateArrDataA1(res.data, 'groupType')[type].indexOf(item) != -1
) {
data.push(item);
}
});
}
if (type == '部门') {
checkDataPm.forEach(item => {
if (
formateArrDataA1(res.data, 'groupType')[type].indexOf(item) != -1
) {
data.push(item);
}
});
// setListPm(data);
}
if (type == '站点') {
checkDataSite.forEach(item => {
if (
formateArrDataA1(res.data, 'groupType')[type].indexOf(item) != -1
) {
data.push(item);
}
});
}
setkeepSearchList(data);
setCurrentPage(1); setCurrentPage(1);
setTotal(res.data.count); setTotal(res.data.count);
if (res.data.count == 0) {
setEmptyValue(1);
} else {
setEmptyValue(0);
}
} }
}); });
}; };
...@@ -256,6 +227,11 @@ const ChangeAddFlows = props => { ...@@ -256,6 +227,11 @@ const ChangeAddFlows = props => {
setTotal(res.data.count); setTotal(res.data.count);
setRoleValue(formateArrDataA1(res.data, 'groupType')); setRoleValue(formateArrDataA1(res.data, 'groupType'));
setFiled1(formateArrDataA1(res.data, 'groupType')); setFiled1(formateArrDataA1(res.data, 'groupType'));
if (res.data.count == 0) {
setEmptyValue(1);
} else {
setEmptyValue(0);
}
} }
}); });
}; };
...@@ -465,22 +441,22 @@ const ChangeAddFlows = props => { ...@@ -465,22 +441,22 @@ const ChangeAddFlows = props => {
}, [listSite]); }, [listSite]);
const handleParChange = key => { const handleParChange = key => {
setKeyValue(key); setKeyValue(key);
setSearchWord(''); // setSearchWord('');
setSearchFlag(0); setSearchFlag(0);
setCurrentPage(1); setCurrentPage(1);
setKeepTabKey(key); setKeepTabKey(key);
let value; let value;
if (key == 0) { if (key == 0) {
value = '角色'; value = '角色';
getRoles('角色', '', pageSize, 1); getRoles('角色', searchWord, pageSize, 1);
} }
if (key == 1) { if (key == 1) {
value = '部门'; value = '部门';
getRoles('部门', '', pageSize, 1); getRoles('部门', searchWord, pageSize, 1);
} }
if (key == 2) { if (key == 2) {
value = '站点'; value = '站点';
getRoles('站点', '', pageSize, 1); getRoles('站点', searchWord, pageSize, 1);
} }
}; };
...@@ -493,7 +469,6 @@ const ChangeAddFlows = props => { ...@@ -493,7 +469,6 @@ const ChangeAddFlows = props => {
const onChangeListNew2 = list => { const onChangeListNew2 = list => {
setListSite(list); setListSite(list);
}; };
return ( return (
<Modal <Modal
title="权限选择" title="权限选择"
...@@ -508,6 +483,10 @@ const ChangeAddFlows = props => { ...@@ -508,6 +483,10 @@ const ChangeAddFlows = props => {
onOk={() => onSubmit()} onOk={() => onSubmit()}
forceRender forceRender
getContainer={false} getContainer={false}
afterClose={() => {
setKeyValue('0');
setSearchWord('');
}}
> >
<Search <Search
style={{ style={{
...@@ -535,29 +514,50 @@ const ChangeAddFlows = props => { ...@@ -535,29 +514,50 @@ const ChangeAddFlows = props => {
> >
<TabPane tab="角色" key="0"> <TabPane tab="角色" key="0">
<div className={styles.cardItemData1}> <div className={styles.cardItemData1}>
<CheckboxGroup {emptyValue == 0 ? (
options={roleValue['角色']} <CheckboxGroup
value={checkedList[0]} options={roleValue['角色']}
onChange={onChangeListNew} value={checkedList[0]}
/> onChange={onChangeListNew}
/>
) : (
<Empty
image={Empty.PRESENTED_IMAGE_SIMPLE}
description="暂无数据"
/>
)}
</div> </div>
</TabPane> </TabPane>
<TabPane tab="部门" key="1"> <TabPane tab="部门" key="1">
<div className={styles.cardItemData1}> <div className={styles.cardItemData1}>
<CheckboxGroup {emptyValue == 0 ? (
options={roleValue['部门']} <CheckboxGroup
value={checkedList[1]} options={roleValue['部门']}
onChange={onChangeListNew1} value={checkedList[1]}
/> onChange={onChangeListNew}
/>
) : (
<Empty
image={Empty.PRESENTED_IMAGE_SIMPLE}
description="暂无数据"
/>
)}
</div> </div>
</TabPane> </TabPane>
<TabPane tab="站点" key="2"> <TabPane tab="站点" key="2">
<div className={styles.cardItemData1}> <div className={styles.cardItemData1}>
<CheckboxGroup {emptyValue == 0 ? (
options={roleValue['站点']} <CheckboxGroup
value={checkedList[2]} options={roleValue['站点']}
onChange={onChangeListNew2} value={checkedList[2]}
/> onChange={onChangeListNew}
/>
) : (
<Empty
image={Empty.PRESENTED_IMAGE_SIMPLE}
description="暂无数据"
/>
)}
</div> </div>
</TabPane> </TabPane>
</Tabs> </Tabs>
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
/* eslint-disable eqeqeq */ /* eslint-disable eqeqeq */
/* eslint-disable no-plusplus */ /* eslint-disable no-plusplus */
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Modal, Checkbox, Tabs, Input, Button, Pagination } from 'antd'; import { Modal, Checkbox, Tabs, Input, Button, Pagination, Empty } from 'antd';
import { CM_Event_LoadDepartmentAndRoles } from '@/services/standingBook/api'; import { CM_Event_LoadDepartmentAndRoles } from '@/services/standingBook/api';
import styles from './incident.less'; import styles from './incident.less';
...@@ -38,7 +38,7 @@ const ChangeAdd = props => { ...@@ -38,7 +38,7 @@ const ChangeAdd = props => {
const [searchWord, setSearchWord] = useState(''); // 关键字 const [searchWord, setSearchWord] = useState(''); // 关键字
const { Search } = Input; const { Search } = Input;
const [total, setTotal] = useState(); const [total, setTotal] = useState();
const [pageSize, setPageSize] = useState(42); const [pageSize, setPageSize] = useState(40);
const [currentPage, setCurrentPage] = useState(1); const [currentPage, setCurrentPage] = useState(1);
const [roleValue, setRoleValue] = useState([]); const [roleValue, setRoleValue] = useState([]);
const [checkDataRole, setCheckDataRole] = useState([]); const [checkDataRole, setCheckDataRole] = useState([]);
...@@ -53,11 +53,11 @@ const ChangeAdd = props => { ...@@ -53,11 +53,11 @@ const ChangeAdd = props => {
const [keepOption2, setKeepOption2] = useState([]); // 保存了获取的站点列表数据 const [keepOption2, setKeepOption2] = useState([]); // 保存了获取的站点列表数据
const [keepTabKey, setKeepTabKey] = useState(0); const [keepTabKey, setKeepTabKey] = useState(0);
const [searchFlag, setSearchFlag] = useState(0); const [searchFlag, setSearchFlag] = useState(0);
const [keepSearchList, setkeepSearchList] = useState([]); // 保存搜索后出现的选中列表
const [list, setList] = useState([]); const [list, setList] = useState([]);
const [listPm, setListPm] = useState([]); const [listPm, setListPm] = useState([]);
const [listSite, setListSite] = useState([]); const [listSite, setListSite] = useState([]);
const [keyValue, setKeyValue] = useState('0'); const [keyValue, setKeyValue] = useState('0');
const [emptyValue, setEmptyValue] = useState(0);
const onSubmit = () => { const onSubmit = () => {
// 没有勾选部门下的选项 // 没有勾选部门下的选项
...@@ -176,28 +176,15 @@ const ChangeAdd = props => { ...@@ -176,28 +176,15 @@ const ChangeAdd = props => {
// 监听分页 // 监听分页
const paginationChange = (page, pageSizes) => { const paginationChange = (page, pageSizes) => {
if (searchWord) { if (keepTabKey == 0) {
if (keepTabKey == 0) { getRoles('角色', searchWord, pageSizes, page);
getRoles('角色', searchWord, pageSizes, page); }
} if (keepTabKey == 1) {
if (keepTabKey == 1) { getRoles('部门', searchWord, pageSizes, page);
getRoles('部门', searchWord, pageSizes, page); }
} if (keepTabKey == 2) {
if (keepTabKey == 2) { getRoles('站点', searchWord, pageSizes, page);
getRoles('站点', searchWord, pageSizes, page);
}
} else {
if (keepTabKey == 0) {
getRoles('角色', '', pageSizes, page);
}
if (keepTabKey == 1) {
getRoles('部门', '', pageSizes, page);
}
if (keepTabKey == 2) {
getRoles('站点', '', pageSizes, page);
}
} }
// 分页时清空复选框
setCurrentPage(page); setCurrentPage(page);
setPageSize(pageSizes); setPageSize(pageSizes);
}; };
...@@ -212,38 +199,14 @@ const ChangeAdd = props => { ...@@ -212,38 +199,14 @@ const ChangeAdd = props => {
if (res.msg === 'Ok') { if (res.msg === 'Ok') {
setRoleValue(formateArrDataA1(res.data, 'groupType')); setRoleValue(formateArrDataA1(res.data, 'groupType'));
setFiled1(formateArrDataA1(res.data, 'groupType')); setFiled1(formateArrDataA1(res.data, 'groupType'));
let data = []; console.log(res.data.count);
if (type == '角色') {
checkDataRole.forEach(item => {
if (
formateArrDataA1(res.data, 'groupType')[type].indexOf(item) != -1
) {
data.push(item);
}
});
}
if (type == '部门') {
checkDataPm.forEach(item => {
if (
formateArrDataA1(res.data, 'groupType')[type].indexOf(item) != -1
) {
data.push(item);
}
});
// setListPm(data);
}
if (type == '站点') {
checkDataSite.forEach(item => {
if (
formateArrDataA1(res.data, 'groupType')[type].indexOf(item) != -1
) {
data.push(item);
}
});
}
setkeepSearchList(data);
setCurrentPage(1); setCurrentPage(1);
setTotal(res.data.count); setTotal(res.data.count);
if (res.data.count == 0) {
setEmptyValue(1);
} else {
setEmptyValue(0);
}
} }
}); });
}; };
...@@ -276,6 +239,11 @@ const ChangeAdd = props => { ...@@ -276,6 +239,11 @@ const ChangeAdd = props => {
setTotal(res.data.count); setTotal(res.data.count);
setRoleValue(formateArrDataA1(res.data, 'groupType')); setRoleValue(formateArrDataA1(res.data, 'groupType'));
setFiled1(formateArrDataA1(res.data, 'groupType')); setFiled1(formateArrDataA1(res.data, 'groupType'));
if (res.data.count == 0) {
setEmptyValue(1);
} else {
setEmptyValue(0);
}
} }
}); });
}; };
...@@ -485,22 +453,22 @@ const ChangeAdd = props => { ...@@ -485,22 +453,22 @@ const ChangeAdd = props => {
}, [listSite]); }, [listSite]);
const handleParChange = key => { const handleParChange = key => {
setKeyValue(key); setKeyValue(key);
setSearchWord(''); // setSearchWord('');
setSearchFlag(0); setSearchFlag(0);
setCurrentPage(1); setCurrentPage(1);
setKeepTabKey(key); setKeepTabKey(key);
let value; let value;
if (key == 0) { if (key == 0) {
value = '角色'; value = '角色';
getRoles('角色', '', pageSize, 1); getRoles('角色', searchWord, pageSize, 1);
} }
if (key == 1) { if (key == 1) {
value = '部门'; value = '部门';
getRoles('部门', '', pageSize, 1); getRoles('部门', searchWord, pageSize, 1);
} }
if (key == 2) { if (key == 2) {
value = '站点'; value = '站点';
getRoles('站点', '', pageSize, 1); getRoles('站点', searchWord, pageSize, 1);
} }
}; };
...@@ -558,29 +526,50 @@ const ChangeAdd = props => { ...@@ -558,29 +526,50 @@ const ChangeAdd = props => {
> >
<TabPane tab="角色" key="0"> <TabPane tab="角色" key="0">
<div className={styles.cardItemData1}> <div className={styles.cardItemData1}>
<CheckboxGroup {emptyValue == 0 ? (
options={roleValue['角色']} <CheckboxGroup
value={checkedList[0]} options={roleValue['角色']}
onChange={onChangeListNew} value={checkedList[0]}
/> onChange={onChangeListNew}
/>
) : (
<Empty
image={Empty.PRESENTED_IMAGE_SIMPLE}
description="暂无数据"
/>
)}
</div> </div>
</TabPane> </TabPane>
<TabPane tab="部门" key="1"> <TabPane tab="部门" key="1">
<div className={styles.cardItemData1}> <div className={styles.cardItemData1}>
<CheckboxGroup {emptyValue == 0 ? (
options={roleValue['部门']} <CheckboxGroup
value={checkedList[1]} options={roleValue['部门']}
onChange={onChangeListNew1} value={checkedList[1]}
/> onChange={onChangeListNew}
/>
) : (
<Empty
image={Empty.PRESENTED_IMAGE_SIMPLE}
description="暂无数据"
/>
)}
</div> </div>
</TabPane> </TabPane>
<TabPane tab="站点" key="2"> <TabPane tab="站点" key="2">
<div className={styles.cardItemData1}> <div className={styles.cardItemData1}>
<CheckboxGroup {emptyValue == 0 ? (
options={roleValue['站点']} <CheckboxGroup
value={checkedList[2]} options={roleValue['站点']}
onChange={onChangeListNew2} value={checkedList[2]}
/> onChange={onChangeListNew}
/>
) : (
<Empty
image={Empty.PRESENTED_IMAGE_SIMPLE}
description="暂无数据"
/>
)}
</div> </div>
</TabPane> </TabPane>
</Tabs> </Tabs>
......
...@@ -237,7 +237,7 @@ ...@@ -237,7 +237,7 @@
padding: 0rem 1rem; padding: 0rem 1rem;
margin-bottom: 1rem; margin-bottom: 1rem;
width: 100%; width: 100%;
height: 28rem; // height: 28re;
} }
} }
.doctorTable { .doctorTable {
......
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