Commit 657d6bc3 authored by 陈前坚's avatar 陈前坚

perf: 查找用户

parent ea962fac
...@@ -14,6 +14,7 @@ import { ...@@ -14,6 +14,7 @@ import {
Divider, Divider,
Tabs, Tabs,
Checkbox, Checkbox,
Button,
} from 'antd'; } from 'antd';
import { import {
FileAddTwoTone, FileAddTwoTone,
...@@ -24,6 +25,8 @@ import { ...@@ -24,6 +25,8 @@ import {
ShareAltOutlined, ShareAltOutlined,
KeyOutlined, KeyOutlined,
ApartmentOutlined, ApartmentOutlined,
SearchOutlined,
StopOutlined,
} from '@ant-design/icons'; } from '@ant-design/icons';
import { PageContainer } from '@ant-design/pro-layout'; import { PageContainer } from '@ant-design/pro-layout';
// import classnames from 'classnames'; // import classnames from 'classnames';
...@@ -40,9 +43,11 @@ const UserManage = () => { ...@@ -40,9 +43,11 @@ const UserManage = () => {
const [treeData1, setTreeData1] = useState([]); const [treeData1, setTreeData1] = useState([]);
const [treeData2, setTreeData2] = useState([]); const [treeData2, setTreeData2] = useState([]);
const [tableData, setTableData] = useState([]); // 用户表 const [tableData, setTableData] = useState([]); // 用户表
const [searchData, setSearchData] = useState([]);
const [currentSelect, setCurrentSelect] = useState([]); const [currentSelect, setCurrentSelect] = useState([]);
const [userVisible, setUserVisible] = useState(false); const [userVisible, setUserVisible] = useState(false);
const [searchUserVisible, setSearchUserVisible] = useState(false);
const [addOrgVisible, setAddOrgVisible] = useState(false); const [addOrgVisible, setAddOrgVisible] = useState(false);
const [editOrgVisible, setEditOrgVisible] = useState(false); const [editOrgVisible, setEditOrgVisible] = useState(false);
const [deleteOrgVisible, setDeleteOrgVisible] = useState(false); const [deleteOrgVisible, setDeleteOrgVisible] = useState(false);
...@@ -62,6 +67,7 @@ const UserManage = () => { ...@@ -62,6 +67,7 @@ const UserManage = () => {
const [rolelist, setRolelist] = useState([]); const [rolelist, setRolelist] = useState([]);
const [stationlist, setStationlist] = useState([]); const [stationlist, setStationlist] = useState([]);
const [searchUserForm] = Form.useForm();
const [addUserForm] = Form.useForm(); const [addUserForm] = Form.useForm();
const [addOrgForm] = Form.useForm(); const [addOrgForm] = Form.useForm();
const [editOrgForm] = Form.useForm(); const [editOrgForm] = Form.useForm();
...@@ -132,7 +138,7 @@ const UserManage = () => { ...@@ -132,7 +138,7 @@ const UserManage = () => {
/> />
</Tooltip> </Tooltip>
<Tooltip title="冻结用户"> <Tooltip title="冻结用户">
<PlayCircleOutlined <StopOutlined
onClick={() => freezeUser(record)} onClick={() => freezeUser(record)}
style={{ fontSize: '16px', color: '#1890FF' }} style={{ fontSize: '16px', color: '#1890FF' }}
/> />
...@@ -161,6 +167,46 @@ const UserManage = () => { ...@@ -161,6 +167,46 @@ const UserManage = () => {
), ),
}, },
]; ];
const searchColumns = [
{
title: '所在机构',
dataIndex: 'OUName',
key: 'OUName',
},
{
title: '登录名称',
dataIndex: 'loginName',
key: 'loginName',
render: item => (
<div
ref={r => {
if (r) {
r.innerHTML = item;
}
}}
/>
),
},
{
title: '用户姓名',
dataIndex: 'userName',
key: 'userName',
render: item => (
<div
ref={r => {
if (r) {
r.innerHTML = item;
}
}}
/>
),
},
{
title: '手机号码',
dataIndex: 'phone',
key: 'phone',
},
];
// 渲染机构树 // 渲染机构树
const mapTree = org => { const mapTree = org => {
...@@ -267,6 +313,9 @@ const UserManage = () => { ...@@ -267,6 +313,9 @@ const UserManage = () => {
}; };
// 左侧目录树相关操作 // 左侧目录树相关操作
const searchUser = () => {
setSearchUserVisible(true);
};
const addUser = (e, title, id) => { const addUser = (e, title, id) => {
// e.stopPropagation(); // e.stopPropagation();
setUserVisible(true); setUserVisible(true);
...@@ -300,9 +349,10 @@ const UserManage = () => { ...@@ -300,9 +349,10 @@ const UserManage = () => {
const relateRole = record => { const relateRole = record => {
setRoleVisible(true); setRoleVisible(true);
setUserID(record.userID); setUserID(record.userID);
setTimeout(() => { getRoleList();
getRoleList(); // setTimeout(() => {
}, 1000); // getRoleList();
// }, 1000);
}; };
const changeOrg = record => { const changeOrg = record => {
setChangeOrgVisible(true); setChangeOrgVisible(true);
...@@ -336,6 +386,29 @@ const UserManage = () => { ...@@ -336,6 +386,29 @@ const UserManage = () => {
setDeleteUserVisible(true); setDeleteUserVisible(true);
setUserID(record.userID); setUserID(record.userID);
}; };
// 查找用户
const submitSearchUser = () => {
get(`/Cityinterface/rest/services/OMS.svc/U_GetUserByKey`, {
_version: 9999,
_dc: time.getTime(),
key: searchUserForm.getFieldValue('key'),
})
.then(res => {
if (res.success) {
// setSearchUserVisible(false);
setSearchData(res.root);
// setSearchData(res.root);
} else {
notification.error({
message: '提交失败',
description: res.message,
});
}
})
.catch(err => {
message.error(err);
});
};
// 提交-添加用户 // 提交-添加用户
const submitAddUser = () => { const submitAddUser = () => {
get(`/Cityinterface/rest/services/OMS.svc/U_AddUser`, { get(`/Cityinterface/rest/services/OMS.svc/U_AddUser`, {
...@@ -460,15 +533,12 @@ const UserManage = () => { ...@@ -460,15 +533,12 @@ const UserManage = () => {
}); });
}; };
const listitem = list => const listitem = list =>
list.map(item1 => { list.map(item1 => (
item1.key = item1.roleID; <Col className="gutter-row" span={6} key={item1.roleID}>
return ( <Checkbox defaultChecked={item1.isChecked} />
<Col className="gutter-row" span={6}> <span>{item1.roleName}</span>
<Checkbox checked={item1.isChecked} /> </Col>
<span>{item1.roleName}</span> ));
</Col>
);
});
const checkBox = () => { const checkBox = () => {
console.log('123'); console.log('123');
}; };
...@@ -487,7 +557,7 @@ const UserManage = () => { ...@@ -487,7 +557,7 @@ const UserManage = () => {
item.key = index; item.key = index;
return ( return (
<> <>
<Divider orientation="left" style={{ fontSize: '14px' }}> <Divider style={{ fontSize: '14px', color: '#1890FF' }}>
<Checkbox onClick={checkBox} /> <Checkbox onClick={checkBox} />
{item.visibleTitle} {item.visibleTitle}
</Divider> </Divider>
...@@ -681,9 +751,20 @@ const UserManage = () => { ...@@ -681,9 +751,20 @@ const UserManage = () => {
<div className={styles.orgContainer}> <div className={styles.orgContainer}>
<span style={{ padding: '8px', fontSize: '16px' }}> <span style={{ padding: '8px', fontSize: '16px' }}>
机构列表 机构列表
<Tooltip title="查找用户">
<SearchOutlined
style={{
fontSize: '18px',
float: 'right',
marginLeft: '12px',
color: '#1890FF',
}}
onClick={searchUser}
/>
</Tooltip>
<Tooltip title="添加下级机构"> <Tooltip title="添加下级机构">
<FolderAddTwoTone <FolderAddTwoTone
style={{ fontSize: '16px', float: 'right' }} style={{ fontSize: '18px', float: 'right' }}
onClick={e => addSubOrg(e, '根目录', '-1')} onClick={e => addSubOrg(e, '根目录', '-1')}
/> />
</Tooltip> </Tooltip>
...@@ -705,6 +786,58 @@ const UserManage = () => { ...@@ -705,6 +786,58 @@ const UserManage = () => {
loading={tableLoading} loading={tableLoading}
/> />
</div> </div>
{/* 查找用户 */}
<Modal
title="查找用户"
visible={searchUserVisible}
onCancel={() => setSearchUserVisible(false)}
footer={[
<Button
key="back"
type="primary"
onClick={() => setSearchUserVisible(false)}
>
关闭
</Button>,
]}
>
<Form form={searchUserForm}>
<Form.Item
name="key"
label="关键字搜索"
rules={[
{
required: true,
},
]}
>
<Input
placeholder="请输入登录名称/用户名称/手机号 ,回车键查找"
onPressEnter={submitSearchUser}
/>
{/* <SearchOutlined
style={{
fontSize: '18px',
float: 'right',
marginLeft: '12px',
color: '#1890FF',
display: 'inline-block',
}}
onClick={submitSearchUser}
/> */}
</Form.Item>
</Form>
<Table
columns={searchColumns}
dataSource={searchData}
onRow={record => ({
onClick: () => {
onSelect([record.OUID]);
setSearchUserVisible(false);
},
})}
/>
</Modal>
{/* 添加用户 */} {/* 添加用户 */}
<Modal <Modal
title={orgTitle} title={orgTitle}
......
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