朱鑫波 преди 3 години
родител
ревизия
262e20b7fd
променени са 3 файла, в които са добавени 134 реда и са изтрити 42 реда
  1. 9 0
      src/filters.js
  2. 1 24
      src/views/modules/earlyWarningRules/configRules.vue
  3. 124 18
      src/views/modules/earlyWarningRules/ruleModule.vue

+ 9 - 0
src/filters.js

@@ -324,6 +324,15 @@ const filters = {
 
         return data[val]
     },
+    operationType(val) {
+        var data = {
+            up: '提高',//'等于',
+            down: '降低',//不等于,
+            to: '调整至',//大于
+        }
+
+        return data[val]
+    },
     //快手年龄
     kuaishouAge(val) {
         var data = {

+ 1 - 24
src/views/modules/earlyWarningRules/configRules.vue

@@ -468,7 +468,6 @@ export default {
     },
     watch: {
         'form.templateName':function(n,o){
-            console.log(n,o)
             if(n!=o){
                 this.templateNameTrue = true
             }else{
@@ -500,7 +499,6 @@ export default {
     },
     methods: {
         blurTemplateName(){
-            console.log(this.form)
             if(this.currentRuleId){
                 if(this.templateNameTrue){
                     if(this.form.templateName!=''){
@@ -535,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)
         },
 
 
@@ -601,9 +596,7 @@ export default {
         onSubmit() {
             this.$refs.ruleForm.validate(valid => {
                 if (valid) {
-                    console.log('submit!',valid);
-                } else {s
-                    console.log('error submit!!');
+                } else {
                     return false;
                 }
             });
@@ -635,7 +628,6 @@ export default {
             
         },
         collapseChange(key){
-            console.log(key)
         },
         addRule(){
 
@@ -673,14 +665,12 @@ export default {
                     ]
                 },
             )
-            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
             })
@@ -691,12 +681,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)=>{
@@ -719,7 +707,6 @@ export default {
             return labels[labels.length - 1];
         },
         ruleConditionChange(item){
-            console.log(item)
             if(item.metricValueName[1]=='COST'){
                 item.judgeType='MONEY';
             }else{
@@ -739,7 +726,6 @@ export default {
              this.$refs.ruleForm.validate(valid=> {
                 if (valid) {
                     // this.form.rulesList=this.rulesList;
-                    console.log(valid,this.form);
                     
                     this.saveLoading=true;
 
@@ -748,13 +734,11 @@ export default {
                                 let ruleList=this.form.ruleList.filter(item=>{
                                     return !item.groupId
                                 })
-                                console.log(ruleList)
                                 if(ruleList.length>0){
                                     postAction(this.url.createRuleGroup,{
                                         templateId:this.currentRuleId,
                                         ruleList
                                     }).then(res=>{
-                                        console.log(res);
                                         this.saveLoading=false;
                                         if(res.success){
                                             
@@ -777,7 +761,6 @@ export default {
                             
                         }else{
                             postAction(this.url.creativeTemplate,this.form).then(res=>{
-                                console.log(res);
                                 this.saveLoading=false;
                                 if(res.success){
                                     this.$router.push('/earlyWarningRules/index')
@@ -793,7 +776,6 @@ export default {
                     
                     
                 } else {
-                    console.log('error submit!!');
                     this.$message.error('请按提示填写必填项目!')
                     return false;
                 }
@@ -820,7 +802,6 @@ export default {
                 getAction(this.url.queryDetailById,{
                     id:this.$route.query.id
                 }).then(res=>{
-                    console.log(res);
                     // this.spinning=false;
                     if(res.success){
                        
@@ -863,13 +844,11 @@ export default {
                                         getAction(this.url.ruleCondition,{
                                             dataType:ele.dataType
                                         }).then(result=>{
-                                            console.log(result)
                                             if(result.success){
                                                 ele.conditionList=result.result
                                                  this.$nextTick(()=>{
                                                     ele.baseIndex=[ele.ruleDimension,ele.indicatorCode];
                                                 })
-                                                console.log(this.form);
                                                 this.form={};
                                                 this.form=res.result
                                             }
@@ -905,7 +884,6 @@ export default {
         },
 
         mediaTypeChange(e,item){
-            console.log(e,item);
            
             if(e.target.value == 0){
                 item.operate = 'SEND'
@@ -924,7 +902,6 @@ export default {
                 pageNo:1,
                 pageSize:500,
             }).then(res=>{
-                console.log(res);
                 if(res.success){ 
                     itemDetail.rulesFieldList=[];
                     this.$nextTick(()=>{

+ 124 - 18
src/views/modules/earlyWarningRules/ruleModule.vue

@@ -55,14 +55,14 @@
                       <div class="text-item">{{ item.groupName }}</div>
                       <div class="required-item" v-if="item.isRequired == 1"></div>
                     </div>
-                     <div class="input-item">
+                     <div class="input-item" style="width:70%;min-width:none">
                     
                       <div class="toolbox-automate-rules-create-content_rules-and-condition_rules" style="margin-bottom:10px">
                         <div class="content">
                           <div class="rules-list">
                             <div class="rules-list-item">
                               <template   v-for="(value, valueIndex) of item.ruleDetail">
-                                <div class="input-item" style="width:100%">
+                                <div class="input-item"   style="width:100%;min-width:none">
                                     <a-form-model-item
                                       :label-col="{ span: 4 }"
                                       :wrapper-col="{ span: 20 }"
@@ -84,13 +84,63 @@
                                       </span>
                                       {{ value.cindicatorCode | cindicatorName }}
                                       <a-input-number
+                                        v-if="value.cindicatorCode=='charge'||value.cindicatorCode=='cost'"
                                         :disabled="!editShow"
                                         style="width: 100px; margin-right: 5px"
                                         v-model="value.threshold"
                                         :min="0.01"
                                         :max="999999.99"
                                         :step="0.01"
-                                      />{{ value.dataUnit }}
+                                      />
+                                      
+                                      <a-select 
+                                        allowClear
+                                        v-else-if="value.cindicatorCode=='dayBudget'" 
+                                        v-model="value.threshold" 
+                                        style="width: 100px; margin-right: 5px"
+                                        :disabled="!editShow"
+                                      >
+                                        <a-select-option value="0.5">
+                                          0.5倍预算
+                                        </a-select-option>
+                                        <a-select-option value="0.8">
+                                          0.8倍预算
+                                        </a-select-option>
+                                        <a-select-option value="1">
+                                          1倍预算
+                                        </a-select-option>
+                                        <a-select-option value="1.2">
+                                          1.2倍预算
+                                        </a-select-option>
+                                      </a-select>
+                                      <a-select 
+                                        allowClear
+                                        v-else-if="value.cindicatorCode=='bid'" 
+                                        v-model="value.threshold" 
+                                        style="width: 100px; margin-right: 5px"
+                                        :disabled="!editShow"
+                                      >
+                                        <a-select-option value="1.2">
+                                          1.2倍出价
+                                        </a-select-option>
+                                         <a-select-option value="1.5">
+                                          1.5倍出价
+                                        </a-select-option>
+                                      </a-select>
+                                      {{ value.cindicatorCode=='charge'||value.cindicatorCode=='cost'?value.dataUnit:'' }}
+                                      <span v-if=" value.ruleCondition == 'between'" style="margin:0 15px">
+                                        ~
+                                      </span>
+                                      <a-input-number
+                                        v-if=" value.ruleCondition == 'between'"
+                                        :disabled="!editShow"
+                                        style="width: 100px; margin-right: 5px"
+                                        v-model="value.thresholdTwo"
+                                        :min="0.01"
+                                        :max="999999.99"
+                                        :step="0.01"
+                                      />
+                                      
                                       
                                       
 
@@ -108,7 +158,8 @@
                         <div class="content">
                           <div class="rules-list">
                             <div class="rules-list-item">
-                              <div class="input-item"  style="width:100%">
+                              <template>
+                              <div class="input-item"  style="width:100%!important;min-width:none">
                                   <a-form-model-item
                                     :label-col="{ span: 4 }"
                                     :wrapper-col="{ span: 20 }"
@@ -121,15 +172,64 @@
                                     }"
                                   >
                                   <!-- <div style="margin-left:20px"> -->
-                                  
+                                  <div v-if="item.operate!='TIME'">
+                                    <span style="margin:0 15px 0 0">{{item.operationType|operationType}}</span>
                                     <a-input-number
                                       :disabled="!editShow"
                                       style="width: 100px; margin-right: 5px"
                                       v-model="item.operationThreshold"
                                       :min="0.01"
-                                      :max="999999.99"
+                                      :max="item.operationValue=='price'?999999.99:99.99"
                                       :step="0.01"
                                     />
+                                    {{item.operationValue=='price'?'元':'%'}}
+                                    <div v-if="item.operationType != 'to'" style="display:inline-block">
+                                      <span style="margin:0 15px">|</span>
+                                      <span style="margin:0 15px 0 0">{{item.operationType == 'up'?'最高调整至':'最低调整至'}}</span>
+                                      <a-input-number
+                                        v-if="item.operationType == 'up'"
+                                        :disabled="!editShow"
+                                        style="width: 100px; margin-right: 5px"
+                                        v-model="item.maxValue"
+                                        :min="0.01"
+                                        :max="9999.99"
+                                        :step="0.01"
+                                      />
+                                      <a-input-number
+                                        v-else-if="item.operationType == 'down'"
+                                        :disabled="!editShow"
+                                        style="width: 100px; margin-right: 5px"
+                                        v-model="item.minValue"
+                                        :min="0.01"
+                                        :max="9999.99"
+                                        :step="0.01"
+                                      />
+                                    </div>
+                                  </div>
+                                  <a-select 
+                                    allowClear
+                                    v-else
+                                    v-model="item.operationThreshold" 
+                                    style="width: 100px; margin-right: 5px"
+                                    :disabled="!editShow"
+                                  >
+                                    <a-select-option value="1">
+                                      1
+                                    </a-select-option>
+                                    <a-select-option value="2">
+                                      2
+                                    </a-select-option>
+                                    <a-select-option value="3">
+                                      3
+                                    </a-select-option>
+                                    <a-select-option value="4">
+                                      4
+                                    </a-select-option>
+                                  </a-select>
+                                    
+                                    
+
+
                                     
                                     
 
@@ -137,6 +237,7 @@
                                     
                                   </a-form-model-item>
                               </div>
+                              </template>
                             </div>
                           </div>
                         </div>
@@ -618,6 +719,14 @@ import timeRange from '@/components/formComponents/timeRange'
 import scheduleTime from '@/components/formComponents/toutiaoTime'
 import region from '@/components/formComponents/selectRegion'
 import switchConfig from './switchConfig'
+let str = '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
+function changeString (str, num){
+  let strArr = str.split('')
+  for (let i = num; i < strArr.length; i+=(num+1)) {
+    strArr[i] = 1
+  }
+  return strArr.join('')
+}
 let statusList = [
   {
     id: 2,
@@ -916,7 +1025,6 @@ export default {
   methods: {
     inputChange(value) {
       value.threshold = value.threshold.trim()
-      console.log(value)
     },
     addData(valueElse, value, index) {
       // alert(1)
@@ -985,7 +1093,6 @@ export default {
     },
 
     inputCheck(val) {
-      // console.log(val)
     },
 
     isCost(val) {
@@ -1006,9 +1113,7 @@ export default {
     onSubmit() {
       this.$refs.ruleForm.validate((valid) => {
         if (valid) {
-          console.log('submit!', valid)
         } else {
-          console.log('error submit!!')
           return false
         }
       })
@@ -1033,6 +1138,7 @@ export default {
           datas = this.form.ruleList.map((item) => {
             return {
               ...item,
+              operationThreshold:item.operationThreshold,
               ruleDetail: item.ruleDetail.map((end) => {
                 if (isArray(item.ruleDetail[0])) {
                   var data = end.map((c) => {
@@ -1063,21 +1169,18 @@ export default {
                       ? end.threshold == str
                         ? ''
                         : end.threshold
-                      : end.threshold,
+                      : end.ruleCondition == 'between'?end.threshold+'~'+end.thresholdTwo:end.threshold,
                   }
                 }
               }),
             }
           })
-          // console.log(data)
           var params = {
             ...this.form,
             ruleList: datas,
             accountId: JSON.parse(localStorage.getItem('getRuleDetail')).accountId,
           }
           this.saveLoading = true
-
-          console.log(params)
           postAction('/ruleAccountThreshold/fillThreshold', params).then((res) => {
             if (res.success) {
               this.saveLoading = false
@@ -1100,7 +1203,6 @@ export default {
 
     //分页页码改变
     pageNoChange(val) {
-      console.log(val)
       this.currentPage = val
       this.selectedCampaign()
     },
@@ -1122,7 +1224,6 @@ export default {
     },
 
     selectedCampaign(e) {
-      // console.log(e.target.value,this.selectedCampaignValue);
       if (this.accountID) {
         this.getExsitGroupList()
       } else {
@@ -1160,7 +1261,6 @@ export default {
       return showVal
     },
     handlerDANWEI(val) {
-      // console.log(val.indexOf("RATE") != -1)
 
       let returnVal = ''
 
@@ -1184,6 +1284,9 @@ export default {
     //         this.rulesFieldList=res.result
     //     }
     // })
+    
+
+
 
     var data = JSON.parse(localStorage.getItem('getRuleDetail'))
     this.editShow = data.edit
@@ -1200,11 +1303,13 @@ export default {
           var data = this.form.ruleList.map((item) => {
             return {
               ...item,
+              operationThreshold:item.operationThreshold,
               ruleDetail: item.ruleDetail.map((end) => {
                 if (isArray(end)) {
                   var data = end.map((c) => {
                     return {
                       ...c,
+                      thresholdTwo:undefined,
                       threshold:
                         c.modelType == 'tagBox'
                           ? c.threshold == null
@@ -1221,6 +1326,7 @@ export default {
                 } else {
                   return {
                     ...end,
+                    thresholdTwo:end.ruleCondition == 'between'?end.threshold.split('~')[1]:undefined,
                     threshold:
                       end.modelType == 'tagBox'
                         ? end.threshold == null
@@ -1230,7 +1336,7 @@ export default {
                         ? end.dataType == 'array'
                           ? end.threshold
                           : [end.threshold]
-                        : end.threshold,
+                        : end.ruleCondition == 'between'?end.threshold.split('~')[0]:end.threshold
                   }
                 }
               }),