From 81ff9b992ee1c5cd87bf82413d596117426fbc79 Mon Sep 17 00:00:00 2001
From: xiaoyi <908147524@qq.com>
Date: 星期四, 29 十月 2026 11:14:25 +0800
Subject: [PATCH] fix(safety): 特种作业证持证人改用员工选择器

---
 src/views/safety/cert/index.vue |   39 ++++++++++++++++++++++++---------------
 1 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/src/views/safety/cert/index.vue b/src/views/safety/cert/index.vue
index ae9c169..f5803d1 100644
--- a/src/views/safety/cert/index.vue
+++ b/src/views/safety/cert/index.vue
@@ -31,6 +31,7 @@
   getCertificatePage,
   updateCertificate,
 } from '#/api/safety';
+import HrmEmployeeSelect from '#/views/hrm/employee/components/select.vue';
 
 import { CERT_STATUS_COLOR, CERT_STATUS_OPTIONS, CERT_TYPE_OPTIONS } from '../shared';
 
@@ -48,9 +49,7 @@
 const formRef = ref<FormInstance>();
 
 const initial = (): SafetyApi.Certificate => ({
-  employeeName: '',
-  employeeNo: '',
-  deptName: '',
+  employeeId: undefined,
   certType: 'HIGH_VOLTAGE_OPERATION',
   certNo: '',
   issuer: '',
@@ -66,14 +65,14 @@
 const model = reactive<SafetyApi.Certificate>(initial());
 
 const rules = {
-  employeeName: [{ required: true, whitespace: true, message: '璇疯緭鍏ユ寔璇佷汉濮撳悕' }],
+  employeeId: [{ required: true, message: '璇烽�夋嫨鎸佽瘉浜�' }],
   certType: [{ required: true, message: '璇烽�夋嫨璇佷欢绫诲瀷' }],
   certNo: [{ required: true, whitespace: true, message: '璇疯緭鍏ヨ瘉浠剁紪鍙�' }],
   expireDate: [{ required: true, message: '璇烽�夋嫨鏈夋晥鏈熻嚦' }],
 };
 
 const columns = [
-  { title: '鎸佽瘉浜�', dataIndex: 'employeeName', width: 110, fixed: 'left' as const },
+  { title: '鎸佽瘉浜�', dataIndex: 'employeeName', width: 150, fixed: 'left' as const },
   { title: '閮ㄩ棬', dataIndex: 'deptName', width: 120 },
   { title: '璇佷欢绫诲瀷', dataIndex: 'certType', width: 160 },
   { title: '璇佷欢缂栧彿', dataIndex: 'certNo', width: 190 },
@@ -133,7 +132,6 @@
   try {
     const data = {
       ...model,
-      employeeName: model.employeeName.trim(),
       certNo: model.certNo.trim(),
     };
     await (data.id ? updateCertificate(data) : createCertificate(data));
@@ -167,6 +165,9 @@
       <Form :model="filters" layout="inline" class="safety-filters" @finish="load(true)">
         <FormItem label="鎸佽瘉浜�">
           <Input v-model:value="filters.employeeName" allow-clear placeholder="濮撳悕" style="width: 120px" />
+        </FormItem>
+        <FormItem label="宸ュ彿">
+          <Input v-model:value="filters.employeeNo" allow-clear placeholder="宸ュ彿" style="width: 120px" />
         </FormItem>
         <FormItem label="閮ㄩ棬">
           <Input v-model:value="filters.deptName" allow-clear placeholder="閮ㄩ棬" style="width: 130px" />
@@ -239,7 +240,18 @@
         @change="tableChange"
       >
         <template #bodyCell="{ column, record }">
-          <template v-if="column.dataIndex === 'certType'">
+          <template v-if="column.dataIndex === 'employeeName'">
+            <div class="flex flex-col">
+              <span class="font-medium">{{ record.employeeName || '-' }}</span>
+              <span class="text-muted-foreground font-mono text-xs">
+                {{ record.employeeNo || '' }}
+              </span>
+            </div>
+          </template>
+          <template v-else-if="column.dataIndex === 'deptName'">
+            {{ record.deptName || '-' }}
+          </template>
+          <template v-else-if="column.dataIndex === 'certType'">
             <Tag color="blue">{{ record.certTypeName }}</Tag>
           </template>
           <template v-else-if="column.dataIndex === 'remainingDays'">
@@ -306,14 +318,11 @@
         layout="vertical"
         class="safety-form"
       >
-        <FormItem label="鎸佽瘉浜哄鍚�" name="employeeName">
-          <Input v-model:value="model.employeeName" :maxlength="50" placeholder="璇疯緭鍏ュ鍚�" />
-        </FormItem>
-        <FormItem label="宸ュ彿" name="employeeNo">
-          <Input v-model:value="model.employeeNo" :maxlength="50" placeholder="閫夊~" />
-        </FormItem>
-        <FormItem label="鎵�灞為儴闂�" name="deptName">
-          <Input v-model:value="model.deptName" :maxlength="100" placeholder="濡� 鐢垫皵杞﹂棿" />
+        <FormItem label="鎸佽瘉浜�" name="employeeId" class="col-span-full">
+          <HrmEmployeeSelect v-model="model.employeeId" placeholder="浠庡憳宸ユ。妗堜腑閫夋嫨鎸佽瘉浜�" />
+          <div class="text-muted-foreground mt-1 text-xs">
+            鎸佽瘉浜烘潵鑷汉鍔涜祫婧愮殑鍛樺伐妗f锛屽鍚� / 宸ュ彿 / 閮ㄩ棬鑷姩甯﹀嚭锛屽憳宸ヨ皟宀楀悗鍙拌处浼氬悓姝ユ洿鏂般��
+          </div>
         </FormItem>
         <FormItem label="璇佷欢绫诲瀷" name="certType">
           <Select v-model:value="model.certType" :options="CERT_TYPE_OPTIONS" />

--
Gitblit v1.9.3