From ef48e4b7a4d34e63ffd2cb23c406f4da6eb72ed7 Mon Sep 17 00:00:00 2001 From: licp <lichunping@guanfang.com.cn> Date: 星期二, 14 五月 2024 13:42:26 +0800 Subject: [PATCH] 优化消息管理,标准库管理 --- src/components/view/b3-classes.vue | 39 +++++++++++++++++++++++++++++++++++++-- 1 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/components/view/b3-classes.vue b/src/components/view/b3-classes.vue index 0417519..61a4050 100644 --- a/src/components/view/b3-classes.vue +++ b/src/components/view/b3-classes.vue @@ -44,7 +44,7 @@ <el-button size="small" type="primary" @click="refreshTable()">鏌� 璇�</el-button> </div> <div class="search_thing btns" style="padding-left: 30px;"> - <el-button size="small" type="primary" v-if="downPower">瀵� 鍑�</el-button> + <el-button size="small" type="primary" v-if="downPower" @click="handleDown" :loading="downLoading">瀵� 鍑�</el-button> <el-button size="small" type="primary" @click="schedulingVisible = true" v-if="addPower">鎺� 鐝�</el-button> </div> </div> @@ -286,7 +286,8 @@ pageLoading: false, // 缁勪欢loading鐨勫睍绀�,榛樿涓簍rue finishLoding: false, // 鍔犺浇瀹屾垚锛屾樉绀哄凡缁忔病鏈夋洿澶氫簡 monthList:[], - yearList:[] + yearList:[], + downLoading:false, } }, watch: { @@ -516,6 +517,40 @@ this.refresh() }) }, + handleDown(){ + let year = this.query.year.getFullYear() + let time = ''; + if(this.query.month){ + let month = this.query.month>9?this.query.month:'0'+this.query.month + time = year+'-'+month+'-01 00:00:00' + }else{ + time = year+'-01-01 00:00:00' + } + this.downLoading = true + this.$axios.get(this.$api.performanceShift.export+`?time=${time}&userName=${this.query.userName}&laboratory=${this.query.laboratory}&isMonth=${this.query.month?true:false}`,{responseType: 'blob'}).then(res => { + this.$message.success('涓嬭浇鎴愬姛') + this.downLoading = false + const blob = new Blob([res], { + type: 'application/force-download' + }) + let fileName=""; + if(this.query.month){ + fileName = year +'-'+this.query.month+' 鐝淇℃伅' + }else{ + fileName = year+' 鐝姹囨��' + } + const filename = decodeURI(fileName+'.xlsx') + // 鍒涘缓涓�涓秴閾炬帴锛屽皢鏂囦欢娴佽祴杩涘幓锛岀劧鍚庡疄鐜拌繖涓秴閾炬帴鐨勫崟鍑讳簨浠� + const elink = document.createElement('a') + elink.download = filename + elink.style.display = 'none' + elink.href = URL.createObjectURL(blob) + document.body.appendChild(elink) + elink.click() + URL.revokeObjectURL(elink.href) // 閲婃斁URL 瀵硅薄 + document.body.removeChild(elink) + }) + }, selectEnumByCategory() { this.$axios.post(this.$api.enums.selectEnumByCategory, { category: "鐝绫诲瀷" -- Gitblit v1.9.3