|
|
@@ -20834,7 +20834,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
var ids = angular.toJson($rootScope.ids);
|
|
|
ids = ids.replace(/\[|]/g,'');
|
|
|
prodUser.coverToUserByIds({ids: ids}, {}, function(data) {
|
|
|
- toaster.pop('success', '成功转入' + data.count);
|
|
|
+ toaster.pop('success', '成功转入' + data.count + '个物料');
|
|
|
}, function(res) {
|
|
|
toaster.pop('error', '转入失败');
|
|
|
});
|
|
|
@@ -20919,19 +20919,6 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
product.checked = $scope.checks.checked;
|
|
|
}
|
|
|
});
|
|
|
-// $scope.total = page.totalElement;
|
|
|
-// Products.matchsize({type: 'all'}, {}, function(data) {
|
|
|
-// $scope.size = data.size;
|
|
|
-// if($scope.total < $scope.size) {
|
|
|
-// $timeout(function() {
|
|
|
-// $scope.tableParams.reload();
|
|
|
-// }, 500);
|
|
|
-// } else {
|
|
|
-// $scope.loading = false;
|
|
|
-// }
|
|
|
-// }, function(response) {
|
|
|
-// toaster.pop('error', '提示', response.data);
|
|
|
-// });
|
|
|
}
|
|
|
}, function (response) {
|
|
|
$scope.loading = false;
|
|
|
@@ -21317,18 +21304,6 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
}
|
|
|
});
|
|
|
$scope.total = page.totalElement;
|
|
|
-// Products.matchsize({type: 'purc'}, {}, function(data) {
|
|
|
-// $scope.size = data.size;
|
|
|
-// if($scope.total < $scope.size) {
|
|
|
-// $timeout(function() {
|
|
|
-// $scope.tableParams.reload();
|
|
|
-// }, 500);
|
|
|
-// } else {
|
|
|
-// $scope.loading = false;
|
|
|
-// }
|
|
|
-// }, function(response) {
|
|
|
-// toaster.pop('error', '提示', response.data);
|
|
|
-// });
|
|
|
}
|
|
|
}, function (response) {
|
|
|
$scope.loading = false;
|
|
|
@@ -22295,10 +22270,11 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * 个人产库
|
|
|
+ * 个人产品库
|
|
|
*/
|
|
|
- app.controller('UserProductCtrl', ['$scope', 'prodUser', 'ngTableParams', '$filter', 'BaseService', 'toaster', '$timeout', '$modal', function ($scope, prodUser, ngTableParams, $filter, BaseService, toaster, $timeout, $modal) {
|
|
|
+ app.controller('UserProductCtrl', ['$scope', 'prodUser', 'ngTableParams', '$filter', 'BaseService', 'toaster', '$timeout', '$modal', '$rootScope', function ($scope, prodUser, ngTableParams, $filter, BaseService, toaster, $timeout, $modal, $rootScope) {
|
|
|
BaseService.scrollBackToTop();
|
|
|
+ $rootScope.ids = [];// 每次加载先清空数据
|
|
|
$scope.searchMethod = false;
|
|
|
var getService = function () {
|
|
|
return $scope.searchMethod ? prodUser.getInfo : prodUser.info;
|
|
|
@@ -22324,6 +22300,17 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
if (page) {
|
|
|
params.total(page.totalElement);
|
|
|
$defer.resolve(page.content);
|
|
|
+ $scope.checkall = true;
|
|
|
+ angular.forEach(page.content, function (prod) {
|
|
|
+ if ($rootScope.ids.indexOf(prod.id) > -1) {
|
|
|
+ prod.$selected = true;
|
|
|
+ } else {
|
|
|
+ $scope.checkall = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $scope.checkboxes = {
|
|
|
+ checked: $scope.checkall
|
|
|
+ };
|
|
|
}
|
|
|
}, function (response) {
|
|
|
$scope.loading = false;
|
|
|
@@ -22387,6 +22374,82 @@ 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) {
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ // 判断数组中是否存在某个对象
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ // 点击其中一个明细的复选框
|
|
|
+ $scope.checkOne = function (product) {
|
|
|
+ var result = true;
|
|
|
+ angular.forEach($scope.tableParams.data, function (item) {
|
|
|
+ if (item.$selected != true) {
|
|
|
+ result = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if(product.$selected) {
|
|
|
+ if(!$rootScope.ids.in_array(product.id)) {
|
|
|
+ $rootScope.ids.push(product.id);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if($rootScope.ids.in_array(product.id)) {
|
|
|
+ $rootScope.ids.remove(product.id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $scope.checkboxes = {
|
|
|
+ checked: result
|
|
|
+ };
|
|
|
+ };
|
|
|
+
|
|
|
+ // 批量删除
|
|
|
+ $scope.deleteByBatch = function() {
|
|
|
+ var ids = angular.toJson($rootScope.ids);
|
|
|
+ prodUser.deleteByBatch({ids: ids}, {}, function(data) {
|
|
|
+ toaster.pop('success', '成功删除' + $rootScope.ids.length + '个物料');
|
|
|
+ $scope.tableParams.page(1);
|
|
|
+ $scope.tableParams.reload();
|
|
|
+ }, function(res) {
|
|
|
+ toaster.pop('error', '删除失败');
|
|
|
+ });
|
|
|
+ }
|
|
|
}]);
|
|
|
|
|
|
/**
|