Prechádzať zdrojové kódy

Merge branch 'feature-zhu'

朱鑫波 3 rokov pred
rodič
commit
598eb39970

+ 22 - 19
src/api/manage.js

@@ -21,24 +21,27 @@ export function postNoCacheAction(url, parameter) {
   })
 }
 // post---文件
-export function postFileAction(url,parameter) {
+export function postFileAction(url, parameter) {
   return axios({
     headers: {
       'Content-Type': 'multipart/form-data'
     },
     url: url,
-    method:'post' ,
+    method: 'post',
     data: parameter
   })
 }
 //post
-export function postAction(url,parameter) {
+export function postAction(url, parameter) {
   return axios({
     url: url,
-    method:'post' ,
-    data: parameter
+    method: 'post',
+    data: parameter,
+
   })
+
 }
+
 export function getAction(url, parameter) {
   return axios({
     url: url,
@@ -46,10 +49,10 @@ export function getAction(url, parameter) {
     params: parameter
   })
 }
-export function postFormAction(url,parameter) {
+export function postFormAction(url, parameter) {
   return axios({
     url: url,
-    method:'post' ,
+    method: 'post',
     params: parameter
   })
 }
@@ -62,10 +65,10 @@ export function deleteAction(url, parameter) {
   })
 }
 //post method= {post | put}
-export function httpAction(url,parameter,method) {
+export function httpAction(url, parameter, method) {
   return axios({
     url: url,
-    method:method ,
+    method: method,
     data: parameter
   })
 }
@@ -105,10 +108,10 @@ export function saveService(parameter) {
 }
 
 //put
-export function putAction(url,parameter) {
+export function putAction(url, parameter) {
   return axios({
     url: url,
-    method:'put',
+    method: 'put',
     data: parameter
   })
 }
@@ -202,11 +205,11 @@ export function downloadFile(url, fileName, parameter) {
  * @param parameter
  * @returns {*}
  */
-export function uploadAction(url,parameter){
+export function uploadAction(url, parameter) {
   return axios({
     url: url,
     data: parameter,
-    method:'post' ,
+    method: 'post',
     headers: {
       'Content-Type': 'multipart/form-data',  // 文件上传
     },
@@ -219,17 +222,17 @@ export function uploadAction(url,parameter){
  * @param subStr
  * @returns {*}
  */
-export function getFileAccessHttpUrl(avatar,subStr) {
-  if(!subStr) subStr = 'http'
-  if(avatar && avatar.startsWith(subStr)){
+export function getFileAccessHttpUrl(avatar, subStr) {
+  if (!subStr) subStr = 'http'
+  if (avatar && avatar.startsWith(subStr)) {
     return avatar;
-  }else{
-    if(avatar && avatar.length>0 && avatar.indexOf('[')==-1){
+  } else {
+    if (avatar && avatar.length > 0 && avatar.indexOf('[') == -1) {
       return window._CONFIG['staticDomainURL'] + "/" + avatar;
     }
   }
 }
-export function postFile(URL,parameter) {
+export function postFile(URL, parameter) {
   return axios({
     url: URL,
     method: 'post',

+ 21 - 0
src/filters.js

@@ -309,6 +309,27 @@ const filters = {
             less: '<',//小于
             greater_equal: '≥',//大于等于
             less_equal: '≤',//小于等于
+            between:'介于'
+        }
+
+        return data[val]
+    },
+    //预警计算符号
+    cindicatorName(val) {
+        var data = {
+            charge: '金额',//'等于',
+            dayBudget: '预算',//不等于,
+            bid: '出价',//大于
+            cost: '成本',//小于
+        }
+
+        return data[val]
+    },
+    operationType(val) {
+        var data = {
+            up: '提高',//'等于',
+            down: '降低',//不等于,
+            to: '调整至',//大于
         }
 
         return data[val]

+ 9 - 0
src/main.js

@@ -110,6 +110,15 @@ Vue.prototype.doMian = "http://139.186.31.213:8804/jeecg-boot";
 Vue.prototype.postFormAction = postFormAction;
 Vue.prototype.postDataAction = postAction;
 Vue.prototype.getAction = getAction;
+
+Vue.prototype.cancel = function () {
+  let cancelArr = window.axiosCancel
+  cancelArr = cancelArr || [] //判断空值
+  cancelArr.forEach((ele, index) => {
+    ele.cancel('取消了请求') // 在失败函数中返回这里自定义的错误信息
+    delete window.axiosCancel[index]
+  })
+}
 new Vue({
   router,
   store,

+ 83 - 69
src/utils/request.js

@@ -6,86 +6,89 @@
 import Vue from 'vue';
 import axios from 'axios';
 import store from '@/store';
-import {VueAxios} from './axios';
-import {Modal, notification} from 'ant-design-vue';
-import {ACCESS_TOKEN} from '@/store/mutation-types';
+import { VueAxios } from './axios';
+import { Modal, notification } from 'ant-design-vue';
+import { ACCESS_TOKEN } from '@/store/mutation-types';
 const key = '1';
 // 创建 axios 实例
 
+window.axiosCancel = []
 if (process.env.NODE_ENV === 'development') {
-    axios.defaults.baseURL = '/jeecg-boot';
+	axios.defaults.baseURL = '/jeecg-boot';
 }
 else if (process.env.NODE_ENV === 'debug') {
 }
 else if (process.env.NODE_ENV === 'production') {
 	// axios.defaults.baseURL = 'http://apipre.tjyourong.com.cn/jeecg-boot'; // 预生产
-    // axios.defaults.baseURL = 'http://gateway.tjyourong.com.cn/jeecg-boot';//测试
-	axios.defaults.baseURL = 'http://api.tjyourong.com.cn/jeecg-boot'; // 生产环境
+	// axios.defaults.baseURL = 'http://gateway.tjyourong.com.cn/jeecg-boot';//测试
+	// axios.defaults.baseURL = 'http://api.tjyourong.com.cn/jeecg-boot'; // 生产环境
+	axios.defaults.baseURL = 'http://gateway.tjyourong.com.cn/jeecg-boot'; // 生产环境
+
 }
 const service = axios.create({
 	// baseURL: '/jeecg-boot', // api base_url
-    timeout: 6000000 // 请求超时时间
+	timeout: 6000000, // 请求超时时间
 });
 
 
 
 
 const err = (error) => {
-    if (error.esponse) {
+	if (error.esponse) {
 		let data = error.response.data
 		const token = Vue.ls.get(ACCESS_TOKEN)
 		// console.log("------异常响应------", token)
 		// console.log("------异常响应------", error.response.status)
 		switch (error.response.status) {
-		case 403:
-			notification.error({key,message: '系统提示', description: '拒绝访问', duration: 4})
-			break
-		case 500:
-			//notification.error({ message: '系统提示', description:'Token失效,请重新登录!',duration: 4})
-			if (token && data.message == "Token失效,请重新登录") {
-			// update-begin- --- author:scott ------ date:20190225 ---- for:Token失效采用弹框模式,不直接跳转----
-			// store.dispatch('Logout').then(() => {
-			//     window.location.reload()
-			// })
-			Modal.error({
-				title: '登录已过期',
-				content: '很抱歉,登录已过期,请重新登录',
-				okText: '重新登录',
-				mask: false,
-				onOk: () => {
-				store.dispatch('Logout').then(() => {
-					Vue.ls.remove(ACCESS_TOKEN)
-					window.location.reload()
-				})
+			case 403:
+				notification.error({ key, message: '系统提示', description: '拒绝访问', duration: 4 })
+				break
+			case 500:
+				//notification.error({ message: '系统提示', description:'Token失效,请重新登录!',duration: 4})
+				if (token && data.message == "Token失效,请重新登录") {
+					// update-begin- --- author:scott ------ date:20190225 ---- for:Token失效采用弹框模式,不直接跳转----
+					// store.dispatch('Logout').then(() => {
+					//     window.location.reload()
+					// })
+					Modal.error({
+						title: '登录已过期',
+						content: '很抱歉,登录已过期,请重新登录',
+						okText: '重新登录',
+						mask: false,
+						onOk: () => {
+							store.dispatch('Logout').then(() => {
+								Vue.ls.remove(ACCESS_TOKEN)
+								window.location.reload()
+							})
+						}
+					})
+					// update-end- --- author:scott ------ date:20190225 ---- for:Token失效采用弹框模式,不直接跳转----
 				}
-			})
-			// update-end- --- author:scott ------ date:20190225 ---- for:Token失效采用弹框模式,不直接跳转----
-			}
-			break
-		case 404:
-			notification.error({key,message: '系统提示', description: '很抱歉,资源未找到!', duration: 4})
-			break
-		case 504:
-			notification.error({key,message: '系统提示', description: '网络超时'})
-			break
-		case 401:
-			notification.error({key,message: '系统提示', description: '未授权,请重新登录', duration: 4})
-			if (token) {
-			store.dispatch('Logout').then(() => {
-				setTimeout(() => {
-				window.location.reload()
-				}, 1500)
-			})
-			}
-			break
-		default:
-			notification.error({
-			key,
-			message: '系统提示',
-			description: data.message,
-			duration: 4
-			})
-			break
+				break
+			case 404:
+				notification.error({ key, message: '系统提示', description: '很抱歉,资源未找到!', duration: 4 })
+				break
+			case 504:
+				notification.error({ key, message: '系统提示', description: '网络超时' })
+				break
+			case 401:
+				notification.error({ key, message: '系统提示', description: '未授权,请重新登录', duration: 4 })
+				if (token) {
+					store.dispatch('Logout').then(() => {
+						setTimeout(() => {
+							window.location.reload()
+						}, 1500)
+					})
+				}
+				break
+			default:
+				notification.error({
+					key,
+					message: '系统提示',
+					description: data.message,
+					duration: 4
+				})
+				break
 		}
 	}
 	return Promise.reject(error)
@@ -94,30 +97,41 @@ const err = (error) => {
 // request interceptor
 service.interceptors.request.use(config => {
 	const token = Vue.ls.get(ACCESS_TOKEN);
-    if (token) {
+	if (token) {
 		config.headers['X-Access-Token'] = token; // 让每个请求携带自定义 token 请根据实际情况自行修改
-    }
-    if (config.method === 'get') {
+	}
+	if (config.method === 'get') {
 		config.params = {
 			_t: Date.parse(new Date()) / 1000,
 			...config.params
 		};
-    }
+	}
+	config.cancelToken = new axios.CancelToken(cancel => {
+		window.axiosCancel.push({
+			cancel
+		})
+	})
+
 	return config;
 }, (error) => {
-  	return Promise.reject(error);
+	return Promise.reject(error);
 });
 
 // response interceptor
 service.interceptors.response.use((response) => {
-    return response.data;
+	return response.data;
 }, (error) => {
-    notification.error({
-        key,
-        message: '系统提示',
-        description: '网络超时,请刷新页面'
-    });
-    return;
+	if (axios.isCancel(error)) {
+		
+	} else {
+		notification.error({
+			key,
+			message: '系统提示',
+			description: '网络超时,请刷新页面'
+		});
+	}
+
+	return;
 });
 
 const installer = {
@@ -128,6 +142,6 @@ const installer = {
 };
 
 export {
-    installer as VueAxios,
+	installer as VueAxios,
 	service as axios
 };

+ 43 - 0
src/views/modules/autoLaunch/channelManage/channelManage.less

@@ -0,0 +1,43 @@
+
+.channelManage {
+    .middle-button {
+        margin: 0 8px;
+    }
+    .divider {
+        height: 62px;
+    }
+    .showNumBox {
+        background: white;
+        overflow: hidden;
+        margin: 15px 0;
+        padding: 30px 0;
+        text-align: center;
+        .ant-card-body {
+            padding-top: 0;
+        }
+        .title {
+            font-size: 14px;
+            font-family: PingFangSC-Regular, PingFang SC;
+            font-weight: 400;
+            color: #999999;
+            line-height: 22px;
+            display: inline-block;
+        }
+    }
+    .tabbody {
+        background: white;
+        padding: 0 24px;
+        margin-bottom: 15px;
+        .ant-tabs-bar {
+            margin: 0;
+        }
+    }
+    .chartBox {
+        background: white;
+        padding: 20px 0;
+    }
+    .tableBody {
+        background: white;
+        padding: 20px;
+    }
+}

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1378 - 0
src/views/modules/autoLaunch/channelManage/index.vue


+ 633 - 0
src/views/modules/autoLaunch/components/configLaunchExploreDrawer.vue

@@ -0,0 +1,633 @@
+<style scoped lang="scss">
+/deep/ .ant-drawer-header {
+    border-bottom: 0px;
+    padding: 0;
+}
+/deep/.ant-drawer-body {
+    padding-top: 0;
+}
+/deep/.ant-tooltip-inner {
+    color: #fff !important;
+    background-color: rgba(0, 0, 0, 0.75) !important;
+}
+/deep/.ant-tooltip-arrow::before {
+    color: #fff !important;
+    background-color: rgba(0, 0, 0, 0.75) !important;
+}
+</style>
+<template>
+    <a-drawer width="50%" :visible="exploreVisible" @close="closeDrawer" id="explore">
+        <a-tabs v-model="exploreKey" slot="title">
+            <a-tab-pane key="1" tab="加速探索"> </a-tab-pane>
+            <a-tab-pane key="2" tab="辅助探索" disabled> </a-tab-pane>
+        </a-tabs>
+        <div v-if="exploreKey == '1'" style="padding-bottom:30px">
+            <a-tabs v-model="exploreHistory" @change="checkTab">
+                <a-tab-pane key="1" tab="批量加速探索"> </a-tab-pane>
+                <a-tab-pane key="2" tab="加速探索历史"> </a-tab-pane>
+            </a-tabs>
+            <div v-if="exploreHistory == '1'">
+                <a-form :form="form">
+                    <p style="font-size:16px">
+                        加速探索开启后预算会在6小时内消耗完成,给单元提供更多的曝光机会,使系统对当前单元的判断更加精准,加速探索不一定能使单元探索成功。
+                    </p>
+                    <p style="font-size:16px">
+                        当前预算:<span v-if="nowBudget == 0" style="font-weight:700"> 不限 </span
+                        ><span v-else style="font-weight:700">{{ nowBudget | decimalsHandle }}</span>
+                    </p>
+                    <p style="font-size:16px;">
+                        探索预算
+                        <a-tooltip>
+                            <template slot="title">
+                                注意:此处的预算为单组预算,总预算为:选择广告组数*单组预算 ,总预算不能超过当前账户预算
+                            </template>
+                            <a-icon type="question-circle" /> </a-tooltip
+                        >:
+                        <a-form-item style="display:inline-block;position:relative;top:-5px;margin-bottom:0">
+                            <a-input-number
+                                style="width:200px"
+                                v-decorator="[
+                                    'exploreDudget',
+                                    { rules: [{ required: true, message: '您还未设置加速探索预算,请先设置预算。' }] }
+                                ]"
+                                :min="100"
+                                :max="nowBudget == 0 ? 99999999999999 : nowBudget"
+                                :step="0.01"
+                            />
+                            <span style="margin: 0 10px" v-if="getFormData('exploreDudget')">
+                                可选:{{
+                                    nowBudget == 0 ? '不限' : Math.floor(nowBudget / getFormData('exploreDudget'))
+                                }}
+                            </span>
+                            <span style="margin: 0 10px"> 已选:{{ selectedRowKeys.length }} </span>
+                        </a-form-item>
+                    </p>
+                    <p>
+                        批量选择需要使用探索工具的广告组
+                        <a style="margin-left:15px" @click="allOpen">一键全部开启</a>
+                    </p>
+                </a-form>
+            </div>
+            <div v-else>
+                <a-form layout="inline" :form="formSearch" hide-required-mark :selfUpdate="true">
+                    <a-row :gutter="24" style="margin-bottom:15px">
+                        <a-col :md="8" :sm="8" :xxl="8">
+                            <a-form-item label="广告组ID">
+                                <a-input allow-clear v-decorator="['unitId']" type="text" placeholder="请输入需要搜索的广告组ID" />
+                            </a-form-item>
+                        </a-col>
+                        <!--  -->
+                        <a-col :md="8" :sm="8" :xxl="8">
+                            <a-form-item label="广告组名称" style="    display: flex;">
+                                <a-input
+                                    allow-clear
+                                    v-decorator="['unitName']"
+                                    type="text"
+                                    placeholder="请输入需要搜索的广告组名称"
+
+                                />
+                            </a-form-item>
+                        </a-col>
+                        <a-col :md="8" :sm="8" :xxl="8">
+                            <a-form-item label="状态">
+                                <a-select
+                                    v-decorator="['exploreStatus', { initialValue: 'null' }]"
+                                    placeholder="请选择"
+                                    style="width:200px"
+                                    allow-clear
+                                >
+                                    <a-select-option key="null">
+                                        全选
+                                    </a-select-option>
+                                    <a-select-option :key="1">
+                                        加速探索
+                                    </a-select-option>
+                                    <a-select-option :key="2">
+                                        加速探索手动暂停
+                                    </a-select-option>
+                                    <a-select-option :key="3">
+                                        探索金额完成
+                                    </a-select-option>
+                                    <a-select-option :key="4">
+                                        时间到达截止时间
+                                    </a-select-option>
+                                </a-select>
+                            </a-form-item>
+                        </a-col>
+                    </a-row>
+                    <a-row :gutter="24">
+                        <a-col :md="16" :sm="16" :xxl="16">
+                            <a-form-item label="时间维度">
+                                <a-radio-group v-decorator="['timeRange', { initialValue: 'lastWeek' }]">
+                                    <a-radio-button value="today">
+                                        今天
+                                    </a-radio-button>
+                                    <a-radio-button value="yesterday">
+                                        昨天
+                                    </a-radio-button>
+                                    <a-radio-button value="lastWeek">
+                                        最近七天
+                                    </a-radio-button>
+                                    <a-radio-button value="lastMonth">
+                                        最近一月
+                                    </a-radio-button>
+                                </a-radio-group>
+                            </a-form-item>
+                        </a-col>
+                        <a-col :md="8" :sm="8" :xxl="8">
+                            <span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
+                                <a-button type="primary" icon="search" @click="handleQueryList">查询</a-button>
+                                <a-button type="primary" @click="handleResetForm" icon="reload" style="margin-left:10px"
+                                    >重置</a-button
+                                >
+                            </span>
+                        </a-col>
+                    </a-row>
+                </a-form>
+            </div>
+            <!-- :scroll="{ x: scrollX }" -->
+            <div class="table">
+                <a-table
+                    :columns="exploreColumns"
+                    :data-source="exploreList"
+                    bordered
+                    :pagination="ipagination"
+                    :loading="loading"
+                    :scroll="{ x: changeNum }"
+                    :rowSelection="
+                        exploreHistory == '1' ? { selectedRowKeys: selectedRowKeys, onChange: onSelectChange } : null
+                    "
+                    @change="sort"
+                    rowKey="unit_id"
+                >
+                    <span slot="ocpxActionType" slot-scope="text, record">
+                        {{ text | ocpxActionType }}
+                    </span>
+                </a-table>
+            </div>
+        </div>
+        <div v-else></div>
+        <div
+            v-if="exploreHistory == '1'"
+            :style="{
+                position: 'absolute',
+                right: 0,
+                bottom: 0,
+                width: '100%',
+                borderTop: '1px solid #e9e9e9',
+                padding: '10px 16px',
+                background: '#fff',
+                textAlign: 'right',
+                zIndex: 1
+            }"
+        >
+            <a-button :style="{ marginRight: '8px' }" @click="closeDrawer">
+                取消
+            </a-button>
+            <a-button type="primary" @click="batchOpen" :disabled="selectedRowKeys.length == 0">
+                批量开启
+            </a-button>
+        </div>
+    </a-drawer>
+</template>
+
+<script>
+import moment from 'moment'
+import { getAction, postAction, downFile, downFilePost, deleteAction } from '@/api/manage'
+import qs from 'qs'
+let typeValue = '预算'
+const exploreColumns = [
+    {
+        title: '组名称',
+        dataIndex: 'unit_name',
+        key: 'unit_name',
+        align: 'center',
+        scopedSlots: { customRender: 'unit_name' },
+        width: 200,
+        fixed: 'left'
+    },
+    {
+        title: '消耗',
+        dataIndex: 'charge',
+        key: 'charge',
+        align: 'center',
+        scopedSlots: { customRender: 'charge' },
+        sorter: () => {}
+    },
+    {
+        title: '激活数',
+        dataIndex: 'activation',
+        key: 'activation',
+        align: 'center',
+        scopedSlots: { customRender: 'activation' },
+        sorter: () => {}
+    },
+    {
+        title: '激活成本',
+        dataIndex: 'activationCost',
+        key: 'activationCost',
+        align: 'center',
+        scopedSlots: { customRender: 'activationCost' },
+        sorter: () => {}
+    },
+    {
+        title: '新增付费人数',
+        dataIndex: 'eventPay',
+        key: 'eventPay',
+        align: 'center',
+        scopedSlots: { customRender: 'eventPay' },
+        sorter: () => {}
+    },
+    {
+        title: '新增付费人数成本',
+        dataIndex: 'eventPayCost',
+        key: 'eventPayCost',
+        align: 'center',
+        scopedSlots: { customRender: 'eventPayCost' },
+        sorter: () => {}
+    },
+    {
+        title: '注册数',
+        dataIndex: 'eventRegister',
+        key: 'eventRegister',
+        align: 'center',
+        scopedSlots: { customRender: 'eventRegister' },
+        sorter: () => {}
+    },
+    {
+        title: '注册成本',
+        dataIndex: 'eventRegisterCost',
+        key: 'eventRegisterCost',
+        align: 'center',
+        scopedSlots: { customRender: 'eventRegisterCost' },
+        sorter: () => {}
+    },
+    {
+        title: '曝光数',
+        dataIndex: 'aclick',
+        key: 'aclick',
+        align: 'center',
+        scopedSlots: { customRender: 'aclick' },
+        sorter: () => {}
+    }
+]
+const exploreHistoryColumns = [
+    {
+        title: '广告组ID',
+        dataIndex: 'unitId',
+        key: 'unitId',
+        align: 'center',
+        scopedSlots: { customRender: 'unitId' },
+        fixed: 'left',
+        width: 120
+    },
+    {
+        title: '组名称',
+        dataIndex: 'unitName',
+        key: 'unitName',
+        align: 'center',
+        scopedSlots: { customRender: 'unitName' },
+        fixed: 'left',
+        width: 200
+    },
+    {
+        title: '总消耗',
+        dataIndex: 'totalCharge',
+        key: 'totalCharge',
+        align: 'center',
+        scopedSlots: { customRender: 'totalCharge' },
+        fixed: 'left',
+        width: 100
+    },
+    {
+        title: '探索预算',
+        dataIndex: 'exploreBudget',
+        key: 'exploreBudget',
+        align: 'center',
+        scopedSlots: { customRender: 'exploreBudget' }
+    },
+    {
+        title: '优化目标',
+        dataIndex: 'ocpxActionType',
+        key: 'ocpxActionType',
+        align: 'center',
+        scopedSlots: { customRender: 'ocpxActionType' }
+    },
+    {
+        title: '封面曝光数',
+        dataIndex: 'impression',
+        key: 'impression',
+        align: 'center',
+        scopedSlots: { customRender: 'impression' }
+    },
+    {
+        title: '素材曝光数',
+        dataIndex: 'click',
+        key: 'click',
+        align: 'center',
+        scopedSlots: { customRender: 'click' }
+    },
+    {
+        title: '封面点击数',
+        dataIndex: 'photoClick',
+        key: 'photoClick',
+        align: 'center',
+        scopedSlots: { customRender: 'photoClick' }
+    },
+    {
+        title: '转化数',
+        dataIndex: 'unifiedConversion',
+        key: 'unifiedConversion',
+        align: 'center',
+        scopedSlots: { customRender: 'unifiedConversion' }
+    },
+    {
+        title: '转化成本',
+        dataIndex: 'unitfiedConversionCost',
+        key: 'unitfiedConversionCost',
+        align: 'center',
+        scopedSlots: { customRender: 'unitfiedConversionCost' }
+    },
+    {
+        title: '状态',
+        dataIndex: 'exploreStatus',
+        key: 'exploreStatus',
+        align: 'center',
+        customRender: function(text) {
+            if (text == 0) {
+                return '默认'
+            } else if (text == 1) {
+                return '加速探索'
+            } else if (text == 2) {
+                return '加速探索手动暂停'
+            } else if (text == 3) {
+                return '探索金额完成'
+            } else if (text == 4) {
+                return '时间到达截止时间'
+            }
+        }
+    }
+]
+export default {
+    name: 'strategy-list',
+    components: {},
+    props: {
+        exploreVisible: {
+            type: Boolean,
+            default() {
+                return false
+            }
+        },
+        exploreKey: {
+            type: String,
+            default() {
+                return '1'
+            }
+        }
+    },
+    // mixins: [JeecgListMixin],
+    data() {
+        return {
+            accountId: '',
+            exploreHistory: '1',
+            nowBudget: 0,
+            changeNum: 1500,
+            target: 'charge',
+            order: 'descend',
+            exploreList: [],
+            exploreDudget: null,
+            loading: false,
+            exploreColumns: [...exploreColumns],
+            selectedRowKeys: [],
+            selectedRows: [],
+            form: this.$form.createForm(this),
+            formSearch: this.$form.createForm(this),
+            exploreUrl: '/explore/todaylist',
+            ipagination: {
+                current: 1,
+                pageSize: 10,
+                //   pageSizeOptions: ['10', '20', '30'],
+                showTotal: (total, range) => {
+                    return range[0] + '-' + range[1] + ' 共' + total + '条'
+                },
+                showQuickJumper: true,
+                showSizeChanger: true,
+                pageSizeOptions: ['10', '30', '50'],
+                total: 0,
+                onChange: (current, pageSize) => {
+                    // 切换分页时的回调,
+                    // 当在页面定义change事件时,切记要把此处的事件清除,因为这两个事件重叠了,可能到时候会导致一些莫名的bug
+                    this.ipagination.current = current
+                    this.ipagination.pageSize = pageSize
+                }
+            }
+        }
+    },
+
+    methods: {
+        closeDrawer() {
+            this.exploreList = []
+            this.selectedRowKeys = []
+            this.exploreKey = '1'
+            this.exploreHistory = '1'
+            this.exploreUrl = '/explore/todaylist'
+            this.exploreColumns = [...exploreColumns]
+            this.form.resetFields()
+            this.$emit('update:exploreVisible', false)
+            this.$emit('update:exploreKey', '1')
+            this.$emit('update:accountId', '')
+        },
+        allOpen() {
+            this.form.validateFields((err, values) => {
+                if (!err) {
+                    if (this.nowBudget == 0) {
+                    } else {
+                        if (this.ipagination.total > Math.floor(this.nowBudget / values.exploreDudget)) {
+                            this.$message.error('预算不足,请重新选择广告组!')
+                            return
+                        }
+                    }
+                    let params = {}
+                    params.accountId = this.accountId
+                    params.exploreBudget = values.exploreDudget
+                    let that = this
+                    this.$confirm({
+                        title: '该操作有数倍超预算风险,你还要继续吗?',
+                        onOk() {
+                            that.postDataAction('/explore/openBudgets', params).then(res => {
+                                if (res.success) {
+                                    that.closeDrawer()
+                                    that.$message.success(res.result)
+                                } else {
+                                }
+                            })
+                        },
+                        onCancel() {}
+                    })
+                }
+            })
+        },
+        batchOpen() {
+            this.form.validateFields((err, values) => {
+                if (!err) {
+                    if (this.selectedRowKeys.length == 0) {
+                        this.$message.error('请选择广告组')
+                        return
+                    }
+                    if (this.nowBudget == 0) {
+                    } else {
+                        if (this.selectedRowKeys.length > Math.floor(this.nowBudget / values.exploreDudget)) {
+                            this.$message.error('预算不足,请重新选择广告组!')
+                            return
+                        }
+                    }
+                    let params = {}
+                    params.accountId = this.accountId
+                    params.unitIds = this.selectedRowKeys
+                    params.exploreBudget = values.exploreDudget
+                    let that = this
+                    this.$confirm({
+                        title: '该操作有数倍超预算风险,你还要继续吗?',
+                        onOk() {
+                            that.postDataAction('/explore/openBudgets', params).then(res => {
+                                if (res.success) {
+                                    that.closeDrawer()
+                                    that.$message.success(res.result)
+                                } else {
+                                }
+                            })
+                        },
+                        onCancel() {}
+                    })
+                }
+            })
+        },
+        onSelectChange(selectedRowKeys, selectionRows) {
+            this.selectedRowKeys = selectedRowKeys
+            this.selectionRows = selectionRows
+        },
+        sort(pagination, filters, sorter, { currentDataSource }) {
+            this.ipagination.current = pagination.current
+            this.ipagination.pageSize = pagination.pageSize
+
+            if (sorter.order) {
+                this.order = sorter.order ? sorter.order : 'descend'
+                this.target = sorter.columnKey
+                this.getData(this.accountId, {
+                    target: sorter.columnKey,
+                    order: sorter.order ? sorter.order : 'descend'
+                })
+            } else {
+                if (this.exploreHistory == '2') {
+                    const paramsData = this.formSearch.getFieldsValue()
+                    this.getData(this.accountId, paramsData)
+                } else {
+                    this.getData(this.accountId, null)
+                }
+            }
+        },
+        checkTab(key) {
+            if (key == '1') {
+                this.exploreUrl = '/explore/todaylist'
+                this.changeNum = 1500
+                this.exploreColumns = [...exploreColumns]
+                this.getData(this.accountId, null)
+            } else if (key == '2') {
+                this.exploreUrl = '/explore/historyList'
+                this.cancel()
+                this.ipagination.current = 1
+                this.exploreColumns = [...exploreHistoryColumns]
+                const paramsData = this.formSearch.getFieldsValue()
+                this.getData(this.accountId, paramsData)
+            }
+        },
+        handleQueryList() {
+            this.ipagination.current = 1
+            const paramsData = this.formSearch.getFieldsValue()
+            this.getData(this.accountId, paramsData)
+        },
+        handleResetForm() {
+            this.ipagination.current = 1
+            this.formSearch.resetFields()
+            const paramsData = this.formSearch.getFieldsValue()
+            this.getData(this.accountId, paramsData)
+        },
+        getData(accountId, data) {
+            this.exploreList = []
+            this.loading = true
+            this.accountId = accountId
+            let params = {}
+            params.accountId = accountId
+            params.pageSize = this.ipagination.pageSize
+            params.pageNo = this.ipagination.current
+            if (data && data.target) {
+                params.sortCode = data.target
+                if (data.order == 'descend') {
+                    params.sortType = 'DESC'
+                } else {
+                    params.sortType = 'ASC'
+                }
+            } else {
+                if (this.exploreHistory == '2') {
+                    params.unitId = data.unitId ? data.unitId : null
+                    params.unitName = data.unitName ? data.unitName : null
+                    params.exploreStatus = data.exploreStatus == 'null' ? null : data.exploreStatus
+                    switch (data.timeRange) {
+                        case 'today':
+                            params.startTime = moment().format('YYYY-MM-DD')
+                            params.endTime = moment().format('YYYY-MM-DD')
+                            break
+                        case 'yesterday':
+                            params.startTime = moment()
+                                .subtract(1, 'days')
+                                .format('YYYY-MM-DD')
+                            params.endTime = moment()
+                                .subtract(1, 'days')
+                                .format('YYYY-MM-DD')
+                            break
+                        case 'lastWeek':
+                            params.startTime = moment()
+                                .subtract(6, 'days')
+                                .format('YYYY-MM-DD')
+                            params.endTime = moment().format('YYYY-MM-DD')
+                            break
+                        case 'lastMonth':
+                            params.startTime = moment()
+                                .subtract(1, 'months')
+                                .format('YYYY-MM-DD')
+                            params.endTime = moment().format('YYYY-MM-DD')
+                            break
+                        default:
+                            params.startTime = moment()
+                                .subtract(6, 'days')
+                                .format('YYYY-MM-DD')
+                            params.endTime = moment().format('YYYY-MM-DD')
+                            break
+                    }
+                } else {
+                    params.sortCode = this.target
+                    params.sortType = this.order == 'descend' ? 'DESC' : 'ASC'
+                }
+            }
+            this.postDataAction(this.exploreUrl, params)
+                .then(res => {
+                    this.loading = false
+                    if (res.success) {
+                        this.nowBudget = res.result.dayBudget ? res.result.dayBudget : 0
+                        this.exploreList = res.result.pageInfo.list
+                        this.ipagination.total = res.result.pageInfo.total
+                    }
+                })
+                .catch(err => {
+                    // 3、调用取消 注意:要写在catch回调函数里
+                })
+        },
+        getFormData(className) {
+            return this.form.getFieldValue(className)
+        }
+    },
+    mounted() {},
+
+    filters: {}
+}
+</script>

+ 73 - 61
src/views/modules/autoLaunch/configLaunchList.vue

@@ -1,3 +1,8 @@
+<style scoped lang="scss">
+    /deep/ .ant-drawer-header{
+        border-bottom: 0px;
+    }
+</style>
 <template>
     <div class="toutiaoBatch">
         
@@ -9,7 +14,7 @@
         
         <div class="topOptions">
             <div >
-                <Treeselect :appId.sync="accountId" :multiple="false"  request="2,4"   ref="treeSelect" style="margin-bottom:8px;width:600px " />               
+                <Treeselect :appId.sync="accountId" :multiple="false"  request="2,4"   ref="treeSelect" style="margin-bottom:8px;width:600px " />          
             </div>
             <span class="optionBtn">
                 <a-button type='primary' @click="search" class="searchBtn">查询</a-button>
@@ -29,7 +34,6 @@
                     :pagination="ipagination"
                     :loading="loading"
                     @change="sort"
-                    :scroll="{'x':scrollX}"
                     
                 >
                     <span slot="status" slot-scope="text,record">
@@ -85,22 +89,8 @@
                     <span slot="operator" slot-scope="text,record">
                         <a href="javascript:;"  @click="goPlanList(record)">编辑</a>
                         <a-divider type="vertical" />
-                        <a href="javascript:;"  @click="deleteRecord(record)">删除</a>
-                        <a-divider type="vertical" />
-                        <a-popover v-model="record.show" trigger="click" placement="topRight" @visibleChange='visibleChange'>
-                            <div slot="content">
-                                    <span style='font-weight:700;margin-right:15px;font-size:15px'>修改后重提</span>
-                                    <a-radio-group v-model="examineAgainType" >
-                                        <a-radio :value="1">修改广告语</a-radio>
-                                        <a-radio :value="0">修改封面</a-radio>
-                                    </a-radio-group>
-                                    <a-button type='default' @click="examineAgainCancel(record)" size='small' style='margin-right:10px'>取消</a-button>
-                                    <a-button type='primary' @click="examineAgainOk(record)" size='small'  class="ok">重提</a-button>
-                            </div>
-                            <a href="javascript:;"  type='primary' @click="()=>{record.show=true}">一键重提</a>
-                            
-                        </a-popover>
-                        <a-divider type="vertical" />
+                        <!-- <a href="javascript:;"  @click="deleteRecord(record)">删除</a>
+                        <a-divider type="vertical" /> -->
                         <a-popover v-model="record.visible" trigger="click" placement="topLeft" @visibleChange='visibleChange'>
                             <span slot="title">出价</span>
                             <template  slot="content" style="width:300px;">
@@ -117,44 +107,53 @@
                             </template>
                             <a href="javascript:;"  type='primary' @click="()=>{record.visible=true}">修改出价</a>
                         </a-popover>
+                        
+                        <!-- <a-divider type="vertical" />
+                        -->
+                        <a-divider type="vertical" />
+                        
+                        <a-dropdown>
+                            <a class="ant-dropdown-link" @click="e => e.preventDefault()">
+                                更多
+                            </a>
+                            <a-menu slot="overlay">
+                                <a-menu-item>
+                                    <a  @click="goExplore(record)">加速探索</a>
+                                </a-menu-item>
+                                <a-menu-item>
+                                    <a-popover v-model="record.show" trigger="click" placement="topRight" @visibleChange='visibleChange'>
+                                        <div slot="content">
+                                                <span style='font-weight:700;margin-right:15px;font-size:15px'>修改后重提</span>
+                                                <a-radio-group v-model="examineAgainType" >
+                                                    <a-radio :value="1">修改广告语</a-radio>
+                                                    <a-radio :value="0">修改封面</a-radio>
+                                                </a-radio-group>
+                                                <a-button type='default' @click="examineAgainCancel(record)" size='small' style='margin-right:10px'>取消</a-button>
+                                                <a-button type='primary' @click="examineAgainOk(record)" size='small'  class="ok">重提</a-button>
+                                        </div>
+                                        <a href="javascript:;"  type='primary' @click="()=>{record.show=true}">一键重提</a>
+                                        
+                                    </a-popover>
+                                </a-menu-item>
+                                <a-menu-item>
+                                    <a href="javascript:;"  @click="deleteRecord(record)">删除</a>
+                                </a-menu-item>
+                            </a-menu>
+                        </a-dropdown>
                     </span>
+                    <!-- <span slot="action" slot-scope="text,record">
+                        <a  @click="goExplore(record)">加速探索</a>
+                    </span> -->
+                    
 
                 </a-table>
             </div>
         </div>
-        
-       <!-- 加速坍缩 -->
-        <!-- <a-modal v-model="targetVisible" title="加速探索" @ok="targethandleOk">
-            <div class="linkBody">
-                <a-row>
-                    <a-col :span="4">
-                        <p style="text-align:right">加速探索预算:</p>
-                    </a-col>
-                    <a-col :span="18">
-                        <a-input-number :min="100"  :step="0.01"  />
-                    </a-col>
-                </a-row>
-                <p></p>
-                <a-row>
-                    <a-col :span="4">
-                        <p style="text-align:right">最多探索量:
-                            <a-tooltip>
-                                <template slot="title">
-                                该广告账户中加速探索的广告组数量的最大值
-                                </template>
-                                <a-icon type="question-circle" />
-                            </a-tooltip>
-                        </p>
-                    </a-col>
-                    <a-col :span="18">
-                        <a-input-number :min="1" :max="10" :step="1"  />
-                    </a-col>
-                </a-row>
-                
-            </div>
-        </a-modal> -->
-              
-    <!-- </a-spin> -->
+        <configLaunchExploreDrawer 
+        :exploreVisible.sync="exploreVisible" 
+        :exploreKey.sync="exploreKey" 
+        ref="exploreDrawer" />
+       
     </div>
 </template>
 
@@ -164,6 +163,7 @@ import { getAction, postAction, downFile, downFilePost,deleteAction } from '@/ap
 // import { JeecgListMixin } from '@/mixins/ipagination'
 // import editableCell from './editableCell'
 import Treeselect from '@/views/modules/Statistics/components/Treeselect.vue'
+import configLaunchExploreDrawer from './components/configLaunchExploreDrawer.vue'
 import qs from 'qs'
 let typeValue='预算'
 
@@ -177,7 +177,6 @@ const strategyColumns = [
     align: 'center',
     scopedSlots: { customRender: 'status' },
     width:110,
-    
   },
    {
     title: '所属账户名称',
@@ -185,7 +184,7 @@ const strategyColumns = [
     key: 'authName',
     align: 'center',
     scopedSlots: { customRender: 'authName' }, 
-    width:300  
+    width:200,
   },
   {
     title: '所属账户ID',
@@ -238,9 +237,17 @@ const strategyColumns = [
     key: 'operator',
     align: 'center',
     scopedSlots: { customRender: 'operator' },
-    width:350,
-   
   },
+//   {
+//     title: '探索工具',
+//     dataIndex: 'action',
+//     key: 'action',
+//     align: 'center',
+//     scopedSlots: { customRender: 'action' },
+//     fixed:'right',
+//     width:150,
+   
+//   },
 
 ];
 
@@ -253,10 +260,14 @@ export default {
     components: {
         // editableCell,
         Treeselect,
+        configLaunchExploreDrawer
     },
     // mixins: [JeecgListMixin],
     data() {
         return {
+            exploreAccountId:"",
+            exploreVisible:false,
+            exploreKey:'',
             targetVisible:false,
             selectedRecord:{},
             bidErrorMessage:'',
@@ -268,8 +279,7 @@ export default {
             strategyState:undefined,
             strategyName:'',
             strategyId:undefined,
-            accountId:[],
-            scrollX:0,
+            scrollX:1400,
             ipagination: {
                 current: 1,
                 pageSize: 10,
@@ -322,6 +332,12 @@ export default {
         },
     },
     methods: {
+        goExplore(item) {
+            this.exploreVisible = true
+            this.exploreKey = '1'
+            this.exploreAccountId = item.accountId
+            this.$refs.exploreDrawer.getData(item.accountId)
+        },
         //状态改变
         switchChange(text,record){
             // this.spinning=true;
@@ -631,10 +647,6 @@ export default {
 
     }
     
-    .ant-tooltip-inner,.ant-tooltip-arrow::before{
-        background-color: #fff;
-        color: #333;
-    }
     #batchModal{
         .rules,.totalPrice{
             font-weight: 600;

+ 1 - 1
src/views/modules/earlyWarningRules/accountClear/createClear.vue

@@ -211,7 +211,7 @@ li.chouzhen.first:before {
                                 <a-col :span="16">
                                     <a-form-item label="模板名称">
                                         <a-input
-                                            :disabled="$route.query.id"
+                                            :disabled="$route.query.preview == 'true'"
                                             v-decorator="[
                                                 'templateName',
                                                 {

+ 274 - 108
src/views/modules/earlyWarningRules/configRules.vue

@@ -21,7 +21,7 @@
                         </div>
                         <div class="input-item"> 
                              <a-form-model-item ref="eventRuleLevel"  prop="eventRuleLevel">
-                                <a-radio-group v-model="form.mediaType" :disabled="form.templateId!=null" @change="mediaTypeChange">
+                                <a-radio-group v-model="form.mediaType" :disabled="form.templateId!=null" @change="mediaTypeAllChange">
                                     <a-radio-button :value="3" >头条</a-radio-button>
                                     <a-radio-button :value="2">快手</a-radio-button>
                                     <!-- <a-radio-button :value="3">头条内广</a-radio-button>
@@ -118,10 +118,24 @@
                                             </a-form-model-item>   
                                         </div>
                                     </div>
-                                    
                                     <div class="row-item" >
                                         <div class="hint-item"></div>
                                         <div class="label-item">
+                                            <div class="text-item">执行操作</div>
+                                            <div class="required-item"></div>
+                                        </div>
+                                        <div class="input-item"> 
+                                             <a-form-model-item>
+                                                <a-radio-group v-model="item.operation"  @change="mediaTypeChange($event,item)">
+                                                    <a-radio-button :value="1">开启</a-radio-button>
+                                                    <a-radio-button :value="0">关闭</a-radio-button>
+                                                </a-radio-group>
+                                            </a-form-model-item>  
+                                        </div>
+                                    </div>
+                                    <div class="row-item" v-if="item.operation == 0">
+                                        <div class="hint-item"></div>
+                                        <div class="label-item">
                                             <div class="text-item">规则类型</div>
                                             <div class="required-item"></div>
                                         </div>
@@ -134,7 +148,7 @@
                                             </a-form-model-item>  
                                         </div>
                                     </div>
-                                    <div class="row-item" >
+                                    <div class="row-item"  v-if="item.operation == 0">
                                         <div class="hint-item"></div>
                                         <div class="label-item">
                                             <div class="text-item">规则必填</div>
@@ -142,14 +156,14 @@
                                         </div>
                                         <div class="input-item"> 
                                              <a-form-model-item ref="isRequired"  prop="isRequired">
-                                                <a-radio-group v-model="item.isRequired" >
+                                                <a-radio-group v-model="item.isRequired" @change="">
                                                     <a-radio-button :value="1">是</a-radio-button>
                                                     <a-radio-button :value="0">否</a-radio-button>
                                                 </a-radio-group>
                                             </a-form-model-item>  
                                         </div>
                                     </div>
-                                    <div class="row-item" v-if="item.ruleType=='group'">
+                                    <div class="row-item" v-if="item.ruleType=='group'&& item.operation == 0">
                                         <div class="hint-item"></div>
                                         <div class="label-item">
                                             <div class="text-item">规则复建</div>
@@ -157,7 +171,7 @@
                                         </div>
                                         <div class="input-item"> 
                                              <a-form-model-item ref="isCopy"  prop="isCopy">
-                                                <a-radio-group v-model="item.isCopy" >
+                                                <a-radio-group v-model="item.isCopy">
                                                     <a-radio-button :value="1">是</a-radio-button>
                                                     <a-radio-button :value="0">否</a-radio-button>
                                                 </a-radio-group>
@@ -167,10 +181,10 @@
                                     <div class="toolbox-automate-rules-create-content_rules-and-condition_rules">
                                         <div class="title">                                            
                                             <a-form-model-item ref="ruleRelationship"  prop="ruleRelationship">
-                                                <span class="condition-title">如果</span>
+                                                <span class="condition-title">{{item.operation==1?'触发机制':'如果'}}</span>
                                                 <a-select  style="width: 300px" v-model="item.ruleRelationship" :disabled="!!item.groupId">
                                                     <a-select-option  value='and'>满足以下所有条件</a-select-option>
-                                                    <a-select-option  value='or'>满足以下任意条件</a-select-option>
+                                                    <!-- <a-select-option  value='or'>满足以下任意条件</a-select-option> -->
                                                 </a-select>
 
                                             </a-form-model-item>                                
@@ -186,10 +200,10 @@
                                                             ]">
                                                                 <a-cascader
                                                                     v-model="ele.baseIndex"
-                                                                    :options="rulesFieldList"
+                                                                    :options="item.rulesFieldList"
                                                                     placeholder="选择指标"
-                                                                    @change="baseIndexChange(ele)"
-                                                                    expand-trigger="hover"
+                                                                    @change="baseIndexChange(ele,item)"
+                                                                    expand-trigger="click"
                                                                     :disabled="!!ele.ruleId"
                                                                     :fieldNames="{ label:'name', value: 'code',children: 'children'}"
                                                                 />
@@ -208,9 +222,32 @@
                                                             </a-form-model-item>  
 
                                                         </div>
-                                                        
                                                         <div class="rules-list-item-subject" >
                                                             <a-form-model-item ref="variableType"  prop="variableType">
+                                                                <a-select   default-value="0"  :disabled="!!ele.ruleId">
+                                                                    <a-select-option  value='0'>当天数据</a-select-option>
+                                                                    <!-- <a-select-option  :value='1'>变量</a-select-option> -->
+                                                                </a-select>
+                                                            </a-form-model-item>                                                             
+                                                        </div>
+                                                        <div class="rules-list-item-subject" v-if="item.operation==1&&ele.baseIndex&&(ele.baseIndex[ele.baseIndex.length-1]=='cost'||ele.baseIndex[ele.baseIndex.length-1]=='charge')">
+                                                            <a-form-model-item ref="variableType"  prop="variableType">
+                                                                <a-select   v-model="ele.cindicatorCode" :disabled="!!ele.ruleId">
+                                                                    <a-select-option  value='charge'>金额</a-select-option>
+                                                                    <a-select-option  value='dayBudget'>预算</a-select-option>
+                                                                </a-select>
+                                                            </a-form-model-item>                                                             
+                                                        </div>
+                                                        <div class="rules-list-item-subject" v-if="item.operation==1&&ele.baseIndex&&ele.baseIndex[ele.baseIndex.length-1]=='convertCost'">
+                                                            <a-form-model-item ref="variableType"  prop="variableType">
+                                                                <a-select   v-model="ele.cindicatorCode" :disabled="!!ele.ruleId">
+                                                                    <a-select-option  value='bid'>出价</a-select-option>
+                                                                    <a-select-option  value='cost'>成本</a-select-option>
+                                                                </a-select>
+                                                            </a-form-model-item>                                                             
+                                                        </div>
+                                                        <!-- <div class="rules-list-item-subject" >
+                                                            <a-form-model-item ref="variableType"  prop="variableType">
                                                                 <a-select   v-model="ele.variableType" :disabled="!!ele.ruleId">
                                                                     <a-select-option  :value='0'>常量</a-select-option>
                                                                     <a-select-option  :value='1'>变量</a-select-option>
@@ -226,11 +263,6 @@
                                                             </a-form-model-item>                                                             
                                                         </div>
 
-
-                                                        <!-- <div class="rules-list-item-subject" v-if="ele.dataType=='number'">
-                                                            <a-input-number :min="0" style="width:100%" :max="9999999.99" :step="1" v-model="ele.threshold" placeholder="请输入" :disabled="!!ele.ruleId" />
-                                                            <span style="margin-left:8px;line-height:32px">{{ele.dataUnit }}</span>
-                                                        </div> -->
                                                         <div class="rules-list-item-subject" >
                                                             <a-form-model-item ref="isUnlimited"  prop="isUnlimited">
                                                                 <a-select   v-model="ele.isUnlimited" placeholder="是否必填" :disabled="!!ele.ruleId">
@@ -238,7 +270,7 @@
                                                                     <a-select-option  :value='0'>不必填</a-select-option>
                                                                 </a-select>
                                                             </a-form-model-item>                                                             
-                                                        </div>
+                                                        </div> -->
                                                        
                                                         </template>
                                                         <div class="rules-list-item-delete" @click="deleteRulesListItem(index,ind)" v-if="ind!=0">
@@ -248,14 +280,14 @@
                                                     
                                             </div>
                                                
-                                            <div class="add-rule" @click="addCondition(item,index)" v-show="item.ruleType=='group'"> 添加条件</div>
+                                            <div class="add-rule" @click="addCondition(item,index)" v-if="!!!item.ruleDetail[0].ruleId" v-show="item.ruleType=='group'||item.operation==1"> 添加条件</div>
                                         </div>
                                     </div>
                                     <div class="toolbox-automate-rules-create-content_rules-and-condition_rules">
                                         <div class="title">
                                             <span class="condition-title">则依次执行以下操作</span>
                                         </div>
-                                        <div class="content">
+                                        <div class="content"  v-if="item.operation==0">
                                                 <div class="rules-list">                                        
                                                     <div class="rules-list-item">
                                                         <div class="rules-list-item-subject" >
@@ -281,6 +313,40 @@
                                                 </div>
                                             
                                         </div>
+                                        <div class="content" v-else>
+                                                <div class="rules-list">                                        
+                                                    <div class="rules-list-item">
+                                                        <div class="rules-list-item-subject" >
+                                                            <a-form-model-item ref="processMethod"  prop="processMethod">
+                                                                <a-select   v-model="item.operate" :disabled="!!item.groupId">
+                                                                    <a-select-option  value='BUDGET'>修改预算</a-select-option>
+                                                                    <a-select-option  value='BID' >出价</a-select-option>
+                                                                    <a-select-option  value='TIME' >投放时间</a-select-option>
+                                                                    
+                                                                </a-select>
+                                                            </a-form-model-item>
+                                                        </div>
+                                                        <div class="rules-list-item-subject" v-if="item.operate!='TIME'">
+                                                            <a-form-model-item ref="processMethod"  prop="processMethod">
+                                                                <a-select   v-model="item.operationType" :disabled="!!item.groupId">
+                                                                    <a-select-option  value='up'>提高</a-select-option>
+                                                                    <a-select-option  value='down'>降低</a-select-option>
+                                                                    <a-select-option  value='to'>调整至</a-select-option>
+                                                                </a-select>
+                                                            </a-form-model-item>
+                                                        </div>
+                                                        <div class="rules-list-item-subject" v-if="item.operate!='TIME'">
+                                                            <a-form-model-item ref="processMethod"  prop="processMethod">
+                                                                <a-select   v-model="item.operationValue" :disabled="!!item.groupId">
+                                                                    <a-select-option  value='price'>金额</a-select-option>
+                                                                    <a-select-option  value='percent'>百分比</a-select-option>
+                                                                </a-select>
+                                                            </a-form-model-item>
+                                                        </div>
+                                                    </div>
+                                                </div>
+                                            
+                                        </div>
                                     </div>
                                 </a-collapse-panel>
                                 </template>
@@ -351,13 +417,16 @@ export default {
                         groupName:'默认规则',
                         ruleRelationship:"and",
                         ruleType:'base',
+                        operation:1,
                         remark:'',
                         isRequired:1,
                         isCopy:0,
+                        rulesFieldList:[],
                         ruleDetail:[
                             {
                                 ruleName:'',
                                 baseIndex:[],
+                                
                                 indicatorCode:undefined,
                                 ruleDimension:'',
                                 dataRange:'CURRENT_DAY_DATA',
@@ -369,10 +438,13 @@ export default {
                                 dataType:'',
                                 judgeFormat:0,
                                 isUnlimited:1,
+                                cindicatorCode:'charge'
                             },
                         ],
-                        operate:'SEND',//预警方式
+                        operate:'BUDGET',//预警方式
                         sendType:'Wechat',//通知方式
+                        operationType:'up',
+                        operationValue:'price'
                     },
                    
                 ],
@@ -396,7 +468,6 @@ export default {
     },
     watch: {
         'form.templateName':function(n,o){
-            console.log(n,o)
             if(n!=o){
                 this.templateNameTrue = true
             }else{
@@ -428,7 +499,6 @@ export default {
     },
     methods: {
         blurTemplateName(){
-            console.log(this.form)
             if(this.currentRuleId){
                 if(this.templateNameTrue){
                     if(this.form.templateName!=''){
@@ -463,17 +533,14 @@ export default {
             
         },
         ruleTypeChange(item){
-            console.log(item)
             if(item.ruleType=='base'){
                 item.isCopy=0;
                 item.ruleDetail=item.ruleDetail.filter((item,index)=>{
                     return index==0
                 })
             }
-            console.log(item)
         },
         inputCheck(val){
-            console.log(val)
         },
 
 
@@ -488,12 +555,11 @@ export default {
             
         },
 
-        baseIndexChange(ele) {
-            console.log(ele,'========================执行了');         
+        baseIndexChange(ele,item) {     
             ele.indicatorCode=ele.baseIndex[1];
             ele.ruleDimension=ele.baseIndex[0];
 
-            this.rulesFieldList.forEach(element => {
+            item.rulesFieldList.forEach(element => {
                 if(element.code==ele.baseIndex[0]){
                     element.children.forEach(item=>{
                         if(item.code==ele.baseIndex[1]){
@@ -504,8 +570,13 @@ export default {
                             if(item.dataType!='number'){
                                 ele.threshold=''
                             }
+                            if(ele.baseIndex[1] == 'cost'||ele.baseIndex[1] == 'charge'){
+                                ele.cindicatorCode = 'charge'
+                            }else{
+                                ele.cindicatorCode = 'bid'
+                            }
                             getAction(this.url.ruleCondition,{
-                                dataType:item.dataType
+                                dataType:item.conditionType
                             }).then(res=>{
                                 // console.log(res);
                                 ele.conditionList=[];
@@ -530,9 +601,7 @@ export default {
         onSubmit() {
             this.$refs.ruleForm.validate(valid => {
                 if (valid) {
-                    console.log('submit!',valid);
-                } else {s
-                    console.log('error submit!!');
+                } else {
                     return false;
                 }
             });
@@ -557,25 +626,30 @@ export default {
                     conditionList:[],     
                     dataType:'',  
                     judgeFormat:0,
-                    isUnlimited:1,               
+                    isUnlimited:1,      
+                    cindicatorCode:'charge'         
                 })
             }
             
         },
         collapseChange(key){
-            console.log(key)
         },
         addRule(){
+
             this.form.ruleList.push(
                 {
                     groupName:'默认规则',
                     ruleRelationship:"and",
                     ruleType:'base',
                     remark:'',
-                    operate:'SEND',//预警方式
+                    operate:'BUDGET',//预警方式
                     sendType:'Wechat',//通知方式
+                    operationType:'up',
+                    operationValue:'price',
                     isRequired:1,
+                    operation:1,
                     isCopy:0,
+                    rulesFieldList:[],
                     ruleDetail:[
                         {
                             ruleName:'',
@@ -590,19 +664,18 @@ export default {
                             conditionList:[],   
                             dataType:'', 
                             judgeFormat:0,
-                            isUnlimited:1,                     
+                            isUnlimited:1,   
+                            cindicatorCode:'charge'                  
                         },
                     ]
                 },
             )
-            console.log(this.$refs.collapse)
-            
+            this.getMediaTypeRuleField(1,this.form.ruleList[this.form.ruleList.length-1])
             this.activeKey=(this.form.ruleList.length-1)+'';
            
             
         },
         deleteRulesListItem(index,ind){
-            console.log(index,ind)
             this.form.ruleList[index].ruleDetail=this.form.ruleList[index].ruleDetail.filter((ele,i)=>{
                 return i!=ind
             })
@@ -613,12 +686,10 @@ export default {
         },
         deleteRule(event,item,index){
             event.stopPropagation();
-            console.log(item,index)
             if(item.groupId){
                 deleteAction(this.url.ruleGroupDelete,{
                     id:item.groupId
                 }).then(res=>{
-                    console.log(res);
                     if(res.success){
                         this.$message.success(res.message);
                         this.form.ruleList=this.form.ruleList.filter((ele,ind)=>{
@@ -641,7 +712,6 @@ export default {
             return labels[labels.length - 1];
         },
         ruleConditionChange(item){
-            console.log(item)
             if(item.metricValueName[1]=='COST'){
                 item.judgeType='MONEY';
             }else{
@@ -661,7 +731,6 @@ export default {
              this.$refs.ruleForm.validate(valid=> {
                 if (valid) {
                     // this.form.rulesList=this.rulesList;
-                    console.log(valid,this.form);
                     
                     this.saveLoading=true;
 
@@ -670,13 +739,18 @@ export default {
                                 let ruleList=this.form.ruleList.filter(item=>{
                                     return !item.groupId
                                 })
-                                console.log(ruleList)
                                 if(ruleList.length>0){
+                                    ruleList = ruleList.map(item=>{
+                                        return {
+                                            ...item,
+                                            ruleType:item.ruleDetail.length>1?'group':'base'
+
+                                        }
+                                    })
                                     postAction(this.url.createRuleGroup,{
                                         templateId:this.currentRuleId,
                                         ruleList
                                     }).then(res=>{
-                                        console.log(res);
                                         this.saveLoading=false;
                                         if(res.success){
                                             
@@ -698,8 +772,13 @@ export default {
                             
                             
                         }else{
+                            this.form.ruleList = this.form.ruleList.map(item=>{
+                                return {
+                                    ...item,
+                                    ruleType:item.ruleDetail.length>1?'group':'base'
+                                }
+                            })
                             postAction(this.url.creativeTemplate,this.form).then(res=>{
-                                console.log(res);
                                 this.saveLoading=false;
                                 if(res.success){
                                     this.$router.push('/earlyWarningRules/index')
@@ -715,7 +794,6 @@ export default {
                     
                     
                 } else {
-                    console.log('error submit!!');
                     this.$message.error('请按提示填写必填项目!')
                     return false;
                 }
@@ -742,49 +820,63 @@ export default {
                 getAction(this.url.queryDetailById,{
                     id:this.$route.query.id
                 }).then(res=>{
-                    console.log(res);
                     // this.spinning=false;
                     if(res.success){
+                       
                         // this.spinning=false;
                         new Promise((resolve,reject)=>{
-                             getAction(this.url.fieldList,{   
-                                mediaType:res.result.mediaType,
-                                pageNo:1,
-                                pageSize:500,
-                            }).then(result=>{
-                                console.log(result);
-                                if(result.success){ 
-                                    this.rulesFieldList=result.result.map(item=>{
-                                        return {
-                                            name:item.dimensionName,
-                                            code:item.dimension,
-                                            children:item.dimensionList
-                                        }
-                                    }) 
-                                    resolve('success')
-                                }            
-                            })
+                            // this.getMediaTypeRuleField(1,this.form.ruleList[0])
+                            //  getAction(this.url.fieldList,{   
+                            //     mediaType:res.result.mediaType,
+                            //     pageNo:1,
+                            //     pageSize:500,
+                            // }).then(result=>{
+                            //     console.log(result);
+                            //     if(result.success){ 
+                            //         this.rulesFieldList=result.result.map(item=>{
+                            //             return {
+                            //                 name:item.dimensionName,
+                            //                 code:item.dimension,
+                            //                 children:item.dimensionList
+                            //             }
+                            //         }) 
+                            //         resolve('success')
+                            //     }            
+                            // })
+                            this.form = res.result
+                            this.form.ruleList=res.result.ruleList.map(b=>{
+                                return {
+                                    ...b,
+                                    rulesFieldList: []
+                                }
+                                
+                            });
+                            resolve('success')
                         }).then(data=>{
-                            if(res.result.ruleList){
-                                res.result.ruleList.map((item,index)=>{
+                            if(this.form.ruleList){
+                                this.form.ruleList.map((item,index)=>{
+                                    this.getMediaTypeRuleField(item.operation,item)
                                     item.ruleDetail.forEach((ele,ind)=>{
 
-                                        ele.baseIndex=[ele.ruleDimension,ele.indicatorCode];
+                                       
                                         getAction(this.url.ruleCondition,{
-                                            dataType:ele.dataType
+                                            dataType:ele.conditionType
                                         }).then(result=>{
-                                            console.log(result)
                                             if(result.success){
                                                 ele.conditionList=result.result
-                                                console.log(this.form);
-                                                this.form={};
-                                                this.form=res.result
+                                                 this.$nextTick(()=>{
+                                                    ele.baseIndex=[ele.ruleDimension,ele.indicatorCode];
+                                                    this.form.ruleList=[...this.form.ruleList]
+                                                })
+                                               
                                             }
                                         })
                                     })
                                 })
-
-                                this.form=res.result;
+                                // this.$nextTick(()=>{
+                                //     this.form.ruleList=[...this.form.ruleList]
+                                // })
+                                // this.form=res.result;
                                 this.spinning=false
                             }else{
                                 
@@ -810,29 +902,98 @@ export default {
             }
 
         },
-
-        mediaTypeChange(e){
-            console.log(e);
-            this.getMediaTypeRuleField()
+        mediaTypeAllChange(){
+            for (let i = 0; i < this.form.ruleList.length; i++) {
+                this.form.ruleList[i].operation = 1
+                this.form.ruleList[i].ruleDetail = []
+                this.form.ruleList[i].ruleDetail.push({
+                        ruleName:'',
+                        baseIndex:[],
+                        
+                        indicatorCode:undefined,
+                        ruleDimension:'',
+                        dataRange:'CURRENT_DAY_DATA',
+                        ruleCondition:undefined,                                
+                        threshold:0,
+                        variableType:1,  
+                        dataUnit:'',
+                        conditionList:[],
+                        dataType:'',
+                        judgeFormat:0,
+                        isUnlimited:1,
+                        cindicatorCode:'charge',
+                        ruleId:null
+                    })
+                this.$nextTick(()=>{
+                    this.getMediaTypeRuleField(1,this.form.ruleList[i])
+                })
+                
+            }
+        },
+        mediaTypeChange(e,item){
+           
+            if(e.target.value == 0){
+                item.operate = 'SEND'
+            }else if(e.target.value==1){
+                item.operate = 'BUDGET'
+            }
+            item.ruleDetail = []
+            item.ruleDetail.push({
+                ruleName:'',
+                baseIndex:[],
+                
+                indicatorCode:undefined,
+                ruleDimension:'',
+                dataRange:'CURRENT_DAY_DATA',
+                ruleCondition:undefined,                                
+                threshold:0,
+                variableType:1,  
+                dataUnit:'',
+                conditionList:[],
+                dataType:'',
+                judgeFormat:0,
+                isUnlimited:1,
+                cindicatorCode:'charge',
+                ruleId:null
+            })
+            this.$nextTick(()=>{
+                this.getMediaTypeRuleField(e.target.value,item)
+            })
+            
         },
 
-        getMediaTypeRuleField(){
+        getMediaTypeRuleField(data,itemDetail){
             this.rulesFieldList=[];
+            // console.log(itemDetail.ruleDetail)
             getAction(this.url.fieldList,{   
                 mediaType:this.form.mediaType,
+                operation:data,
                 pageNo:1,
                 pageSize:500,
             }).then(res=>{
-                console.log(res);
                 if(res.success){ 
-                    this.rulesFieldList=[];
-                    this.rulesFieldList=res.result.map(item=>{
-                        return {
-                            name:item.dimensionName,
-                            code:item.dimension,
-                            children:item.dimensionList
-                        }
-                    }) 
+                    itemDetail.rulesFieldList=[];
+                    this.$nextTick(()=>{
+                        itemDetail.ruleDetail.map(c=>{
+                            return {
+                                ...c,
+                                baseIndex:[],
+                                conditionList:[],
+                                ruleCondition:''
+
+                            }
+                        })
+                    })
+                    this.$nextTick(()=>{
+                        itemDetail.rulesFieldList=res.result.map(item=>{
+                            return {
+                                name:item.dimensionName,
+                                code:item.dimension,
+                                children:item.dimensionList
+                            }
+                        }) 
+                    })
+                   
                    
                 }            
             })
@@ -880,23 +1041,28 @@ export default {
         // this.spinning=true;
         this.currentRuleId=this.$route.query.id
         if(!this.$route.query.id){
-            getAction(this.url.fieldList,{   
-                mediaType:this.form.mediaType,
-                pageNo:1,
-                pageSize:500,
-            }).then(res=>{
-                console.log(res);
-                if(res.success){ 
-                    this.rulesFieldList=res.result.map(item=>{
-                        return {
-                            name:item.dimensionName,
-                            code:item.dimension,
-                            children:item.dimensionList
-                        }
-                    }) 
-                    this.getTempletDetail()   
-                }            
-            })
+
+            this.getMediaTypeRuleField(1,this.form.ruleList[0])
+            // getAction(this.url.fieldList,{   
+            //     mediaType:this.form.mediaType,
+            //     pageNo:1,
+            //     pageSize:500,
+            // }).then(res=>{
+            //     console.log(res);
+            //     if(res.success){ 
+
+
+
+            //         this.rulesFieldList=res.result.map(item=>{
+            //             return {
+            //                 name:item.dimensionName,
+            //                 code:item.dimension,
+            //                 children:item.dimensionList
+            //             }
+            //         }) 
+            //         this.getTempletDetail()   
+            //     }            
+            // })
         }else{
             this.getTempletDetail()   
         }
@@ -1050,7 +1216,7 @@ export default {
         margin-bottom: 24px;  
     }
     .toolbox-automate-rules-create-content_rules-and-condition_rules, .toolbox-automate-rules-create-content_rules-and-condition_condition {
-        width: 1138px;
+        width: 100%;
         background: #fff;
         border-radius: 4px;
         border: 1px solid #dadfe3;

+ 2 - 2
src/views/modules/earlyWarningRules/pushTreeSelect.vue

@@ -106,11 +106,11 @@ export default {
                     return {
                       id: i.accountId,
                       label:
-                        (i.userName.length == 2
+                        (i.userName?i.userName.length == 2
                           ? i.userName + '\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0'
                           : i.userName.length == 3
                           ? i.userName + '\xa0\xa0\xa0\xa0'
-                          : i.userName) +
+                          : i.userName:'') +
                         '\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0' +
                         i.accountId +
                         '\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0\xa0' +

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 666 - 414
src/views/modules/earlyWarningRules/ruleModule.vue


+ 1 - 1
vue.config.js

@@ -105,7 +105,7 @@ module.exports = {
         // target: 'http://192.168.1.43:8088', //请求本地 需要jeecg-boot后台项目  毕洁泉
         // target: 'http://192.168.1.43:8806', //请求本地 需要jeecg-boot后台项目  毕洁泉
         // target: 'http://192.168.0.252:8098', //请求本地 需要jeecg-boot后台项目  毕洁泉
-        // target: 'http://192.168.1.219:8081', //请求本地 需要jeecg-boot后台项目  赵西安
+        target: 'http://192.168.1.219:7701', //请求本地 需要jeecg-boot后台项目  赵西安
         // target: 'http://192.168.1.193:8080', //请求本地 需要jeecg-boot后台项目  李煜一
         // target: 'http://192.168.1.193:31012', //请求本地 需要jeecg-boot后台项目  李煜一
         target: 'http://api.tjyourong.com.cn', //请求本地 需要jeecg-boot后台项目