소스 검색

优化号表控制功能和惠民活动功能的日期控件

hurugang 2 년 전
부모
커밋
945aad4063

+ 20 - 6
src/main/resources/static/js/charge/discount.js

@@ -42,6 +42,20 @@ $(function () {
         initDiscountList();
     }, 1200);
 
+    //日期控件注册
+    $('#discountBeginTime').datetimepicker({
+        language: 'zh-CN',
+        format: 'yyyy-mm-dd',
+        minView:"month",
+        autoclose: true,//选中自动关闭
+    });
+    //日期控件注册
+    $('#discountEndTime').datetimepicker({
+        language: 'zh-CN',
+        format: 'yyyy-mm-dd',
+        minView:"month",
+        autoclose: true,//选中自动关闭
+    });
 });
 
 /**
@@ -412,8 +426,8 @@ function updateDiscount(id) {
                     $("#deptNoParmas").selectpicker('val', arr);
                     $("#deptNoParmas").selectpicker('refresh');
                 }
-                $("#discountBeginTime").find("input").val(res.data.discountBeginTime);
-                $("#discountEndTime").find("input").val(res.data.discountEndTime);
+                $("#discountBeginTime").val(res.data.discountBeginTime);
+                $("#discountEndTime").val(res.data.discountEndTime);
                 if (res.data.chargeItemCodes != null && res.data.chargeItemCodes != '') {
                     var arr = res.data.chargeItemCodes.split(",");
                     $("#chargeItemCodesParams").selectpicker('val', arr);
@@ -547,8 +561,8 @@ $('#save').click(function () {
             "name": $("#nameParams").val(),
             "deptType": $("#deptTypeParams").val(),
             "deptNo": deptNoStr,
-            "discountBeginTime": $("#discountBeginTime").find("input").val(),
-            "discountEndTime": $("#discountEndTime").find("input").val(),
+            "discountBeginTime": $("#discountBeginTime").val(),
+            "discountEndTime": $("#discountEndTime").val(),
             "chargeItemCodes": chargeItemCodesStr,
             "discountType": $("#discountTypeParams").val(),
             "discountPrice": $("#discountPrice").val(),
@@ -581,8 +595,8 @@ function clearInput() {
     $("#deptTypeParams").selectpicker('refresh');
     $("#deptNoParmas").selectpicker('val', null);//默认选中
     $("#deptNoParmas").selectpicker('refresh');
-    $("#discountBeginTime").find("input").val(null);
-    $("#discountEndTime").find("input").val(null);
+    $("#discountBeginTime").val(null);
+    $("#discountEndTime").val(null);
     $("#chargeItemCodesParams").selectpicker('val', null);//默认选中
     $("#chargeItemCodesParams").selectpicker('refresh');
     $("#deleteFlagParams").selectpicker('val', 0);//默认选中

+ 56 - 49
src/main/resources/static/js/mz/request.js

@@ -72,56 +72,63 @@ $(function () {
     initDoctorSelect();
     initChargeType();
 
-    $("#editDay").change(function (e) {
-        var editDay = $("#editDay").val();
-        if (editDay.length == 8 && editDay.indexOf("-") <= 0) {
-            if (editDay.substring(4, 6) > 12) {
-                new PNotify({
-                    title: '错误提示',
-                    text: '号表日期错误,月份不能大于12',
-                    type: 'error',
-                    hide: true,
-                    styling: 'bootstrap3'
-                });
-                $("#editDay").val(null);
-                return;
-            }
-            if (editDay.substring(6) > 31) {
-                new PNotify({
-                    title: '错误提示',
-                    text: '号表日期错误,天数不能大于31',
-                    type: 'error',
-                    hide: true,
-                    styling: 'bootstrap3'
-                });
-                $("#editDay").val(null);
-                return;
-            }
-            editDay = editDay.substring(0, 4) + "-" + editDay.substring(4, 6) + "-" + editDay.substring(6);
-            $("#editDay").val(editDay);
-        }
-        var dateFormat = /^(\d{4})-(\d{2})-(\d{2})$/;
-        if (!dateFormat.test(editDay)) {
-            new PNotify({
-                title: '错误提示',
-                text: '号表日期错误',
-                type: 'error',
-                hide: true,
-                styling: 'bootstrap3'
-            });
-        }
-        var arr = editDay.split("-");
-        if (!checkDate(arr[0], arr[1], arr[2])) {
-            new PNotify({
-                title: '错误提示',
-                text: '表表日期错误',
-                type: 'error',
-                hide: true,
-                styling: 'bootstrap3'
-            });
-        }
-    });
+    // $("#editDay").change(function (e) {
+    //     var editDay = $("#editDay").val();
+    //     if (editDay.length == 8 && editDay.indexOf("-") <= 0) {
+    //         if (editDay.substring(4, 6) > 12) {
+    //             new PNotify({
+    //                 title: '错误提示',
+    //                 text: '号表日期错误,月份不能大于12',
+    //                 type: 'error',
+    //                 hide: true,
+    //                 styling: 'bootstrap3'
+    //             });
+    //             $("#editDay").val(null);
+    //             return;
+    //         }
+    //         if (editDay.substring(6) > 31) {
+    //             new PNotify({
+    //                 title: '错误提示',
+    //                 text: '号表日期错误,天数不能大于31',
+    //                 type: 'error',
+    //                 hide: true,
+    //                 styling: 'bootstrap3'
+    //             });
+    //             $("#editDay").val(null);
+    //             return;
+    //         }
+    //         editDay = editDay.substring(0, 4) + "-" + editDay.substring(4, 6) + "-" + editDay.substring(6);
+    //         $("#editDay").val(editDay);
+    //     }
+    //     var dateFormat = /^(\d{4})-(\d{2})-(\d{2})$/;
+    //     if (!dateFormat.test(editDay)) {
+    //         new PNotify({
+    //             title: '错误提示',
+    //             text: '号表日期错误',
+    //             type: 'error',
+    //             hide: true,
+    //             styling: 'bootstrap3'
+    //         });
+    //     }
+    //     var arr = editDay.split("-");
+    //     if (!checkDate(arr[0], arr[1], arr[2])) {
+    //         new PNotify({
+    //             title: '错误提示',
+    //             text: '表表日期错误',
+    //             type: 'error',
+    //             hide: true,
+    //             styling: 'bootstrap3'
+    //         });
+    //     }
+    // });
 
+    //挂号日期控件注册
+    $('#editDay').datetimepicker({
+        language: 'zh-CN',
+        format: 'yyyy-mm-dd',
+        minView:"month",
+        autoclose: true,//选中自动关闭
+    });
 });
 
 /**

+ 4 - 4
src/main/resources/templates/charge/discount.html

@@ -109,8 +109,8 @@
                                 </label>
                                 <div class="col-md-6 col-sm-6 col-xs-12">
                                     <div class="form-group">
-                                        <div class='input-group date' id='discountBeginTime'>
-                                            <input type='text' class="form-control"/>
+                                        <div class='input-group date' id='discountBeginTimeDiv'>
+                                            <input type='text' class="form-control" id='discountBeginTime'/>
                                             <span class="input-group-addon">
                                <span class="glyphicon glyphicon-calendar"></span>
                             </span>
@@ -123,8 +123,8 @@
                                 </label>
                                 <div class="col-md-6 col-sm-6 col-xs-12">
                                     <div class="form-group">
-                                        <div class='input-group date' id='discountEndTime'>
-                                            <input type='text' class="form-control"/>
+                                        <div class='input-group date' id='discountEndTimeDiv'>
+                                            <input type='text' class="form-control" id='discountEndTime'/>
                                             <span class="input-group-addon">
                                <span class="glyphicon glyphicon-calendar"></span>
                             </span>

+ 1 - 1
src/main/resources/templates/mz/request.html

@@ -111,7 +111,7 @@
             <div class="modal-body">
                 <form class="form-horizontal form-label-left" novalidate id="editUserForm" autocomplete="off">
                     <div class="item form-group thmz_alert">
-                        <label class="control-label col-md-4 col-sm-4 col-xs-12" for="editDayGroup">日期
+                        <label class="control-label col-md-4 col-sm-4 col-xs-12" for="editDay">日期
                             <span
                                     class="required">*</span>
                         </label>