|
|
@@ -212,7 +212,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
}).state('purc.productmatches', {
|
|
|
url : "/productmatches",
|
|
|
templateUrl : "static/tpl/index/approvalFlow/productmatches.html",
|
|
|
- controller: 'ProductmatchesCtrl'
|
|
|
+ controller: 'ProductmatchesForPurcCtrl'
|
|
|
}).state('purc.uploadProduct', {
|
|
|
url : "/uploadProduct",
|
|
|
templateUrl : "static/tpl/index/purc/uploadByBatch.html",
|
|
|
@@ -382,7 +382,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
}).state('sale.productmatches', {
|
|
|
url : "/productmatches",
|
|
|
templateUrl : "static/tpl/index/approvalFlow/productmatches.html",
|
|
|
- controller: 'ProductmatchesCtrl'
|
|
|
+ controller: 'ProductmatchesForSaleCtrl'
|
|
|
}).state('sale.maketodo', {
|
|
|
url : "/maketodo",
|
|
|
templateUrl : "static/tpl/index/make/todo.html"
|
|
|
@@ -10081,7 +10081,6 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
Products.matchall({}, function(data) {
|
|
|
toaster.pop('info', '提示', '匹配成功'+data.size+'标准器件');
|
|
|
window.location.href = "#/sale/productmatches";
|
|
|
- $rootScope.productMatchStatus = "sale";
|
|
|
}, function(response) {
|
|
|
toaster.pop('error', '提示', response.data);
|
|
|
});
|
|
|
@@ -15719,11 +15718,12 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
$scope.tableParams.page(1);
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
var getService = function() {
|
|
|
if($rootScope.productMatchStatus === 'sale') {
|
|
|
- return GetProductInfo;
|
|
|
+ return Products.matchResultforSale;
|
|
|
} else if($rootScope.productMatchStatus === 'purc') {
|
|
|
- return PurcProduct;
|
|
|
+ return Products.matchResultforPurc;
|
|
|
} else {
|
|
|
return Products.matchResult;
|
|
|
}
|
|
|
@@ -15846,7 +15846,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
checkResults(result);
|
|
|
}
|
|
|
|
|
|
- // 一键更新
|
|
|
+ // 一键更新
|
|
|
$scope.updateAll = function() {
|
|
|
angular.forEach($scope.tableParams.data, function(product) {
|
|
|
if(product.checked) {
|
|
|
@@ -15861,21 +15861,377 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
+ });
|
|
|
+ Products.updateall( {}, ids, function(data) {
|
|
|
+ if(data.success) {
|
|
|
+ toaster.pop('success', '提示', data.success);
|
|
|
+ $scope.tableParams.page(1);
|
|
|
+ $scope.tableParams.reload();
|
|
|
+ }
|
|
|
+ ids = []; // 清空ids,防止重复点击出现多余的数据
|
|
|
+ }, function(response) {
|
|
|
+ toaster.pop('error', '提示', response.data);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }]);
|
|
|
+
|
|
|
+ // 当前企业匹配的标准物料信息(销售)
|
|
|
+ app.controller('ProductmatchesForSaleCtrl', ['$scope', 'ProductAll', 'ngTableParams', '$filter', 'BaseService', 'toaster', '$timeout', 'Products', '$rootScope', 'PurcProduct', 'GetProductInfo', function($scope, ProductAll, ngTableParams, $filter, BaseService, toaster, $timeout, Products, $rootScope, PurcProduct, GetProductInfo) {
|
|
|
+ BaseService.scrollBackToTop();
|
|
|
+ $scope.active = 'all';
|
|
|
+ $scope.agreedText = '全部';
|
|
|
+ $scope.dateZoneText = '一个月内';
|
|
|
+ $scope.condition = {dateZone: 1};
|
|
|
+ $scope.currency = Symbol.currency;//将币别转化为对应的符号
|
|
|
+ $scope.changeAgreed = function(agreed) {
|
|
|
+ $scope.condition.agreed = agreed;
|
|
|
+ $scope.agreedText = typeof agreed == 'undefined' ? '全部' : (agreed == 1 ? '已同意' : '不同意');
|
|
|
+ $scope.condition.$agreedOpen = false;
|
|
|
+ };
|
|
|
+ $scope.changeDateZone = function(zone) {
|
|
|
+ $scope.condition.dateZone = zone;
|
|
|
+ $scope.dateZoneText = typeof zone == 'undefined' ? '半年前' : (zone == 1 ? '一个月内' : '半年内');
|
|
|
+ $scope.condition.$dateZoneOpen = false;
|
|
|
+ getDateCondition(zone, $scope.condition);
|
|
|
+ $scope.tableParams.reload();
|
|
|
+ };
|
|
|
+ $scope.setActive = function(state) {
|
|
|
+ if($scope.active != state) {
|
|
|
+ $scope.active = state;
|
|
|
+ if($scope.tableParams.page() == 1)
|
|
|
+ $scope.tableParams.reload();
|
|
|
+ else
|
|
|
+ $scope.tableParams.page(1);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ var getService = function() {
|
|
|
+ return Products.matchResultforSale;
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.tableParams = new ngTableParams({
|
|
|
+ page : 1,
|
|
|
+ count : 5,
|
|
|
+ sorting: {
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ total : 0,
|
|
|
+ counts: [5, 10, 25, 50],
|
|
|
+ getData : function($defer, params) {
|
|
|
+ $scope.loading = true;
|
|
|
+ var pageParams = params.url();
|
|
|
+ pageParams.keyword = $scope.keyword;
|
|
|
+ pageParams.searchFilter = $scope.searchFilter;
|
|
|
+ getService().call(null, BaseService.parseParams(pageParams), function(page){
|
|
|
+ $scope.loading = false;
|
|
|
+ if(page) {
|
|
|
+ console.log(page);
|
|
|
+ params.total(page.totalElement);
|
|
|
+ $defer.resolve(page.content);
|
|
|
+ $scope.keywordXls = angular.copy(pageParams.keyword);//保存当前取值的关键词
|
|
|
+ $scope.searchFilterXls = angular.copy(pageParams.searchFilter);
|
|
|
+ angular.forEach(page.content, function(product) { // 每次进入判断全选状态,然后给单据赋状态
|
|
|
+ ids = [];
|
|
|
+ if(product.matchresults.length == 1) {
|
|
|
+ product.checked = $scope.checks.checked;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }, function(response) {
|
|
|
+ $scope.loading = false;
|
|
|
+ toaster.pop('error', '数据加载失败', response.data);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 搜索框回车
|
|
|
+ $scope.onSearch = function() {
|
|
|
+ $scope.tableParams.page(1);
|
|
|
+ $scope.tableParams.reload();
|
|
|
+ };
|
|
|
+
|
|
|
+ var ids = [];
|
|
|
+ $scope.checks = {
|
|
|
+ checked: false
|
|
|
+ };
|
|
|
+
|
|
|
+ // 全选框
|
|
|
+ $scope.checkAll = function() {
|
|
|
+ ids = [];// 每次选择时先清空,防止重复
|
|
|
+ angular.forEach($scope.tableParams.data, function(product) {
|
|
|
+ if(product.matchresults.length == 1) {
|
|
|
+ product.checked = $scope.checks.checked;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ // 单选
|
|
|
+ $scope.checkOne = function(product) {
|
|
|
+ ids = [];// 每次选择时先清空,防止重复
|
|
|
+ product.checked = !product.checked;
|
|
|
+ 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.product = {
|
|
|
+ checked: false
|
|
|
+ };
|
|
|
+
|
|
|
+ var checkResults = function(result) {
|
|
|
+ angular.forEach($scope.tableParams.data, function(product) {
|
|
|
+ if (product.id == result.prid) {
|
|
|
+ product.checked = false;
|
|
|
+ angular.forEach(product.matchresults, function(item) {
|
|
|
+ if(result.id == item.id) {
|
|
|
+ if(item.checked) {
|
|
|
+ product.checked = true;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ item.checked = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
});
|
|
|
- if(ids.length == 0) {
|
|
|
- toaster.pop('info', '提示', '请先选择标准器件');
|
|
|
- } else {
|
|
|
- Products.updateall( {}, ids, function(data) {
|
|
|
- if(data.success) {
|
|
|
- toaster.pop('success', '提示', data.success);
|
|
|
- $scope.tableParams.page(1);
|
|
|
- $scope.tableParams.reload();
|
|
|
+// checkProductCheck();
|
|
|
+ };
|
|
|
+
|
|
|
+ var checkProductCheck = function () {
|
|
|
+ var checked = true;
|
|
|
+ angular.forEach($scope.tableParams.data, function(product) {
|
|
|
+ if(!product.checked) {
|
|
|
+ checked = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $scope.product.checked = checked;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 单选明细
|
|
|
+ $scope.checkItem = function(result) {
|
|
|
+ ids = [];
|
|
|
+ result.checked = !result.checked;
|
|
|
+ checkResults(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 一键更新
|
|
|
+ $scope.updateAll = function() {
|
|
|
+ angular.forEach($scope.tableParams.data, function(product) {
|
|
|
+ if(product.checked) {
|
|
|
+ if(product.matchresults.length == 1) {
|
|
|
+ ids.push(product.matchresults[0].id);
|
|
|
+ }
|
|
|
+ if (product.matchresults.length > 1) {
|
|
|
+ angular.forEach(product.matchresults, function(item) {
|
|
|
+ if(item.checked) {
|
|
|
+ ids.push(item.id);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ Products.updateall( {}, ids, function(data) {
|
|
|
+ if(data.success) {
|
|
|
+ toaster.pop('success', '提示', data.success);
|
|
|
+ $scope.tableParams.page(1);
|
|
|
+ $scope.tableParams.reload();
|
|
|
+ }
|
|
|
+ ids = []; // 清空ids,防止重复点击出现多余的数据
|
|
|
+ }, function(response) {
|
|
|
+ toaster.pop('error', '提示', response.data);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }]);
|
|
|
+
|
|
|
+ // 当前企业匹配的标准物料信息(采购)
|
|
|
+ app.controller('ProductmatchesForPurcCtrl', ['$scope', 'ProductAll', 'ngTableParams', '$filter', 'BaseService', 'toaster', '$timeout', 'Products', '$rootScope', 'PurcProduct', 'GetProductInfo', function($scope, ProductAll, ngTableParams, $filter, BaseService, toaster, $timeout, Products, $rootScope, PurcProduct, GetProductInfo) {
|
|
|
+ BaseService.scrollBackToTop();
|
|
|
+ $scope.active = 'all';
|
|
|
+ $scope.agreedText = '全部';
|
|
|
+ $scope.dateZoneText = '一个月内';
|
|
|
+ $scope.condition = {dateZone: 1};
|
|
|
+ $scope.currency = Symbol.currency;//将币别转化为对应的符号
|
|
|
+ $scope.changeAgreed = function(agreed) {
|
|
|
+ $scope.condition.agreed = agreed;
|
|
|
+ $scope.agreedText = typeof agreed == 'undefined' ? '全部' : (agreed == 1 ? '已同意' : '不同意');
|
|
|
+ $scope.condition.$agreedOpen = false;
|
|
|
+ };
|
|
|
+ $scope.changeDateZone = function(zone) {
|
|
|
+ $scope.condition.dateZone = zone;
|
|
|
+ $scope.dateZoneText = typeof zone == 'undefined' ? '半年前' : (zone == 1 ? '一个月内' : '半年内');
|
|
|
+ $scope.condition.$dateZoneOpen = false;
|
|
|
+ getDateCondition(zone, $scope.condition);
|
|
|
+ $scope.tableParams.reload();
|
|
|
+ };
|
|
|
+ $scope.setActive = function(state) {
|
|
|
+ if($scope.active != state) {
|
|
|
+ $scope.active = state;
|
|
|
+ if($scope.tableParams.page() == 1)
|
|
|
+ $scope.tableParams.reload();
|
|
|
+ else
|
|
|
+ $scope.tableParams.page(1);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ var getService = function() {
|
|
|
+ return Products.matchResultforPurc;
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.tableParams = new ngTableParams({
|
|
|
+ page : 1,
|
|
|
+ count : 5,
|
|
|
+ sorting: {
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ total : 0,
|
|
|
+ counts: [5, 10, 25, 50],
|
|
|
+ getData : function($defer, params) {
|
|
|
+ $scope.loading = true;
|
|
|
+ var pageParams = params.url();
|
|
|
+ pageParams.keyword = $scope.keyword;
|
|
|
+ pageParams.searchFilter = $scope.searchFilter;
|
|
|
+ getService().call(null, BaseService.parseParams(pageParams), function(page){
|
|
|
+ $scope.loading = false;
|
|
|
+ if(page) {
|
|
|
+ console.log(page);
|
|
|
+ params.total(page.totalElement);
|
|
|
+ $defer.resolve(page.content);
|
|
|
+ $scope.keywordXls = angular.copy(pageParams.keyword);//保存当前取值的关键词
|
|
|
+ $scope.searchFilterXls = angular.copy(pageParams.searchFilter);
|
|
|
+ angular.forEach(page.content, function(product) { // 每次进入判断全选状态,然后给单据赋状态
|
|
|
+ ids = [];
|
|
|
+ if(product.matchresults.length == 1) {
|
|
|
+ product.checked = $scope.checks.checked;
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
- ids = []; // 清空ids,防止重复点击出现多余的数据
|
|
|
}, function(response) {
|
|
|
- toaster.pop('error', '提示', response.data);
|
|
|
+ $scope.loading = false;
|
|
|
+ toaster.pop('error', '数据加载失败', response.data);
|
|
|
});
|
|
|
}
|
|
|
+ });
|
|
|
+
|
|
|
+ // 搜索框回车
|
|
|
+ $scope.onSearch = function() {
|
|
|
+ $scope.tableParams.page(1);
|
|
|
+ $scope.tableParams.reload();
|
|
|
+ };
|
|
|
+
|
|
|
+ var ids = [];
|
|
|
+ $scope.checks = {
|
|
|
+ checked: false
|
|
|
+ };
|
|
|
+
|
|
|
+ // 全选框
|
|
|
+ $scope.checkAll = function() {
|
|
|
+ ids = [];// 每次选择时先清空,防止重复
|
|
|
+ angular.forEach($scope.tableParams.data, function(product) {
|
|
|
+ if(product.matchresults.length == 1) {
|
|
|
+ product.checked = $scope.checks.checked;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ // 单选
|
|
|
+ $scope.checkOne = function(product) {
|
|
|
+ ids = [];// 每次选择时先清空,防止重复
|
|
|
+ product.checked = !product.checked;
|
|
|
+ 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.product = {
|
|
|
+ checked: false
|
|
|
+ };
|
|
|
+
|
|
|
+ var checkResults = function(result) {
|
|
|
+ angular.forEach($scope.tableParams.data, function(product) {
|
|
|
+ if (product.id == result.prid) {
|
|
|
+ product.checked = false;
|
|
|
+ angular.forEach(product.matchresults, function(item) {
|
|
|
+ if(result.id == item.id) {
|
|
|
+ if(item.checked) {
|
|
|
+ product.checked = true;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ item.checked = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+// checkProductCheck();
|
|
|
+ };
|
|
|
+
|
|
|
+ var checkProductCheck = function () {
|
|
|
+ var checked = true;
|
|
|
+ angular.forEach($scope.tableParams.data, function(product) {
|
|
|
+ if(!product.checked) {
|
|
|
+ checked = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $scope.product.checked = checked;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 单选明细
|
|
|
+ $scope.checkItem = function(result) {
|
|
|
+ ids = [];
|
|
|
+ result.checked = !result.checked;
|
|
|
+ checkResults(result);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 一键更新
|
|
|
+ $scope.updateAll = function() {
|
|
|
+ angular.forEach($scope.tableParams.data, function(product) {
|
|
|
+ if(product.checked) {
|
|
|
+ if(product.matchresults.length == 1) {
|
|
|
+ ids.push(product.matchresults[0].id);
|
|
|
+ }
|
|
|
+ if (product.matchresults.length > 1) {
|
|
|
+ angular.forEach(product.matchresults, function(item) {
|
|
|
+ if(item.checked) {
|
|
|
+ ids.push(item.id);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ Products.updateall( {}, ids, function(data) {
|
|
|
+ if(data.success) {
|
|
|
+ toaster.pop('success', '提示', data.success);
|
|
|
+ $scope.tableParams.page(1);
|
|
|
+ $scope.tableParams.reload();
|
|
|
+ }
|
|
|
+ ids = []; // 清空ids,防止重复点击出现多余的数据
|
|
|
+ }, function(response) {
|
|
|
+ toaster.pop('error', '提示', response.data);
|
|
|
+ });
|
|
|
}
|
|
|
}]);
|
|
|
|
|
|
@@ -16041,7 +16397,6 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
Products.matchall({}, function(data) {
|
|
|
toaster.pop('info', '提示', '匹配成功'+data.size+'标准器件');
|
|
|
window.location.href = "#/purc/productmatches";
|
|
|
- $rootScope.productMatchStatus = 'purc';
|
|
|
}, function(response) {
|
|
|
toaster.pop('error', '提示', response.data);
|
|
|
});
|