|
|
@@ -83,6 +83,7 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
|
|
|
// 品牌change事件
|
|
|
$scope.onBrandChange = function(brand, index) {
|
|
|
+ $rootScope.singleEntryInfo = true
|
|
|
$scope.objError.pbranden = false
|
|
|
if (index === undefined) {
|
|
|
if (brand === '') {
|
|
|
@@ -118,6 +119,7 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
}
|
|
|
|
|
|
$scope.RegulKindBlur = function() {
|
|
|
+ $rootScope.singleEntryInfo = true
|
|
|
$scope.objError.kind = false
|
|
|
}
|
|
|
|
|
|
@@ -127,11 +129,12 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
* @param name 品牌名称
|
|
|
*/
|
|
|
$scope.RegulonBrandBlur = function(name) {
|
|
|
+ $rootScope.singleEntryInfo = true
|
|
|
// setTimeout(function() {
|
|
|
if (name === '') {
|
|
|
$scope.Regul.BrandList = []
|
|
|
} else {
|
|
|
- $scope.Regul.pbranden = $scope.Regul.BrandList.value && $scope.Regul.BrandList.value[0].nameEn || name
|
|
|
+ $scope.Regul.pbranden = $scope.Regul.BrandList && $scope.Regul.BrandList.value && $scope.Regul.BrandList.value[0].nameEn || name
|
|
|
$scope.Regul.BrandList = []
|
|
|
}
|
|
|
// }, 300)
|
|
|
@@ -143,6 +146,7 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
}
|
|
|
|
|
|
$scope.setBrand = function(brand, index) {
|
|
|
+ $rootScope.singleEntryInfo = true
|
|
|
if (index === undefined) {
|
|
|
$scope.Regul.pbranden = brand
|
|
|
$scope.Regul.BrandList = []
|
|
|
@@ -167,6 +171,7 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
;
|
|
|
|
|
|
$scope.onCodeChange = function(code, index) {
|
|
|
+ $rootScope.singleEntryInfo = true
|
|
|
$scope.objError.pcmpcode = false
|
|
|
if (index === undefined) {
|
|
|
if (code === '') {
|
|
|
@@ -179,27 +184,6 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
return false
|
|
|
}
|
|
|
$scope.Regul.CodeList = getSimilarCode(code).$$state
|
|
|
- } else {
|
|
|
- if ((/[^\x00-\xff]/g).test(code)) {
|
|
|
- var chineseIndex = -1;
|
|
|
- for (var i = 0; i < code.length; i++) {
|
|
|
- if ((/[^\x00-\xff]/g).test(code.charAt(i))) {
|
|
|
- chineseIndex = i;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- $scope.replaceMaterialList[index].ptrCmpcode = cutOutString(code,
|
|
|
- chineseIndex);
|
|
|
- } else if (code && getRealLen(code) > 100) {
|
|
|
- $scope.replaceMaterialList[index].ptrCmpcode = cutOutString(code,
|
|
|
- 100);
|
|
|
- } else {
|
|
|
- if (!code) {
|
|
|
- $scope.setShowSimilarCodeList(false, index);
|
|
|
- } else {
|
|
|
- $scope.getSimilarCode(code, index);
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
/**
|
|
|
@@ -208,27 +192,25 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
* @param name 型号名称
|
|
|
*/
|
|
|
$scope.RegulonCodeBlur = function(name) {
|
|
|
+ $rootScope.singleEntryInfo = true
|
|
|
if (name === '') {
|
|
|
$scope.Regul.CodeList = []
|
|
|
} else {
|
|
|
- $scope.Regul.pcmpcode = $scope.Regul.CodeList.value && $scope.Regul.CodeList.value[0].code || name
|
|
|
+ $scope.Regul.pcmpcode = $scope.Regul.CodeList.value && $scope.Regul.CodeList.value[0].pcmpcode || name
|
|
|
+ $scope.Regul.pbranden = $scope.Regul.CodeList.value && $scope.Regul.CodeList.value[0].pbranden || $scope.Regul.pbranden
|
|
|
+ $scope.Regul.spec = $scope.Regul.CodeList.value && $scope.Regul.CodeList.value[0].pbranden || $scope.Regul.spec
|
|
|
+ $scope.Regul.kind = $scope.Regul.CodeList.value && $scope.Regul.CodeList.value[0].pbranden || $scope.Regul.kind
|
|
|
$scope.Regul.CodeList = []
|
|
|
}
|
|
|
}
|
|
|
$scope.setCode = function(code, index) {
|
|
|
- $scope.Regul.pcmpcode = code
|
|
|
- $scope.Regul.CodeList = []
|
|
|
- }
|
|
|
+ $rootScope.singleEntryInfo = true
|
|
|
+ $scope.Regul.pcmpcode = code.pcmpcode
|
|
|
|
|
|
- $scope.getSimilarCode = function(keyword, index) {
|
|
|
- if (keyword) {
|
|
|
- Search.getSimilarComponents({
|
|
|
- keyword: keyword
|
|
|
- }, function(data) {
|
|
|
- $scope.similarCode = data || [];
|
|
|
- $scope.setShowSimilarCodeList(data && data.length, index);
|
|
|
- }, function(error) {})
|
|
|
- }
|
|
|
+ $scope.Regul.pbranden = code.pbranden
|
|
|
+ $scope.Regul.spec = code.spec
|
|
|
+ $scope.Regul.kind = code.kind
|
|
|
+ $scope.Regul.CodeList = []
|
|
|
}
|
|
|
|
|
|
var countLength = function(string) {
|
|
|
@@ -241,8 +223,9 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
*/
|
|
|
function getSimilarCode(name) {
|
|
|
if (name) {
|
|
|
- return Search.getSimilarComponents({keyword: name}).$promise.then(
|
|
|
+ return Material.getSimilarComponents({keyword: name}).$promise.then(
|
|
|
function (data) {
|
|
|
+ console.log(data)
|
|
|
return data.map(function (item) {
|
|
|
return item;
|
|
|
});
|
|
|
@@ -264,6 +247,7 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
}
|
|
|
|
|
|
$scope.setPriceMinPackAmount = function(num) {
|
|
|
+ $rootScope.singleEntryInfo = true
|
|
|
if (num && num.indexOf('.') > -1) {
|
|
|
toaster.pop('warning', '提示', '最小包装数不能存在小数点')
|
|
|
$scope.Regul.minPackQty = 1
|
|
|
@@ -274,6 +258,7 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
}
|
|
|
|
|
|
$scope.setReserve = function(num) {
|
|
|
+ $rootScope.singleEntryInfo = true
|
|
|
if (num && num.indexOf('.') > -1) {
|
|
|
toaster.pop('warning', '提示', '库存数量不能存在小数点')
|
|
|
$scope.Regul.reserve = 1
|
|
|
@@ -284,11 +269,13 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
}
|
|
|
|
|
|
$scope.setOnePrice = function(num) {
|
|
|
+ $rootScope.singleEntryInfo = true
|
|
|
$scope.Regul.OnePrice = num
|
|
|
$scope.objError.OnePrice = false
|
|
|
}
|
|
|
// 修改规格书
|
|
|
$scope.onUploadSuccess = function(data) {
|
|
|
+ $rootScope.singleEntryInfo = true
|
|
|
$scope.Regul.Regulpic = data.path;
|
|
|
$scope.Regul.Ischange = true
|
|
|
};
|
|
|
@@ -333,6 +320,7 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
toaster.pop('warning', '提示', '最小包装数未编辑导致无法上架');
|
|
|
return
|
|
|
}
|
|
|
+ $rootScope.singleEntryInfo = true
|
|
|
if (!$scope.Regul.breakUp && $scope.Regul.minBuyQty !== $scope.Regul.minPackQty) {
|
|
|
if ($scope.Regul.minBuyQty % $scope.Regul.minPackQty !== 0) {
|
|
|
$scope.Regul.minBuyQty = $scope.Regul.minPackQty
|
|
|
@@ -545,13 +533,13 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if ($scope.Regul.minPackQty !== '' && /\D/.test($scope.Regul.minPackQty)) {
|
|
|
+ if ($scope.Regul.minPackQty && /\D/.test($scope.Regul.minPackQty)) {
|
|
|
toaster.pop('warning','提示', '最小包装数输入不正确')
|
|
|
$scope.objError.minPackQty = true
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if ($scope.Regul.OnePrice !== '' && !/^\d+(\.\d+)?$/.test($scope.Regul.OnePrice)) {
|
|
|
+ if ($scope.Regul.OnePrice && !/^\d+(\.\d+)?$/.test($scope.Regul.OnePrice.trim())) {
|
|
|
toaster.pop('warning','提示', '成本单价输入不正确')
|
|
|
$scope.objError.OnePrice = true
|
|
|
return;
|