Selaa lähdekoodia

Merge branch 'master' of http://39.106.184.70:3000/ctop/adsp-vue

zhuxinbo 5 vuotta sitten
vanhempi
commit
9da77ccfa1

+ 30 - 7
src/views/modules/Statistics/CompareData.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="compareData">
     <!-- /展示的对比数据的模态框 -->
-    <a-modal v-model="compVisiable" title="数据对比" @ok="handleOk" width="65%" border :footer="null">
+    <a-modal v-model="compVisiable" title="数据对比" @ok="handleOk" width="65%" border :footer="null" @cancel='handleCancel'>
       <div class="clickHandle">
         <a-radio-group v-model="value"  @change="radioChange" name="dateGroup">
           <a-radio-button value="month" defaultChecked>月对比</a-radio-button>
@@ -387,6 +387,13 @@ export default {
     }
   },
   methods: {
+    //关闭
+    handleCancel(){
+      this.value='month';
+      this.tableTab=1;
+       this.monthValue = [moment().subtract(1, 'months'), moment()]
+      this.dateValue = [moment().subtract(1, 'days'), moment()]
+    },
     //单选框选择
     radioChange(e) {
       this.compareSign = e.target.value
@@ -409,7 +416,8 @@ export default {
       }
     },
     tableTabChange(e) {
-      this.tableTab = e.target.value
+      this.tableTab = e.target.value;
+      this.tableData=0;
       if (e.target.value == '1') {
         this.tableData = this.smallDate
       } else {
@@ -434,11 +442,23 @@ export default {
     sectionHttp(params) {
       this.loading = true
       this.compareOption = JSON.parse(JSON.stringify(compareOption))
+      this.costcompare.prev=0
+      this.clickcompare.prev=0
+      this.showNumcompare.prev=0
+      this.costcompare.next=0
+      this.clickcompare.next=0
+      this.showNumcompare.next=0
       return new Promise((resolve, reject) => {
         postAction('/ctop/byteDance/homePage/report/compare', params).then(res => {
         //   console.log(res)
           if (res.success) {
-            this.loading = false
+            this.loading = false;
+            // this.costcompare.prev=0
+            // this.clickcompare.prev=0
+            // this.showNumcompare.prev=0
+            // this.costcompare.next=0
+            // this.clickcompare.next=0
+            // this.showNumcompare.next=0
             if (this.compareSign == 'day') {
               this.tabCost = JSON.parse(JSON.stringify(initDay))
               this.tabClick = JSON.parse(JSON.stringify(initDay))
@@ -498,6 +518,7 @@ export default {
             })
 
             this.smallDate = [...res.result.list.smallDate]
+
             res.result.list.bigDate.forEach((ele,index) => {
               if (!ele.costProportion) {
                 ele.costProportion = '-'
@@ -507,22 +528,24 @@ export default {
                 ele.statDate = ele.statDate + ' ' + ele.statHour
               }
               ele.key=index+1
-              // console.log(ele)
+              console.log(ele.cost)
               this.costcompare.next += ele.cost
               this.clickcompare.next += ele.click
               this.showNumcompare.next += ele.showNum
             })
+
             if(res.result.list.bigDate.length<res.result.list.smallDate.length){
                 for (let i = 0; i < res.result.list.bigDate.length; i++) {
                     this.costcompare.prev += res.result.list.smallDate[i].cost
                     this.clickcompare.prev += res.result.list.smallDate[i].click
                     this.showNumcompare.prev += res.result.list.smallDate[i].showNum
+                    console.log(res.result.list.smallDate[i].cost)
                 }
             }else{
                 for (let i = 0; i < res.result.list.smallDate.length; i++) {
-                    this.costcompare.prev += res.result.list.bigDate[i].cost
-                    this.clickcompare.prev += res.result.list.bigDate[i].click
-                    this.showNumcompare.prev += res.result.list.bigDate[i].showNum
+                    this.costcompare.prev += res.result.list.smallDate[i].cost
+                    this.clickcompare.prev += res.result.list.smallDate[i].click
+                    this.showNumcompare.prev += res.result.list.smallDate[i].showNum
                 }
             }
             

+ 1 - 0
src/views/modules/Statistics/newHome.vue

@@ -429,6 +429,7 @@ export default {
     },
     dateValue: {
     handler(newName, oldName) {
+      console.log(newName,oldName)
         this.sectionHttp({
             type:this.type,
             startDate:this.dateValue[0].format('YYYY-MM-DD'),