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/analysis/HomePage.vue | 48 ++++++++++++++++++++++++++++-------------------- 1 files changed, 28 insertions(+), 20 deletions(-) diff --git a/src/views/analysis/HomePage.vue b/src/views/analysis/HomePage.vue index e864a56..91ad87c 100644 --- a/src/views/analysis/HomePage.vue +++ b/src/views/analysis/HomePage.vue @@ -42,8 +42,8 @@ <!-- </el-form-item> --> </div> <div style="display: flex; justify-content: right; margin-right: 160px;"> - <el-button type="primary" @click="isRepeat">缁熻鍒嗘瀽</el-button> - <el-button type="primary" @click="toSql">鍏ュ簱绠$悊</el-button> + <el-button type="primary" :loading="button.statisticsButton" @click="isRepeat">缁熻鍒嗘瀽</el-button> + <el-button type="primary" :loading="button.WarehousingButton" @click="toSql">鍏ュ簱绠$悊</el-button> </div> @@ -65,8 +65,8 @@ <!-- </el-header> --> <!-- <el-main> --> - <div class="table" v-show="!isNoData"> - <el-table :data="displayData" border="" id="table" ref="table" height="500px" v-loading="loading" > + <div class="table" v-show="!isNoData" v-loading="loading"> + <el-table :data="displayData" border="" id="table" ref="table" height="500px" > <el-table-column type="index" label="搴忓彿" :index="indexMethod" v-if="showColumn.num"> </el-table-column> <!--缁戝畾涓�涓柟娉曪紝灏嗚繑鍥炲�艰祴缁檌ndex,鍗宠〃鏍兼瘡琛屾暟鎹殑涓嬫爣--> <el-table-column prop="fumeDevId" label="璁惧缂栧彿" v-if="showColumn.deviceid" fixed> </el-table-column> <el-table-column prop="fumeDate" label="鏃ユ湡" v-if="showColumn.date"> </el-table-column> @@ -164,6 +164,12 @@ export default { data() { return { + button:{ + // 缁熻鍒嗘瀽鎸夐挳 + statisticsButton:false, + // 鍏ュ簱鎸夐挳 + WarehousingButton:false + }, isNoData:true, loading:false, radio: '閫変腑涓旂鐢�', @@ -318,7 +324,7 @@ this.isNoData = true return } - // 绉婚櫎绌烘暟鎹姸鎬� + // 绉婚櫎绌烘暟鎹姸鎬� this.isNoData = false this.total = this.afterAnalysis.length; this.handleCurrentChange(1); // 榛樿鏄剧ず绗竴椤� @@ -340,35 +346,36 @@ if (this.shopname) { params['shopname'] = this.shopname; } + if(this.value){ + params['value'] = this.value; + } if(this.begin){ params['begin']=this.begin } if(this.end){ params['end'] = this.end } + // 鍙﹀涓�涓猯oading鍦╝nalysisData()涓� this.loading=true - axiosInstanceInstance.get('/data/search',{params:params}) - .then(response => { + this.button.statisticsButton = true + axiosInstanceInstance.get('/data/search',{params:params}).then(response => { this.isRepeated=response.data.data - console.log('璇锋眰',this.isRepeated); + if(this.isRepeated>0){ + alert('璇ュ簵閾虹殑鏃舵宸插瓨鍦ㄥ垎鏋愭暟鎹�,璇烽噸鏂伴�夋嫨') + this.button.statisticsButton = false + return + }else{ + this.analysisData() + this.button.statisticsButton = false + } + }) - - setTimeout(() => { - console.log('璇锋眰鍚�',this.isRepeated); - if(this.isRepeated>0){ - alert('璇ュ簵閾虹殑鏃舵宸插瓨鍦ㄥ垎鏋愭暟鎹�,璇烽噸鏂伴�夋嫨') - return - }else{ - this.analysisData() - console.log('鎵ц浜�'); - } - }, 1000); - }, //鍐欏叆MySql toSql(){ + this.button.WarehousingButton = true this.afterAnalysis.forEach((item)=>{ console.log(item); let jsonData=JSON.stringify(item) @@ -381,6 +388,7 @@ }) alert('宸叉垚鍔熷啓鍏ユ暟鎹簱') + this.button.WarehousingButton = fasle this.isWrite='鏄�' }, -- Gitblit v1.9.3