Selaa lähdekoodia

Merge branch 'develop' of http://git.zanxiangnet.com/wjx/ad-manage

shenwu 2 vuotta sitten
vanhempi
commit
2cb6a7901a

+ 4 - 4
src/pages/launchSystemNew/account/index.tsx

@@ -69,7 +69,7 @@ const AdAuthorize: React.FC = () => {
 
     useEffect(() => {
         getList()
-    }, [queryForm])
+    }, [])
 
     /** 获取账号列表 */
     const getList = () => {
@@ -168,13 +168,13 @@ const AdAuthorize: React.FC = () => {
                             <Radio.Button value="putUser">批量指派投放助理</Radio.Button>
                         </Radio.Group>
                         <Input.TextArea
-                            placeholder="广告账号, 多个以,隔开(id1,id2)"
+                            placeholder="多个广告账号以,隔开(id1,id2)"
                             allowClear
                             style={{ minWidth: 200 }}
-                            rows={1}
                             value={queryForm?.accountIds}
+                            rows={1}
                             onChange={(e) => {
-                                setQueryForm({ ...queryForm, accountIds: e.target.value })
+                                setQueryForm({ ...queryForm, accountIds: e.target.value.replaceAll(/\s/ig,'') })
                             }}
                         />
                         <Button onClick={getList} type='primary' loading={getAdAccountList.loading}>搜索</Button>

+ 37 - 14
src/pages/launchSystemNew/adq/ad/index.tsx

@@ -103,13 +103,13 @@ const Ad: React.FC<Props> = (props) => {
             message.error('请先勾选要同步的广点通账号!')
             return
         }
-        let arr = [...new Set(selectedRows?.map(item=>item.accountId))]
-        syncAjax.run({ accountIdList:arr }).then(res => {
+        let arr = [...new Set(selectedRows?.map(item => item.accountId))]
+        syncAjax.run({ accountIdList: arr }).then(res => {
             res && listAjax.refresh()
             res ? message.success('同步成功!') : message.error('同步失败!')
 
         })
-    }, [listAjax,selectedRows])
+    }, [listAjax, selectedRows])
 
     /** 删除 */
     const deleteHandle = (type: 0 | 1, adgroupId?: number) => {
@@ -190,7 +190,6 @@ const Ad: React.FC<Props> = (props) => {
         setDetailData(data)
         setDetailShow(true)
     }
-
     return <div>
         {/* 修改广告 */}
         {update.visible && <UpdateAd
@@ -417,8 +416,32 @@ const Ad: React.FC<Props> = (props) => {
                             record?.deepConversionSpec?.deepConversionWorthSpec?.goal === 'GOAL_1DAY_PURCHASE_ROAS'
                         )
                 }),
-                onChange: (selectedRowKeys: any, selectedRows: any) => {
-                    setSelectedRows(selectedRows)
+                onChange: (selectedRowKeys: any, selectedRowss: any) => {
+                    let newArr: any = [...selectedRows]
+                    let type = selectedRowss.length === 0 ? 'delAll' : selectedRowss.length === listAjax?.data.data.records.length ? 'add' : 'del'
+                    switch (type) {
+                        case 'add':
+                            console.log('新增')
+                            newArr = [...newArr, ...selectedRowss]
+                            break;
+                        case 'del':
+                            console.log('删除')
+                            newArr.forEach((item: { adgroupId: any }) => {
+                                if (selectedRowss.every((i: { adgroupId: any }) => i.adgroupId != item.adgroupId)) {
+                                    newArr = newArr.filter((i: { adgroupId: any }) => i.adgroupId != item.adgroupId)
+                                }
+                            })
+                            break;
+                        case 'delAll':
+                            console.log('删除全部')
+                            newArr.forEach((item: { adgroupId: any }) => {
+                                if (listAjax?.data.data.records.some((i: { adgroupId: any }) => i.adgroupId == item.adgroupId)) {
+                                    newArr = newArr.filter((i: { adgroupId: any }) => i.adgroupId != item.adgroupId)
+                                }
+                            })
+                            break;
+                    }
+                    setSelectedRows(newArr)
                 }
             }}
             onChange={(props: any) => {
@@ -432,14 +455,14 @@ const Ad: React.FC<Props> = (props) => {
         />
         {detailShow && <PlanDetail visible={detailShow} onClose={() => { setDetailShow(false) }} data={detailData} />}
         {czjlShow && <Modal
-                visible={czjlShow}
-                onCancel={()=>{setCzjlShow(false)}}
-                onOk={()=>{setCzjlShow(false)}}
-                width={1200}
-                footer={null}
-                title={"广告操作记录"}
-            >
-                <Log {...props} />
+            visible={czjlShow}
+            onCancel={() => { setCzjlShow(false) }}
+            onOk={() => { setCzjlShow(false) }}
+            width={1200}
+            footer={null}
+            title={"广告操作记录"}
+        >
+            <Log {...props} />
         </Modal>}
     </div>
 }