Procházet zdrojové kódy

feat: 企微数据 - 短剧数据趋势 - 默认排序逻辑

zhengxy %!s(int64=2) %!d(string=před) roky
rodič
revize
2d48ad2277

+ 11 - 4
project/src/components/dataBoard/shortDramaTrends.vue

@@ -197,7 +197,7 @@ export default {
197 197
         closing_date: '', // 收益截止日期
198 198
         plat_order_type: '', // 推广类型
199 199
         costCover: ['', ''], // 回本率(范围)
200
-        sort_field: 'expense_date', // 排序字段 - 默认值
200
+        sort_field: 'paid', // 排序字段 - 默认值
201 201
         sort_type: 'desc', // 升序/降序
202 202
       },
203 203
     }
@@ -211,6 +211,11 @@ export default {
211 211
     isADQ() {
212 212
       return this.filter.order_type === orderTypeOptions.ADQ
213 213
     },
214
+    // 当前"时间"列是否展示的为"时间段" => 是时间段 默认排序"消耗"、非时间段 默认排序时间
215
+    isShowTimes() {
216
+      // 没选"短剧" => 展示的为时间段
217
+      return !this.filter.playlet_id
218
+    },
214 219
   },
215 220
   created () {
216 221
     this.initTableHeight()
@@ -534,7 +539,7 @@ export default {
534 539
     onChangeOrderType() {
535 540
       this.handleGetChart()
536 541
       this.handleGetSummaryList()
537
-      this.filter.sort_field = 'expense_date'
542
+      this.filter.sort_field = this.isShowTimes ? 'paid' : 'expense_date'
538 543
       this.filter.sort_type = 'desc'
539 544
       this.pagination.page = 1
540 545
       this.handleGetList()
@@ -552,6 +557,8 @@ export default {
552 557
       this.filter.playlet_id = val
553 558
       this.handleGetChart()
554 559
       this.handleGetSummaryList()
560
+      this.filter.sort_field = this.isShowTimes ? 'paid' : 'expense_date'
561
+      this.filter.sort_type = 'desc'
555 562
       this.pagination.page = 1
556 563
       this.handleGetList()
557 564
     },
@@ -589,7 +596,7 @@ export default {
589 596
       if (this.filter.sort_field === sort_field) {
590 597
         if (this.filter.sort_type === sort_type) {
591 598
           // 点击的是当前排序字段 && 是当前排序类型 => 重置 取消排序
592
-          this.filter.sort_field = 'expense_date'
599
+          this.filter.sort_field = this.isShowTimes ? 'paid' : 'expense_date'
593 600
           this.filter.sort_type = 'desc'
594 601
         } else {
595 602
           // 点击的是当前排序字段 && 非当前排序类型 => 设置排序类型
@@ -613,7 +620,7 @@ export default {
613 620
       this.filter.closing_date = '',
614 621
       this.filter.plat_order_type = ''
615 622
       this.filter.costCover = ['', '']
616
-      this.filter.sort_field = 'expense_date'
623
+      this.filter.sort_field = 'paid'
617 624
       this.filter.sort_type = 'desc'
618 625
       this.pagination.page = 1
619 626
       this.handleGetChart()