|
@@ -3,7 +3,7 @@ import React, { useEffect, useState } from "react"
|
|
|
import '../../tencentAdPutIn/index.less'
|
|
|
import { getAccountAllListApi } from "@/services/launchAdq/adAuthorize"
|
|
|
import { useAjax } from "@/Hook/useAjax"
|
|
|
-import { authAccountAssetsGroupAccountApi, getConversionInfoApi } from "@/services/adqV3/global"
|
|
|
+import { authAccountAssetsGroupAccountApi, batchAuthAccountAssetsGroupAccountApi, getConversionInfoApi } from "@/services/adqV3/global"
|
|
|
import { GOAL_ROAS_ENUM, OPTIMIZATIONGOAL_ENUM } from "../../tencentAdPutIn/const"
|
|
|
|
|
|
interface Props {
|
|
@@ -31,6 +31,7 @@ const AddSubAccount: React.FC<Props> = ({ authType, authMainAccountId, accountAs
|
|
|
|
|
|
const getAccountAllList = useAjax(() => getAccountAllListApi())
|
|
|
const authAccountAssetsGroupAccount = useAjax((params) => authAccountAssetsGroupAccountApi(params))
|
|
|
+ const batchAuthAccountAssetsGroupAccount = useAjax((params) => batchAuthAccountAssetsGroupAccountApi(params))
|
|
|
const getConversionInfo = useAjax((params) => getConversionInfoApi(params))
|
|
|
/************************************/
|
|
|
|
|
@@ -58,17 +59,30 @@ const AddSubAccount: React.FC<Props> = ({ authType, authMainAccountId, accountAs
|
|
|
form.validateFields().then(valid => {
|
|
|
console.log(valid)
|
|
|
let params = { ...valid, accountAssetsGroupId: accountAssetsGroupId }
|
|
|
- if (valid.assetId) {
|
|
|
- const assetName = tableData.find(item => item.value === valid.assetId).name
|
|
|
- params.assetName = assetName
|
|
|
- }
|
|
|
- authAccountAssetsGroupAccount.run(params).then(res => {
|
|
|
- console.log(res)
|
|
|
- if (res) {
|
|
|
- message.success('授权成功')
|
|
|
- onChange?.()
|
|
|
+ if (authType === 'conversion') {
|
|
|
+ if (valid.assetId?.length) {
|
|
|
+ params.assetsDTOS = valid.assetId.map((id: any) => {
|
|
|
+ const assetName = tableData.find(item => item.value === id).name
|
|
|
+ return { assetId: id, assetName }
|
|
|
+ })
|
|
|
+ delete valid.assetId
|
|
|
}
|
|
|
- })
|
|
|
+ batchAuthAccountAssetsGroupAccount.run(params).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ if (res) {
|
|
|
+ message.success('授权成功')
|
|
|
+ onChange?.()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ authAccountAssetsGroupAccount.run(params).then(res => {
|
|
|
+ console.log(res)
|
|
|
+ if (res) {
|
|
|
+ message.success('授权成功')
|
|
|
+ onChange?.()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -78,7 +92,7 @@ const AddSubAccount: React.FC<Props> = ({ authType, authMainAccountId, accountAs
|
|
|
onCancel={onClose}
|
|
|
className="modalResetCss"
|
|
|
onOk={handleOk}
|
|
|
- confirmLoading={authAccountAssetsGroupAccount.loading}
|
|
|
+ confirmLoading={authAccountAssetsGroupAccount.loading || batchAuthAccountAssetsGroupAccount.loading}
|
|
|
>
|
|
|
<Form
|
|
|
name="basicAddSub"
|
|
@@ -91,9 +105,11 @@ const AddSubAccount: React.FC<Props> = ({ authType, authMainAccountId, accountAs
|
|
|
placeholder="请选择授权资产"
|
|
|
allowClear
|
|
|
showSearch
|
|
|
+ mode="multiple"
|
|
|
filterOption={(input, option) =>
|
|
|
(option?.label as any)?.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
|
}
|
|
|
+ maxTagCount={5}
|
|
|
loading={getConversionInfo.loading}
|
|
|
options={tableData}
|
|
|
dropdownMatchSelectWidth={false}
|