Browse Source

进度条延迟显示加载到100%状态

luyanan 6 years ago
parent
commit
236bfb2a4e
1 changed files with 13 additions and 8 deletions
  1. 13 8
      src/views/bridgesConsole/bridgeMonitor/index.vue

+ 13 - 8
src/views/bridgesConsole/bridgeMonitor/index.vue

@ -21,16 +21,16 @@
21 21
              @change="changeTimeRange">
22 22
            </el-option>
23 23
          </el-select>
24
          <el-button type="primary" @click="getMonitorByDay">查询</el-button>
24
          <el-button type="primary" @click="getMonitorByDay" :disabled="progressShow">查询</el-button>
25 25
      </div>
26 26
      <el-row class="line-chart-box">
27
        <el-col :xs="24" :sm="24" :lg="24" v-for="item in alarmShowList" :key="item.index" v-if="alarmList.length">
28
          <lineChart :chartData="item" :historyM="historyM"></lineChart>
29
        </el-col>
30 27
        <div class="progress-box" v-if="progressShow">
31 28
          <span>正在加载 {{proBar}}%</span>
32 29
          <el-progress :text-inside="true" :stroke-width="18" :percentage="proBar"></el-progress>
33 30
        </div>
31
        <el-col :xs="24" :sm="24" :lg="24" v-for="item in alarmShowList" :key="item.index" v-if="alarmList.length">
32
          <lineChart :chartData="item" :historyM="historyM"></lineChart>
33
        </el-col>
34 34
      </el-row>
35 35
      <DefaultPage v-if="!alarmList.length && !progressShow"></DefaultPage>
36 36
      <div class="pagination-container">
@ -142,9 +142,9 @@ export default {
142 142
      }, 1500 * Math.random())
143 143
    },
144 144
    getMonitorByDay() {
145
      this.progressShow = true
146
      NProgress.start()
147 145
      var that = this
146
      that.progressShow = true
147
      NProgress.start()
148 148
      that.proBar = 0
149 149
      that.alarmList = []
150 150
      that.changeProgress()
@ -159,7 +159,7 @@ export default {
159 159
      getMonitorByDay({ seq: arr, begin: sDate, end: eDate }, flag).then(res => {
160 160
        NProgress.inc()
161 161
        if (res.success && res.data) {
162
          this.progressShow = false
162
          that.proBar = 100
163 163
          var monitorList = []
164 164
          for (let i = 0; i < res.data.length; i++) {
165 165
            var str = res.data[i].cid
@ -184,7 +184,12 @@ export default {
184 184
            monitorData.seData.push(res.data[i].hvalue)
185 185
            monitorData.seData.push(res.data[i].lvalue)
186 186
          }
187
          that.alarmList = monitorList
187
          if (that.proBar === 100) {
188
            that.alarmList = monitorList
189
            setTimeout(function() {
190
              that.progressShow = false
191
            }, 1)
192
          }
188 193
        }
189 194
      })
190 195
    },