|
|
@@ -2060,7 +2060,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
var distribute = [];
|
|
|
angular.forEach($scope.userinfos, function(user, index) {
|
|
|
if(user.distribute) {
|
|
|
- distribute.push(index);
|
|
|
+ distribute.push({num: index});
|
|
|
}
|
|
|
});
|
|
|
$scope.distribute = distribute;
|
|
|
@@ -2068,36 +2068,29 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
$scope.loading = false;
|
|
|
})
|
|
|
|
|
|
+ var checkStatus = function(userinfos) {
|
|
|
+ var distribute = [];
|
|
|
+ angular.forEach(userinfos, function(user, index) {
|
|
|
+ if(user.distribute) {
|
|
|
+ distribute.push({num: index});
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $scope.distribute = distribute;
|
|
|
+ $scope.isChanged = !angular.equals($scope.havedone, $scope.distribute);
|
|
|
+ }
|
|
|
$scope.isChanged = false;
|
|
|
$scope.isChangedAll = false;
|
|
|
$scope.changes = [];
|
|
|
// 点击勾选全部的复选框
|
|
|
- $scope.checkAll = function(isChanged) {
|
|
|
+ $scope.checkAll = function() {
|
|
|
angular.forEach($scope.userinfos, function(item, index) {
|
|
|
item.distribute = $scope.checkboxes.checked;
|
|
|
});
|
|
|
-// $scope.isChanged = true;
|
|
|
+ checkStatus($scope.userinfos);
|
|
|
};
|
|
|
|
|
|
- $scope.isChanged = function() {
|
|
|
- return angular.equals($scope.distribute, $scope.changes);
|
|
|
- }
|
|
|
// 点击其中一个明细的复选框
|
|
|
- $scope.checkOne = function(vendor, isChanged, index){
|
|
|
- if(isChanged) {
|
|
|
- angular.forEach($scope.changes, function(item, value) {
|
|
|
- if(item.num == index) {
|
|
|
- $scope.changes.splice(value, 1);
|
|
|
- }
|
|
|
- }) ;
|
|
|
- } else {
|
|
|
- $scope.changes.push({num: index});
|
|
|
- }
|
|
|
- if($scope.changes.length != 0) {
|
|
|
- $scope.isChanged = true;
|
|
|
- } else {
|
|
|
- $scope.isChanged = false;
|
|
|
- }
|
|
|
+ $scope.checkOne = function() {
|
|
|
var result = true;
|
|
|
angular.forEach($scope.userinfos, function(item) {
|
|
|
if(item.distribute != true){
|
|
|
@@ -2106,6 +2099,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
}
|
|
|
});
|
|
|
$scope.checkboxes.checked = result;
|
|
|
+ checkStatus($scope.userinfos);
|
|
|
};
|
|
|
$scope.close = function(save) {
|
|
|
var chooseResult = [];
|