Browse Source

期新建及编辑提示修改

laiguoran 3 years ago
parent
commit
8d6288b70b
2 changed files with 18 additions and 0 deletions
  1. 9 0
      app/public/js/measure_stage.js
  2. 9 0
      app/view/measure/stage_modal.ejs

+ 9 - 0
app/public/js/measure_stage.js

@@ -182,6 +182,15 @@ function checkValidForm() {
         toastr.error('请选择开始-截止日期');
         toastr.error('请选择开始-截止日期');
         return false;
         return false;
     }
     }
+    const date = $('#add-qi input[name="date"]').val();
+    const period = $('#add-qi input[name="period"]').val();
+    const startDate = period.split('~')[0];
+    const endDate = period.split('~')[1];
+    if (startDate.indexOf(date) === -1 && endDate.indexOf(date) === -1) {
+        toastr.error('所选日期与当前月份不匹配,请重新选择');
+        $('#add-qi input[name="period"]').parents('.form-group').append('<small class="text-danger">所选日期与当前月份不匹配,请重新选择</small>');
+        return false;
+    }
     $('#add-stage-btn').attr('disabled', true);
     $('#add-stage-btn').attr('disabled', true);
     $('#hide-all').show();
     $('#hide-all').show();
     return true;
     return true;

+ 9 - 0
app/view/measure/stage_modal.ejs

@@ -139,6 +139,15 @@
             toastr.error('请选择开始-截止日期');
             toastr.error('请选择开始-截止日期');
             return false;
             return false;
         }
         }
+        const date = $('#edit-date').val();
+        const period = $('#edit-period').val();
+        const startDate = period.split('~')[0];
+        const endDate = period.split('~')[1];
+        if (startDate.indexOf(date) === -1 && endDate.indexOf(date) === -1) {
+            toastr.error('所选日期与当前月份不匹配,请重新选择');
+            $('#edit-period').parents('.form-group').append('<small class="text-danger">所选日期与当前月份不匹配,请重新选择</small>');
+            return false;
+        }
     };
     };
     <% } %>
     <% } %>
     $('.datepicker-here').datepicker({
     $('.datepicker-here').datepicker({