Browse Source

出入库时间选择问题

yangc 7 years ago
parent
commit
af13f1ba35

+ 25 - 25
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_storageCtrl.js

@@ -90,8 +90,8 @@ define([ 'app/app' ], function(app) {
             $scope.type = $scope.storage_tab === 'inBound'? 'INBOUND' : 'OUTBOUND'
             $scope.selfSupport = $scope.storage_tab === 'inBound'? $scope.boundType.INBOUND : $scope.boundType.OUTBOUND;
             var currentTime = _getClearDay(new Date());
-            var endDate = new Date(currentTime + 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000);
-            $scope.startDate = new Date(currentTime - 30 * 24 * 60 * 60 * 1000);
+            var endDate = currentTime + 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000;
+            $scope.startDate = currentTime - 30 * 24 * 60 * 60 * 1000;
             $scope.endDate = endDate;
         };
         clearRecordParams();
@@ -163,15 +163,15 @@ define([ 'app/app' ], function(app) {
             if (type === 'dateArea') {
                 // 时间筛选
                 var currentTime = _getClearDay(new Date());
-                var endDate = new Date(currentTime + 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000);
+                var endDate = currentTime + 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000;
                 if (val === 'oneMonth') {
-                    $scope.startDate = new Date(currentTime - 30 * 24 * 60 * 60 * 1000);
+                    $scope.startDate = currentTime - 30 * 24 * 60 * 60 * 1000;
                     $scope.endDate = endDate;
                 } else if (val === 'threeMonth') {
-                    $scope.startDate = new Date(currentTime - 3 * 30 * 24 * 60 * 60 * 1000);
+                    $scope.startDate = currentTime - 3 * 30 * 24 * 60 * 60 * 1000;
                     $scope.endDate = endDate;
                 } else if (val === 'sixMonth') {
-                    $scope.startDate = new Date(currentTime - 6 * 30 * 24 * 60 * 60 * 1000);
+                    $scope.startDate = currentTime - 6 * 30 * 24 * 60 * 60 * 1000;
                     $scope.endDate = endDate;
                 } else {
                     $scope.startDate = null;
@@ -203,21 +203,21 @@ define([ 'app/app' ], function(app) {
         };
 
         // 日期选择框选择时间显示
-        $scope.onDateCondition = function (bool) {
-          var startTime = $scope.startDate ? $scope.startDate.getTime() : null;
-          var endTime = $scope.endDate ? $scope.endDate.getTime() : null;
-          if (startTime && endTime && startTime > endTime) {
-              if (bool === 1) {
-                  toaster.pop('info', '起始时间不能大于结束时间')
-                  $scope.startDate = null;
-              } else {
-                  toaster.pop('info', '结束时间不能小于起始时间');
-                  $scope.endDate = null;
-              }
-          }
-          if ($scope.endDate && bool === 2) {
-              $scope.endDate = new Date($scope.endDate.getTime() + 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000);
-          }
+        $scope.onDateCondition = function (bool, autoStartDate, autoEndDate) {
+            $scope.startDate = autoStartDate ? autoStartDate.getTime() : null;
+            $scope.endDate = autoEndDate ? autoEndDate.getTime() + 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000 : null;
+            if ($scope.startDate && $scope.endDate && $scope.startDate > $scope.endDate) {
+                if (bool === 1) {
+                    toaster.pop('info', '起始时间不能大于结束时间')
+                    $scope.startDate = null;
+                } else {
+                    toaster.pop('info', '结束时间不能小于起始时间');
+                    $scope.endDate = null;
+                }
+            }
+            /*   if ($scope.endDate && bool === 2) {
+             $scope.endDate = $scope.endDate + 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000;
+             }*/
             getLoadStorageData();
         };
 
@@ -250,11 +250,11 @@ define([ 'app/app' ], function(app) {
                     if($scope.storage_tab === 'outBound' && $scope.handleItem === 2) {
                         param.sorting = {"createtime":"DESC"};
                         param.status = '502-406';
-                        param.startMils = $scope.startDate ? $scope.startDate.getTime() : null;
-                        param.endMils = $scope.endDate ? $scope.endDate.getTime() : null;
+                        param.startMils = $scope.startDate;
+                        param.endMils = $scope.endDate;
                     } else {
-                        param.fromDate = $scope.startDate ? $scope.startDate.getTime() : null;
-                        param.toDate = $scope.endDate ? $scope.endDate.getTime() : null;
+                        param.fromDate = $scope.startDate;
+                        param.toDate = $scope.endDate;
                     }
                     if ($scope.handleItem !== 1) {
                         Goods[getUrl()](param, function(data) {

+ 2 - 2
src/main/webapp/resources/view/vendor/forstore/vendor_storage.html

@@ -1196,7 +1196,7 @@
                                current-text="今天" clear-text="清除" close-text="关闭"
                                datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"
                                ng-click="openDatePicker($event, condition, 0,1)"
-                               ng-change="onDateCondition(1)"/>
+                               ng-change="onDateCondition(1, startDate, endDate)"/>
                         <button class="open" ng-click="openDatePicker($event, condition, 0)"></button>
                     </div>
 
@@ -1209,7 +1209,7 @@
                                current-text="今天" clear-text="清除" close-text="关闭"
                                datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"
                                ng-click="openDatePicker($event, condition, 1, 2)"
-                               ng-change="onDateCondition(2)"/>
+                               ng-change="onDateCondition(2, startDate, endDate)"/>
                         <button class="open" ng-click="openDatePicker($event, condition, 1)"></button>
                     </div>
                 </div>