gaodd il y a 2 ans
Parent
commit
d39ce66272

+ 32 - 64
src/main/resources/static/app/storage/drug/drugStatement/controller/drugStatementCtrl.js

@@ -6,75 +6,43 @@ angular.module('app.storage').controller("drugStatementCtrl", function ($scope,$
6 6
 	$scope.endTime = null;
7 7
     // 获取列表数据.
8 8
     $scope.loadData = function (time) {
9
-    	if(time == null){
10
-    		startTime = $("#startDate").val(); // 时间控件获取值
11
-        	endTime = $("#endDate").val(); // 时间控件获取值
9
+    	/*if(time == null){
10
+    		$scope.startTime = $("#startDate").val(); // 时间控件获取值
11
+    		$scope.endTime = $("#endDate").val(); // 时间控件获取值
12 12
     	}else{
13
+    		var tYear = new Date().getFullYear();
14
+    		
15
+    		$scope.startDate = new Date(tYear,0,1);
16
+    		$scope.endDate = new date();
17
+    		$scope.startTime = null;
18
+    		$scope.endTime = null;
19
+    	}*/
20
+    	
21
+    	if(time == 1 ){ //清空
22
+    		$scope.startTime = null;
23
+    		$scope.endTime = null;
13 24
     		$scope.startDate = null;
14
-    		$scope.endDate = null;
15
-    		startTime = null;
16
-    		endTime = null;
25
+    		$scope.endDate = null
26
+    		
27
+    	}else{
28
+    		$scope.startTime = $("#startDate").val(); // 时间控件获取值
29
+    		$scope.endTime = $("#endDate").val(); // 时间控件获取值
30
+    		if($scope.startTime == null || $scope.startTime == ""){
31
+        		$scope.startDate = new Date().getFullYear()+"-"+"01"+"-"+"01";
32
+    		}
33
+    		if($scope.endTime == null || $scope.endTime == ""){
34
+    			$scope.endDate = new Date().getFullYear()+"-"+(new Date().getMonth()+1)+"-"+new Date().getDate();
35
+    		}
17 36
     	}
18 37
     	
19
-    	drugStatementService.getList(startTime,endTime).then(function (data) {
38
+    	
39
+    	drugStatementService.getList($scope.startTime, $scope.endTime).then(function (data) {
20 40
     		
21 41
             $scope.statementList = data.data;
22 42
             
23 43
         }, function (data) {
24 44
             console.log(data);
25 45
         });
26
-    	
27
-    	/*$scope.statementList = 
28
-    		
29
-    		
30
-    		[
31
-    	        {
32
-    	            "storagecount": 170,
33
-    	            "drugKindCount": 1,
34
-    	            "deliverycount": 170,
35
-    	            "amount": 170,
36
-    	            "drugkind": 3024,
37
-    	            "shelfamount": 170,
38
-    	            "drugNameCount": 1,
39
-    	            "drugname": 3032,
40
-    	            "openingInventory": 0
41
-    	        },
42
-    	        {
43
-    	            "storagecount": 56,
44
-    	            "drugKindCount": 3,
45
-    	            "deliverycount": 62,
46
-    	            "amount": 170,
47
-    	            "drugspecificationunit": 5507,
48
-    	            "drugkind": 3025,
49
-    	            "shelfamount": 170,
50
-    	            "drugNameCount": 2,
51
-    	            "drugname": 3041,
52
-    	            "openingInventory": 6
53
-    	        },
54
-    	        {
55
-    	            "storagecount": 18,
56
-    	            "drugKindCount": 0,
57
-    	            "deliverycount": 18,
58
-    	            "amount": 33,
59
-    	            "drugkind": 3025,
60
-    	            "shelfamount": 33,
61
-    	            "drugNameCount": 0,
62
-    	            "drugname": 3041,
63
-    	            "openingInventory": 0
64
-    	        },
65
-    	        {
66
-    	            "storagecount": 30,
67
-    	            "drugKindCount": 0,
68
-    	            "deliverycount": 30,
69
-    	            "amount": 71,
70
-    	            "drugspecificationunit": 5505,
71
-    	            "drugkind": 3025,
72
-    	            "shelfamount": 71,
73
-    	            "drugNameCount": 1,
74
-    	            "drugname": 3044,
75
-    	            "openingInventory": 0
76
-    	        }
77
-    	        ]*/
78 46
     };
79 47
     $scope.loadData();
80 48
 
@@ -87,17 +55,17 @@ angular.module('app.storage').controller("drugStatementCtrl", function ($scope,$
87 55
   //打印
88 56
     $scope.preview = function (oper) { 
89 57
     	if (oper < 10){ 
90
-	    	  bdhtml=window.document.body.innerHTML;//获取当前页的html代码 
91
-	    	  sprnstr="<!--startprint"+oper+"-->";//设置打印开始区域 
92
-	    	  eprnstr="<!--endprint"+oper+"-->";//设置打印结束区域 
93
-	    	  prnhtml=bdhtml.substring(bdhtml.indexOf(sprnstr)+18); //从开始代码向后取html 
58
+	    	  var bdhtml=window.document.body.innerHTML;//获取当前页的html代码 
59
+	    	  var sprnstr="<!--startprint"+oper+"-->";//设置打印开始区域 
60
+	    	  var eprnstr="<!--endprint"+oper+"-->";//设置打印结束区域 
61
+	    	  var prnhtml=bdhtml.substring(bdhtml.indexOf(sprnstr)+18); //从开始代码向后取html 
94 62
 	    	  
95 63
 	    	  prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr));//从结束代码向前取html 
96 64
 	    	  window.document.body.innerHTML=prnhtml; 
97 65
 	    	  window.print(); 
98 66
 	    	  window.document.body.innerHTML=bdhtml; 
99 67
     	 }else{
100
-    		 window.print(); 
68
+    		 window.print();
101 69
     	 }
102 70
     	 
103 71
     }