Browse Source

Merge branch 'feature/1223' into develop

zhengxy 2 years ago
parent
commit
0b8ce2ce7b
1 changed files with 13 additions and 5 deletions
  1. 13 5
      project/src/components/dataBoard/throwPerson/throwPersonPuton.vue

+ 13 - 5
project/src/components/dataBoard/throwPerson/throwPersonPuton.vue

@@ -56,15 +56,18 @@
56 56
       <ux-table-column v-for="item in desCol" :key="item.prop" :resizable="true" :field="item.prop" :title="item.label"
57 57
         :min-width="item.min_width ? item.min_width : 120" :fixed="item.fixed ? item.fixed : ''" align="center">
58 58
         <template #header>
59
-          <div class="flex-align-jus-center">
59
+          <div
60
+            :class="['flex-align-jus-center', item.sort ? 'pointer' : '', sort_field == item.prop ? 'sortFieldStyle' : '']"
61
+            @click="item.sort ? sortFieldEvent(item.prop) : ''">
60 62
             {{ item.label }}
63
+            <i class="el-icon-caret-bottom" v-if="item.sort"></i>
61 64
             <el-tooltip v-if="item.notes" :content="item.notes" placement="top">
62 65
               <div><i class="el-icon-question"></i></div>
63 66
             </el-tooltip>
64 67
           </div>
65 68
         </template>
66 69
         <template v-slot="{ row }">
67
-          <span>{{ row[item.prop] || row[item.prop] == 0 ? $formatNum(row[item.prop]) : '-' }}</span>
70
+          <span :class="sort_field == item.prop ? 'sortFieldStyle' : ''">{{ row[item.prop] || row[item.prop] == 0 ? $formatNum(row[item.prop]) : '-' }}</span>
68 71
         </template>
69 72
       </ux-table-column>
70 73
     </ux-grid>
@@ -124,7 +127,7 @@ export default {
124 127
       pages: 0,
125 128
       total: 0,
126 129
       page_size: 20,
127
-      sort_field: 'first_day_roi',
130
+      sort_field: '',
128 131
       dataInfo: {},
129 132
       default_time: [this.$getDay(-30, false), this.$getDay(0, false)],
130 133
       time: [],
@@ -137,7 +140,7 @@ export default {
137 140
         { prop: "user_name", label: "投手", min_width: 160 },
138 141
         { prop: "start_date", label: "开始日期", min_width: 160 },
139 142
         { prop: "end_date", label: "截止日期", min_width: 160 },
140
-        { prop: "cost", label: "累计消耗" },
143
+        { prop: "cost", label: "累计消耗", sort: true },
141 144
         { prop: "pay_money", label: "累计充值" },
142 145
         { prop: "scan_follow_total", label: "企微粉丝人数" },
143 146
         { prop: "qw_cost", label: "企微成本" },
@@ -247,6 +250,7 @@ export default {
247 250
           user_id: this.user_id,
248 251
           start: this.time[0],
249 252
           end: this.time[1],
253
+          sort_field: this.sort_field,
250 254
           page: type == 'export' ? 1 : this.page,
251 255
           pagesize: type == 'export' ? this.$store.state.exportNumber : this.page_size,
252 256
         }
@@ -276,7 +280,11 @@ export default {
276 280
       this.init(val)
277 281
     },
278 282
     sortFieldEvent (type) {
279
-      this.sort_field = type;
283
+      if (type === this.sort_field) { // 重复点击当前排序字段 => 重置排序字段
284
+        this.sort_field = ''
285
+      } else {
286
+        this.sort_field = type;
287
+      }
280 288
       this.init(1)
281 289
     },
282 290
     exportEvent (data) {