From c3bb35b20d6e076f73a1cad50fd6b9b94ca399a7 Mon Sep 17 00:00:00 2001
From: zhouwx <1175765986@qq.com>
Date: 星期一, 06 一月 2025 16:15:05 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/views/notCoalMine/nPeopleManage/index.vue |   49 ++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 38 insertions(+), 11 deletions(-)

diff --git a/src/views/notCoalMine/nPeopleManage/index.vue b/src/views/notCoalMine/nPeopleManage/index.vue
index 0ff7c4b..0dd1e86 100644
--- a/src/views/notCoalMine/nPeopleManage/index.vue
+++ b/src/views/notCoalMine/nPeopleManage/index.vue
@@ -41,10 +41,14 @@
       <el-table-column label="姓名" align="center" prop="name" />
       <el-table-column label="性别" align="center" prop="sex">
         <template #default="scope">
-          {{ scope.row.sex == 0?'男':'女' }}
+          {{ scope.row.sex == 0?'男':scope.row.sex == 1?'女':'未知' }}
         </template>
       </el-table-column>
-      <el-table-column label="身份证号" align="center" prop="idCardNum" />
+      <el-table-column label="身份证号" align="center" prop="idCardNum">
+        <template #default="scope">
+          {{scope.row.idCardNum | peridcardtm}}
+        </template>
+      </el-table-column>
       <el-table-column label="电话" align="center" prop="phone"/>
       <el-table-column label="民族" align="center" prop="nationCode">
         <template #default="scope">
@@ -59,7 +63,7 @@
       <el-table-column label="最高学历" align="center" prop="highestEducation"/>
       <el-table-column label="作业证书" align="center" prop="certCount">
         <template #default="scope">
-          <el-button v-if="scope.row.certCount>0" type="text">{{ scope.row.certCount }}</el-button>
+          <el-button v-if="scope.row.certCount>0" type="text" @click="openCert(scope.row)">{{ scope.row.certCount }}</el-button>
           <span v-else>{{scope.row.certCount}}</span>
         </template>
       </el-table-column>
@@ -67,7 +71,8 @@
       <el-table-column label="违章次数" align="center" prop="violationCount"/>
       <el-table-column label="证件照片" align="center" prop="photoPath">
         <template #default="scope">
-          <el-button type="text" @click="viewFile(scope.row.photoPath)">预览</el-button>
+          <el-button type="text" v-if="scope.row.photoPath && scope.row.photoPath !==''" @click="viewFile(scope.row.photoPath)">预览</el-button>
+          <span type="text" v-else>暂无</span>
         </template>
       </el-table-column>
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
@@ -95,6 +100,7 @@
       @pagination="getPage"
     />
     <peopleDialog ref="peopleDialog"></peopleDialog>
+    <certDialog ref="certDialog" @closeDialog="resetQuery"></certDialog>
   </div>
 </template>
 
@@ -103,11 +109,11 @@
 import peopleDialog from "./components/peopleDialog";
 import axios from "axios";
 import {getToken} from "@/utils/auth";
-
+import certDialog from "@/views/notCoalMine/nPeopleManage/components/certDialog"
 export default {
   name: "nPeopleManage",
   dicts: ['sys_nation_code'],
-  components: { peopleDialog },
+  components: { peopleDialog, certDialog },
   data() {
     return {
       loading: false,
@@ -147,7 +153,7 @@
       if(obj){
         return obj.label
       }else{
-        return '无'
+        return '未知'
       }
     },
     openPeople(data,type){
@@ -161,14 +167,24 @@
       this.getPage()
     },
     resetQuery(){
-      this.$refs['queryForm'].resetFields()
+      this.queryParams={
+        idCardNum: '',
+        name: '',
+        pageNum: 1,
+        pageSize: 10
+      }
       this.getPage()
     },
     handleAdd(){
 
     },
     viewFile(file){
-      axios.get(process.env.VUE_APP_BASE_API + file,{headers:{'Content-Type': 'application/json','Authorization': "Bearer " + getToken()},responseType: 'blob'}).then(res=>{
+      const t = this
+      if(file.substring(0, 1) !== '/'){
+        t.$message.error('无效的图片地址')
+        return
+      }
+      axios.get(process.env.VUE_APP_BASE_API + file,{headers:{'Content-Type': 'application/json','Authorization': "Bearer " + getToken()},responseType: 'blob',timeout: 3000}).then(res=>{
         if (res) {
           const link = document.createElement('a')
           let blob = new Blob([res.data],{type: res.data.type})
@@ -176,10 +192,21 @@
           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('获取文件失败')
+        // }else if(err == 'Error: Request failed with status code 404'){
+        //   t.$message.error('获取文件失败')
+        // }else{
+          t.$message.error(err)
+        // }
       })
-    }
+    },
+    openCert(data){
+      this.$refs.certDialog.openDialog(data)
+    },
   }
 };
 </script>

--
Gitblit v1.9.2