|
@@ -1,6 +1,6 @@
|
|
|
|
|
|
import HocError from '@/Hoc/HocError'
|
|
|
-import { Col, Modal, Row, Input, message, Space, Tabs, Button, Radio } from 'antd'
|
|
|
+import { Col, Modal, Row, Input, message, Space, Tabs, Button, Radio, Select } from 'antd'
|
|
|
import React, { useCallback, useEffect, useState } from 'react'
|
|
|
import { columnsMp } from './tableConfig'
|
|
|
import { useAjax } from '@/Hook/useAjax'
|
|
@@ -11,7 +11,7 @@ import GroupLeft from './groupLeft'
|
|
|
import QQAuth from './qqAuto'
|
|
|
import { MenuFoldOutlined, MenuUnfoldOutlined, PlusOutlined, SwapOutlined } from '@ant-design/icons'
|
|
|
import TeamMembers from '../components/teamMembers'
|
|
|
-import { getAdAccountAllOfMember, getErpUserAll } from '@/services/launchAdq/adq'
|
|
|
+import { getAdAccountAllOfMember, getErpUserAll, getServiceProviderAll, putConfigServiceProvider } from '@/services/launchAdq/adq'
|
|
|
import AddAccountToGroup from './addAccountToGroup'
|
|
|
import { delAccountToGroupApi } from '@/services/launchAdq/subgroup'
|
|
|
import { useModel } from 'umi'
|
|
@@ -36,6 +36,8 @@ const AdAuthorize: React.FC = () => {
|
|
|
const [crShow, setCrShow] = useState<boolean>(false) // 变更记录控制
|
|
|
const [crData, setCrData] = useState<{ name: number, id: number } | null>(null)
|
|
|
const [checkAccShow, setCheckAccShow] = useState<boolean>(false)
|
|
|
+ const [openServer, setOpenServer] = useState<any[]>([])//配置服务商数据
|
|
|
+ const [serverName, setServerName] = useState<any>(null)//选择的服务商名称
|
|
|
const [data, setData] = useState<{
|
|
|
putResourceId?: number | undefined,
|
|
|
beginTime?: string | undefined,
|
|
@@ -53,18 +55,20 @@ const AdAuthorize: React.FC = () => {
|
|
|
const [selectAccData, setSelectAccData] = useState<any[]>([])
|
|
|
const [puShow, setPuShow] = useState<boolean>(false)
|
|
|
const [puData, setPuData] = useState<any[]>([])
|
|
|
- const [switchType, setSwitchType] = useState<'account' | 'putUser'>('account')
|
|
|
-
|
|
|
+ const [switchType, setSwitchType] = useState<'account' | 'putUser' | 'setServer'>('account')
|
|
|
const putRemark = useAjax((adAccountId: any, remark: any) => putAdAccountApi(adAccountId, remark))
|
|
|
const delAccountToGroup = useAjax((params) => delAccountToGroupApi(params))
|
|
|
const getAdAccountList = useAjax((params) => getAdAccountListApi(params), { formatResult: true })
|
|
|
const allOfMember = useAjax(() => getAdAccountAllOfMember(), { formatResult: true })
|
|
|
const erpUserALL = useAjax(() => getErpUserAll(), { formatResult: true })
|
|
|
+ const api_getServiceProviderAll = useAjax(() => getServiceProviderAll(), { formatResult: true })
|
|
|
+ const api_putConfigServiceProvider = useAjax((params) => putConfigServiceProvider(params), { formatResult: true })
|
|
|
/*************************/
|
|
|
|
|
|
useEffect(() => {
|
|
|
groupListInit()
|
|
|
!erpUserALL.data && erpUserALL.run()
|
|
|
+ !api_getServiceProviderAll.data && api_getServiceProviderAll.run()
|
|
|
}, [])
|
|
|
|
|
|
useEffect(() => {
|
|
@@ -123,7 +127,20 @@ const AdAuthorize: React.FC = () => {
|
|
|
setPuData(data)
|
|
|
setPuShow(true)
|
|
|
}
|
|
|
-
|
|
|
+ // 批量配置服务商
|
|
|
+ const setServiceProviderName = (accountIds: any) => {
|
|
|
+ api_putConfigServiceProvider.run({ accountIds, serviceProviderName: serverName.label }).then(res => {
|
|
|
+ if (res.data) {
|
|
|
+ message.success("配置成功!")
|
|
|
+ setOpenServer([]);
|
|
|
+ setServerName(null)
|
|
|
+ getAdAccountList.refresh()
|
|
|
+ } else {
|
|
|
+ message.error("配置失败!")
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ //
|
|
|
return <div style={{ height: '100%' }}>
|
|
|
<Tabs
|
|
|
tabBarStyle={{ marginBottom: 1 }}
|
|
@@ -156,7 +173,7 @@ const AdAuthorize: React.FC = () => {
|
|
|
ajax={getAdAccountList}
|
|
|
dataSource={getAdAccountList?.data?.data?.records}
|
|
|
loading={getAdAccountList?.loading}
|
|
|
- columns={() => columnsMp(edit, del, checkAccount, changeRecord, putUserHandle, activeKey, userInfo?.userId?.toString(), queryForm?.groupId, getAdAccountList)}
|
|
|
+ columns={() => columnsMp(edit, setOpenServer, del, checkAccount, changeRecord, putUserHandle, activeKey, userInfo?.userId?.toString(), queryForm?.groupId, getAdAccountList)}
|
|
|
total={getAdAccountList?.data?.data?.total}
|
|
|
page={getAdAccountList?.data?.data?.current}
|
|
|
pageSize={getAdAccountList?.data?.data?.size}
|
|
@@ -166,6 +183,7 @@ const AdAuthorize: React.FC = () => {
|
|
|
<Radio.Group value={switchType} onChange={(e) => { setSwitchType(e.target.value); setSelectAccData([]) }}>
|
|
|
<Radio.Button value="account">批量切号</Radio.Button>
|
|
|
<Radio.Button value="putUser">批量指派投放助理</Radio.Button>
|
|
|
+ <Radio.Button value="setServer">批量配置服务商</Radio.Button>
|
|
|
</Radio.Group>
|
|
|
<Input.TextArea
|
|
|
placeholder="多个广告账号以,隔开(id1,id2)"
|
|
@@ -182,7 +200,9 @@ const AdAuthorize: React.FC = () => {
|
|
|
<Button type='primary' onClick={() => setVisible(true)}><PlusOutlined />广告账号授权</Button>
|
|
|
{switchType === 'account' ?
|
|
|
(selectAccData?.length > 0 && <Button type="primary" ghost icon={<SwapOutlined />} onClick={() => { checkAccount(selectAccData) }}>批量切号</Button>) :
|
|
|
- (selectAccData?.length > 0 && <Button type="primary" ghost icon={<SwapOutlined />} onClick={() => { putUserHandle(selectAccData) }}>批量指派投放助理</Button>)}
|
|
|
+ switchType === 'putUser' ? (selectAccData?.length > 0 && <Button type="primary" ghost icon={<SwapOutlined />} onClick={() => { putUserHandle(selectAccData) }}>批量指派投放助理</Button>) :
|
|
|
+ selectAccData?.length > 0 && <Button type="primary" ghost icon={<SwapOutlined />} onClick={() => { setOpenServer(selectAccData) }}>批量配置服务商</Button>
|
|
|
+ }
|
|
|
</Space>}
|
|
|
rowSelection={{
|
|
|
selectedRowKeys: selectAccData?.map((item: any) => item.id?.toString()),
|
|
@@ -229,6 +249,52 @@ const AdAuthorize: React.FC = () => {
|
|
|
/>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ {/* 批量设置服务商 */}
|
|
|
+ {openServer.length > 0 && <Modal
|
|
|
+ title="配置服务商"
|
|
|
+ onOk={() => setServiceProviderName(openServer?.map(item => item.accountId))}
|
|
|
+ onCancel={() => { setOpenServer([]); setServerName(null) }}
|
|
|
+ visible={openServer.length > 0}
|
|
|
+ confirmLoading={api_putConfigServiceProvider.loading}
|
|
|
+ >
|
|
|
+ <Row gutter={[20, 20]}>
|
|
|
+ <Col span={24}>
|
|
|
+ <Row>
|
|
|
+ <Col span={3}><b>广告主:</b></Col>
|
|
|
+ <Col span={21}>
|
|
|
+ {openServer.map((item, index) => {
|
|
|
+ return index === openServer.length - 1 ? item.accountId : item.accountId + ','
|
|
|
+ })}
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+ </Col>
|
|
|
+ <Col span={24}>
|
|
|
+ <Row>
|
|
|
+ <Col span={3}><b>服务商:</b></Col>
|
|
|
+ <Col span={21}>
|
|
|
+ <Select
|
|
|
+ style={{ minWidth: 200 }}
|
|
|
+ showSearch
|
|
|
+ allowClear
|
|
|
+ placeholder="请选择服务商"
|
|
|
+ optionFilterProp="children"
|
|
|
+ onChange={(value: any, option: any) => {
|
|
|
+ setServerName(option)
|
|
|
+ }}
|
|
|
+ filterOption={(input, option: any) =>
|
|
|
+ (option?.label ?? '').toLowerCase().includes(input.toLowerCase())
|
|
|
+ }
|
|
|
+ value={serverName}
|
|
|
+ options={api_getServiceProviderAll?.data?.data?.map((item: { id: any, serviceProviderName: any }) => {
|
|
|
+ return { value: item.id, label: item.serviceProviderName }
|
|
|
+ })}
|
|
|
+ />
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+
|
|
|
+ </Modal>}
|
|
|
{/* 广告授权 */}
|
|
|
{visible && <QQAuth qqVisible={visible} callBack={() => setVisible(false)} />}
|
|
|
{/* 变更记录 */}
|