Browse Source

feat: 数据看板 - 运营数据 - 接口联调

zhengxy 2 years ago
parent
commit
ac3a99a428

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

@@ -88,6 +88,7 @@ var api = {
88 88
   statistics_playletData: "/api/statistics/playletData",
89 89
   pitcher_wxAccountList: "/api/pitcher/wxAccountList",
90 90
   stat_operateDayRetrieve: "/api/stat/operateDayRetrieve",
91
+  stat_operateDayRetrieveByAccount: "/api/stat/operateDayRetrieveByAccount",
91 92
   pitcher_dramaList: "/api/pitcher/dramaList",
92 93
   stat_playletPopulariz: "/api/stat/playletPopulariz",
93 94
   stat_momentsPopulariz: "/api/stat/momentsPopulariz",

+ 28 - 29
project/src/components/dataBoard/operateDayRetrieve.vue

@@ -17,9 +17,9 @@
17 17
         <el-button v-if="isCanExport" type="primary" size="mini" @click="init(1,'export')">导出Excel</el-button>
18 18
       </div>
19 19
       <div class="screenBox filter-wrap">
20
-        <date-picker style="margin-left: -20px;" :labelWidth="true" title="选择日期" @changeTime="changeTime"></date-picker>
21
-        <self-channel v-show="isMP" title="公众号" type='thePublic' @channelDefine="(val)=>{account_id = val;init(1)}"></self-channel>
22
-        <self-channel v-show="isMP" title="剧集" type='dramaList' @channelDefine="(val)=>{playlet_id = val;init(1)}"></self-channel>
20
+        <date-picker :labelWidth="true" title="选择日期" :quickFlag="true" @changeTime="changeTime" />
21
+        <self-channel v-show="isMP" title="公众号" type='thePublic' labelWidth style="margin-right: 30px;margin-left: -10px;" @channelDefine="(val)=>{account_id = val;init(1)}" />
22
+        <self-channel v-show="isMP" title="剧集" type='dramaList' labelWidth style="margin-right: 30px;margin-left: -30px;" @channelDefine="(val)=>{playlet_id = val;init(1)}" />
23 23
       </div>
24 24
 
25 25
       <ux-grid style="margin-top:10px" ref="plxTable" :border="false" @row-click="()=>{return}" :header-cell-style="()=>{return { backgroundColor: '#FFFFFF !important', border: 'none!important' }}" :height="height" show-footer-overflow="tooltip" show-overflow="tooltip" size="mini">
@@ -128,39 +128,36 @@ export default {
128 128
       }
129 129
     },
130 130
     changeTime (time) {//筛选时间变化
131
-      if (!time || time && time.length == 0) {
132
-        this.time = []
133
-      } else {
134
-        this.time = time
135
-      }
131
+      this.time = (Array.isArray(time) && time.length) ? time : []
136 132
       this.init(1)
137 133
     },
138
-    init (page, type) {
139
-      if (type != 'export') {
140
-        this.page = page ? page : this.page;
141
-      } else {
142
-        if (this.total == 0) {
143
-          this.$message({
144
-            message: '暂无数据可导出',
145
-            type: "warning"
146
-          })
147
-          return
134
+    async init (page, type) {
135
+      try {
136
+        if (type != 'export') {
137
+          this.page = page ? page : this.page;
138
+        } else {
139
+          if (this.total == 0) {
140
+            this.$message({
141
+              message: '暂无数据可导出',
142
+              type: "warning"
143
+            })
144
+            return
145
+          }
148 146
         }
149
-      }
150
-      this.loading = true
151
-      this.$axios.get(this.URL.BASEURL + this.URL.stat_operateDayRetrieve, {
152
-        params: {
153
-          start: this.time[0],
154
-          end: this.time[1],
147
+
148
+        this.loading = true
149
+        const params = {
150
+          start: this.time[0] || '',
151
+          end: this.time[1] || '',
155 152
           order_type: this.order_type,
156 153
           drama_id: this.isMP ? this.playlet_id : '',
157 154
           app_id: this.isMP ? this.account_id: '',
158 155
           page: type == 'export' ? 1 : this.page,
159 156
           pagesize: type == 'export' ? this.$store.state.exportNumber : this.page_size,
160 157
         }
161
-      }).then((res) => {
162
-        var res = res.data
163
-        this.loading = false
158
+        const url = `${this.URL.BASEURL}${this.URL.stat_operateDayRetrieveByAccount}`
159
+
160
+        const { data: res = {} } = await this.$axios.get(url, { params })
164 161
         if (res && res.errno == 0) {
165 162
           if (type == 'export') {
166 163
             this.exportEvent(res.rst.data)
@@ -189,9 +186,11 @@ export default {
189 186
             type: "warning"
190 187
           })
191 188
         }
192
-      }).catch((err) => {
189
+      } catch (error) {
190
+        console.log('error => ', error)
191
+      } finally {
193 192
         this.loading = false
194
-      });
193
+      }
195 194
     },
196 195
     handleCurrentChange (val) {
197 196
       this.init(val)