zlwu hai 1 ano
pai
achega
3aa593bfa1

+ 48 - 9
web/src/views/xskh/assessmentApplication/AssessmentApplicationForm.vue

@@ -1000,7 +1000,7 @@ const openDialog = async (id?: string | number, title?: string, schedule?: Asses
   dialog.title = title || '提交考核申请';
 
   // 重置表单
-  Object.assign(form.value, initFormData);
+  resetFormData();
 
   if (schedule) {
     data.currentSchedule = schedule;
@@ -1123,6 +1123,25 @@ const openDialog = async (id?: string | number, title?: string, schedule?: Asses
           pageLoading.value = false;
 
           return; // 直接返回,不再加载指标数据
+        } else {
+          // 用户没有申请记录,确保清空所有数据
+          console.log('用户没有申请记录,清空所有数据');
+          // 重新重置表单,确保附加分模块数据被清空
+          resetFormData();
+          // 重新设置考核计划信息
+          if (schedule) {
+            data.currentSchedule = schedule;
+            form.value.scheduleId = schedule.id;
+            form.value.scheduleName = schedule.scheduleName;
+            form.value.startTime = schedule.startTime;
+            form.value.endTime = schedule.endTime;
+            // 重新获取学生信息
+            await getCurrentUserStudentInfo();
+          }
+          // 确保附加分模块数据被清空
+          form.value.bonusApprovalList = [];
+          // 确保自评得分列表也被清空,等待重新加载
+          form.value.selfScoreList = [];
         }
       }
     } catch (error) {
@@ -1142,6 +1161,18 @@ const openDialog = async (id?: string | number, title?: string, schedule?: Asses
   }
 };
 
+/** 重置表单数据 */
+const resetFormData = () => {
+  // 重置表单数据
+  Object.assign(form.value, initFormData);
+  // 重置当前考核计划
+  data.currentSchedule = null;
+  // 重置表单验证状态
+  assessmentApplicationFormRef.value?.resetFields();
+  // 重置页面加载状态
+  pageLoading.value = false;
+};
+
 /** 安全转换ID字段,保持精度 */
 const safeConvertId = (id: string | number | undefined): string | undefined => {
   if (id === undefined || id === null) return undefined;
@@ -1191,6 +1222,8 @@ const handleSave = async () => {
           ElMessage.success('保存成功');
         }
         dialog.visible = false;
+        // 重置表单数据,确保下次打开时没有残留数据
+        resetFormData();
         emit('success');
       } catch (error) {
         console.error('保存失败:', error);
@@ -1251,6 +1284,8 @@ const handleSubmit = async () => {
           }
         }
         dialog.visible = false;
+        // 重置表单数据,确保下次打开时没有残留数据
+        resetFormData();
         emit('success');
       } catch (error) {
         console.error('提交失败:', error);
@@ -1274,6 +1309,8 @@ const handleDelete = async () => {
     await deleteAssessmentApplication(safeConvertId(form.value.id));
     ElMessage.success('删除成功');
     dialog.visible = false;
+    // 重置表单数据,确保下次打开时没有残留数据
+    resetFormData();
     emit('success');
   } catch (error) {
     if (error !== 'cancel') {
@@ -1285,6 +1322,8 @@ const handleDelete = async () => {
 /** 取消按钮 */
 const cancel = () => {
   dialog.visible = false;
+  // 重置表单数据,确保下次打开时没有残留数据
+  resetFormData();
 };
 
 /** 根据状态获取标签类型 */
@@ -1772,14 +1811,14 @@ defineExpose({
   cursor: pointer !important;
   z-index: 10 !important;
   position: relative !important;
-  background-color: #67c23a !important;
-  border-color: #67c23a !important;
-  color: #ffffff !important;
+  /* background-color: #67c23a !important; */
+  /* border-color: #67c23a !important; */
+  /* color: #ffffff !important; */
 }
 
 .view-mode .download-btn:hover {
-  background-color: #85ce61 !important;
-  border-color: #85ce61 !important;
+  /* background-color: #85ce61 !important; */
+  /* border-color: #85ce61 !important; */
 }
 
 /* 查看模式下禁用按钮的样式覆盖 */
@@ -1787,9 +1826,9 @@ defineExpose({
   pointer-events: auto !important;
   opacity: 1 !important;
   cursor: pointer !important;
-  background-color: #67c23a !important;
-  border-color: #67c23a !important;
-  color: #ffffff !important;
+  /* background-color: #67c23a !important; */
+  /* border-color: #67c23a !important; */
+  /* color: #ffffff !important; */
 }
 
 /* 查看模式下禁用按钮的悬停样式 */

+ 2 - 2
web/src/views/xskh/assessmentApproval/AssessmentApprovalForm.vue

@@ -220,7 +220,7 @@
                                 >
                                   <el-icon><Download /></el-icon>
                                 </el-button>
-                                <el-button type="danger" @click.stop="handleRemoveAttachmentConfirm(file, item)" title="删除">
+                                <el-button v-if="!isViewMode" type="danger" @click.stop="handleRemoveAttachmentConfirm(file, item)" title="删除">
                                   <el-icon><Delete /></el-icon>
                                 </el-button>
                               </el-button-group>
@@ -1249,7 +1249,7 @@ defineExpose({
   background: #fafafa;
   border-top: 1px solid #f0f0f0;
   transition: all 0.3s;
-  height: 28px;
+  height: 34px;
 }
 
 .upload-file-card-actions .el-button-group {