Browse Source

feat: 企微数据 - 数据循环统计 - 数据更新时间

zhengxy 2 years ago
parent
commit
9e6806f340
1 changed files with 45 additions and 4 deletions
  1. 45 4
      project/src/components/dataBoard/regRangeReport.vue

+ 45 - 4
project/src/components/dataBoard/regRangeReport.vue

@@ -1,7 +1,7 @@
1 1
 <template>
2 2
   <div v-loading="loading">
3 3
     <div class="screenBox flex">
4
-      <switchMpAdq v-model="order_type" @change="init(1)" />
4
+      <switchMpAdq v-model="order_type" @change="init(1);handleGetUpdateTime();" />
5 5
       <el-button type="primary" size="mini" @click="init(1, 'export')">导出Excel</el-button>
6 6
     </div>
7 7
     <div class="screenBox flex">
@@ -9,7 +9,7 @@
9 9
         <date-picker :reset="reset" title="自定义" :quickFlag='true' :afferent_time="default_time" :clearFlag='false'
10 10
           @changeTime="changeTime"></date-picker>
11 11
         <!-- 推广类型 -->
12
-        <selfChannel :reset="reset" title="推广类型" type="promotionType" @channelDefine="(val)=>{plat_order_type=val;init(1)}" />
12
+        <selfChannel :reset="reset" title="推广类型" type="promotionType" @channelDefine="(val)=>{plat_order_type=val;init(1);handleGetUpdateTime();}" />
13 13
         <!-- 收益截止日期 -->
14 14
         <div style="margin-left: 30px;" class="common-screen-item">
15 15
           <label class="common-screen-label">收益截止日期</label>
@@ -26,12 +26,14 @@
26 26
       <input-range v-model="totalRoi" label="回本率" />
27 27
       <input-range v-model="paid" label="消耗" />
28 28
       <div>
29
-        <el-button size="mini" type="primary" plain @click="init(1)">确定</el-button>
29
+        <el-button size="mini" type="primary" plain @click="init(1);handleGetUpdateTime();">确定</el-button>
30 30
         <el-button size="mini" plain @click="handleReset">重置</el-button>
31 31
       </div>
32 32
     </div>
33 33
     <!-- S 新增区间筛选项 -->
34
-
34
+    <!-- S 数据更新时间 -->
35
+    <div class="update-time"><i class="el-icon-warning-outline" />数据更新时间:{{ updateTime || '-' }}</div>
36
+    <!-- E 数据更新时间 -->
35 37
     <!-- S 汇总表 summaryTable -->
36 38
     <ux-grid style="margin-top:10px" ref="summaryTable" :border="false" @row-click="() => { return }" :header-cell-style="() => { return { backgroundColor: '#FFFFFF !important', border: 'none!important' } }" show-footer-overflow="tooltip" show-overflow="tooltip" size="mini">
37 39
       <ux-table-column v-for="item in summaryTableCol" :key="item.column" :resizable="true" :field="item.column" :title="item.name" :min-width="item.min_width ? item.min_width : 140" :fixed="item.fixed ? item.fixed : ''" align="center">
@@ -114,6 +116,7 @@ export default {
114 116
       closing_date: '', // 收益截止日期
115 117
       sort_field: 'date', // 排序字段 默认 时间 & 降序
116 118
       sort_type: 'desc', // 升序/降序
119
+      updateTime: '', // 数据更新时间
117 120
     }
118 121
   },
119 122
   computed: {
@@ -130,8 +133,27 @@ export default {
130 133
     this.height = document.documentElement.clientHeight - 200 > 400 ? document.documentElement.clientHeight - 200 : 400
131 134
     this.time = this.default_time
132 135
     this.init(1)
136
+    this.handleGetUpdateTime()
133 137
   },
134 138
   methods: {
139
+    // 获取"数据更新时间"
140
+    async handleGetUpdateTime() {
141
+      console.log('handleGetUpdateTime => ')
142
+      try {
143
+        const params = { type: '' }
144
+        if (this.isMP) params.type = 'data_cycle_mp'
145
+        if (this.isADQ) params.type = 'data_cycle_adq'
146
+        const { data: res = {} } = await this.$axios.get(`${this.URL.BASEURL}${this.URL.dataBoard_uptime}`, { params })
147
+        if (res && res.errno == 0) {
148
+          this.updateTime = res.rst.uptime
149
+        } else if (res.errno != 4002) {
150
+          this.$message.warning(res.err)
151
+          this.updateTime = ''
152
+        }
153
+      } catch (error) {
154
+        this.updateTime = ''
155
+      }
156
+    },
135 157
     handleReset() {
136 158
       this.reset = !this.reset
137 159
       this.order_type = orderTypeOptions.MP
@@ -147,6 +169,7 @@ export default {
147 169
       this.sort_field = 'date'
148 170
       this.sort_type = 'desc'
149 171
       this.init(1)
172
+      this.handleGetUpdateTime()
150 173
     },
151 174
     changeTime (time) {//筛选时间变化
152 175
       if (!time || time && time.length == 0) {
@@ -155,8 +178,10 @@ export default {
155 178
         this.time = time
156 179
       }
157 180
       this.init(1)
181
+      this.handleGetUpdateTime()
158 182
     },
159 183
     async init(page, type) {
184
+      console.log('init => ')
160 185
       try {
161 186
         if (type != 'export') {
162 187
           this.page = page ? page : this.page;
@@ -227,11 +252,13 @@ export default {
227 252
     },
228 253
     handleCurrentChange (val) {
229 254
       this.init(val)
255
+      this.handleGetUpdateTime()
230 256
     },
231 257
     // 监听“收益截止日期”筛选变化
232 258
     onChangeClosingDate(val) {
233 259
       this.closing_date = val || ''
234 260
       this.init(1)
261
+      this.handleGetUpdateTime()
235 262
     },
236 263
     // 监听排序变化
237 264
     onClickSort(sort_field, sort_type) {
@@ -252,6 +279,7 @@ export default {
252 279
       }
253 280
       // 后端排序 => 获取最新数据
254 281
       this.init(1)
282
+      this.handleGetUpdateTime()
255 283
     },
256 284
     exportEvent (data) {
257 285
       const tHeader = data.list.head.map(v => v.name)
@@ -276,6 +304,19 @@ export default {
276 304
   background: #fff;
277 305
   padding: 5px 20px;
278 306
 }
307
+.update-time {
308
+  margin-top: 10px;
309
+  padding-left: 20px;
310
+  display: flex;
311
+  align-items: center;
312
+  font-size: 12px;
313
+  color: #999;
314
+  i {
315
+    font-size: 14px;
316
+    font-weight: 600;
317
+    margin-right: 4px;
318
+  }
319
+}
279 320
 .ml-10 {
280 321
   margin-left: 10px;
281 322
 }