From e3686634452289d43e750a44f30f72b0e7754866 Mon Sep 17 00:00:00 2001
From: 吴羡 <16976746+Xian-TT3@user.noreply.gitee.com>
Date: 星期六, 07 十一月 2026 00:26:56 +0800
Subject: [PATCH] 修复人员管理模块各标签页问题并完善设备、文件受控页面

---
 src/views/CNAS/personnel/personnelInfo/components/AddInDetail.vue |   50 +++++++++++++++++++++++++++++++++++---------------
 1 files changed, 35 insertions(+), 15 deletions(-)

diff --git a/src/views/CNAS/personnel/personnelInfo/components/AddInDetail.vue b/src/views/CNAS/personnel/personnelInfo/components/AddInDetail.vue
index 1b2291b..dcdda3e 100644
--- a/src/views/CNAS/personnel/personnelInfo/components/AddInDetail.vue
+++ b/src/views/CNAS/personnel/personnelInfo/components/AddInDetail.vue
@@ -1,19 +1,20 @@
 <template>
   <div>
-    <el-dialog v-model="addTrainingPlanDia" title="鏂板鍩硅璁″垝" width="50%" @close="closeAdd">
+    <el-dialog v-model="addTrainingPlanDia" :title="operationType === 'edit' ? '缂栬緫鍩硅璁″垝' : '鏂板鍩硅璁″垝'" width="50%" @close="closeAdd">
       <div class="body">
         <el-form ref="trainingPlanForm" :model="trainingPlan" label-position="right" label-width="90px" :rules="trainingPlanRules">
           <el-row>
             <el-col :span="12">
               <el-form-item label="鍩硅鏃ユ湡:" prop="trainingDate">
-                <el-date-picker v-model="trainingPlan.trainingDate" format="YYYY-MM"
-                                placeholder="閫夋嫨鏃ユ湡" size="small" value-format="YYYY-MM"
-                                type="month" style="width: 100%"></el-date-picker>
+                <el-date-picker v-model="trainingPlan.trainingDate" format="YYYY-MM-DD"
+                                placeholder="閫夋嫨鏃ユ湡" size="small" value-format="YYYY-MM-DD"
+                                type="date" style="width: 100%"></el-date-picker>
               </el-form-item>
             </el-col>
             <el-col :span="12">
               <el-form-item label="璇炬椂:" prop="classHour">
-                <el-input type="number" v-model="trainingPlan.classHour" label="鎻忚堪鏂囧瓧" size="small"></el-input>
+                <el-input-number v-model="trainingPlan.classHour" :min="0" :max="9999" :precision="0"
+                                 controls-position="right" size="small" style="width: 100%"></el-input-number>
               </el-form-item>
             </el-col>
             <el-col :span="12">
@@ -101,11 +102,11 @@
         planId: '',
         id: '',
         trainingDate: '',
-        classHour: '',
+        classHour: null,
         trainingObjectives: '',
         participants: '',
         trainingContent: '',
-        trainingLecturerId: '',
+        trainingLecturerId: null,
         trainingLecturerName: '',
         trainingMode: '',
         holdingDepartment: '',
@@ -126,17 +127,22 @@
       this.operationType = type
       if (this.operationType === 'edit') {
         this.trainingPlan = this.HaveJson(row)
+        // 鍘嗗彶鏁版嵁鍙兘鍙瓨浜嗗勾鏈堬紝琛ラ綈鍒板綋鏈�1鏃ワ紝閬垮厤鏃ユ湡鎺т欢鏃犳硶鍥炴樉
+        if (this.trainingPlan.trainingDate && /^\d{4}-\d{2}$/.test(this.trainingPlan.trainingDate)) {
+          this.trainingPlan.trainingDate += '-01'
+        }
         this.lecturerType = row.trainingLecturerId ? 'internal' : (row.trainingLecturerName ? 'external' : 'internal')
       } else {
         this.lecturerType = 'internal'
         this.trainingPlan = {
           id: '',
           trainingDate: '',
-          classHour: '',
+          classHour: null,
           trainingObjectives: '',
           participants: '',
           trainingContent: '',
-          trainingLecturerId: '',
+          trainingLecturerId: null,
+          trainingLecturerName: '',
           trainingMode: '',
           holdingDepartment: '',
           remarks: '',
@@ -144,6 +150,9 @@
       }
       this.trainingPlan.planId = id
       this.getUserList()
+      this.$nextTick(() => {
+        this.$refs.trainingPlanForm && this.$refs.trainingPlanForm.clearValidate()
+      })
     },
     handleLecturerTypeChange(type) {
       if (type === 'internal') {
@@ -172,15 +181,20 @@
             this.trainingPlan.trainingLecturerName = null
           }
           this.submitAddLoading = true
-          this.trainingPlan.planId = this.currentChangeRow.id
+          if (!this.trainingPlan.planId) {
+            this.trainingPlan.planId = this.currentChangeRow.id
+          }
           const personTrainingDetailed = this.trainingPlan
           addOrUpdatePersonTrainingDetailed(personTrainingDetailed).then(res => {
-            this.submitAddLoading = false
             if (res.code == 200) {
               this.$message.success('鎻愪氦鎴愬姛');
               this.closeAdd();
+            } else {
+              this.$message.error(res.msg || '鎻愪氦澶辫触')
             }
           }).catch(() => {
+            this.$message.error('鎻愪氦澶辫触')
+          }).finally(() => {
             this.submitAddLoading = false
           })
         }
@@ -188,16 +202,22 @@
     },
     // 鍏抽棴寮规
     closeAdd() {
-      this.$refs['trainingPlanForm'].resetFields();
+      if (this.$refs['trainingPlanForm']) {
+        this.$refs['trainingPlanForm'].resetFields();
+      }
       this.$emit('search')
       this.addTrainingPlanDia = false;
     },
-    // 鑾峰彇璐熻矗浜轰俊鎭帴鍙�
+    // 鑾峰彇璁插笀鍊欓�変汉锛堝叏绯荤粺浜哄憳锛屼笉闄愭湰閮ㄩ棬锛�
     getUserList() {
-      selectUserCondition({type: 2}).then(res => {
+      selectUserCondition({ isCustom: 0 }).then(res => {
         if (res.code == 200) {
-          this.responsibleOptions = res.data
+          this.responsibleOptions = Array.isArray(res.data) ? res.data : []
+        } else {
+          this.responsibleOptions = []
         }
+      }).catch(() => {
+        this.responsibleOptions = []
       })
     },
   },

--
Gitblit v1.9.3