wjx %!s(int64=2) %!d(string=hai) anos
pai
achega
85c12354e2

+ 9 - 8
src/components/EarlyWarning/addEdit.tsx

@@ -2,7 +2,7 @@ import { useAjax } from "@/Hook/useAjax"
 import { addSysWarningRuleApi, editSysWarningRuleApi } from "@/services/adMonitor/earlyWarning"
 import { DeleteOutlined, PlusOutlined } from "@ant-design/icons"
 import { Button, Form, Input, InputNumber, message, Modal, Popconfirm, Select, Space, Switch } from "antd"
-import React from "react"
+import React, { useEffect } from "react"
 import { MonitorFieldEnum, WarningTypeEnum } from "./config"
 import './index.less'
 import PriceInput from "./priceInput"
@@ -25,11 +25,13 @@ const AddEdit: React.FC<Props> = (props) => {
     const editSysWarningRule = useAjax((params) => editSysWarningRuleApi(params))
     /******************************/
 
-    console.log('initialValues--->', initialValues);
-    
+    useEffect(() => {
+        if (rules?.some((item: { field: string[] }) => item?.field?.includes('cost_trend_last_three_hour') && !(item?.['cost_trend_last_three_hour']?.value === 1))) {
+            form.setFieldsValue({ rules: rules.map((item: any) => ({ ...item, cost_trend_last_three_hour: { value: 1, condition: '=' } })) })
+        }
+    }, [rules])
 
     const handleOk = () => {
-        // console.log(JSON.stringify(rules));
         form.validateFields().then(values => {
             if (values?.rules) {
                 let newValues = JSON.parse(JSON.stringify(values))
@@ -110,12 +112,11 @@ const AddEdit: React.FC<Props> = (props) => {
                 <Form.Item name="enable" label={<strong>Enable?</strong>} valuePropName="checked" rules={[{ required: true }]}>
                     <Switch />
                 </Form.Item>
-                <Form.Item name="defaultRule" label={<strong>是否默认规则</strong>} rules={[{ required: true }]}>
+                <Form.Item name="defaultRule" label={<strong>是否默认规则</strong>} valuePropName="checked" rules={[{ required: true }]}>
                     <Switch />
                 </Form.Item>
             </div>
-            <Form.List name="rules"
-            >
+            <Form.List name="rules">
                 {(fields, { add, remove }, { errors }) => <>
                     <>{fields.map(({ key, name, ...restField }) => {
                         return <div key={key} style={{ width: '100%' }} className="field">
@@ -162,7 +163,7 @@ const AddEdit: React.FC<Props> = (props) => {
                                     },
                                 }]}
                             >
-                                <PriceInput />
+                                <PriceInput disabled={field === 'cost_trend_last_three_hour'} />
                             </Form.Item>)}
                         </div>
                     })}</>

+ 28 - 4
src/components/EarlyWarning/config.ts

@@ -3,27 +3,51 @@ export enum MonitorFieldEnum {
     cost_total = '总消耗',
     cost_day = '今日消耗',
     cost_hour = '当前小时消耗',
-    cost_trend_last_three_hour = '消耗趋势(前 3小时)',
+    cost_trend_last_three_hour = '消耗趋势(前3小时)',
     view_total = '总曝光量',
-    thousand_display_price_total = '总千次曝光成本',
+    view_day = '今日曝光',
+    thousand_display_price_total = '千次曝光成本',
+    thousand_display_price_day = '今日千次曝光成本',
     click_total = '总点击量',
+    click_day = '今日点击量',
     ctr_total = '总点击率',
+    ctr_day = '今日点击率',
     cpc_total = '总点击均价',
+    cpc_day = '今日点击均价',
     conversions_count_total = '总转化目标量',
+    conversions_count_day = '今日转化目标量',
     conversions_cost_total = '总转化目标成本',
+    conversions_cost_day = '今日转化目标成本',
     conversions_rate_total = '总目标转化率',
+    conversions_rate_day = '今日目标转化率',
     order_count_total = '总下单量',
+    order_count_day = '今日下单量',
     order_amount_total = '总下单金额',
+    order_amount_day = '今日下单金额',
     order_cost_total = '总下单成本',
+    order_cost_day = '今日下单成本',
     order_rate_total = '总下单率',
+    order_rate_day = '今日下单率',
     order_roi_total = '总下单roi',
+    order_roi_day = '今日下单roi',
     first_day_order_count_total = '总首日下单量',
+    first_day_order_count_day = '今日首日下单量',
     first_day_order_amount_total = '总首日下单金额',
+    first_day_order_amount_day = '今天的首日下单金额',
     first_day_order_roi_total = '总首日下单率',
-    atv_total = '总下单客单价',
+    first_day_order_roi_day = '今天的首日下单率',
+    atv_total = '客单价',
+    atv_day = '今日客单价',
     mp_follow_uv_total = '总公众号关注人数',
+    mp_follow_uv_day = '今日公众号关注人数',
     mp_follow_cost_total = '总公众号关注成本',
-    mp_follow_rate_total = '总公众号关注率'
+    mp_follow_cost_day = '今日公众号关注成本',
+    mp_follow_rate_total = '总公众号关注率',
+    mp_follow_rate_day = '今日公众号关注率',
+    add_fans_count_total = '加粉数',
+    add_fans_count_day = '今日加粉数',
+    add_fans_cost_total = '加粉成本',
+    add_fans_cost_day = '今日加粉成本',
 }
 
 export enum WarningTypeEnum {

+ 5 - 2
src/components/EarlyWarning/priceInput.tsx

@@ -11,14 +11,15 @@ interface PriceValue {
 interface Props {
     value?: PriceValue,
     onChange?: (value: PriceValue) => void;
+    disabled?: boolean
 }
 
 /**
  * 自定义数据input
  * @param param0 
  */
-const PriceInput: React.FC<Props> = ({ value = {}, onChange }) => {
-
+const PriceInput: React.FC<Props> = ({ value = {}, onChange, disabled = false }) => {
+    
     /**********************/
     const [number, setNumber] = useState(0);
     const [condition, setCondition] = useState<Condition>('>');
@@ -50,6 +51,7 @@ const PriceInput: React.FC<Props> = ({ value = {}, onChange }) => {
         <Select
             value={value.condition || condition}
             style={{ width: 100 }}
+            disabled={disabled}
             onChange={onConditionChange}
         >
             <Select.Option value=">">大于</Select.Option>
@@ -60,6 +62,7 @@ const PriceInput: React.FC<Props> = ({ value = {}, onChange }) => {
         </Select>
         <Input
             type="text"
+            disabled={disabled}
             value={value.value || number}
             onChange={onNumberChange}
             style={{ width: 130, margin: '0 8px' }}

+ 1 - 1
src/global.less

@@ -383,7 +383,7 @@ body {
   }
 }
 
-.ant-select-selector, .ant-input, .ant-input-affix-wrapper, .ant-btn, .ant-modal-content, .ant-select-dropdown, .ant-input-number-input {
+.ant-select-selector, .ant-input, .ant-input-affix-wrapper, .ant-btn, .ant-modal-content, .ant-select-dropdown, .ant-input-number-input, .ant-tooltip-inner {
   border-radius: 4px !important;
 }
 

+ 2 - 2
src/pages/launchSystemNew/adq/ad/index.tsx

@@ -380,8 +380,8 @@ const Ad: React.FC<Props> = (props) => {
                     {model ? <>
                         <Col><Button type='primary' style={{ background: '#1890ff' }} icon={<FieldTimeOutlined />} disabled={selectedRows.length === 0} onClick={editScheduling}>修改排期出价名称</Button></Col>
                         <Col><Button type='primary' style={{ background: '#1890ff' }} icon={<CopyOutlined />} disabled={selectedRows.length === 0} onClick={copyHandle}>复制</Button></Col>
-                        <Col><Button type='primary' style={{ background: '#67c23a', borderColor: '#67c23a' }} loading={editAdqAdgroupsData.loading} icon={<PlayCircleOutlined />} disabled={selectedRows.length === 0} onClick={() => adStatus('play')}>启动广告</Button></Col>
-                        <Col><Button type='primary' style={{ background: '#e6a23c', borderColor: '#e6a23c' }} loading={editAdqAdgroupsData.loading} icon={<PauseCircleOutlined />} disabled={selectedRows.length === 0} onClick={() => adStatus('suspend')}>暂停广告</Button></Col>
+                        <Col><Button type='primary' style={{ background: '#67c23a', borderColor: '#67c23a' }} loading={editAdqAdgroupsData.loading} icon={<PlayCircleOutlined />} disabled={selectedRows.length === 0} onClick={() => adStatus('play')}>启动</Button></Col>
+                        <Col><Button type='primary' style={{ background: '#e6a23c', borderColor: '#e6a23c' }} loading={editAdqAdgroupsData.loading} icon={<PauseCircleOutlined />} disabled={selectedRows.length === 0} onClick={() => adStatus('suspend')}>暂停</Button></Col>
                         <Col><Button type='primary' style={{ background: '#00bcd4', borderColor: '#00bcd4' }} loading={putAdqAdgroupsSyncBatchApi.loading} icon={<SyncOutlined />} disabled={selectedRows.length === 0} onClick={syncAd}>同步广告</Button></Col>
                         <Col><SetEarlyWarning selectedRows={selectedRows} onChange={() => listAjax.refresh()}/></Col>
                         <Col>