浏览代码

feat: 定制化分析报告页面增加loading优化

cuiyalong 3 年之前
父节点
当前提交
f7b08ba5cf
共有 1 个文件被更改,包括 13 次插入1 次删除
  1. 13 1
      src/jfw/modules/app/src/web/staticres/jyapp/big-member/js/report_analysis.js

+ 13 - 1
src/jfw/modules/app/src/web/staticres/jyapp/big-member/js/report_analysis.js

@@ -276,6 +276,7 @@ var vm = new Vue({
     var id = utils.getParam('id')
     if (id) {
       this.rid = decodeURIComponent(id)
+      this.filtersPageShow = false
     }
   },
   mounted: function () {
@@ -570,6 +571,7 @@ var vm = new Vue({
 
       this.analysis.loaded = false
       this.analysis.loading = true
+      var loading = this.showLoading()
 
       $.ajax({
         type: 'POST',
@@ -577,14 +579,16 @@ var vm = new Vue({
         data: query,
         success: function (res) {
           if (res && res.error_code === 0 && res.data) {
-            location.replace('./report_analysis?id=' + res.data)
+            this.rid = res.data
             this.analysis.loaded = true
+            location.replace('./report_analysis?id=' + res.data)
           } else {
             this.$toast(res.error_msg)
           }
         }.bind(this),
         complete: function () {
           this.analysis.loading = false
+          loading.clear()
         }.bind(this)
       })
     },
@@ -630,6 +634,9 @@ var vm = new Vue({
       return $data
     },
     onEmpty () {
+      if (this.loading) {
+        this.loading.clear()
+      }
       this.filtersPageShow = true
       this.analysis.loaded = true
       this.rid = ''
@@ -643,6 +650,7 @@ var vm = new Vue({
       if (!query.rid) {
         return
       }
+      this.loading = this.showLoading()
       var res = $.ajax({
         type: 'POST',
         async: false,
@@ -671,6 +679,10 @@ var vm = new Vue({
       ]
 
       flagArr.forEach(this.getReport)
+
+      if (this.loading) {
+        this.loading.clear()
+      }
     },
     getReport (flag) {
       const query = {