|
@@ -42,7 +42,6 @@ const DataSourceModal: React.FC<Props> = (props) => {
|
|
|
// 获取数据源
|
|
|
const getList = (params: number[]) => {
|
|
|
getDataSource.run({ accountIds: params, promotedObjectType }).then(res => {
|
|
|
- console.log('res===>', res)
|
|
|
if (res && Object.keys(res)?.indexOf(params[0].toString()) !== -1) {
|
|
|
setTableData(res[params[0]]?.map((item: { userActionSetId: string }) => ({ ...item, id: item?.userActionSetId })))
|
|
|
} else {
|
|
@@ -79,7 +78,7 @@ const DataSourceModal: React.FC<Props> = (props) => {
|
|
|
|
|
|
/** 一键设置 */
|
|
|
const setOnekey = () => {
|
|
|
- let dataSourceNames: string[] = data[selectAdz - 1]['userActionSetsList']?.map((item: { name: string }) => item.name)
|
|
|
+ let dataSourceIds: number[] = data[selectAdz - 1]['userActionSetsList']?.map((item: { userActionSetId: number }) => item.userActionSetId)
|
|
|
let newData = JSON.parse(JSON.stringify(data))
|
|
|
const hide = message.loading(`正在设置...`, 0, () => {
|
|
|
message.success('设置成功');
|
|
@@ -87,8 +86,8 @@ const DataSourceModal: React.FC<Props> = (props) => {
|
|
|
getDataSource.run({ accountIds: newData?.filter((item: { adAccountId: number }) => item.adAccountId !== data[selectAdz - 1].adAccountId)?.map((item: { adAccountId: number }) => item?.adAccountId), promotedObjectType }).then(res => {
|
|
|
if (res && typeof res === 'object') {
|
|
|
Object.keys(res).forEach((key: string) => {
|
|
|
- let values = dataSourceNames.map(name => {
|
|
|
- let value = res[key]?.find((item: { name: string }) => item.name === name)
|
|
|
+ let values = dataSourceIds.map(id => {
|
|
|
+ let value = res[key]?.find((item: { userActionSetId: number }) => item.userActionSetId === id)
|
|
|
if (value) {
|
|
|
return { ...value, id: value.userActionSetId }
|
|
|
}
|
|
@@ -138,7 +137,7 @@ const DataSourceModal: React.FC<Props> = (props) => {
|
|
|
{data.length > 1 && <Button disabled={!data[selectAdz - 1]['userActionSetsList']?.length} onClick={setOnekey} type="link" loading={getDataSource.loading}>
|
|
|
<Space>
|
|
|
<span>一键设置</span>
|
|
|
- <Tooltip color="#FFF" overlayInnerStyle={{ color: '#000' }} title="设置其它账号有相同名称的数据源为那个账号的数据源(注意需要数据源名称相同,否则不设置)">
|
|
|
+ <Tooltip color="#FFF" overlayInnerStyle={{ color: '#000' }} title="设置其它账号有相同ID的数据源为那个账号的数据源(注意需要数据源ID相同,否则不设置)">
|
|
|
<QuestionCircleOutlined />
|
|
|
</Tooltip>
|
|
|
</Space>
|