Просмотр исходного кода

时间筛选

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@1173 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
suntg 10 лет назад
Родитель
Сommit
1db49eedf8

+ 56 - 1
src/main/webapp/resources/js/index/app.js

@@ -631,6 +631,23 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 		}
 		return fn;
 	};
+	
+	var getDateCondition = function(zone, condition) {
+		var date = new Date();
+		if(zone == 1) {
+			date.setMonth(date.getMonth() - 1);
+			condition.dateFrom = date;
+			condition.dateTo = null;
+		} else if (zone == 6) {
+			date.setMonth(date.getMonth() - 6);
+			condition.dateFrom = date;
+			condition.dateTo = null;
+		} else {
+			condition.dateFrom = null;
+			condition.dateTo = null;
+		}
+	};
+	
 	app.controller('SaleOrderCtrl', ['$scope', '$filter', 'PurcOrderItem', 'PurcOrder', 'ngTableParams', 'toaster', 'ReportService', 'BaseService', 'PurcOrderItemHis',
 	   function($scope, $filter, PurcOrderItem, PurcOrder, ngTableParams, toaster, ReportService, BaseService, PurcOrderItemHis){
 		$scope.active = 'todo';
@@ -640,6 +657,8 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 			$scope.condition.dateZone = zone;
 			$scope.dateZoneText = typeof zone == 'undefined' ? '半年前' : (zone == 1 ? '一个月内' : '半年内');
 			$scope.condition.$dateZoneOpen = false;
+			getDateCondition(zone, $scope.condition);
+			$scope.tableParams.reload();
 		};
 		$scope.setActive = function(state) {
 			if($scope.active != state) {
@@ -667,12 +686,16 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 				$scope.loading = true;
 				var pageParams = params.url();
 				pageParams.keyword = $scope.keyword;
+				pageParams.fromDate = $scope.condition.dateFrom ? $scope.condition.dateFrom.getTime() : null;
+				pageParams.endDate = $scope.condition.dateTo ? $scope.condition.dateTo.getTime() : null;
 				getService()[getState($scope.active)].call(null, BaseService.parseParams(pageParams), function(page){
 					$scope.loading = false;
 					if(page) {
 						params.total(page.totalElements);
 						$defer.resolve(page.content);
 						$scope.keywordXls = angular.copy($scope.keyword);//保存当前取值的关键词
+						$scope.fromDateXls = angular.copy($scope.condition.dateFrom ? $scope.condition.dateFrom.getTime() : null);//保存当前取值的起始日期
+						$scope.endDateXls = angular.copy($scope.condition.dateTo ? $scope.condition.dateTo.getTime() : null);//保存当前取值的截止日期
 					}
 				}, function(response){
 					$scope.loading = false;
@@ -793,6 +816,10 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 		$scope.onSearch = function() {
 			$scope.tableParams.reload();
 		};
+		// 选择查找日期
+		$scope.onDateCondition = function(){
+			$scope.tableParams.reload();
+		};
 		//设置为已查看
 		$scope.setDisplay = function(state, orderId) {
 			if(orderId) {//设置单个
@@ -1572,13 +1599,16 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 			getData : function($defer, params) {
 				$scope.loading = true;
 				var pageParams = params.url();
-				pageParams.keyword = $scope.keyword;
+				pageParams.keyword = $scope.keyword;pageParams.fromDate = $scope.condition.dateFrom ? $scope.condition.dateFrom.getTime() : null;
+				pageParams.endDate = $scope.condition.dateTo ? $scope.condition.dateTo.getTime() : null;
 				getService()[getState($scope.active)].call(null, BaseService.parseParams(pageParams), function(page){
 					$scope.loading = false;
 					if(page) {
 						params.total(page.totalElements);
 						$defer.resolve(page.content);
 						$scope.keywordXls = angular.copy($scope.keyword);//保存当前取值的关键词
+						$scope.fromDateXls = angular.copy($scope.condition.dateFrom ? $scope.condition.dateFrom.getTime() : null);//保存当前取值的起始日期
+						$scope.endDateXls = angular.copy($scope.condition.dateTo ? $scope.condition.dateTo.getTime() : null);//保存当前取值的截止日期
 					}
 				}, function(response){
 					$scope.loading = false;
@@ -1692,6 +1722,11 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 			$scope.tableParams.reload();
 		};
 		
+		// 选择查找日期
+		$scope.onDateCondition = function(){
+			$scope.tableParams.reload();
+		};
+		
 		//货车功能
 		var truck = $rootScope.truck;
 		if(!truck) {
@@ -1832,12 +1867,16 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 				$scope.loading = true;
 				var pageParams = params.url();
 				pageParams.keyword = $scope.keyword;
+				pageParams.fromDate = $scope.condition.dateFrom ? $scope.condition.dateFrom.getTime() : null;
+				pageParams.endDate = $scope.condition.dateTo ? $scope.condition.dateTo.getTime() : null;
 				getService()[getState($scope.active)].call(null, BaseService.parseParams(pageParams), function(page){
 					$scope.loading = false;
 					if(page) {
 						params.total(page.totalElements);
 						$defer.resolve(page.content);
 						$scope.keywordXls = angular.copy($scope.keyword);//保存当前取值的关键词
+						$scope.fromDateXls = angular.copy($scope.condition.dateFrom ? $scope.condition.dateFrom.getTime() : null);//保存当前取值的起始日期
+						$scope.endDateXls = angular.copy($scope.condition.dateTo ? $scope.condition.dateTo.getTime() : null);//保存当前取值的截止日期
 					}
 				}, function(response){
 					$scope.loading = false;
@@ -1857,6 +1896,11 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 			$scope.tableParams.reload();
 		};
 		
+		// 选择查找日期
+		$scope.onDateCondition = function(){
+			$scope.tableParams.reload();
+		};
+		
 	}]);
 	
 	/**
@@ -2539,12 +2583,16 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 				$scope.loading = true;
 				var pageParams = params.url();
 				pageParams.keyword = $scope.keyword;
+				pageParams.fromDate = $scope.condition.dateFrom ? $scope.condition.dateFrom.getTime() : null;
+				pageParams.endDate = $scope.condition.dateTo ? $scope.condition.dateTo.getTime() : null;
 				getService()[getState($scope.active)].call(null, BaseService.parseParams(pageParams), function(page){
 					$scope.loading = false;
 					if(page) {
 						params.total(page.totalElements);
 						$defer.resolve(page.content);
 						$scope.keywordXls = angular.copy($scope.keyword);//保存当前取值的关键词
+						$scope.fromDateXls = angular.copy($scope.condition.dateFrom ? $scope.condition.dateFrom.getTime() : null);//保存当前取值的起始日期
+						$scope.endDateXls = angular.copy($scope.condition.dateTo ? $scope.condition.dateTo.getTime() : null);//保存当前取值的截止日期
 					}
 				}, function(response){
 					$scope.loading = false;
@@ -2564,6 +2612,11 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 			$scope.tableParams.reload();
 		};
 		
+		// 选择查找日期
+		$scope.onDateCondition = function(){
+			$scope.tableParams.reload();
+		};
+		
 	}]);
 	
 	app.controller('EnterpriseCtrl', ['$scope', 'AccountEnterprise', function($scope, AccountEnterprise){
@@ -3109,5 +3162,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 			}
 		};
 	}]);
+	
+	
 	return app;
 });

+ 8 - 6
src/main/webapp/resources/tpl/index/fa/apBill.html

@@ -131,7 +131,7 @@
 		<div class="more" ng-class="{'open': condition.$open}">
 			<form class="form-inline">
 			  <div class="form-group ">
-			    <label>日期:</label>
+			    <label>发票日期:</label>
 			    <div class="btn-group btn-menu" dropdown is-open="condition.$dateZoneOpen">
 				  <button type="button" style="width: 85px;" class="btn btn-default btn-xs dropdown-toggle">
 				    	{{dateZoneText}}<i class="fa fa-fw fa-angle-down icon-right"></i></span>
@@ -146,10 +146,11 @@
 						<input type="text" ng-model="condition.dateFrom"
 							class="form-control" placeholder="从"
 							datepicker-popup="yyyy-MM-dd" is-open="condition.$fromOpened"
-							ng-required="true"
+							ng-required="true" max-date="condition.dateTo"
 							current-text="今天" clear-text="清除" close-text="关闭"
 							datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"
-							ng-focus="openDatePicker($event, condition, '$fromOpened')">
+							ng-focus="openDatePicker($event, condition, '$fromOpened')"
+							ng-change="onDateCondition()">
 						<span class="input-group-btn">
 							<button type="button" class="btn btn-default"
 								ng-click="openDatePicker($event, condition, '$fromOpened')">
@@ -161,10 +162,11 @@
 						<input type="text" ng-model="condition.dateTo"
 							class="form-control" placeholder="到"
 							datepicker-popup="yyyy-MM-dd" is-open="condition.$toOpened"
-							ng-required="true"
+							ng-required="true" min-date="condition.dateFrom"
 							current-text="今天" clear-text="清除" close-text="关闭"
 							datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"
-							ng-focus="openDatePicker($event, condition, '$toOpened')">
+							ng-focus="openDatePicker($event, condition, '$toOpened')"
+							ng-change="onDateCondition()">
 						<span class="input-group-btn">
 							<button type="button" class="btn btn-default"
 								ng-click="openDatePicker($event, condition, '$toOpened')">
@@ -198,7 +200,7 @@
 				</div> <!-- 分页 -->
 			</td>
 			<td class="text-center">
-				<a href="sale/apBill/xls?keyword={{keywordXls}}" target="_self" class="text-simple" title="导出Excel表格"><i class="fa fa-file-excel-o fa-fw"></i>导出</a>
+				<a href="sale/apBill/xls?keyword={{keywordXls}}&fromDate={{fromDateXls}}&endDate={{endDateXls}}" target="_self" class="text-simple" title="导出Excel表格"><i class="fa fa-file-excel-o fa-fw"></i>导出</a>
 			</td>
 		</tr>
 		<tr class="sep-row">

+ 8 - 6
src/main/webapp/resources/tpl/index/sale/notice.html

@@ -215,7 +215,7 @@
 		<div class="more" ng-class="{'open': condition.$open}">
 			<form class="form-inline">
 			  <div class="form-group ">
-			    <label>日期:</label>
+			    <label>交货日期:</label>
 			    <div class="btn-group btn-menu" dropdown is-open="condition.$dateZoneOpen">
 				  <button type="button" dropdown-toggle style="width: 85px;" class="btn btn-default btn-xs dropdown-toggle">
 				    	{{dateZoneText}}<i class="fa fa-fw fa-angle-down icon-right"></i></span>
@@ -230,10 +230,11 @@
 						<input type="text" ng-model="condition.dateFrom"
 							class="form-control" placeholder="从"
 							datepicker-popup="yyyy-MM-dd" is-open="condition.$fromOpened"
-							ng-required="true"
+							ng-required="true" max-date="condition.dateTo"
 							current-text="今天" clear-text="清除" close-text="关闭"
 							datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"
-							ng-focus="openDatePicker($event, condition, '$fromOpened')">
+							ng-focus="openDatePicker($event, condition, '$fromOpened')"
+							ng-change="onDateCondition()">
 						<span class="input-group-btn">
 							<button type="button" class="btn btn-default"
 								ng-click="openDatePicker($event, condition, '$fromOpened')">
@@ -245,10 +246,11 @@
 						<input type="text" ng-model="condition.dateTo"
 							class="form-control" placeholder="到"
 							datepicker-popup="yyyy-MM-dd" is-open="condition.$toOpened"
-							ng-required="true"
+							ng-required="true" min-date="condition.dateFrom"
 							current-text="今天" clear-text="清除" close-text="关闭"
 							datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"
-							ng-focus="openDatePicker($event, condition, '$toOpened')">
+							ng-focus="openDatePicker($event, condition, '$toOpened')"
+							ng-change="onDateCondition()">
 						<span class="input-group-btn">
 							<button type="button" class="btn btn-default"
 								ng-click="openDatePicker($event, condition, '$toOpened')">
@@ -286,7 +288,7 @@
 				</div> <!-- 分页 -->
 			</td>
 			<td class="text-center">
-				<a href="sale/notice/xls?_state={{active}}&keyword={{keywordXls}}" target="_self" class="text-simple" title="导出Excel表格"><i class="fa fa-file-excel-o fa-fw"></i>导出</a>
+				<a href="sale/notice/xls?_state={{active}}&keyword={{keywordXls}}&fromDate={{fromDateXls}}&endDate={{endDateXls}}" target="_self" class="text-simple" title="导出Excel表格"><i class="fa fa-file-excel-o fa-fw"></i>导出</a>
 			</td>
 		</tr>
 		<tr class="sep-row">

+ 9 - 6
src/main/webapp/resources/tpl/index/sale/order.html

@@ -143,7 +143,7 @@
 		<div class="more" ng-class="{'open': condition.$open}">
 			<form class="form-inline">
 			  <div class="form-group ">
-			    <label>日期:</label>
+			    <label>单据日期:</label>
 			    <div class="btn-group btn-menu" dropdown is-open="condition.$dateZoneOpen">
 				  <button type="button" dropdown-toggle style="width: 85px;" class="btn btn-default btn-xs dropdown-toggle">
 				    	{{dateZoneText}}<i class="fa fa-fw fa-angle-down icon-right"></i></span>
@@ -158,10 +158,11 @@
 						<input type="text" ng-model="condition.dateFrom"
 							class="form-control" placeholder="从"
 							datepicker-popup="yyyy-MM-dd" is-open="condition.$fromOpened"
-							ng-required="true"
+							ng-required="true" max-date="condition.dateTo"
 							current-text="今天" clear-text="清除" close-text="关闭"
 							datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"
-							ng-focus="openDatePicker($event, condition, '$fromOpened')">
+							ng-focus="openDatePicker($event, condition, '$fromOpened')"
+							ng-change="onDateCondition()">
 						<span class="input-group-btn">
 							<button type="button" class="btn btn-default"
 								ng-click="openDatePicker($event, condition, '$fromOpened')">
@@ -173,10 +174,11 @@
 						<input type="text" ng-model="condition.dateTo"
 							class="form-control" placeholder="到"
 							datepicker-popup="yyyy-MM-dd" is-open="condition.$toOpened"
-							ng-required="true"
+							ng-required="true" min-date="condition.dateFrom"
 							current-text="今天" clear-text="清除" close-text="关闭"
 							datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"
-							ng-focus="openDatePicker($event, condition, '$toOpened')">
+							ng-focus="openDatePicker($event, condition, '$toOpened')"
+							ng-change="onDateCondition()">
 						<span class="input-group-btn">
 							<button type="button" class="btn btn-default"
 								ng-click="openDatePicker($event, condition, '$toOpened')">
@@ -220,7 +222,8 @@
 				</div> <!-- 分页 -->
 			</td>
 			<td class="text-center">
-				<a href="sale/orders/xls?_state={{active}}&keyword={{keywordXls}}" target="_self" class="text-simple" title="导出Excel表格"><i class="fa fa-file-excel-o fa-fw"></i>导出</a>
+				<a href="sale/orders/xls?_state={{active}}&keyword={{keywordXls}}&fromDate={{fromDateXls}}&endDate={{endDateXls}}" 
+					target="_self" class="text-simple" title="导出Excel表格"><i class="fa fa-file-excel-o fa-fw"></i>导出</a>
 			</td>
 		</tr>
 		<tr class="sep-row">

+ 8 - 6
src/main/webapp/resources/tpl/index/sale/send.html

@@ -149,7 +149,7 @@
 		<div class="more" ng-class="{'open': condition.$open}">
 			<form class="form-inline">
 			  <div class="form-group ">
-			    <label>日期:</label>
+			    <label>发货日期:</label>
 			    <div class="btn-group btn-menu" dropdown is-open="condition.$dateZoneOpen">
 				  <button type="button" dropdown-toggle style="width: 85px;" class="btn btn-default btn-xs dropdown-toggle">
 				    	{{dateZoneText}}<i class="fa fa-fw fa-angle-down icon-right"></i></span>
@@ -164,10 +164,11 @@
 						<input type="text" ng-model="condition.dateFrom"
 							class="form-control" placeholder="从"
 							datepicker-popup="yyyy-MM-dd" is-open="condition.$fromOpened"
-							ng-required="true"
+							ng-required="true" max-date="condition.dateTo"
 							current-text="今天" clear-text="清除" close-text="关闭"
 							datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"
-							ng-focus="openDatePicker($event, condition, '$fromOpened')">
+							ng-focus="openDatePicker($event, condition, '$fromOpened')"
+							ng-change="onDateCondition()">
 						<span class="input-group-btn">
 							<button type="button" class="btn btn-default"
 								ng-click="openDatePicker($event, condition, '$fromOpened')">
@@ -179,10 +180,11 @@
 						<input type="text" ng-model="condition.dateTo"
 							class="form-control" placeholder="到"
 							datepicker-popup="yyyy-MM-dd" is-open="condition.$toOpened"
-							ng-required="true"
+							ng-required="true" min-date="condition.dateFrom"
 							current-text="今天" clear-text="清除" close-text="关闭"
 							datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"
-							ng-focus="openDatePicker($event, condition, '$toOpened')">
+							ng-focus="openDatePicker($event, condition, '$toOpened')"
+							ng-change="onDateCondition()">
 						<span class="input-group-btn">
 							<button type="button" class="btn btn-default"
 								ng-click="openDatePicker($event, condition, '$toOpened')">
@@ -215,7 +217,7 @@
 				</div> <!-- 分页 -->
 			</td>
 			<td class="text-center">
-				<a href="sale/notice/sends/xls?_state={{active}}&keyword={{keywordXls}}" target="_self" class="text-simple" title="导出Excel表格"><i class="fa fa-file-excel-o fa-fw"></i>导出</a>
+				<a href="sale/notice/sends/xls?_state={{active}}&keyword={{keywordXls}}&fromDate={{fromDateXls}}&endDate={{endDateXls}}" target="_self" class="text-simple" title="导出Excel表格"><i class="fa fa-file-excel-o fa-fw"></i>导出</a>
 			</td>
 		</tr>
 		<tr class="sep-row">