Ver Código Fonte

feat: 企微数据 - 账号数据趋势 - mp列表接口联调

zhengxy 2 anos atrás
pai
commit
ebd53bc2a5

+ 1 - 0
project/src/assets/config/interface_api.js

257
 
257
 
258
   dataBoard_dataCycleList: "/api/statistics/dataCycleList", // 数据循环统计
258
   dataBoard_dataCycleList: "/api/statistics/dataCycleList", // 数据循环统计
259
   dataBoard_adqAccount: "/api/accountDataTrend/adqAccount", // 账号数据趋势 - adq
259
   dataBoard_adqAccount: "/api/accountDataTrend/adqAccount", // 账号数据趋势 - adq
260
+  dataBoard_mpAccount: "/api/accountDataTrend/mpAccount", // 账号数据趋势 - mp
260
 };
261
 };
261
 
262
 
262
 export { api };
263
 export { api };

+ 20 - 13
project/src/components/dataBoard/accountTrends.vue

78
             <div v-if="item.column === 'ref_date'">
78
             <div v-if="item.column === 'ref_date'">
79
               <span>{{ row['expense_date'] }}</span><span v-if="row['expense_date_end']"> - {{ row['expense_date_end'] }}</span>
79
               <span>{{ row['expense_date'] }}</span><span v-if="row['expense_date_end']"> - {{ row['expense_date_end'] }}</span>
80
             </div>
80
             </div>
81
-            <!-- 日期 -->
81
+            <!-- adq账号 -->
82
             <span v-else-if="item.column === 'account_id'">
82
             <span v-else-if="item.column === 'account_id'">
83
               {{ row['account_id'] || '-' }}
83
               {{ row['account_id'] || '-' }}
84
             </span>
84
             </span>
217
     // 获取列表数据
217
     // 获取列表数据
218
     async handleGetList() {
218
     async handleGetList() {
219
       console.log('handleGetList => ',)
219
       console.log('handleGetList => ',)
220
-      console.log('filter => ', JSON.parse(JSON.stringify(this.filter)))
221
-      console.log('pagination => ', JSON.parse(JSON.stringify(this.pagination)))
222
       try {
220
       try {
223
         this.loading = true
221
         this.loading = true
224
         const params = {
222
         const params = {
226
           page_size: this.pagination.page_size,
224
           page_size: this.pagination.page_size,
227
           start_date: this.filter.time[0],
225
           start_date: this.filter.time[0],
228
           end_date: this.filter.time[1],
226
           end_date: this.filter.time[1],
229
-          account_id: this.isADQ ? this.filter.account_id_adq : (this.isMP ? this.filter.account_id : ''),
230
           closing_date: this.filter.closing_date,
227
           closing_date: this.filter.closing_date,
231
           plat_order_type: this.filter.plat_order_type,
228
           plat_order_type: this.filter.plat_order_type,
232
           cost_cover_min: this.filter.costCover[0],
229
           cost_cover_min: this.filter.costCover[0],
234
           sort_field: this.filter.sort_field,
231
           sort_field: this.filter.sort_field,
235
           sort_type: this.filter.sort_type,
232
           sort_type: this.filter.sort_type,
236
         }
233
         }
237
-        const { data: res = {} } = await this.$axios.post(`${this.URL.BASEURL}${this.URL.dataBoard_adqAccount}`, params)
234
+        let url = ''
235
+
236
+        if (this.isADQ) { // adq 参数 & api
237
+          params.account_id = this.filter.account_id_adq
238
+          url = `${this.URL.BASEURL}${this.URL.dataBoard_adqAccount}`
239
+        } else if (this.isMP) { // mp 参数 & api
240
+          params.app_id = this.filter.account_id
241
+          url = `${this.URL.BASEURL}${this.URL.dataBoard_mpAccount}`
242
+        }
243
+
244
+        const { data: res = {} } = await this.$axios.post(url, params)
238
         this.loading = false
245
         this.loading = false
239
         if (res && res.errno == 0) {
246
         if (res && res.errno == 0) {
240
           res.rst.extra[0].fixed = 'left' // 前2列固定左侧
247
           res.rst.extra[0].fixed = 'left' // 前2列固定左侧
241
           res.rst.extra[1].fixed = 'left' // 前2列固定左侧
248
           res.rst.extra[1].fixed = 'left' // 前2列固定左侧
242
           const detailsTableCol = []
249
           const detailsTableCol = []
243
           const detailsTableColDays = []
250
           const detailsTableColDays = []
244
-          res.rst.extra.forEach(item => { // 处理列宽问题 给长字符列设置min_width
245
-            if (item.name.includes('DAY')) {
251
+          res.rst.extra.forEach(item => {
252
+            if (item.name.includes('DAY')) { // 收集 DAY1、DAY2...表头
246
               detailsTableColDays.push(item)
253
               detailsTableColDays.push(item)
247
-            } else {
248
-              if (item.name && item.name.length > 6) {
254
+            } else { // 普通表头
255
+              if (item.name && item.name.length > 6) { // 长字符宽度
249
                 item['min_width'] = item.name.length * 20
256
                 item['min_width'] = item.name.length * 20
250
               }
257
               }
251
-              if (item.column === 'ref_date' && ((this.isMP && !this.filter.account_id) || (this.isADQ && !this.filter.account_id_adq))) {
258
+              if (item.column === 'ref_date' && ((this.isMP && !this.filter.account_id) || (this.isADQ && !this.filter.account_id_adq))) { // 时间(日期)列宽度
252
                 item['min_width'] = 200
259
                 item['min_width'] = 200
253
               }
260
               }
254
-              detailsTableCol.push(item)
261
+              detailsTableCol.push(item) // 收集普通表头
255
             }
262
             }
256
           })
263
           })
257
           this.detailsTableCol = Object.freeze(detailsTableCol)
264
           this.detailsTableCol = Object.freeze(detailsTableCol)
517
       this.filter.closing_date = '',
524
       this.filter.closing_date = '',
518
       this.filter.plat_order_type = ''
525
       this.filter.plat_order_type = ''
519
       this.filter.costCover = ['', '']
526
       this.filter.costCover = ['', '']
520
-      this.filter.sort_field = ''
521
-      this.filter.sort_type = ''
527
+      this.filter.sort_field = 'expense_date'
528
+      this.filter.sort_type = 'desc'
522
       this.pagination.page = 1
529
       this.pagination.page = 1
523
       this.handleGetList()
530
       this.handleGetList()
524
     },
531
     },