|
@@ -1,49 +1,57 @@
|
|
import HocError from '@/Hoc/HocError'
|
|
import HocError from '@/Hoc/HocError'
|
|
-import GroupLeft from '@/pages/launchSystemNew/account/groupLeft'
|
|
|
|
import TeamMembers from '@/pages/launchSystemNew/components/teamMembers'
|
|
import TeamMembers from '@/pages/launchSystemNew/components/teamMembers'
|
|
-import { GetAdAccountParams } from '@/services/launchAdq/adAuthorize'
|
|
|
|
import { MenuFoldOutlined, MenuUnfoldOutlined } from '@ant-design/icons'
|
|
import { MenuFoldOutlined, MenuUnfoldOutlined } from '@ant-design/icons'
|
|
-import { Tabs } from 'antd'
|
|
|
|
|
|
+import { Select, Tabs } from 'antd'
|
|
import React, { useCallback, useEffect, useState } from 'react'
|
|
import React, { useCallback, useEffect, useState } from 'react'
|
|
import style from './index.less'
|
|
import style from './index.less'
|
|
-import { getAdAccountAllOfMember } from '@/services/launchAdq/adq'
|
|
|
|
|
|
+import { getAdAccountAllOfMember, getErpUserAll } from '@/services/launchAdq/adq'
|
|
import { useAjax } from '@/Hook/useAjax'
|
|
import { useAjax } from '@/Hook/useAjax'
|
|
import TableData from '@/pages/launchSystemNew/components/TableData'
|
|
import TableData from '@/pages/launchSystemNew/components/TableData'
|
|
import { oceanengine_adAccount_listOfUser } from '@/services/toutiao/ttAccountManage'
|
|
import { oceanengine_adAccount_listOfUser } from '@/services/toutiao/ttAccountManage'
|
|
|
|
+import { columns } from './tableConfig'
|
|
|
|
+import AppointPut from './appointPut'
|
|
function ttAccountManage() {
|
|
function ttAccountManage() {
|
|
|
|
+ const [puShow, setPuShow] = useState<boolean>(false)
|
|
|
|
+ const [puData, setPuData] = useState<any[]>([])
|
|
const [activeKey, setActiveKey] = useState<string>('1')
|
|
const [activeKey, setActiveKey] = useState<string>('1')
|
|
const [showLeft, setShowLeft] = useState<boolean>(false)
|
|
const [showLeft, setShowLeft] = useState<boolean>(false)
|
|
- const [queryForm, setQueryForm] = useState<GetAdAccountParams>({ pageNum: 1, pageSize: 20 })
|
|
|
|
|
|
+ const [queryForm, setQueryForm] = useState<any>({ pageNum: 1, pageSize: 20 })
|
|
|
|
|
|
const allOfMember = useAjax(() => getAdAccountAllOfMember(), { formatResult: true })
|
|
const allOfMember = useAjax(() => getAdAccountAllOfMember(), { formatResult: true })
|
|
|
|
+ const erpUserALL = useAjax(() => getErpUserAll(), { formatResult: true })
|
|
const getAdAccountList = useAjax((params) => oceanengine_adAccount_listOfUser(params), { formatResult: true })
|
|
const getAdAccountList = useAjax((params) => oceanengine_adAccount_listOfUser(params), { formatResult: true })
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
|
+ !erpUserALL.data && erpUserALL.run()
|
|
getList()
|
|
getList()
|
|
- }, [])
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ }, [queryForm])
|
|
/** 获取账号列表 */
|
|
/** 获取账号列表 */
|
|
const getList = useCallback(() => {
|
|
const getList = useCallback(() => {
|
|
- let params = JSON.parse(JSON.stringify(queryForm))
|
|
|
|
- if (params.accountIds) {
|
|
|
|
- params.accountIds = params.accountIds.split(/[\,\,]/)
|
|
|
|
- } else {
|
|
|
|
- delete params?.accountIds
|
|
|
|
- }
|
|
|
|
- getAdAccountList.run(params)
|
|
|
|
|
|
+ // let params = JSON.parse(JSON.stringify(queryForm))
|
|
|
|
+ // if (params.accountIds) {
|
|
|
|
+ // params.accountIds = params.accountIds.split(/[\,\,]/)
|
|
|
|
+ // } else {
|
|
|
|
+ // delete params?.accountIds
|
|
|
|
+ // }
|
|
|
|
+ getAdAccountList.run(queryForm)
|
|
}, [queryForm])
|
|
}, [queryForm])
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /** 指派投手 */
|
|
|
|
+ const putUserHandle = (data: any[]) => {
|
|
|
|
+ setPuData(data)
|
|
|
|
+ setPuShow(true)
|
|
|
|
+ }
|
|
return <div style={{ height: '100%' }}>
|
|
return <div style={{ height: '100%' }}>
|
|
<Tabs
|
|
<Tabs
|
|
tabBarStyle={{ marginBottom: 1 }}
|
|
tabBarStyle={{ marginBottom: 1 }}
|
|
activeKey={activeKey}
|
|
activeKey={activeKey}
|
|
type="card"
|
|
type="card"
|
|
- // tabBarExtraContent={<Button type='primary' onClick={()=>setVisible(true)}><PlusOutlined />广告账号授权</Button>}
|
|
|
|
onChange={(activeKey) => {
|
|
onChange={(activeKey) => {
|
|
if (activeKey !== 'contract') {
|
|
if (activeKey !== 'contract') {
|
|
let newQueryForm = JSON.parse(JSON.stringify(queryForm))
|
|
let newQueryForm = JSON.parse(JSON.stringify(queryForm))
|
|
delete newQueryForm?.groupId
|
|
delete newQueryForm?.groupId
|
|
- delete newQueryForm?.putUserId
|
|
|
|
|
|
+ delete newQueryForm?.userId
|
|
setQueryForm(newQueryForm)
|
|
setQueryForm(newQueryForm)
|
|
setActiveKey(activeKey)
|
|
setActiveKey(activeKey)
|
|
} else {
|
|
} else {
|
|
@@ -56,20 +64,37 @@ function ttAccountManage() {
|
|
<Tabs.TabPane tab={showLeft ? <MenuUnfoldOutlined /> : <MenuFoldOutlined />} key='contract' />
|
|
<Tabs.TabPane tab={showLeft ? <MenuUnfoldOutlined /> : <MenuFoldOutlined />} key='contract' />
|
|
</Tabs>
|
|
</Tabs>
|
|
<div className={style.manage}>
|
|
<div className={style.manage}>
|
|
- {!showLeft && activeKey === '1' && <GroupLeft onChange={(groupId) => setQueryForm({ ...queryForm, groupId, pageNum: 1 })} value={queryForm?.groupId} />}
|
|
|
|
- {!showLeft && activeKey === '2' && <TeamMembers allOfMember={allOfMember} onChange={(putUserId) => setQueryForm({ ...queryForm, putUserId, pageNum: 1 })} value={queryForm?.putUserId} />}
|
|
|
|
- <div className={style.manage__left} style={showLeft ? { width: '100%' } : { width: 'calc(100% - 200px)' }}>
|
|
|
|
|
|
+ {!showLeft && activeKey === '2' && <TeamMembers allOfMember={allOfMember} onChange={(userId) => setQueryForm({ ...queryForm, userId, pageNum: 1 })} value={queryForm?.userId} />}
|
|
|
|
+ <div className={style.manage__left} style={showLeft || activeKey === '1' ? { width: '100%' } : { width: 'calc(100% - 200px)' }}>
|
|
<TableData
|
|
<TableData
|
|
ajax={getAdAccountList}
|
|
ajax={getAdAccountList}
|
|
dataSource={getAdAccountList?.data?.data?.records}
|
|
dataSource={getAdAccountList?.data?.data?.records}
|
|
loading={getAdAccountList?.loading}
|
|
loading={getAdAccountList?.loading}
|
|
- columns={() => []}
|
|
|
|
|
|
+ columns={() => columns(putUserHandle)}
|
|
total={getAdAccountList?.data?.data?.total}
|
|
total={getAdAccountList?.data?.data?.total}
|
|
page={getAdAccountList?.data?.data?.current}
|
|
page={getAdAccountList?.data?.data?.current}
|
|
pageSize={getAdAccountList?.data?.data?.size}
|
|
pageSize={getAdAccountList?.data?.data?.size}
|
|
size="small"
|
|
size="small"
|
|
scroll={{ y: 600 }}
|
|
scroll={{ y: 600 }}
|
|
- // leftChild={null}
|
|
|
|
|
|
+ myKey="accountId"
|
|
|
|
+ leftChild={<>
|
|
|
|
+ <Select
|
|
|
|
+ mode="tags"
|
|
|
|
+ style={{ minWidth: 270 }}
|
|
|
|
+ placeholder="账号ID搜索每次输入按下回车分割账号"
|
|
|
|
+ onChange={(value)=>{
|
|
|
|
+ let arr:any =[]
|
|
|
|
+ value?.map((str: string)=>{
|
|
|
|
+ if(str?.search(/[,,]/) !== -1){
|
|
|
|
+ let newArr = str.split(/[,,]/)
|
|
|
|
+ arr =[...arr,...newArr]
|
|
|
|
+ }else{
|
|
|
|
+ arr.push(str)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ setQueryForm({...queryForm,accountIds:arr})
|
|
|
|
+ }}
|
|
|
|
+ /></>}
|
|
onChange={(props: any) => {
|
|
onChange={(props: any) => {
|
|
let { pagination } = props
|
|
let { pagination } = props
|
|
let { current, pageSize } = pagination
|
|
let { current, pageSize } = pagination
|
|
@@ -78,6 +103,8 @@ function ttAccountManage() {
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
+ {/* 指派 */}
|
|
|
|
+ {puShow && <AppointPut value={puData} visible={puShow} onClose={() => { setPuShow(false) }} allOfMember={erpUserALL} onChange={() => { setPuShow(false); getAdAccountList.refresh(); }} />}
|
|
</div>
|
|
</div>
|
|
}
|
|
}
|
|
|
|
|