wjx 2 年 前
コミット
096044d178

+ 2 - 0
src/pages/launchSystemNew/account/index.tsx

@@ -9,6 +9,7 @@ import style from './index.less'
 import TableData from '../components/TableData'
 import GroupLeft from './groupLeft'
 import { MenuFoldOutlined, MenuUnfoldOutlined } from '@ant-design/icons'
+import TeamMembers from '../components/teamMembers'
 
 /** 投放管理 */
 const AdAuthorize: React.FC = () => {
@@ -71,6 +72,7 @@ const AdAuthorize: React.FC = () => {
 
         <div className={style.manage}>
             {!showLeft && activeKey === '1' && <GroupLeft onChange={(groupId) => setQueryForm({ ...queryForm, groupId })} value={queryForm?.groupId}/>}
+            {!showLeft && activeKey === '2' && <TeamMembers onChange={(putUserId) => setQueryForm({ ...queryForm, putUserId })} value={queryForm?.putUserId}/>}
             
             <div className={style.manage__left} style={showLeft ? { width: '100%' } : { width: 'calc(100% - 200px)' }}>
                 <TableData

+ 17 - 0
src/pages/launchSystemNew/components/teamMembers/index.less

@@ -0,0 +1,17 @@
+.teamMembers {
+    width: 200px;
+    height: 100%;
+    background-color: #fff;
+    overflow: hidden;
+    overflow-y: auto;
+
+    >.menus {
+        width: 100%;
+        height: calc(100% - 32px);
+        overflow: hidden;
+    }
+
+    ul::-webkit-scrollbar {
+        width: 0 !important;
+    }
+}

+ 71 - 12
src/pages/launchSystemNew/components/teamMembers/index.tsx

@@ -1,12 +1,14 @@
 import { useAjax } from "@/Hook/useAjax"
 import { getAdAccountAllOfMember } from "@/services/launchAdq/adq"
 import { IdcardFilled } from "@ant-design/icons"
+import { Menu, Select, Spin } from "antd"
 import React, { useEffect, useState } from "react"
 import { useModel } from "umi"
-
+import './index.less'
 
 interface Props {
     onChange?: (id?: number) => void
+    value?: number
 }
 /**
  * 选择组员左菜单
@@ -14,17 +16,29 @@ interface Props {
 const TeamMembers: React.FC<Props> = (props) => {
 
     /*************************/
+    const { onChange, value } = props
     const [userAll, setUserAll] = useState([])
-    const [selectedArr, setSelectedArr] = useState([])
 
     const userInfo = useModel('@@initialState', model => model.initialState?.currentUser)
     const [userId, setUserId] = useState<any>(userInfo?.userId?.toString())
     const allOfMember = useAjax(() => getAdAccountAllOfMember(), { formatResult: true })
     /*************************/
 
-    /** 获取组员 */ 
+
+    useEffect(() => {
+        onChange?.(userId)
+    }, [userId])
+
+    useEffect(() => {
+        if (value) {
+            setUserId(value.toString())
+        }
+    }, [value])
+
+    /** 获取组员 */
     useEffect(() => {
-        allOfMember.run().then(res => {
+        (async function () {
+            let res = allOfMember?.data || await allOfMember.run()
             if (res?.data) {
                 let useAll: any = []
                 res?.data?.forEach((item: { key: { userId: any; nickName: any; }; value: any[]; }) => {
@@ -42,18 +56,63 @@ const TeamMembers: React.FC<Props> = (props) => {
                 })
                 setUserAll(useAll)
             }
-        })
+        })()
+
     }, [])
-    
-    /** 选中的组员的子账号 */
+
+    useEffect(() => {
+
+    }, [])
+    console.log('allOfMember--->', allOfMember);
+
+
+    /** 初始跳转到自己的名称 */
     useEffect(() => {
-        if (userAll.length > 0 && userId) {
-            let newArr: any = userAll?.filter((item: any) => item.key == userId)
-            setSelectedArr(newArr[0]?.childrenarr || [])
+        if (userAll?.length > 0 && userId) {
+            let topEq = userAll?.findIndex((item: any) => item.key == userId)
+            let em: any = document.getElementById('myMenus')
+            if (em) em.scrollTop = (52 - 4) * topEq
         }
-    }, [userAll, userId])
+    }, [userId, userAll])
 
-    return <div>
+    return <div className="teamMembers">
+        <Select
+            placeholder='名称搜索'
+            style={{ width: '100%' }}
+            showSearch
+            filterOption={(input: any, option: any) => {
+                return (option!?.children as unknown as string)?.toLowerCase()?.includes(input?.toLowerCase())
+            }}
+            loading={allOfMember.loading}
+            allowClear
+            onChange={(value: any) => {
+                if (value) {
+                    setUserId(value.toString())
+                }
+            }}
+        >
+            {userAll.map((item: any) => {
+                return <Select.Option value={item.key} key={item.key}>{item.label}</Select.Option>
+            })}
+        </Select>
+        <Spin className="menus" spinning={allOfMember.loading}>
+            <Menu
+                id='myMenus'
+                theme='light'
+                onClick={(e: any) => {
+                    setUserId(e.key)
+                }}
+                selectedKeys={userId}
+                mode="inline"
+                multiple={false}
+                items={userAll}
+                style={{
+                    overflowY: 'auto',
+                    height: 'calc(100vh - 190px)',
+                    overflowX: 'hidden'
+                }}
+            />
+        </Spin>
 
     </div>
 }

+ 1 - 0
src/services/launchAdq/adAuthorize.ts

@@ -10,6 +10,7 @@ export interface GetAdAccountParams {
     pageSize: number,
     groupId?: number,
     accountIds?: number[]
+    putUserId?: number
 }
 export async function getAdAccountListApi(data: GetAdAccountParams) {
     return request(api + '/adq/adAccount/accountList', {