فهرست منبع

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

wjx 2 سال پیش
والد
کامیت
27cfa02046

+ 32 - 0
src/components/EarlyWarning/expandedColumns.tsx

@@ -0,0 +1,32 @@
+import { DelAdSysWarningRuleProps } from "@/services/adMonitor/earlyWarning"
+import { Popconfirm } from "antd"
+import React from "react"
+
+function columns(del: (data: DelAdSysWarningRuleProps) => void) {
+    const data: any = [
+        { title: '广告账号', dataIndex: 'accountId', key: 'accountId' },
+        { title: '广告名称', dataIndex: 'adgroupName', key: 'adgroupName', width: 350, ellipsis: true },
+        { title: '广告ID', dataIndex: 'adgroupId', key: 'adgroupId' },
+        { title: '创意ID', dataIndex: 'campaignId', key: 'campaignId' },
+        {
+            title: '操作',
+            dataIndex: 'cz',
+            key: 'cz',
+            render: (a: string[], b: any) => {
+                return <Popconfirm
+                    title="确定删除?"
+                    onConfirm={() => del(b)}
+                    okText="是"
+                    cancelText="否"
+                >
+                    <a style={{ color: 'red' }}>删除</a>
+                </Popconfirm>
+            }
+        },
+    ]
+
+
+    return data
+}
+
+export default columns

+ 46 - 0
src/components/EarlyWarning/expandedRowTable.tsx

@@ -0,0 +1,46 @@
+import { useAjax } from "@/Hook/useAjax"
+import { delAdSysWarningRuleApi, DelAdSysWarningRuleProps, getSysWarningRuleApi } from "@/services/adMonitor/earlyWarning"
+import { SyncOutlined } from "@ant-design/icons"
+import { message, Table } from "antd"
+import React, { useEffect } from "react"
+import columns from "./expandedColumns"
+
+
+const ExpandedRowTable: React.FC<{ data: any }> = ({ data }) => {
+
+    /*****************************/
+    const getSysWarningRule = useAjax((params) => getSysWarningRuleApi(params), { formatResult: true })
+    const delAdSysWarningRule = useAjax((params) => delAdSysWarningRuleApi(params))
+    /*****************************/
+
+    useEffect(() => {
+        console.log(data);
+        if (data?.id) {
+            getSysWarningRule.run(data.id)
+        }
+    }, [])
+
+
+    const del = (data: DelAdSysWarningRuleProps) => {
+        let { accountId, adgroupId, campaignId } = data
+        delAdSysWarningRule.run([{ accountId, adgroupId, campaignId }]).then(res => {
+            message.success('删除成功')
+            getSysWarningRule.refresh()
+        })
+    }
+
+    return <Table
+        size="small"
+        bordered
+        columns={columns(del)}
+        loading={getSysWarningRule.loading}
+        dataSource={getSysWarningRule?.data?.data}
+        title={() => <div style={{ textAlign: 'center', color: '#1890ff', fontWeight: 700, position: 'relative' }}>
+            <span>当前规则配置下的广告</span>
+            <a style={{ position: 'absolute', left: 0 }} onClick={() => getSysWarningRule.refresh()}><SyncOutlined /></a>
+        </div>}
+        pagination={false}
+    />;
+}
+
+export default React.memo(ExpandedRowTable)

+ 3 - 1
src/components/EarlyWarning/index.tsx

@@ -4,6 +4,7 @@ import { delSysWarningRuleApi, getSysWarningRuleListApi, RuleProps } from "@/ser
 import { Button, Drawer, Input, message, Space } from "antd"
 import React, { useEffect, useState } from "react"
 import AddEdit from "./addEdit"
+import ExpandedRowTable from "./expandedRowTable"
 import tableConfig from "./tableConfig"
 
 
@@ -51,7 +52,7 @@ const EarlyWarning: React.FC = () => {
                 field
             }
         })
-        
+
         setEditData({ initialValues: newData })
         setAddVisible(true)
     }
@@ -91,6 +92,7 @@ const EarlyWarning: React.FC = () => {
                     total={getSysWarningRuleList?.data?.data?.length}
                     gutter={[0, 10]}
                     leftChild={<Space direction='vertical'></Space>}
+                    expandedRowRender={(data) => <ExpandedRowTable data={data}/>}
                 />
             </Space>
         </Drawer>}

+ 2 - 1
src/components/Tables/index.tsx

@@ -145,7 +145,8 @@ function Tables(props: Props) {
             className={className}
             expandable={expandedRowRender ? {
                 defaultExpandedRowKeys: ['0'],
-                expandRowByClick: true, expandedRowRender: (data) => {
+                expandRowByClick: true, 
+                expandedRowRender: (data) => {
                     return expandedRowRender(data)
                 }
             } : {}}

+ 2 - 1
src/pages/launchSystemNew/adq/ad/copy.tsx

@@ -96,6 +96,7 @@ const Copy: React.FC<Props> = (props) => {
                 timeSeries: getTimeSeriesList(),
                 firstDayBeginTime: moment('2023-02-24 00:00:00'),
                 copyCount: 1,
+                isCopyAdcreative:true
             }}
         >
             <Form.Item label={<strong>投放日期</strong>} name='dateType'>
@@ -155,7 +156,7 @@ const Copy: React.FC<Props> = (props) => {
                             <Select.Option key={"AD_STATUS_SUSPEND"} value={"AD_STATUS_SUSPEND"}>关闭</Select.Option>
                         </Select>
             </Form.Item>
-            <Form.Item label={<strong>是否复制创意</strong>} name={"isCopyAdcreative"} valuePropName="checked" >
+            <Form.Item label={<strong>是否复制创意</strong>} name={"isCopyAdcreative"} valuePropName="checked"  >
                 <Switch checkedChildren="是" unCheckedChildren="否"  />
             </Form.Item>
             <Form.Item label={<strong>复制数量</strong>} name='copyCount' rules={[{ required: true, message: '请输入复制数量' }]}>

+ 17 - 6
src/services/adMonitor/earlyWarning.ts

@@ -63,12 +63,23 @@ export async function delSysWarningRuleApi(ruleIds: string) {
     })
 }
 
-/** */
-// export async function delAdSysWarningRuleApi(ruleIds: string) {
-//     return request(`${api}/adq/sysWarningRule/delete/${ruleIds}`, {
-//         method: 'POST'
-//     })
-// }
+
+export interface DelAdSysWarningRuleProps {
+    accountId: number, 
+    adgroupId: number, 
+    campaignId: number
+}
+/**
+ * 删除告警规则下的广告
+ * @param data 
+ * @returns 
+ */
+export async function delAdSysWarningRuleApi(data: DelAdSysWarningRuleProps[]) {
+    return request(`${api}/adq/sysWarningRule/deleteAd`, {
+        method: 'POST',
+        data
+    })
+}
 
 /**
  * 告警规则列表