ouyj 2 ヶ月 前
コミット
bc3cb23372
1 ファイル変更11 行追加9 行削除
  1. 11 9
      pages/score/detail/selfEvaluate.uvue

+ 11 - 9
pages/score/detail/selfEvaluate.uvue

@@ -296,7 +296,7 @@ const selfEvaluationForm = ref<SelfEvaluationFormData>({
   model: null as string | null,
   workSummary: '',
   extraWork: '',
-  maintenanceType: null,
+  maintenanceType: '',
   inspectionType: [],
   itemCompletionFactor: null,
   itemCompletionFactorSum: null,
@@ -663,8 +663,7 @@ function validateField(fieldName: string, value: any): string | null {
       return `${summaryType}总结不能为空`;
     }
   } else if (fieldName == 'maintenanceType') {
-    // 验证检修类型
-    console.log('验证检修类型,当前值:', value, '类型:', typeof value, '是否为null:', value == null, '是否为空字符串:', value == '');
+    // 验证检修类型 
     if (value == null || value == '') {
       return "请选择检修类型";
     }
@@ -1116,7 +1115,7 @@ async function loadOrderDetail() {
         pcsStationName: (data.get('pcsStationName') as string | null) ?? '',
         workSummary: orderType.value == '1' ? ((data.get('content') as string | null) ?? '') : ((data.get('realContent') as string | null) ?? ''),
           extraWork: orderType.value == '1' ? ((data.get('extraWork') as string | null) ?? '') : '',
-        maintenanceType: (data.get('maintenanceType') as string | null),
+        maintenanceType: (data.get('maintenanceType') as string | null) ?? '',
         model: (data.get('model') as string | null),  // 风机型号
         inspectionType: orderType.value == '2' ? 
           (Array.isArray(data.get('inspectionType')) ? 
@@ -1621,10 +1620,13 @@ async function submitSelfEvaluationForm(): Promise<void> {
     console.log('验证结果类型:', typeof isValid, '是否为false:', isValid == false);
     if (!isValid) { 
       console.log('验证失败,显示错误:', validationMsg);
-      uni.showToast({
-        title: validationMsg,
-        icon: 'none'
-      });
+      // 在iOS平台中,有时需要稍作延迟才能正确显示toast
+      setTimeout(() => {
+        uni.showToast({
+          title: validationMsg,
+          icon: 'none'
+        });
+      }, 50);
       return;
     }
     
@@ -1665,7 +1667,7 @@ async function submitSelfEvaluationForm(): Promise<void> {
         scorePersonListArray.push(person);
       } 
       formValue.set('scorePersonList', scorePersonListArray);
-      
+
       const response: any = await submitSelfEvaluation(formValue);
     
     const resultObj = response as UTSJSONObject