|  | @@ -4,18 +4,22 @@ import { GenderEnum, EducationEnum, ExcludedDimensionEnum, MaritalStatusEnum, Op
 | 
											
												
													
														|  |  import { ModalConfig } from '.'
 |  |  import { ModalConfig } from '.'
 | 
											
												
													
														|  |  import { useAjax } from '@/Hook/useAjax'
 |  |  import { useAjax } from '@/Hook/useAjax'
 | 
											
												
													
														|  |  import { getTagsList } from '@/services/launchAdq/global'
 |  |  import { getTagsList } from '@/services/launchAdq/global'
 | 
											
												
													
														|  | 
 |  | +import { filter } from '@umijs/deps/compiled/lodash'
 | 
											
												
													
														|  |  interface Props {
 |  |  interface Props {
 | 
											
												
													
														|  |      title?: string,
 |  |      title?: string,
 | 
											
												
													
														|  |      visible: boolean,
 |  |      visible: boolean,
 | 
											
												
													
														|  |      PupFn: (arg: ModalConfig) => void,
 |  |      PupFn: (arg: ModalConfig) => void,
 | 
											
												
													
														|  |      callback: (params: any) => void,
 |  |      callback: (params: any) => void,
 | 
											
												
													
														|  | -    confirmLoading: boolean
 |  | 
 | 
											
												
													
														|  | 
 |  | +    confirmLoading: boolean,
 | 
											
												
													
														|  | 
 |  | +    type?: 'add' | 'look' | 'edit',//新增,查看,编辑
 | 
											
												
													
														|  | 
 |  | +    dataInfo?: any
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  const ios_os = Object.keys(UserOsEnum).filter(key => key.includes('IOS'))
 |  |  const ios_os = Object.keys(UserOsEnum).filter(key => key.includes('IOS'))
 | 
											
												
													
														|  |  const android_os = Object.keys(UserOsEnum).filter(key => key.includes('ANDROID'))
 |  |  const android_os = Object.keys(UserOsEnum).filter(key => key.includes('ANDROID'))
 | 
											
												
													
														|  |  /**创意模板*/
 |  |  /**创意模板*/
 | 
											
												
													
														|  |  function AdModal(props: Props) {
 |  |  function AdModal(props: Props) {
 | 
											
												
													
														|  | -    let { visible, title, confirmLoading, PupFn, callback } = props
 |  | 
 | 
											
												
													
														|  | 
 |  | +    let { visible, confirmLoading, PupFn, callback, type, dataInfo } = props
 | 
											
												
													
														|  | 
 |  | +    let arg = type === 'look' ? { footer: null } : {}
 | 
											
												
													
														|  |      const tagsList_REGION = useAjax((params) => getTagsList(params))
 |  |      const tagsList_REGION = useAjax((params) => getTagsList(params))
 | 
											
												
													
														|  |      const tagsList_MODEL = useAjax((params) => getTagsList(params))
 |  |      const tagsList_MODEL = useAjax((params) => getTagsList(params))
 | 
											
												
													
														|  |      const [form] = Form.useForm();
 |  |      const [form] = Form.useForm();
 | 
											
										
											
												
													
														|  | @@ -52,7 +56,7 @@ function AdModal(props: Props) {
 | 
											
												
													
														|  |                          if (newValues[key] === '1') {
 |  |                          if (newValues[key] === '1') {
 | 
											
												
													
														|  |                              newValues.targeting.geoLocation = {
 |  |                              newValues.targeting.geoLocation = {
 | 
											
												
													
														|  |                                  locationTypes: ['LIVE_IN'],//对于微信流量(site_set=SITE_SET_WECHAT、SITE_SET_MOMENTS、SITE_SET_MINI_GAME_WECHAT),仅能选择"LIVE_IN"(常住);
 |  |                                  locationTypes: ['LIVE_IN'],//对于微信流量(site_set=SITE_SET_WECHAT、SITE_SET_MOMENTS、SITE_SET_MINI_GAME_WECHAT),仅能选择"LIVE_IN"(常住);
 | 
											
												
													
														|  | -                                regions: newValues.regions && newValues.regions[0] === 1156 ? regionsList[0]?.children?.filter((item:any)=>!item.disabled)?.map((item: { value: any })=>item.value) : newValues.regions
 |  | 
 | 
											
												
													
														|  | 
 |  | +                                regions: newValues.regions && newValues.regions[0] === 1156 ? regionsList[0]?.children?.filter((item: any) => !item.disabled)?.map((item: { value: any }) => item.value) : newValues.regions
 | 
											
												
													
														|  |                              }
 |  |                              }
 | 
											
												
													
														|  |                          }
 |  |                          }
 | 
											
												
													
														|  |                          delete newValues[key]
 |  |                          delete newValues[key]
 | 
											
										
											
												
													
														|  | @@ -170,10 +174,10 @@ function AdModal(props: Props) {
 | 
											
												
													
														|  |                          break;
 |  |                          break;
 | 
											
												
													
														|  |                  }
 |  |                  }
 | 
											
												
													
														|  |              })
 |  |              })
 | 
											
												
													
														|  | -            console.log(JSON.stringify(newValues))
 |  | 
 | 
											
												
													
														|  | -            // callback(newValues)
 |  | 
 | 
											
												
													
														|  | 
 |  | +            // console.log(JSON.stringify(newValues))
 | 
											
												
													
														|  | 
 |  | +            callback(newValues)
 | 
											
												
													
														|  |          })
 |  |          })
 | 
											
												
													
														|  | -    }, [form,regionsList])
 |  | 
 | 
											
												
													
														|  | 
 |  | +    }, [form, regionsList])
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      // 监听ios系统全选事件
 |  |      // 监听ios系统全选事件
 | 
											
												
													
														|  |      useEffect(() => {
 |  |      useEffect(() => {
 | 
											
										
											
												
													
														|  | @@ -256,23 +260,50 @@ function AdModal(props: Props) {
 | 
											
												
													
														|  |          })
 |  |          })
 | 
											
												
													
														|  |      }, [])
 |  |      }, [])
 | 
											
												
													
														|  |      // 回填数据
 |  |      // 回填数据
 | 
											
												
													
														|  | -    useEffect(()=>{
 |  | 
 | 
											
												
													
														|  | -        if(regionsList.length > 0){
 |  | 
 | 
											
												
													
														|  | -            console.log(111)
 |  | 
 | 
											
												
													
														|  | -            let arr = [156,540000,630000,510000,450000,320000,220000,370000,340000,150000,140000,420000,130000,360000,310000,330000,650000,350000,120000,110000,640000,530000,210000,610000,520000,230000,460000,440000,500000,410000,620000,430000]
 |  | 
 | 
											
												
													
														|  | -            let newArr = regionsList[0]?.children?.filter((item:any)=>!item.disabled)?.map((item: { value: any })=>item.value)
 |  | 
 | 
											
												
													
														|  | 
 |  | +    useEffect(() => {
 | 
											
												
													
														|  | 
 |  | +        if (regionsList.length > 0 && dataInfo) {
 | 
											
												
													
														|  | 
 |  | +            let newArr = regionsList[0]?.children?.filter((item: any) => !item.disabled)?.map((item: { value: any }) => item.value)//全选省列表
 | 
											
												
													
														|  | 
 |  | +            let { description, targetingName, targeting } = dataInfo
 | 
											
												
													
														|  | 
 |  | +            let { age, deviceBrandModel, devicePrice, education, excludedConvertedAudience, gender, geoLocation, maritalStatus, networkType, userOs, wechatAdBehavior } = targeting
 | 
											
												
													
														|  |              form.setFieldsValue({
 |  |              form.setFieldsValue({
 | 
											
												
													
														|  | -                regions:JSON.stringify(arr) === JSON.stringify(newArr) ? [1156] : arr//地域回填
 |  | 
 | 
											
												
													
														|  | 
 |  | +                targetingName,//定向名称
 | 
											
												
													
														|  | 
 |  | +                description,//定向描述
 | 
											
												
													
														|  | 
 |  | +                geoLocationType: geoLocation?.regions ? '1' : '0',//地域选项
 | 
											
												
													
														|  | 
 |  | +                regions: geoLocation?.regions && JSON.stringify(geoLocation?.regions) === JSON.stringify(newArr) ? [1156] : geoLocation?.regions,//地域回填
 | 
											
												
													
														|  | 
 |  | +                ageType: age ? '1' : '0',//年龄选项
 | 
											
												
													
														|  | 
 |  | +                age_min: age ? age[0].min : 14,//年龄
 | 
											
												
													
														|  | 
 |  | +                age_max: age ? age[0].max : 66,//年龄
 | 
											
												
													
														|  | 
 |  | +                gender: gender ? gender?.join() : '0',//性别
 | 
											
												
													
														|  | 
 |  | +                educationType: education ? '1' : '0',//学历
 | 
											
												
													
														|  | 
 |  | +                education,//学历
 | 
											
												
													
														|  | 
 |  | +                maritalStatusType: maritalStatus ? '1' : '0',//婚恋
 | 
											
												
													
														|  | 
 |  | +                maritalStatus,//婚恋
 | 
											
												
													
														|  | 
 |  | +                excludedDimension: excludedConvertedAudience ? excludedConvertedAudience?.excludedDimension : '0',//排除已转化
 | 
											
												
													
														|  | 
 |  | +                conversionBehaviorList: excludedConvertedAudience ? excludedConvertedAudience?.conversionBehaviorList[0] : undefined,//排除已转化
 | 
											
												
													
														|  | 
 |  | +                deviceBrandModelType: deviceBrandModel ? '1' : '0',//设备品牌型号
 | 
											
												
													
														|  | 
 |  | +                deviceBrandModelList: deviceBrandModel?.excludedList || deviceBrandModel?.includedList,//设备品牌型号
 | 
											
												
													
														|  | 
 |  | +                isexcluded: deviceBrandModel && deviceBrandModel?.excludedList,//设备品牌型号
 | 
											
												
													
														|  | 
 |  | +                userOsType:userOs?'1':'0',//操作系统
 | 
											
												
													
														|  | 
 |  | +                userOsIos:userOs?.filter((os:string)=>os.includes('IOS')),//操作系统
 | 
											
												
													
														|  | 
 |  | +                userOsAndroid:userOs?.filter((os:string)=>os.includes('ANDROID')),//操作系统
 | 
											
												
													
														|  | 
 |  | +                networkType:networkType?'1':'0',//联网方式
 | 
											
												
													
														|  | 
 |  | +                network:networkType,//联网方式
 | 
											
												
													
														|  | 
 |  | +                devicePriceType:devicePrice?'1':'0',//设备价格
 | 
											
												
													
														|  | 
 |  | +                devicePrice,//设备价格
 | 
											
												
													
														|  | 
 |  | +                wechatAdBehaviorType:wechatAdBehavior?'1':'0',//微信再营销
 | 
											
												
													
														|  | 
 |  | +                actions:wechatAdBehavior?.actions,//再营销
 | 
											
												
													
														|  | 
 |  | +                excludedActions:wechatAdBehavior?.excludedActions,//排除再营销
 | 
											
												
													
														|  |              })
 |  |              })
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  | -    },[regionsList])
 |  | 
 | 
											
												
													
														|  | 
 |  | +    }, [regionsList, dataInfo])
 | 
											
												
													
														|  |      return <Modal
 |  |      return <Modal
 | 
											
												
													
														|  |          visible={visible}
 |  |          visible={visible}
 | 
											
												
													
														|  | -        title={title + '定向'}
 |  | 
 | 
											
												
													
														|  | -        onCancel={() => { PupFn({ visible: false }) }}
 |  | 
 | 
											
												
													
														|  | 
 |  | +        title={type === 'add' ? '新建定向' : type === 'look' ? '定向详情' : '编辑定向'}
 | 
											
												
													
														|  | 
 |  | +        onCancel={() => { PupFn({ visible: false ,dataInfo:null,type:'add'}) }}
 | 
											
												
													
														|  |          onOk={handleOk}
 |  |          onOk={handleOk}
 | 
											
												
													
														|  |          width={900}
 |  |          width={900}
 | 
											
												
													
														|  |          confirmLoading={confirmLoading}
 |  |          confirmLoading={confirmLoading}
 | 
											
												
													
														|  | 
 |  | +        {...arg}
 | 
											
												
													
														|  |      >
 |  |      >
 | 
											
												
													
														|  |          <Form
 |  |          <Form
 | 
											
												
													
														|  |              form={form}
 |  |              form={form}
 |