From c67f52b0060a3d3339a0c62850e919c152d3a669 Mon Sep 17 00:00:00 2001 From: licp <lichunping@guanfang.com.cn> Date: 星期五, 21 六月 2024 10:00:31 +0800 Subject: [PATCH] 完成人员考评接口对接 --- src/components/view/b3-personnel-evaluation.vue | 67 ++++++++++++++++++++++++++------- 1 files changed, 52 insertions(+), 15 deletions(-) diff --git a/src/components/view/b3-personnel-evaluation.vue b/src/components/view/b3-personnel-evaluation.vue index 1e6910f..9bac5cf 100644 --- a/src/components/view/b3-personnel-evaluation.vue +++ b/src/components/view/b3-personnel-evaluation.vue @@ -22,7 +22,7 @@ <div class="search_thing"> <div class="search_label">瀹為獙瀹わ細</div> <div class="search_input"> - <el-select v-model="entity.laboratory" placeholder="鍏ㄩ儴" size="small" @change="refreshTable()"> + <el-select v-model="entity.departLims" placeholder="鍏ㄩ儴" size="small" @change="refreshTable()"> <el-option v-for="item in laboratoryList" :key="item.value" :label="item.label" :value="item.value"> </el-option> </el-select> @@ -31,7 +31,7 @@ <div class="search_thing"> <div class="search_label">浜哄憳鍚嶇О锛�</div> <div class="search_input"><el-input size="small" placeholder="璇疯緭鍏�" clearable - v-model="entity.deviceName" @keyup.enter.native="refreshTable()"></el-input></div> + v-model="entity.name" @keyup.enter.native="refreshTable()"></el-input></div> </div> <div class="search_thing" style="padding-left: 30px;"> <el-button size="small" @click="refresh()">閲� 缃�</el-button> @@ -45,10 +45,10 @@ <el-radio-button label="leaderRate">缁勯暱璇勫垎</el-radio-button> <el-radio-button label="supervisorRate">涓荤鎵撳垎</el-radio-button> </el-radio-group> - <el-button type="primary" size="small">瀵� 鍑�</el-button> + <el-button type="primary" size="small" :loading="outLoading" @click="handleDown">瀵� 鍑�</el-button> </div> <div class="table"> - <component :is="tabValue" :month="entity.month" :laboratory="getLaboratory()"></component> + <component :is="tabValue" ref="component" :entity="entity" v-if="laboratoryList.length>0"></component> </div> </div> </template> @@ -68,35 +68,72 @@ data(){ return{ entity:{ - month:new Date().getFullYear()+'-'+(new Date().getMonth() + 1), - laboratory:'' + month:new Date().getFullYear()+'-'+((new Date().getMonth() + 1) < 10 ? '0'+(new Date().getMonth() + 1):(new Date().getMonth() + 1)), + departLims:'', + name:'' }, tabValue:'evaluation', - laboratoryList:[] + laboratoryList:[], + outLoading:false, + copyEntity:null } }, - mounted(){ + created(){ this.obtainItemParameterList() }, methods: { - refreshTable(){}, - refresh(){}, + refreshTable(){ + this.$refs.component.refreshTable() + }, + refresh(){ + this.entity = this.HaveJson(this.copyEntity) + this.$refs.component.refresh() + }, obtainItemParameterList() { this.$axios.get(this.$api.laboratoryScope.obtainItemParameterList).then(res => { let data = [] res.data.forEach(a => { data.push({ label: a.laboratoryName, - value: a.id + value: a.laboratoryName }) }) this.laboratoryList = data - this.entity.laboratory = data[0].value + this.entity.departLims = data[0].value + this.copyEntity = this.HaveJson(this.entity) }) }, - getLaboratory(){ - return this.laboratoryList.find(a=>a.value==this.entity.laboratory) - } + handleDown(){ + let url = '' + let title = '' + if(this.tabValue=='evaluation'){ + url = this.$api.evaluate.exportEvaluate + title = '鑰冭瘎琛�' + }else if(this.tabValue=='employeeMutualEvaluation'){ + url = this.$api.evaluate.exportEvaluate + title = '鑰冭瘎琛�' + }else if(this.tabValue=='leaderRate'){ + url = this.$api.evaluate.exportEvaluateLeader + title = '缁勯暱璇勫垎琛�' + }else if(this.tabValue=='supervisorRate'){ + url = this.$api.evaluate.exportEvaluateCompetent + title = '涓荤璇勫垎琛�' + } + let entity = {...this.entity} + this.outLoading = true + this.$axios.post(url,{ + ...entity + },{responseType: "blob"}).then(res => { + this.outLoading = false + this.$message.success('瀵煎嚭鎴愬姛') + const blob = new Blob([res],{ type: 'application/octet-stream' }); + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = entity.departLims+'-'+entity.month+title+'.xlsx'; + link.click(); + }) + }, } } </script> -- Gitblit v1.9.3