|
|
@@ -64,8 +64,8 @@ define([ 'app/app' ], function(app) {
|
|
|
if (val != 'autoMonth') {
|
|
|
initData();
|
|
|
} else {
|
|
|
- $scope.startDate = null;
|
|
|
- $scope.endDate = null;
|
|
|
+ // $scope.startDate = '';
|
|
|
+ // $scope.endDate = '';
|
|
|
}
|
|
|
};
|
|
|
|
|
|
@@ -86,7 +86,12 @@ define([ 'app/app' ], function(app) {
|
|
|
item[openParam].open = !item[openParam].open;
|
|
|
};
|
|
|
|
|
|
- $scope.onDateCondition = function (bool) {
|
|
|
+ $scope.onDateCondition = function (bool, date) {
|
|
|
+ if (bool == 1) {
|
|
|
+ $scope.startDate = date;
|
|
|
+ } else {
|
|
|
+ $scope.endDate = date;
|
|
|
+ }
|
|
|
var startTime = $scope.startDate ? $scope.startDate.getTime() : null;
|
|
|
var endTime = $scope.endDate ? $scope.endDate.getTime() : null;
|
|
|
if (startTime && endTime && startTime > endTime) {
|
|
|
@@ -174,7 +179,7 @@ define([ 'app/app' ], function(app) {
|
|
|
var getProductData = function () {
|
|
|
// 上传产品个数
|
|
|
var defer = $q.defer();
|
|
|
- Goods.getProductsCmp({fromDate: $scope.startDate.getTime(), toDate: $scope.endDate.getTime()}, function (data) {
|
|
|
+ Goods.getProductsCmp({fromDate: $scope.startDate && $scope.startDate.getTime(), toDate: $scope.endDate && $scope.endDate.getTime()}, function (data) {
|
|
|
defer.resolve(data.data);
|
|
|
}, function (err) {
|
|
|
defer.reject(err);
|
|
|
@@ -205,8 +210,8 @@ define([ 'app/app' ], function(app) {
|
|
|
};
|
|
|
// 获取不同时间阶段的相关数据
|
|
|
var initData = function () {
|
|
|
- var addStartDate = new Date($scope.startDate.getTime() + 24 * 60 * 60 * 1000),
|
|
|
- addEndDate = new Date($scope.endDate.getTime() + 24 * 60 * 60 * 1000);
|
|
|
+ var addStartDate = $scope.startDate && new Date($scope.startDate.getTime() + 24 * 60 * 60 * 1000),
|
|
|
+ addEndDate = $scope.endDate && new Date($scope.endDate.getTime() + 24 * 60 * 60 * 1000);
|
|
|
$scope.addStartFormatDate = _formatDate(addStartDate, 'yyyy-MM-dd');
|
|
|
$scope.addEndFormatDate = _formatDate(addEndDate, 'yyyy-MM-dd');
|
|
|
$scope.startFormatDate = _formatDate($scope.startDate, 'yyyy-MM-dd');
|