|
|
@@ -1022,14 +1022,24 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
|
|
|
})
|
|
|
};
|
|
|
-
|
|
|
+ $scope.errorObj = [];
|
|
|
$scope.setProductReplacesByPerson = function (productReplaceList) {
|
|
|
for (var i = 0; i < productReplaceList.length; i++) {
|
|
|
- if (!(productReplaceList[i].ptrBranden && productReplaceList[i].ptrCmpcode)) {
|
|
|
+ $scope.errorObj[i] = {code : 0, brand : 0};
|
|
|
+ if (!productReplaceList[i].ptrCmpcode) {
|
|
|
+ $scope.errorObj[i].code = 1;
|
|
|
+ }
|
|
|
+ if (!productReplaceList[i].ptrBranden) {
|
|
|
+ $scope.errorObj[i].brand = 1;
|
|
|
+ }
|
|
|
+ productReplaceList[i].detno = i + 1;
|
|
|
+ }
|
|
|
+ console.log($scope.errorObj);
|
|
|
+ for (var i = 0; i < productReplaceList.length; i++) {
|
|
|
+ if ($scope.errorObj[i].code == 1 || $scope.errorObj[i].brand == 1) {
|
|
|
toaster.pop('error', '请填完整信息');
|
|
|
return;
|
|
|
- }
|
|
|
- productReplaceList[i].detno = i + 1;
|
|
|
+ }
|
|
|
}
|
|
|
Material.setProductReplacesByPerson(productReplaceList , function (data) {
|
|
|
loadDataReload();
|
|
|
@@ -2468,6 +2478,7 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
$scope.activeIndex = -1;
|
|
|
|
|
|
$scope.setActiveIndex = function (index,material) {
|
|
|
+ $scope.errorObj = [];
|
|
|
$scope.activeIndex = index;
|
|
|
if (material) {
|
|
|
$scope.editCmp = material.pcmpcode;
|
|
|
@@ -2539,9 +2550,15 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
}
|
|
|
}
|
|
|
$scope.setShowSimilarCodeList = function (flag, index) {
|
|
|
+ if (!$scope.replaceMaterialList[index].ptrCmpcode || !$scope.similarCode || !$scope.similarCode.length) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
$scope.replaceMaterialList[index].showSimilarCodeList = flag;
|
|
|
}
|
|
|
$scope.setShowSimilarBrandList = function (flag, index) {
|
|
|
+ if (!$scope.replaceMaterialList[index].ptrBranden || !$scope.similarBrand || !$scope.similarBrand.length) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
$scope.replaceMaterialList[index].showSimilarBrandList = flag;
|
|
|
}
|
|
|
$scope.setIsInCodeList = function (flag) {
|
|
|
@@ -2565,9 +2582,15 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
}
|
|
|
}
|
|
|
$scope.onCodeBlur = function (index) {
|
|
|
+ if ($scope.replaceMaterialList[index].ptrCmpcode) {
|
|
|
+ $scope.errorObj[index].code = 0;
|
|
|
+ }
|
|
|
$scope.setShowSimilarCodeList($scope.isInCodeList, index);
|
|
|
}
|
|
|
$scope.onBrandBlur = function (index) {
|
|
|
+ if ($scope.replaceMaterialList[index].ptrBranden) {
|
|
|
+ $scope.errorObj[index].brand = 0;
|
|
|
+ }
|
|
|
$scope.setShowSimilarBrandList($scope.isInBrandList, index);
|
|
|
}
|
|
|
$scope.setCode = function (index, code) {
|