|
|
@@ -9720,7 +9720,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
/**
|
|
|
* 物料资料
|
|
|
*/
|
|
|
- app.controller('ProductListCtrl', ['$scope', 'GetProductInfo', 'ngTableParams', '$filter', 'BaseService', 'toaster', '$timeout', '$rootScope', function($scope, GetProductInfo, ngTableParams, $filter, BaseService, toaster, $timeout, $rootScope) {
|
|
|
+ app.controller('ProductListCtrl', ['$scope', 'GetProductInfo', 'ngTableParams', '$filter', 'BaseService', 'toaster', '$timeout', '$rootScope', '$modal', function($scope, GetProductInfo, ngTableParams, $filter, BaseService, toaster, $timeout, $rootScope, $modal) {
|
|
|
BaseService.scrollBackToTop();
|
|
|
$scope.active = 'all';
|
|
|
$scope.agreedText = '全部';
|
|
|
@@ -9818,6 +9818,100 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
toaster.pop('error', '提示', response.data);
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+ var products = [];
|
|
|
+ $scope.checks = {
|
|
|
+ checked: false
|
|
|
+ };
|
|
|
+
|
|
|
+ // 全选框
|
|
|
+ $scope.checkAll = function() {
|
|
|
+ products = [];// 每次选择时先清空,防止重复
|
|
|
+ angular.forEach($scope.tableParams.data, function(product) {
|
|
|
+ if(product.cmpUuId == null) {
|
|
|
+ product.checked = $scope.checks.checked;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ // 单选
|
|
|
+ $scope.checkOne = function(product) {
|
|
|
+ products = [];// 每次选择时先清空,防止重复
|
|
|
+ var result = true;
|
|
|
+ angular.forEach($scope.tableParams.data, function(item) {
|
|
|
+ if(item.$selected != true){
|
|
|
+ result = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $scope.checks.checked = result;
|
|
|
+ var checked = true;
|
|
|
+ angular.forEach($scope.tableParams.data, function(message) { // 单选全部时,全选选中
|
|
|
+ if (!message.checked) {
|
|
|
+ checked = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $scope.checks.checked = checked;
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.updateByBatch = function(updatetype) {
|
|
|
+ angular.forEach($scope.tableParams.data, function(product) { // 单选全部时,全选选中
|
|
|
+ if (product.checked) {
|
|
|
+ products.push(product);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ console.log(products);
|
|
|
+ if(products.length == 0) {
|
|
|
+ toaster.pop('warning', 'ts', '请至少选择一个产品');
|
|
|
+ } else {
|
|
|
+ var modalInstance = $modal.open({
|
|
|
+ templateUrl: 'static/tpl/index/baseInfo/modal/updateByBatch_modal.html',
|
|
|
+ controller: 'UpdateByBatchCtrl',
|
|
|
+ size: 'lg',
|
|
|
+ resolve: {
|
|
|
+ products: function() {
|
|
|
+ return products;
|
|
|
+ },
|
|
|
+ updatetype: function() {
|
|
|
+ return updatetype;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ modalInstance.result.then(function(data) {
|
|
|
+ toaster.pop('success', '提示', data.data);
|
|
|
+ $scope.tableParams.reload();
|
|
|
+ }, function(){
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }]);
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量修改
|
|
|
+ */
|
|
|
+ app.controller('UpdateByBatchCtrl', ['$scope', '$modalInstance', 'toaster', 'BaseService', 'updatetype', 'products', 'Products', function($scope, $modalInstance, toaster, BaseService, updatetype, products, Products) {
|
|
|
+ $scope.updatetype = updatetype;
|
|
|
+ $scope.products = products;
|
|
|
+ $scope.changed = false;
|
|
|
+ $scope.ensure = function(keyword) {
|
|
|
+ $scope.keyword = keyword;
|
|
|
+ $scope.changed = true;
|
|
|
+ }
|
|
|
+ $scope.returnUpdate = function() {
|
|
|
+ $scope.changed = false;
|
|
|
+ }
|
|
|
+ $scope.cancel = function() {
|
|
|
+ $modalInstance.dismiss();
|
|
|
+ }
|
|
|
+ $scope.okay = function() {
|
|
|
+ Products.updateByBatch({updatetype: updatetype, keyword: $scope.keyword}, $scope.products, function(data) {
|
|
|
+ $modalInstance.close(data);
|
|
|
+ }, function(response) {
|
|
|
+ toaster.pop('error', '提示', response.data);
|
|
|
+ });
|
|
|
+ }
|
|
|
}]);
|
|
|
|
|
|
/**
|
|
|
@@ -15305,7 +15399,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
/**
|
|
|
* 采购物料资料
|
|
|
*/
|
|
|
- app.controller('PurcProductCtrl', ['$scope', 'PurcProduct', 'ngTableParams', '$filter', 'BaseService', 'toaster', '$timeout', 'Products', function($scope, PurcProduct, ngTableParams, $filter, BaseService, toaster, $timeout, Products) {
|
|
|
+ app.controller('PurcProductCtrl', ['$scope', 'PurcProduct', 'ngTableParams', '$filter', 'BaseService', 'toaster', '$timeout', 'Products', '$modal', function($scope, PurcProduct, ngTableParams, $filter, BaseService, toaster, $timeout, Products, $modal) {
|
|
|
BaseService.scrollBackToTop();
|
|
|
$scope.active = 'all';
|
|
|
$scope.agreedText = '全部';
|
|
|
@@ -15397,6 +15491,74 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
toaster.pop('error', '提示', response.data);
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+ var products = [];
|
|
|
+ $scope.checks = {
|
|
|
+ checked: false
|
|
|
+ };
|
|
|
+
|
|
|
+ // 全选框
|
|
|
+ $scope.checkAll = function() {
|
|
|
+ products = [];// 每次选择时先清空,防止重复
|
|
|
+ angular.forEach($scope.tableParams.data, function(product) {
|
|
|
+ if(product.cmpUuId == null) {
|
|
|
+ product.checked = $scope.checks.checked;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ // 单选
|
|
|
+ $scope.checkOne = function(product) {
|
|
|
+ products = [];// 每次选择时先清空,防止重复
|
|
|
+ var result = true;
|
|
|
+ angular.forEach($scope.tableParams.data, function(item) {
|
|
|
+ if(item.$selected != true){
|
|
|
+ result = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $scope.checks.checked = result;
|
|
|
+ var checked = true;
|
|
|
+ angular.forEach($scope.tableParams.data, function(message) { // 单选全部时,全选选中
|
|
|
+ if (!message.checked) {
|
|
|
+ checked = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $scope.checks.checked = checked;
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.updateByBatch = function(updatetype) {
|
|
|
+ angular.forEach($scope.tableParams.data, function(product) { // 单选全部时,全选选中
|
|
|
+ if (product.checked) {
|
|
|
+ products.push(product);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ console.log(products);
|
|
|
+ if(products.length == 0) {
|
|
|
+ toaster.pop('warning', 'ts', '请至少选择一个产品');
|
|
|
+ } else {
|
|
|
+ var modalInstance = $modal.open({
|
|
|
+ templateUrl: 'static/tpl/index/baseInfo/modal/updateByBatch_modal.html',
|
|
|
+ controller: 'UpdateByBatchCtrl',
|
|
|
+ size: 'lg',
|
|
|
+ resolve: {
|
|
|
+ products: function() {
|
|
|
+ return products;
|
|
|
+ },
|
|
|
+ updatetype: function() {
|
|
|
+ return updatetype;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ modalInstance.result.then(function(data) {
|
|
|
+ toaster.pop('success', '提示', data.data);
|
|
|
+ $scope.tableParams.reload();
|
|
|
+ }, function(){
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
}]);
|
|
|
|
|
|
/**
|