From 6ef9e5189ac1888b8c4c504d5c5d3f431807ff56 Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期六, 15 三月 2025 11:57:40 +0800
Subject: [PATCH] 修改电路试验单位
---
src/components/view/b3-personnel-evaluation.vue | 87 ++++++++++++++++++++++++++++++++++++-------
1 files changed, 72 insertions(+), 15 deletions(-)
diff --git a/src/components/view/b3-personnel-evaluation.vue b/src/components/view/b3-personnel-evaluation.vue
index 1e6910f..1b0e506 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,92 @@
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
+ const blob = new Blob([res],{ type: 'application/octet-stream' });
+ //灏咮lob 瀵硅薄杞崲鎴愬瓧绗︿覆
+ let reader = new FileReader();
+ reader.readAsText(blob, 'utf-8');
+ reader.onload = () => {
+ try {
+ let result = JSON.parse(reader.result);
+ if (result.message) {
+ this.$message.error(result.message);
+ } else {
+ const url = URL.createObjectURL(blob);
+ const link = document.createElement('a');
+ link.href = url;
+ link.download = entity.departLims+'-'+entity.month+title+'.xlsx';
+ link.click();
+ this.$message.success('瀵煎嚭鎴愬姛')
+ }
+ } catch (err) {
+ console.log(err);
+ const url = URL.createObjectURL(blob);
+ const link = document.createElement('a');
+ link.href = url;
+ link.download = entity.departLims+'-'+entity.month+title+'.xlsx';
+ link.click();
+ this.$message.success('瀵煎嚭鎴愬姛')
+ }
+ }
+ })
+ },
}
}
</script>
--
Gitblit v1.9.3