|
|
@@ -1,29 +1,22 @@
|
|
|
import React, { useEffect, useRef, useState } from "react";
|
|
|
import style from '../corpUserManage/index.less'
|
|
|
-import { Button, Card, Input, Select, Table, Tabs } from "antd";
|
|
|
-import { MenuUnfoldOutlined, MenuFoldOutlined, SearchOutlined } from '@ant-design/icons';
|
|
|
-import TeamMembers from "@/components/Team/teamMembers";
|
|
|
+import { Button, Card, Input, Select, Table } from "antd";
|
|
|
+import { SearchOutlined } from '@ant-design/icons';
|
|
|
import { getAdAccountAllOfMember, getCorpAllListApi } from "@/API/global";
|
|
|
import { useAjax } from "@/Hook/useAjax";
|
|
|
-import { getAllOfUserListApi } from "../../API/device";
|
|
|
+import { getAllOfUserListApi, GetAllOfUserListProps } from "../../API/device";
|
|
|
import { useSize } from "ahooks";
|
|
|
import { WeTableConfig } from "./tableConfig";
|
|
|
-import useNewToken from "@/Hook/useNewToken";
|
|
|
import SearchBox from "../../components/searchBox";
|
|
|
|
|
|
|
|
|
const DevicePage: React.FC = () => {
|
|
|
|
|
|
/**************************************/
|
|
|
- const { token } = useNewToken();
|
|
|
const ref = useRef<HTMLDivElement>(null)
|
|
|
const size = useSize(ref)
|
|
|
- const [activeKey, setActiveKey] = useState<string>('1')
|
|
|
- const [showLeft, setShowLeft] = useState<boolean>(false)
|
|
|
- const userIdStr = sessionStorage.getItem('userId')
|
|
|
- const [userId, setUserId] = useState<number>(userIdStr ? Number(userIdStr) : undefined);
|
|
|
- const [queryForm, setQueryForm] = useState<{ corpId?: string, corpUserName?: string }>({})
|
|
|
- const [queryFormNew, setQueryFormNew] = useState<{ corpId?: string, corpUserName?: string }>({})
|
|
|
+ const [queryForm, setQueryForm] = useState<GetAllOfUserListProps>({ pageNum: 1, pageSize: 20, stopUse: false, online: false })
|
|
|
+ const [queryFormNew, setQueryFormNew] = useState<GetAllOfUserListProps>({ pageNum: 1, pageSize: 20, stopUse: false, online: false })
|
|
|
|
|
|
const allOfMember = useAjax(() => getAdAccountAllOfMember())
|
|
|
const getAllOfUserList = useAjax((params) => getAllOfUserListApi(params))
|
|
|
@@ -36,35 +29,12 @@ const DevicePage: React.FC = () => {
|
|
|
}, [])
|
|
|
|
|
|
useEffect(() => {
|
|
|
- if (userId) {
|
|
|
- getAllOfUserList.run({ userId, ...queryForm })
|
|
|
- }
|
|
|
- }, [userId, queryForm])
|
|
|
+ getAllOfUserList.run(queryForm)
|
|
|
+ }, [queryForm])
|
|
|
|
|
|
return <div className={style.corpUserManage}>
|
|
|
- <Tabs
|
|
|
- tabBarStyle={{ marginBottom: 1 }}
|
|
|
- activeKey={activeKey}
|
|
|
- type="card"
|
|
|
- onChange={(activeKey) => {
|
|
|
- if (activeKey !== 'contract') {
|
|
|
- setUserId(userIdStr ? Number(userIdStr) : undefined)
|
|
|
- setActiveKey(activeKey)
|
|
|
- } else {
|
|
|
- setShowLeft(!showLeft)
|
|
|
- }
|
|
|
- }}
|
|
|
- items={[{ label: '我的', key: '1' }, { label: '组员', key: '2' }, { label: showLeft ? <MenuUnfoldOutlined /> : <MenuFoldOutlined />, key: 'contract' }]}
|
|
|
- />
|
|
|
|
|
|
- <div className={style.corpUserManage_bottom}>
|
|
|
- {!showLeft && activeKey === '2' && <TeamMembers
|
|
|
- allOfMember={allOfMember}
|
|
|
- onChange={(putUserId) => {
|
|
|
- setUserId(putUserId)
|
|
|
- }}
|
|
|
- value={userId}
|
|
|
- />}
|
|
|
+ <div className={style.corpUserManage_bottom} style={{ height: '100%' }}>
|
|
|
|
|
|
<Card className={style.corpUserList} styles={{ body: { padding: 0, display: 'flex', flexDirection: 'column', height: '100%', overflow: 'hidden' } }}>
|
|
|
<SearchBox
|
|
|
@@ -77,12 +47,13 @@ const DevicePage: React.FC = () => {
|
|
|
>
|
|
|
<>
|
|
|
<Select
|
|
|
- value={queryFormNew?.corpId}
|
|
|
- onChange={(e) => setQueryFormNew({ ...queryFormNew, corpId: e })}
|
|
|
+ value={queryFormNew?.corpIdList}
|
|
|
+ onChange={(e) => setQueryFormNew({ ...queryFormNew, corpIdList: e })}
|
|
|
showSearch
|
|
|
style={{ width: 150 }}
|
|
|
maxTagCount={1}
|
|
|
- placeholder="主体"
|
|
|
+ mode='multiple'
|
|
|
+ placeholder="选择企业"
|
|
|
filterOption={(input, option) =>
|
|
|
((option?.label ?? '') as string).toLowerCase().includes(input.toLowerCase())
|
|
|
}
|
|
|
@@ -90,18 +61,43 @@ const DevicePage: React.FC = () => {
|
|
|
options={getCorpAllList?.data?.data?.map((item: any) => ({ label: item.corpName, value: item.corpId }))}
|
|
|
/>
|
|
|
<Input onChange={(e) => setQueryFormNew({ ...queryFormNew, corpUserName: e.target.value as any })} value={queryFormNew?.corpUserName} placeholder="企微号名称" allowClear />
|
|
|
+ <Select
|
|
|
+ value={queryFormNew?.stopUse}
|
|
|
+ onChange={(e) => setQueryFormNew({ ...queryFormNew, stopUse: e })}
|
|
|
+ showSearch
|
|
|
+ style={{ width: 100 }}
|
|
|
+ placeholder="是否停用?"
|
|
|
+ allowClear
|
|
|
+ options={[{ label: '是', value: true }, { label: '否', value: false }]}
|
|
|
+ />
|
|
|
+ <Select
|
|
|
+ value={queryFormNew?.online}
|
|
|
+ onChange={(e) => setQueryFormNew({ ...queryFormNew, online: e })}
|
|
|
+ showSearch
|
|
|
+ style={{ width: 100 }}
|
|
|
+ placeholder="手机在线?"
|
|
|
+ allowClear
|
|
|
+ options={[{ label: '是', value: true }, { label: '否', value: false }]}
|
|
|
+ />
|
|
|
</>
|
|
|
</SearchBox>
|
|
|
<div className={style.corpUserList_table} ref={ref}>
|
|
|
<Table
|
|
|
- dataSource={getAllOfUserList?.data?.data}
|
|
|
+ dataSource={getAllOfUserList?.data?.data?.records}
|
|
|
columns={WeTableConfig()}
|
|
|
bordered
|
|
|
pagination={{
|
|
|
- defaultPageSize: 20
|
|
|
+ current: getAllOfUserList?.data?.data?.current,
|
|
|
+ pageSize: getAllOfUserList?.data?.data?.size,
|
|
|
+ total: getAllOfUserList?.data?.data?.total,
|
|
|
+ showSizeChanger: true,
|
|
|
+ onChange: (page, pageSize) => {
|
|
|
+ setQueryFormNew({ ...queryFormNew, pageNum: page, pageSize })
|
|
|
+ setQueryForm({ ...queryForm, pageNum: page, pageSize })
|
|
|
+ }
|
|
|
}}
|
|
|
rowClassName={(record) => record?.phoneInfo?.online && record?.phoneInfo?.accessibility != false ? '' : style.notOnline}
|
|
|
- rowKey={(row) => userId + '_' + row.corpUserId + '_' + row.corpId}
|
|
|
+ rowKey={(row) => row.corpUserId + '_' + row.corpId}
|
|
|
loading={getAllOfUserList?.loading}
|
|
|
scroll={{ y: size?.height && ref.current ? size?.height - ref.current.querySelector('.ant-table-thead').clientHeight - 42 : 300 }}
|
|
|
/>
|