From 60076cbbe1da6cc8ed3a4ebb8f67e92ea9be9e4a Mon Sep 17 00:00:00 2001
From: zmc <zmc_li@foxmail.com>
Date: 星期二, 15 八月 2023 16:02:58 +0800
Subject: [PATCH] 设置按钮的加载效果

---
 src/views/ExceedingFume.vue |  112 +++++++++++++++++++++++---------------------------------
 1 files changed, 46 insertions(+), 66 deletions(-)

diff --git a/src/views/ExceedingFume.vue b/src/views/ExceedingFume.vue
index 1e65022..ffbb091 100644
--- a/src/views/ExceedingFume.vue
+++ b/src/views/ExceedingFume.vue
@@ -12,7 +12,6 @@
         </ExceptionType>
 
         <TimeSelect @submit-time="giveTime"></TimeSelect>
-        <!-- </div> -->
       </div>
       <div
         ref="h2"
@@ -244,10 +243,9 @@
           </el-card>
         </el-collapse-item>
       </el-collapse>
-      <!-- <hr/>
- <br> -->
+
       <h4 class="table-text">寮傚父鏁版嵁</h4>
-      <!--  -->
+
     </el-col>
   </el-row>
   <el-card class="table-page" v-show="!isNoData">
@@ -354,13 +352,15 @@
         <div class="dialog-button-position">
           <el-button
             type="danger"
-            :disabled="isPreCantouch"
+            :loading="button.preButton"
+            :disabled="isPreCantouch || banTouch"
             @click="getPreviousRowData"
             >涓婃潯寮傚父</el-button
           >
           <el-button
             type="danger"
-            :disabled="isNextCantouch"
+            :loading="button.afterButton"
+            :disabled="isNextCantouch || banTouch"
             @click="getNextRowData"
             >涓嬫潯寮傚父</el-button
           >
