|
@@ -5,6 +5,7 @@ import { getAccountAllListApi } from "@/services/launchAdq/adAuthorize"
|
|
|
import { useAjax } from "@/Hook/useAjax"
|
|
|
import { authAccountAssetsGroupAccountApi, batchAuthAccountAssetsGroupAccountApi, getConversionInfoApi } from "@/services/adqV3/global"
|
|
|
import { GOAL_ROAS_ENUM, OPTIMIZATIONGOAL_ENUM } from "../../tencentAdPutIn/const"
|
|
|
+import { useDebounce } from "ahooks"
|
|
|
|
|
|
interface Props {
|
|
|
authType: 'material' | 'conversion'
|
|
@@ -26,8 +27,9 @@ const AddSubAccount: React.FC<Props> = ({ authType, authMainAccountId, accountAs
|
|
|
|
|
|
/************************************/
|
|
|
const [form] = Form.useForm()
|
|
|
- const [errorDataList, setErrorDataList] = useState<any[]>([])
|
|
|
const [tableData, setTableData] = useState<any[]>([])//table数据
|
|
|
+ const [value, setValue] = useState<string>();
|
|
|
+ const keywords = useDebounce(value, { wait: 300 });
|
|
|
|
|
|
const getAccountAllList = useAjax(() => getAccountAllListApi())
|
|
|
const authAccountAssetsGroupAccount = useAjax((params) => authAccountAssetsGroupAccountApi(params))
|
|
@@ -37,7 +39,7 @@ const AddSubAccount: React.FC<Props> = ({ authType, authMainAccountId, accountAs
|
|
|
|
|
|
useEffect(() => {
|
|
|
if (authType === 'conversion') {
|
|
|
- getConversionInfo.run({ accountId: authMainAccountId, pageNum: 1, pageSize: 1000 }).then(res => {
|
|
|
+ getConversionInfo.run({ accountId: authMainAccountId, pageNum: 1, pageSize: 1000, keywords }).then(res => {
|
|
|
setTableData(res?.records?.filter((item: { ownerId: string }) => item.ownerId === authMainAccountId)?.map((item: { conversionName: string; optimizationGoal: string; deepBehaviorOptimizationGoal: string; deepWorthOptimizationGoal: string, conversionId: number, createSourceType: string }) => {
|
|
|
const deepGoal = item?.deepBehaviorOptimizationGoal ? OPTIMIZATIONGOAL_ENUM[item?.deepBehaviorOptimizationGoal as keyof typeof OPTIMIZATIONGOAL_ENUM] : item?.deepWorthOptimizationGoal ? GOAL_ROAS_ENUM[item?.deepWorthOptimizationGoal as keyof typeof GOAL_ROAS_ENUM] : null
|
|
|
const cType = item?.createSourceType === 'SELF_CREATED' ? '自建转化' : item?.createSourceType === 'PLATFORM' ? '平台类转化' : ''
|
|
@@ -49,7 +51,12 @@ const AddSubAccount: React.FC<Props> = ({ authType, authMainAccountId, accountAs
|
|
|
}) || [])
|
|
|
})
|
|
|
}
|
|
|
- }, [authType])
|
|
|
+ }, [authType, keywords])
|
|
|
+
|
|
|
+
|
|
|
+ const handleSearch = (keywords?: string) => {
|
|
|
+ setValue(keywords)
|
|
|
+ };
|
|
|
|
|
|
useEffect(() => {
|
|
|
getAccountAllList.run()
|
|
@@ -106,12 +113,13 @@ const AddSubAccount: React.FC<Props> = ({ authType, authMainAccountId, accountAs
|
|
|
allowClear
|
|
|
showSearch
|
|
|
mode="multiple"
|
|
|
- filterOption={(input, option) =>
|
|
|
- (option?.label as any)?.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
|
|
- }
|
|
|
maxTagCount={5}
|
|
|
loading={getConversionInfo.loading}
|
|
|
options={tableData}
|
|
|
+ showArrow={false}
|
|
|
+ filterOption={false}
|
|
|
+ onSearch={handleSearch}
|
|
|
+ searchValue={value}
|
|
|
dropdownMatchSelectWidth={false}
|
|
|
/>
|
|
|
</Form.Item>}
|