|
|
@@ -179,27 +179,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);
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
/**
|
|
|
@@ -211,24 +190,19 @@ define(['app/app', 'jquery-uploadify'], function(app) {
|
|
|
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.CodeList = []
|
|
|
+ $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.setCode = function(code, index) {
|
|
|
- $scope.Regul.pcmpcode = code
|
|
|
+ $scope.Regul.pcmpcode = code.pcmpcode
|
|
|
$scope.Regul.CodeList = []
|
|
|
- }
|
|
|
-
|
|
|
- $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
|
|
|
}
|
|
|
|
|
|
var countLength = function(string) {
|
|
|
@@ -241,8 +215,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;
|
|
|
});
|