@@ -451,6 +451,16 @@
   },
   data() {
     return {
+      button:{
+        // 鏌ヨ鎸夐挳
+        queryButton:false,
+        // 涓婁竴鏉℃寜閽�
+        preButton:false,
+        // 涓嬩竴鏉℃寜閽�
+        afterButton:false,
+        // 
+        banTouch:0
+      },
       // 寮傚父鎶樼嚎鍥剧殑閰嶇疆
       option: {},
       // 鎶樼嚎鍥惧睍绀�
@@ -659,7 +669,6 @@
           let current = timePoints[i];
           let next = timePoints[i + 1];
           while (this.isTimeDifferenceGreaterThan10Minutes(current, next)) {
-            console.log('generateTimePoints');
             current = dayjs(current)
               .add(10, 'minute')
               .format('YYYY-MM-DD HH:mm:ss');
@@ -688,7 +697,6 @@
       const year2 = date2.getFullYear();
       const month2 = date2.getMonth();
       const day2 = date2.getDate();
-      console.log(month1, month2);
 
       // 鍒ゆ柇涓や釜鏃ユ湡鏄惁鐩稿樊涓�涓湀
       if (year1 === year2) {
@@ -798,6 +806,9 @@
     getNextRowData() {
       // 涓嶆槸琛ㄦ牸鐨勭涓�琛�
       if (this.selectedRowIndex !== 0) {
+        // 璁剧疆涓婁笅鏉℃寜閽笉鍙偣鍑�
+        this.banTouch = 1
+
         //寰楀埌涓婁竴琛屾暟鎹储寮�
         this.selectedRowIndex = this.selectedRowIndex - 1;
         //璇锋眰鏁版嵁 鏀瑰彉exceedingData
@@ -813,32 +824,35 @@
         if (this.drawerData.endTime) {
           params['endTime'] = this.displayData[this.selectedRowIndex].endTime;
         }
-
+        this.button.afterButton = true
         axiosInstanceInstance
           .get('/fume/exceed', { params: params })
           .then((response) => {
             // 淇濆瓨杩斿洖鐨勮秴鏍囨暟鎹�
             this.exceedingData = response.data.data;
-            // this.chart = null;
-            // this.drawChart();
             this.drawChartTest();
             this.exceptionTotal = this.exceedingData.length;
+            this.button.afterButton = false
+
+            this.banTouch = 0
+
           });
       }
-      //琛ㄦ牸鐨勭涓�琛岋紝鍒欎笂涓�鏉℃棤鏁版嵁
-      else {
-        console.log(null);
-      }
+      // //琛ㄦ牸鐨勭涓�琛岋紝鍒欎笂涓�鏉℃棤鏁版嵁
+      // else {
+      //   console.log(null);
+      // }
     },
 
     // 鑾峰彇鑾峰彇琛ㄦ牸涓嬩竴琛屾暟鎹�
     getPreviousRowData() {
       // 涓嶆槸琛ㄦ牸鐨勭涓�琛�
       if (this.selectedRowIndex < this.displayData.length - 1) {
-        //寰楀埌涓婁竴琛屾暟鎹储寮�
+        // 璁剧疆涓婁笅鏉℃寜閽笉鍙偣鍑�
+        this.banTouch = 1
 
+        //寰楀埌涓婁竴琛屾暟鎹储寮�
         this.selectedRowIndex = this.selectedRowIndex + 1;
-        console.log('涓�', this.selectedRowIndex);
 
         //璇锋眰鏁版嵁 鏀瑰彉exceedingData
         this.setinfo(this.selectedRowIndex);
@@ -853,20 +867,24 @@
         if (this.drawerData.endTime) {
           params['endTime'] = this.displayData[this.selectedRowIndex].endTime;
         }
+        this.button.preButton = true
         axiosInstanceInstance
           .get('/fume/exceed', { params: params })
           .then((response) => {
             // 淇濆瓨杩斿洖鐨勮秴鏍囨暟鎹�
             this.exceedingData = response.data.data;
-            console.log(this.exceedingData);
             this.drawChartTest();
             this.exceptionTotal = this.exceedingData.length;
+            this.button.preButton = false
+
+          
+            this.banTouch = 0
           });
       }
       //琛ㄦ牸鐨勭涓�琛岋紝鍒欎笂涓�鏉℃棤鏁版嵁
-      else {
-        console.log(null);
-      }
+      // else {
+      //   console.log(null);
+      // }
     },
 
     // 鈥樻煡鐪嬭鎯呪�� 寮瑰嚭妗嗛儴鍒�
@@ -916,8 +934,7 @@
       if (this.exceptionValue.length != 0) {
         params['exceptionValue'] = this.exceptionValue.join();
       }
-      console.log('鍘�', this.exceptionValue);
-      console.log('澶勭悊', this.exceptionValue.join());
+
       if (this.beginTime) {
         params['beginTime'] = this.beginTime;
       }
@@ -925,12 +942,14 @@
         params['endTime'] = this.endTime;
       }
       this.loading = true;
+      this.button.queryButton = true
       axiosInstanceInstance
         .get('/fume/abnormalthree', { params: params })
         .then((response) => {
           this.abnormalData = response.data.data;
           this.total = this.abnormalData.length;
           this.loading = false;
+          this.button.queryButton = false
           if (response.data.data.length == 0) {
             ElMessage('璇ユ椂娈垫棤鏁版嵁');
             this.isNoData = true;
@@ -939,8 +958,7 @@
           // 绉婚櫎绌烘暟鎹姸鎬�
           this.isNoData = false;
           this.handleCurrentChange(1);
-          console.log('杩斿洖鐨勬暟鎹�', this.abnormalData);
-          console.log('闀垮害', response.data.data.total);
+
         });
     },
     handleSizeChange(val) {
@@ -964,7 +982,6 @@
       // 璁$畻缁撴潫鏃堕棿鍑忓幓寮�濮嬫椂闂翠腑闂寸浉宸灏戜釜鍗佸垎閽�
       const diffInMinutes = end.diff(start, 'minute');
       const diffInTenMinutes = Math.floor(diffInMinutes / 10);
-      console.log('鍑犱釜10鍒嗛挓', diffInTenMinutes);
       return diffInTenMinutes;
     },
 
@@ -1317,13 +1334,11 @@
         .get('/fume/history', { params: paramsBefore })
         .then((result1) => {
           this.beforeData = result1.data.data;
-          console.log('beforeData:', this.beforeData);
           // 璇锋眰鍚庡崐娈�
           axiosInstanceInstance
             .get('/fume/history', { params: paramsAfter })
             .then((result2) => {
               this.afterData = result2.data.data;
-              console.log('afterData:', this.afterData);
               //淇濆瓨寮傚父鍖洪棿鐨勫��
               let tempArr = [];
               // 淇濆瓨寮傚父鍖洪棿鍓嶅悗鐨勫��
@@ -1351,7 +1366,6 @@
 
                 after = this.shallowCopyList(this.afterData);
                 // after = this.afterData
-                console.log('after:', after);
               }
               // 瓒呮爣
               else {
@@ -1381,7 +1395,6 @@
 
               // 灏嗗墠鍚庡尯闂存暟鎹� 涓� 寮傚父鍖洪棿鏁版嵁 鍚堝苟
               this.allExceptionTimeData = [...before, ...tempArr, ...after];
-              console.log('缁勫悎鏁版嵁锛�', this.allExceptionTimeData);
               // x杞存棩鏈熸椂闂�
               let dateList = [];
               // y杞� 瓒呮爣娌圭儫娴撳害
@@ -1397,9 +1410,6 @@
 
               dateList = timeAndValue['xAxis'];
               fumeExceeding = timeAndValue['yAxis'];
-
-              console.log('dateList:', dateList);
-              console.log('fumeExceeding:', fumeExceeding);
 
               // 鎻愬彇寮傚父璧峰鏃堕棿鐐瑰湪鏁翠釜鍖洪棿鍐呯殑鏁版嵁绱㈠紩
               let startIndex = dateList.findIndex(
@@ -1457,7 +1467,6 @@
             ]
           };
         });
-        console.log(this.optionsShop);
       });
     },
     exportDom() {
@@ -1511,8 +1520,6 @@
         })
         .then((result) => {
           this.exception0 = result.data.data;
-          console.log('寮傚父0', this.exception0);
-          console.log('寮傚父0鏁伴噺', this.exception0.length);
         });
       axiosInstanceInstance
         .get('/fume/shopname', {
@@ -1542,7 +1549,6 @@
     getRecentSevenDays() {
       // 缁欑骇鑱旈�夋嫨鍣ㄨ缃粯璁ょ殑閫夋嫨椤�
       this.devId = ['浠樺皬濮愬湪鎴愰兘', 'qinshi_31010320210010'];
-      console.log(this.currentDateTime, this.oneWeekAgoDateTime);
       let params = {};
       params['beginTime'] = this.beginTime;
       params['endTime'] = this.endTime;
@@ -1567,13 +1573,7 @@
 </script>
 
 <style scoped>
-/* .exception-root-container {
-  margin: 20px;
-  padding: 10px;
-  border: 1px;
-  height: 615px;
 
-} */
 .header-container {
   display: flex;
   margin-left: 20px;
@@ -1609,8 +1609,6 @@
 /* 寮傚父鍒嗘瀽鏁版嵁涓庢寜閽� */
 .exception-container {
   display: flex;
-  /* direction: column; */
-  /* flex-grow: 2,1; */
 }
 .example-showcase .el-loading-mask {
   z-index: 9;
@@ -1632,7 +1630,6 @@
   font-size: 18px;
 }
 .collapse-header-text {
-  /* margin-right: 150px; */
   margin-top: 5px;
   font-size: 14px;
   color: gray;
@@ -1641,7 +1638,6 @@
 .box-card-label {
   font-size: 14px;
   white-space: nowrap;
-  /* overflow-x: auto; */
 }
 :deep().el-card {
   border-radius: 9px;
@@ -1656,9 +1652,7 @@
 .table-page {
   margin-left: 20px;
 }
-:deep().table-page .el-card__body {
-  /* padding: 0px; */
-}
+
 .table-text {
   font-size: 18px;
   margin: 5px 0px 10px 20px;
@@ -1697,16 +1691,12 @@
 .box-card {
   height: 190px;
 }
-:deep().box-card .el-card__body {
-  /* padding: 5px; */
-}
+
 .sub-box-card {
   height: 100px;
   border: 0px;
 }
-:deep().sub-box-card .el-card__body {
-  /* padding: 0px; */
-}
+
 .mx-1 {
   margin-bottom: 0px;
 }
@@ -1715,16 +1705,6 @@
   justify-content: right;
   margin-bottom: 10px;
 }
-/* :global(.el-table .exceeding-row) {
-  --el-table-expanded-cell-bg-color: #f53f3f;
-}
-:global(.el-table .abnormal-power-supply) {
-  --el-table-expanded-cell-bg-color: #ffcf8b;
-}
-
-:global(.el-table .disconnect) {
-  --el-table-expanded-cell-bg-color: #ff7d00;
-} */
 
 :deep().el-table__row .exceeding-row{
   background-color:  #F53F3F;

--
Gitblit v1.9.3