|
|
@@ -1024,8 +1024,12 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
};
|
|
|
|
|
|
$scope.setProductReplacesByPerson = function (productReplaceList) {
|
|
|
+ for (var i = 0; i < productReplaceList.length; i++) {
|
|
|
+ productReplaceList[i].detno = i + 1;
|
|
|
+ }
|
|
|
Material.setProductReplacesByPerson(productReplaceList , function (data) {
|
|
|
-
|
|
|
+ loadDataReload();
|
|
|
+ $scope.setActiveIndex(-1);
|
|
|
}, function (response) {
|
|
|
})
|
|
|
}
|
|
|
@@ -2473,16 +2477,21 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
|
|
|
$scope.replaceMaterialList = [
|
|
|
{
|
|
|
- brand: '',
|
|
|
- code: ''
|
|
|
+ ptrBranden: '',
|
|
|
+ ptrCmpcode: '',
|
|
|
+ showSimilarCodeList: false,
|
|
|
+ showSimilarBrandList: false
|
|
|
}
|
|
|
]
|
|
|
$scope.setReplies = function (type, index) {
|
|
|
- if (type === 'add' && $scope.replaceMaterialList.length < 5) {
|
|
|
- if ($scope.replaceMaterialList[index].brand && $scope.replaceMaterialList[index].code) {
|
|
|
+ if (type === 'add' && $scope.replaceMaterialList.length < 10) {
|
|
|
+ if ($scope.replaceMaterialList[index].ptrBranden && $scope.replaceMaterialList[index].ptrCmpcode) {
|
|
|
$scope.replaceMaterialList.splice(index + 1, 0, {
|
|
|
- code: '',
|
|
|
- brand: ''
|
|
|
+ ptrCmpcode: '',
|
|
|
+ ptrBranden: '',
|
|
|
+ showSimilarCodeList: false,
|
|
|
+ showSimilarBrandList: false,
|
|
|
+ productId: $scope.replaceMaterialList[0].productId
|
|
|
})
|
|
|
} else {
|
|
|
toaster.pop('error', '请填完整信息');
|
|
|
@@ -2492,6 +2501,71 @@ define([ 'app/app', 'jquery-uploadify' ], function(app) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // $scope.showSimilarCodeList = false;
|
|
|
+ $scope.isInCodeList = true;
|
|
|
+ // $scope.showSimilarBrandList = false;
|
|
|
+ $scope.isInBrandList = true;
|
|
|
+
|
|
|
+ $scope.getSimilarCode = function (keyword, index) {
|
|
|
+ if (keyword) {
|
|
|
+ Search.getSimilarComponents({keyword : keyword}, function (data) {
|
|
|
+ $scope.similarCode = data || [];
|
|
|
+ $scope.setShowSimilarCodeList(data && data.length, index);
|
|
|
+ }, function (error) {
|
|
|
+ toaster.pop('error', '系统错误');
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $scope.getSimilarBrand = function (keyword, index) {
|
|
|
+ if (keyword) {
|
|
|
+ Search.getSimilarBrands({keyword : keyword}, function (data) {
|
|
|
+ $scope.similarBrand = data || [];
|
|
|
+ $scope.setShowSimilarBrandList(data && data.length, index);
|
|
|
+ }, function (error) {
|
|
|
+ toaster.pop('error', '系统错误');
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $scope.setShowSimilarCodeList = function (flag, index) {
|
|
|
+ $scope.replaceMaterialList[index].showSimilarCodeList = flag;
|
|
|
+ }
|
|
|
+ $scope.setShowSimilarBrandList = function (flag, index) {
|
|
|
+ $scope.replaceMaterialList[index].showSimilarBrandList = flag;
|
|
|
+ }
|
|
|
+ $scope.setIsInCodeList = function (flag) {
|
|
|
+ $scope.isInCodeList = flag;
|
|
|
+ }
|
|
|
+ $scope.setIsInBrandList = function (flag) {
|
|
|
+ $scope.isInBrandList = flag;
|
|
|
+ }
|
|
|
+ $scope.onCodeChange = function (code, index) {
|
|
|
+ if (!code) {
|
|
|
+ $scope.setShowSimilarCodeList(false, index);
|
|
|
+ } else {
|
|
|
+ $scope.getSimilarCode(code, index);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $scope.onBrandChange = function (brand, index) {
|
|
|
+ if (!brand) {
|
|
|
+ $scope.setShowSimilarBrandList(false, index);
|
|
|
+ } else {
|
|
|
+ $scope.getSimilarBrand(brand, index);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $scope.onCodeBlur = function (index) {
|
|
|
+ $scope.setShowSimilarCodeList($scope.isInCodeList, index);
|
|
|
+ }
|
|
|
+ $scope.onBrandBlur = function (index) {
|
|
|
+ $scope.setShowSimilarBrandList($scope.isInBrandList, index);
|
|
|
+ }
|
|
|
+ $scope.setCode = function (index, code) {
|
|
|
+ $scope.replaceMaterialList[index].ptrCmpcode = code;
|
|
|
+ $scope.setShowSimilarCodeList(false, index);
|
|
|
+ }
|
|
|
+ $scope.setBrand = function (index, brand) {
|
|
|
+ $scope.replaceMaterialList[index].ptrBranden = brand;
|
|
|
+ $scope.setShowSimilarBrandList(false, index);
|
|
|
+ }
|
|
|
}]);
|
|
|
|
|
|
//类目选择模态框
|