value
2024-06-23 7345595fdb083a70e8c708dce246af34b2d7f69f
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>