|
|
@@ -6503,6 +6503,9 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
$scope.isUser = data.isUser;
|
|
|
});
|
|
|
|
|
|
+ // 用来记录已经选择的id
|
|
|
+ $rootScope.ids = [];
|
|
|
+
|
|
|
$scope.active = 'todo';
|
|
|
$scope.currency = Symbol.currency;
|
|
|
$scope.dateZoneText = '不限';
|
|
|
@@ -6564,6 +6567,12 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
$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);//保存当前取值的截止日期
|
|
|
+
|
|
|
+ angular.forEach(page.content, function (notice) {
|
|
|
+ if ($rootScope.ids.indexOf(notice.id) > -1) {
|
|
|
+ notice.$selected = true;
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
}, function (response) {
|
|
|
$scope.loading = false;
|
|
|
@@ -6699,13 +6708,47 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
$scope.checkboxes = {
|
|
|
checked: false
|
|
|
};
|
|
|
+ angular.forEach($scope.tableParams.data, function (item) {
|
|
|
+ $scope.checkboxes.checked = false;
|
|
|
+ if($rootScope.ids.in_array(item.id)) {
|
|
|
+ $rootScope.ids.remove(item.id);
|
|
|
+ $scope.checkboxes.checked = true;
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
// 点击勾选全部的复选框
|
|
|
$scope.checkAll = function () {
|
|
|
angular.forEach($scope.tableParams.data, function (item) {
|
|
|
- if (!item.waiting)
|
|
|
+ if (!item.waiting) {
|
|
|
item.$selected = $scope.checkboxes.checked;
|
|
|
+ if(item.$selected) {
|
|
|
+ if(!$rootScope.ids.in_array(item.id)) {
|
|
|
+ $rootScope.ids.push(item.id);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if($rootScope.ids.in_array(item.id)) {
|
|
|
+ $rootScope.ids.remove(item.id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
});
|
|
|
+ console.log($rootScope.ids);
|
|
|
+ };
|
|
|
+
|
|
|
+ // 判断数组中是否存在某个对象
|
|
|
+ Array.prototype.S = String.fromCharCode(2);
|
|
|
+ Array.prototype.in_array = function(e) {
|
|
|
+ var r = new RegExp(this.S + e + this.S);
|
|
|
+ return (r.test(this.S + this.join(this.S) + this.S));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 从数组中移除某个对象
|
|
|
+ Array.prototype.remove = function(val) {
|
|
|
+ var index = this.indexOf(val);
|
|
|
+ if (index > -1) {
|
|
|
+ this.splice(index, 1);
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
// 点击其中一个明细的复选框
|
|
|
@@ -6717,7 +6760,15 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
return;
|
|
|
}
|
|
|
});
|
|
|
- $scope.checkboxes.checked = result;
|
|
|
+ if(order.$selected) {
|
|
|
+ if(!$rootScope.ids.in_array(order.id)) {
|
|
|
+ $rootScope.ids.push(order.id);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if($rootScope.ids.in_array(order.id)) {
|
|
|
+ $rootScope.ids.remove(order.id);
|
|
|
+ }
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
// 打开批量发货模态框
|
|
|
@@ -6733,7 +6784,10 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
},
|
|
|
token: function() {
|
|
|
return $scope.token;
|
|
|
- }
|
|
|
+ },
|
|
|
+ ids: function() {
|
|
|
+ return $rootScope.ids;
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
modalInstance.result.then(function () {
|
|
|
@@ -6829,7 +6883,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
}
|
|
|
}]);
|
|
|
|
|
|
- app.controller('SaleNoticeSendByBatchCtrl', ['$scope', '$modalInstance', 'Symbol', 'selectedNotices', 'PurcNotice', 'toaster', '$state', '$timeout', 'token', function ($scope, $modalInstance, Symbol, selectedNotices, PurcNotice, toaster, $state, $timeout, token) {
|
|
|
+ app.controller('SaleNoticeSendByBatchCtrl', ['$scope', '$modalInstance', 'Symbol', 'selectedNotices', 'PurcNotice', 'toaster', '$state', '$timeout', 'token', 'ids', function ($scope, $modalInstance, Symbol, selectedNotices, PurcNotice, toaster, $state, $timeout, token, ids) {
|
|
|
$scope.notices = angular.copy(selectedNotices);
|
|
|
$scope.currency = Symbol.currency;//将币别转化为对应的符号
|
|
|
$scope.saleSend = {
|