|
|
@@ -20612,8 +20612,9 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
}]);
|
|
|
|
|
|
// 当前企业所有的物料信息
|
|
|
- app.controller('ProductAllCtrl', ['$scope', 'ProductAll', 'ngTableParams', '$filter', 'BaseService', 'toaster', '$timeout', 'Products', 'ProductAllNewest', function ($scope, ProductAll, ngTableParams, $filter, BaseService, toaster, $timeout, Products, ProductAllNewest) {
|
|
|
+ app.controller('ProductAllCtrl', ['$scope', 'ProductAll', 'ngTableParams', '$filter', 'BaseService', 'toaster', '$timeout', 'Products', 'ProductAllNewest', '$rootScope', 'prodUser', function ($scope, ProductAll, ngTableParams, $filter, BaseService, toaster, $timeout, Products, ProductAllNewest, $rootScope, prodUser) {
|
|
|
BaseService.scrollBackToTop();
|
|
|
+ $rootScope.ids = [];// 用来记录已经选择的物料
|
|
|
$scope.active = 'all';
|
|
|
$scope.agreedText = '全部';
|
|
|
$scope.dateZoneText = '一个月内';
|
|
|
@@ -20668,6 +20669,17 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
$defer.resolve(page.content);
|
|
|
$scope.keywordXls = angular.copy(pageParams.keyword);//保存当前取值的关键词
|
|
|
$scope.searchFilterXls = angular.copy(pageParams.searchFilter);
|
|
|
+ $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;
|
|
|
@@ -20743,6 +20755,94 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
toaster.pop('error', '提示', response.data);
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ $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) {
|
|
|
+ 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.addtoUserByCheck = function() {
|
|
|
+ var ids = angular.toJson($rootScope.ids);
|
|
|
+ ids = ids.replace(/\[|]/g,'');
|
|
|
+ prodUser.coverToUserByIds({ids: ids}, {}, function(data) {
|
|
|
+ toaster.pop('success', '成功转入' + data.count);
|
|
|
+ }, function(res) {
|
|
|
+ toaster.pop('error', '转入失败');
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 转入我的产品库
|
|
|
+ $scope.addtoUser = function(id) {
|
|
|
+ prodUser.coverToUser({id: id}, {}, function(data) {
|
|
|
+ toaster.pop('success', '转入成功');
|
|
|
+ }, function(res) {
|
|
|
+ toaster.pop('error', '转入失败');
|
|
|
+ });
|
|
|
+ }
|
|
|
}]);
|
|
|
|
|
|
// 当前企业匹配的标准物料信息
|
|
|
@@ -21358,7 +21458,8 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
*/
|
|
|
app.controller('PurcProductCtrl', ['$scope', 'PurcProduct', 'ngTableParams', '$filter', 'BaseService', 'toaster', '$timeout', 'Products', '$modal', 'GetProductInfo', '$rootScope', 'PurcProductNewest', 'AccountEnterprise', function ($scope, PurcProduct, ngTableParams, $filter, BaseService, toaster, $timeout, Products, $modal, GetProductInfo, $rootScope, PurcProductNewest, AccountEnterprise) {
|
|
|
BaseService.scrollBackToTop();
|
|
|
-
|
|
|
+ // 用来记录已经选择的id
|
|
|
+ $rootScope.ids = [];
|
|
|
var loadAccount = function () {
|
|
|
AccountEnterprise.get({}, function (data) {
|
|
|
$scope.enterprise = data;
|