马宇豪
2023-10-13 cabf58ac1a2356a9f0296d957191fefde333f58b
src/views/coalMine/cPeopleManage/index.vue
@@ -44,14 +44,22 @@
          {{ scope.row.sex == 0?'男':'女' }}
        </template>
      </el-table-column>
      <el-table-column label="身份证号" align="center" prop="code" />
      <el-table-column label="身份证号" align="center" prop="code">
        <template #default="scope">
          {{scope.row.code | peridcardtm}}
        </template>
      </el-table-column>
      <el-table-column label="电话" align="center" prop="mobilePhone"/>
      <el-table-column label="民族" align="center" prop="nationCode">
        <template #default="scope">
          {{getNationName(scope.row.nationCode)}}
        </template>
      </el-table-column>
      <el-table-column label="最高学历" align="center" prop="eduLevel"/>
      <el-table-column label="最高学历" align="center" prop="eduLevel">
        <template #default="scope">
          {{getDegreeName(scope.row.eduLevel)}}
        </template>
      </el-table-column>
      <el-table-column label="证件照片" align="center" prop="photoPath">
        <template #default="scope">
          <el-button type="text" @click="viewFile(scope.row.photoAttachment)">预览</el-button>
@@ -114,7 +122,7 @@
import { getToken } from "@/utils/auth";
export default {
  name: "cPeopleManage",
  dicts: ['sys_nation_code'],
  dicts: ['sys_nation_code','sys_highest_education_code'],
  components: { peopleDialog, experienceDialog, certDialog, trainDialog, examDialog },
  data() {
    return {
@@ -155,7 +163,15 @@
      if(obj){
        return obj.label
      }else{
        return '无'
        return '未知'
      }
    },
    getDegreeName(code){
      let obj = JSON.parse(JSON.stringify(this.dict.type.sys_highest_education_code)).find(i=>i.value == code)
      if(obj){
        return obj.label
      }else{
        return '未知'
      }
    },
    openPeople(data,type){
@@ -203,22 +219,32 @@
      this.getPage()
    },
    resetQuery(){
      this.$refs['queryForm'].resetFields()
      this.queryParams = {
        code: '',
        name: '',
        pageNum: 1,
        pageSize: 10
      }
      this.getPage()
    },
    handleAdd(){
    },
    viewFile(file){
      const t = this
      axios.get(process.env.VUE_APP_BASE_API + file.fileUrl,{headers:{'Content-Type': 'application/json','Authorization': "Bearer " + getToken()},responseType: 'blob'}).then(res=>{
        if (res) {
        if (res && res.data) {
          const link = document.createElement('a')
          let blob = new Blob([res.data],{type: res.data.type})
          link.style.display = "none";
          link.href = URL.createObjectURL(blob); // 创建URL
          window.open(link.href)
        } else {
          this.$message.error('获取文件失败')
          t.$message.error('获取文件失败')
        }
      }).catch(function(err){
        if(err == 'Error: Network Error'){
          t.$message.error('获取文件失败,请重新上传')
        }
        if(err == 'Error: Request failed with status code 404'){
          t.$message.error('获取文件失败,请重新上传')
        }
      })
    },