wjx 2 lat temu
rodzic
commit
b3b7b5051b

+ 1 - 1
src/components/EarlyWarning/addEdit.tsx

@@ -143,7 +143,7 @@ const AddEdit: React.FC<Props> = (props) => {
                                     allowClear
                                     placeholder="选择要设置的字段"
                                     filterOption={(input, option) =>
-                                        ((option?.label ?? '') as any).toLowerCase().includes(input.toLowerCase())
+                                        ((option?.children ?? '') as any).toLowerCase().includes(input.toLowerCase())
                                     }
                                 >
                                     {Object.keys(MonitorFieldEnum).map((item, index) => <Select.Option disabled={rules?.[key]?.['field']?.length >= 3 && !rules?.[key]['field'].includes(item)} value={item} key={index}>{MonitorFieldEnum[item]}</Select.Option>)}

+ 33 - 0
src/components/EarlyWarning/look.tsx

@@ -0,0 +1,33 @@
+import { RuleProps } from "@/services/adMonitor/earlyWarning"
+import { EyeOutlined } from "@ant-design/icons"
+import { Tooltip } from "antd"
+import React from "react"
+import { MonitorFieldEnum } from "./config"
+
+/**
+ * 查看规则
+ */
+interface Props {
+    rules: {
+        rule: RuleProps[]
+    }[]
+}
+const Look: React.FC<Props> = ({ rules }) => {
+
+    return <Tooltip
+        color="#FFF"
+        title={<span
+            style={{ color: '#000' }}
+            dangerouslySetInnerHTML={{
+                __html: rules.map((item, index) => `<span style="color: red; ">(</span> ${item.rule.map(rule => `${MonitorFieldEnum[rule.field]}${rule.condition}${rule.value}`)
+                    .join(' <span style="color: #1890ff; ">并且</span> ')} <span style="color: red; ">)</span>`)
+                    .join(` <span style="color: red; font-weight: 700; font-size: 16px ">或者</span> `)
+            }}
+        ></span>}
+    >
+        <a><EyeOutlined /></a>
+    </Tooltip>
+}
+
+
+export default React.memo(Look)

+ 13 - 2
src/components/EarlyWarning/tableConfig.tsx

@@ -1,6 +1,7 @@
 import { Badge, Popconfirm, Space, Tag } from 'antd'
 import React from 'react'
 import { WarningTypeEnum } from './config'
+import Look from './look'
 function tableConfig(edit: (data: any) => void, del: (id: number) => void): any {
     return [
         {
@@ -8,7 +9,7 @@ function tableConfig(edit: (data: any) => void, del: (id: number) => void): any
             dataIndex: 'id',
             key: 'id',
             align: 'center',
-            width: 55,
+            width: 50,
         },
         {
             title: '规则名称',
@@ -42,7 +43,7 @@ function tableConfig(edit: (data: any) => void, del: (id: number) => void): any
             dataIndex: 'defaultRule',
             key: 'defaultRule',
             align: 'center',
-            width: 70,
+            width: 80,
             render: (a: 0 | 1, b: any) => {
                 return <Badge status={{ '0': 'error', '1': 'success' }[a] as any} text={{ '0': '否', '1': '是' }[a]} />
             }
@@ -57,6 +58,16 @@ function tableConfig(edit: (data: any) => void, del: (id: number) => void): any
                 return <Badge status={{ '0': 'error', '1': 'success' }[a] as any} text={{ '0': '否', '1': '是' }[a]} />
             }
         },
+        {
+            title: '查看',
+            dataIndex: 'rules',
+            key: 'rules',
+            align: 'center',
+            width: 60,
+            render: (a: any, b: any) => {
+                return <Look rules={a}/>
+            }
+        },
         {
             title: '操作',
             dataIndex: 'cz',

+ 47 - 10
src/pages/launchSystemNew/launchManage/createAd/index.tsx

@@ -7,7 +7,7 @@ import { getTagsList, get_adcreative_template } from "@/services/launchAdq/globa
 import { getSysAdgroupsInfo } from "@/services/launchAdq/localAd"
 import { getsysTargetingInfo } from "@/services/launchAdq/targeting"
 import { CheckOutlined, CloseOutlined, SearchOutlined } from "@ant-design/icons"
-import { Button, Card, Col, Empty, Row, Select, Space, Spin, Tooltip, Image, message, Tabs, Popconfirm, notification } from "antd"
+import { Button, Card, Col, Empty, Row, Select, Space, Spin, Tooltip, Image, message, Tabs, Popconfirm, notification, Divider, Checkbox, Modal } from "antd"
 import React, { useCallback, useEffect, useState } from "react"
 import { useModel } from "umi"
 import Ad from "./ad"
@@ -73,6 +73,7 @@ const CreateAd: React.FC = () => {
     const [usesArr, setUsersArr] = useState<any>(localStorage.getItem('ADQUSERS' + userId) ? JSON.parse(localStorage.getItem('ADQUSERS' + userId) as any) : [])
     const { init, get } = useModel('useLaunchAdq.useBdMediaPup')
     const [cloudParams, setCloudParams] = useState<{ adcreativeTemplateId?: number }>({})
+    const [accSearch, setAccSearch] = useState<string>()
 
 
     const tagsList_REGION = useAjax((params) => getTagsList(params))
@@ -662,9 +663,19 @@ const CreateAd: React.FC = () => {
         console.log('paramsSubmit====>', params)
         createAdBatch.run(params).then(res => {
             if (res) {
-                sessionStorage.setItem('CAMP', props?.campaignName)
-                message.success('创建成功')
-                window.location.href = '/#/launchSystemNew/launchManage/taskList'
+                Modal.success({
+                    content: '任务提交成功',
+                    bodyStyle: { fontWeight: 700 },
+                    okText: '跳转任务列表',
+                    closable: true,
+                    onOk: () => {
+                        sessionStorage.setItem('CAMP', props?.campaignName)
+                        window.location.href = '/#/launchSystemNew/launchManage/taskList'
+                    },
+                    onCancel: () => {
+                        setSubVisible(false)
+                    }
+                })
             }
         })
     }
@@ -858,8 +869,8 @@ const CreateAd: React.FC = () => {
             setAccountCreateLogs([])
         }
     }
-    console.log('accountCreateLogs', accountCreateLogs);
-    
+
+
     return <Space direction="vertical" style={{ width: '100%' }}>
         <Card
             title={<Space>
@@ -891,13 +902,13 @@ const CreateAd: React.FC = () => {
                         }}
                         onChange={(e, option) => { getGroupAccountList(e) }}
                     >
-                        {getGroupList.data?.map((item: any) => <Select.Option value={item.groupId} key={item.groupId}>{item.groupName}</Select.Option>)}
+                        {getGroupList?.data?.map((item: any) => <Select.Option value={item.groupId} key={item.groupId}>{item.groupName}</Select.Option>)}
                     </Select>
                 </Selector>
                 <Selector label="媒体账户">
                     <Select
                         mode="multiple"
-                        style={{ minWidth: 200 }}
+                        style={{ minWidth: 200, maxWidth: 500 }}
                         placeholder="请选择媒体账户"
                         maxTagCount={1}
                         allowClear
@@ -906,16 +917,42 @@ const CreateAd: React.FC = () => {
                             <span>+{accountCreateLogs?.length > 1 ? accountCreateLogs.length - 1 : 0}</span>
                         </Tooltip>}
                         dropdownMatchSelectWidth={false}
+                        autoClearSearchValue={false}
                         filterOption={(input: any, option: any) => {
-                            return option!.children?.toString().toLowerCase().includes(input.toLowerCase())
+                            let newInput: string[] = input ? input?.split(/[,,\n\s]+/ig) : []
+                            return newInput?.some(val => option!.children?.toString().toLowerCase()?.includes(val))
                         }}
                         value={accountCreateLogs?.map((item: { id: number }) => item?.id)}
                         onChange={(e, option) => {
-                            console.log(option)
                             setQueryForm({ ...queryForm, adqPageList: [], pageList: [], taskMediaMaps: queryForm?.taskMediaMaps?.map((item: { sysPageId: number }) => ({ ...item, sysPageId: '', accountPageIdMap: {}, cropUserGroupMap: [] })) })
                             setAccountCreateLogs(option?.map((item: any) => ({ adAccountId: item?.children?.toString()?.split('_')[0], id: item?.value })))
                             clearData()
                         }}
+                        searchValue={accSearch}
+                        onSearch={(val) => {
+                            setAccSearch(val)
+                        }}
+                        dropdownRender={menu => (
+                            <>
+                                {menu}
+                                <Divider style={{ margin: '8px 0' }} />
+                                <Space style={{ padding: '0 8px 4px' }}>
+                                    <Checkbox onChange={(e) => {
+                                        let data = []
+                                        if (e.target.checked) {
+                                            data = JSON.parse(JSON.stringify(getAllUserAccount?.data?.data))
+                                            if (accSearch) {
+                                                let newAccSearch = accSearch?.split(/[,,\n\s]+/ig)
+                                                data = data?.filter((item: any) => newAccSearch?.some(val => item!.accountId?.toString().toLowerCase()?.includes(val)))
+                                            }
+                                        }
+                                        setQueryForm({ ...queryForm, adqPageList: [], pageList: [], taskMediaMaps: queryForm?.taskMediaMaps?.map((item: { sysPageId: number }) => ({ ...item, sysPageId: '', accountPageIdMap: {}, cropUserGroupMap: [] })) })
+                                        setAccountCreateLogs(data?.map((item: any) => ({ adAccountId: item?.accountId, id: item?.id })))
+                                        clearData()
+                                    }}>全选</Checkbox>
+                                </Space>
+                            </>
+                        )}
                     >
                         {getAllUserAccount?.data?.data?.map((item: any) => <Select.Option value={item.id} key={item.id}>{item.remark ? item.accountId + '_' + item.remark : item.accountId}</Select.Option>)}
                     </Select>