Browse Source

物料产品编辑功能更新

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@9729 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
hejq 8 years ago
parent
commit
a6464887cc

+ 26 - 21
src/main/java/com/uas/platform/b2b/service/impl/BaseInfoServiceImpl.java

@@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.ui.ModelMap;
 
+import com.alibaba.fastjson.JSON;
 import com.uas.account.entity.RequsetStatus;
 import com.uas.account.util.AccountUtils;
 import com.uas.platform.b2b.core.util.ContextUtils;
@@ -345,28 +346,28 @@ public class BaseInfoServiceImpl implements BaseInfoService {
 				prodInfo.setAttach(attach);
 			}
 		}
-		if (prodInfo.getCmpUuId() != null) {
-			Component component = componentDao.findByUuid(prodInfo.getCmpUuId());
-			if (component != null) {
-				prodInfo.setPbranden(component.getBrand().getNameEn());
-				prodInfo.setPbrand(component.getBrand().getNameCn());
-				prodInfo.setCmpCode(component.getCode());
-				prodInfo.setKind(component.getKind().getNameCn());
-				prodInfo.setPcmpcode(component.getCode());
-				prodInfo.setKinden(component.getKind().getNameEn());
-				prodInfo.setStandard(Constant.YES);
-			} 
-		} else {
-			List<Component> components = componentDao.findByCode(prodInfo.getCmpCode());
-			if (components.size() == 1) { // 存在一个,全部赋值成标准数据
-				Component comp = components.get(0);
-				prodInfo.setKind(comp.getKind().getNameCn());
-				prodInfo.setKinden(comp.getKind().getNameEn());
-				prodInfo.setPbranden(comp.getBrand().getNameEn());
-				prodInfo.setPbrand(comp.getBrand().getNameCn());
-				prodInfo.setPcmpcode(comp.getCode());
-				prodInfo.setStandard(Constant.YES);
+		// 根据填写的标准器件库的信息进行关联判断
+		if (prodInfo.getPcmpcode() != null && prodInfo.getPbranden() != null && prodInfo.getKind() != null) {
+			List<Component> cmps = componentDao.findByCode(prodInfo.getPcmpcode());
+			if (!CollectionUtils.isEmpty(cmps)) {
+				for (Component cmp : cmps) {
+					System.out.println(JSON.toJSON(cmp));
+					if (cmp.getBrand().getNameEn().equals(prodInfo.getPbranden())
+							&& cmp.getKind().getNameCn().equals(prodInfo.getKind())) {// 匹配标准
+						prodInfo.setPbrand(cmp.getBrand().getNameCn());
+						prodInfo.setKinden(cmp.getKind().getNameEn());
+						prodInfo.setCmpUuId(cmp.getUuid());
+						prodInfo.setStandard(Constant.YES);
+						break;
+					} else {
+						prodInfo.setCmpUuId(null);
+						prodInfo.setStandard(Constant.NO);
+					}
+				}
 			}
+		} else {
+			prodInfo.setCmpUuId(null);
+			prodInfo.setStandard(Constant.NO);
 		}
 		productDao.save(prodInfo);
 		map.put("success", "更新成功");
@@ -440,6 +441,7 @@ public class BaseInfoServiceImpl implements BaseInfoService {
 								prodInfo.setKind(cmp.getKind().getNameCn());
 								prodInfo.setKinden(cmp.getKind().getNameEn());
 								prodInfo.setPcmpcode(cmp.getCode());
+								prodInfo.setCmpUuId(cmp.getUuid());
 								prodInfo.setStandard(Constant.YES);
 							} else if (cmp.getBrand().getNameCn().equals(prodInfo.getBrand())
 							&& cmp.getKind().getNameCn().equals(prodInfo.getTitle())) {
@@ -448,6 +450,7 @@ public class BaseInfoServiceImpl implements BaseInfoService {
 								prodInfo.setKind(cmp.getKind().getNameCn());
 								prodInfo.setKinden(cmp.getKind().getNameEn());
 								prodInfo.setPcmpcode(cmp.getCode());
+								prodInfo.setCmpUuId(cmp.getUuid());
 								prodInfo.setStandard(Constant.YES);
 							} else if (cmp.getBrand().getNameEn().equals(prodInfo.getBrand())
 									&& cmp.getKind().getNameEn().equals(prodInfo.getTitle())) {
@@ -456,6 +459,7 @@ public class BaseInfoServiceImpl implements BaseInfoService {
 								prodInfo.setKind(cmp.getKind().getNameCn());
 								prodInfo.setKinden(cmp.getKind().getNameEn());
 								prodInfo.setPcmpcode(cmp.getCode());
+								prodInfo.setCmpUuId(cmp.getUuid());
 								prodInfo.setStandard(Constant.YES);
 							}else if (cmp.getBrand().getNameCn().equals(prodInfo.getBrand())
 									&& cmp.getKind().getNameEn().equals(prodInfo.getTitle())) {
@@ -464,6 +468,7 @@ public class BaseInfoServiceImpl implements BaseInfoService {
 								prodInfo.setKind(cmp.getKind().getNameCn());
 								prodInfo.setKinden(cmp.getKind().getNameEn());
 								prodInfo.setPcmpcode(cmp.getCode());
+								prodInfo.setCmpUuId(cmp.getUuid());
 								prodInfo.setStandard(Constant.YES);
 							}
 						}

+ 127 - 8
src/main/webapp/resources/js/index/app.js

@@ -1765,6 +1765,8 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 				});
 			}
 		}
+		
+		// 分配用户
 		$scope.addUserInfo = function(customer) {
 			//TODO
 			if ($scope.thisUser.sys) {
@@ -2033,15 +2035,17 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 			$scope.loading = false;
 		})
 
+		$scope.changes = [];
+		var changed = {status: false, index: null};
 		// 点击勾选全部的复选框
 		$scope.checkAll = function() {
 			angular.forEach($scope.userinfos, function(item) {
 				item.distribute = $scope.checkboxes.checked;
 			});
-            $scope.isChanged = true;
 		};
+		
 		// 点击其中一个明细的复选框
-		$scope.checkOne = function(vendor){
+		$scope.checkOne = function(vendor, isChanged, index){
 			var result = true;
 			angular.forEach($scope.userinfos, function(item) {
 				if(item.distribute != true){
@@ -2050,7 +2054,32 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 				}
 			});
 			$scope.checkboxes.checked = result;
-            $scope.isChanged = true;
+			if($scope.changes.length == 0) {
+				changed = {
+						status: !isChanged,
+						index: index
+				}
+				$scope.changes.push(changed);
+				 $scope.isChanged = !isChanged;
+			} else {
+				angular.forEach($scope.changes, function(changed) {
+					if(changed.index = index) {
+						changed.status = !isChanged;
+					}
+				});
+			}
+			console.log($scope.isChanged);
+			angular.forEach($scope.changes, function(changed) {
+				if(changed.index != index) {
+					if(changed.status) {
+						$scope.isChanged = true;
+					}
+					console.log($scope.isChanged);
+					if(!$scope.isChanged) {
+						$scope.isChanged = !isChanged;
+					}
+				}
+			});
 		};
 		$scope.close = function(save) {
 			var chooseResult = [];
@@ -10615,7 +10644,52 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 			});
 		};
 		loadData();
-
+		
+		// 联想词 start
+		// 获取类目
+        $scope.getSimilarKinds = function(value) {
+            if (value) {
+                return Products.getSimilarKind({keyword : value}).$promise.then(function(data) {
+                    return data.map(function(item) {
+                        return item;
+                    });
+                });
+            }
+        };
+	    
+        $scope.onAssociateKindClick = function(kind, prodInfo) {
+        	$scope.prodInfo.kind = kind.kindCn;
+        }
+        
+        $scope.getSimilarBrands = function(value) {
+        	if(value) {
+        		return Products.getSimilarBrand({keyword: value}).$promise.then(function(data) {
+        			return data.map(function(item) {
+        				return item;
+        			});
+        		});
+        	}
+        }
+        
+        $scope.onAssociateBrandClick = function(brand, prodInfo) {
+        	$scope.prodInfo.pbranden = brand.brandEn;
+        }
+        
+        $scope.getSimilarComponents = function(value) {
+        	if(value) {
+        		return Products.getSimilarComponent({keyword: value}).$promise.then(function(data) {
+        			return data.map(function(item) {
+        				return item;
+        			});
+        		});
+        	}
+        }
+        
+        $scope.onAssociateComponentClick = function(cmp, prodInfo) {
+        	$scope.prodInfo.pcmpcode = cmp.code;
+        }
+     // 联想词 end
+        
 		//更新为标准器件
 		$scope.updateone = function(id) {
 			Products.updateone({id: id}, {}, function(data) {
@@ -10713,8 +10787,8 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 				if(data.success) {
 					toaster.pop('success', '提示', data.success);
                     $rootScope.isProductEdit = false;
-//					loadData();
-                    window.location.href="#/sale/prodList";
+					loadData();
+//                    window.location.href="#/sale/prodList";
 				}
 				if(data.error) {
 					toaster.pop('error', '提示', data.error);
@@ -17836,6 +17910,51 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 		};
 		loadData();
 
+		// 联想词 start
+		// 获取类目
+        $scope.getSimilarKinds = function(value) {
+            if (value) {
+                return Products.getSimilarKind({keyword : value}).$promise.then(function(data) {
+                    return data.map(function(item) {
+                        return item;
+                    });
+                });
+            }
+        };
+	    
+        $scope.onAssociateKindClick = function(kind, prodInfo) {
+        	$scope.prodInfo.kind = kind.kindCn;
+        }
+        
+        $scope.getSimilarBrands = function(value) {
+        	if(value) {
+        		return Products.getSimilarBrand({keyword: value}).$promise.then(function(data) {
+        			return data.map(function(item) {
+        				return item;
+        			});
+        		});
+        	}
+        }
+        
+        $scope.onAssociateBrandClick = function(brand, prodInfo) {
+        	$scope.prodInfo.pbranden = brand.brandEn;
+        }
+        
+        $scope.getSimilarComponents = function(value) {
+        	if(value) {
+        		return Products.getSimilarComponent({keyword: value}).$promise.then(function(data) {
+        			return data.map(function(item) {
+        				return item;
+        			});
+        		});
+        	}
+        }
+        
+        $scope.onAssociateComponentClick = function(cmp, prodInfo) {
+        	$scope.prodInfo.pcmpcode = cmp.code;
+        }
+     // 联想词 end
+        
 		//更新为标准器件
 		$scope.updateone = function(id) {
 			Products.updateone({id: id}, {}, function(data) {
@@ -17931,8 +18050,8 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 			}).success(function(data) {
 				if(data.success) {
 					toaster.pop('success', '提示', data.success);
-//					loadData();
-					window.location.href="#/sale/prodList";
+					loadData();
+//					window.location.href="#/sale/prodList";
 				}
 				if(data.error) {
 					toaster.pop('error', '提示', data.error);

+ 1 - 3
src/main/webapp/resources/tpl/index/account/add_userInfo.html

@@ -33,15 +33,13 @@
 			<th width="80px;">用户UU</th>
 			<th width="100px;">用户名称</th>
 			<th width="40px;" style="text-align: center"><input type="checkbox" name="checkbox" ng-model="checkboxes.checked" ng-click="checkAll()"></th>
-
-
 		</thead>
 		<tbody>
 				<div style="overflow-y:scroll; width:100%;max-height:500px">			
 					<tr ng-repeat="user in userinfos| filter: keyword">
 						<td width="80px;">{{user.userUU}}</td>
 						<td width="100px;">{{user.userName}}</td>
-						<td width="40px;" style="text-align: center"><input ng-model="user.distribute" name="checkbox" ng-click="checkOne(user)" type="checkbox"></td>
+						<td width="40px;" style="text-align: center"><input ng-model="user.distribute" name="checkbox" ng-click="checkOne(user, user.$isChanged, $index); user.$isChanged=!user.$isChanged" type="checkbox"></td>
 					</tr>
 				</div>
 		<tbody>

+ 2 - 2
src/main/webapp/resources/tpl/index/baseInfo/newProdInfo.html

@@ -120,7 +120,7 @@
                 <div class="col-md-2">产品型号:</div>
                 <div class="col-md-4">
                 	<input type="text"  ng-model="prodInfo.cmpCode" style="cursor: pointer;" required="true"
-                		ng-change="getSimilarComponents(prodInfo.cmpCode)" name="title" ng-focus="onFocus('cmpCode')"
+                		ng-change="getSimilarComponents(prodInfo.cmpCode)" name="cmpCode" ng-focus="onFocus('cmpCode')"
                 		typeahead="cmp.code for cmp in getSimilarComponents($viewValue)"
 						autocomplete="off" typeahead-on-select="onAssociateComponentClick($item, prodInfo)"
 						spellcheck="false">
@@ -128,7 +128,7 @@
                 <div class="col-md-2">产品品牌:</div>
                 <div class="col-md-4">
                 	<input type="text"  ng-model="prodInfo.brand" style="cursor: pointer;" required="true"
-                		ng-change="getSimilarBrands(prodInfo.brand)" name="title" ng-focus="onFocus('brand')"
+                		ng-change="getSimilarBrands(prodInfo.brand)" name="brand" ng-focus="onFocus('brand')"
                 		typeahead="brand.brandEn for brand in getSimilarBrands($viewValue)"
 						autocomplete="off" typeahead-on-select="onAssociateBrandClick($item, prodInfo)"
 						spellcheck="false">

+ 32 - 16
src/main/webapp/resources/tpl/index/baseInfo/productDetail.html

@@ -126,27 +126,21 @@
             <div class="pro-list-tab row">
                 <div class="col-md-2">导入产品编号:</div>
                 <div class="col-md-4">
-                    <input type="text" ng-model="prodInfo.code" ng-class="{'readonly-pointer': !prodInfo.$editing}" required="true" ng-readonly="!prodInfo.$editing">
+                    <input type="text" ng-model="prodInfo.code" ng-class="{'readonly-pointer': !prodInfo.$editing}" required="true" readonly>
                 </div>
                 <div class="col-md-2">导入产品名称:</div>
                 <div class="col-md-4">
-                    <input type="text"  ng-model="prodInfo.title" ng-class="{'readonly-pointer': !prodInfo.$editing}" required="true" ng-readonly="!prodInfo.$editing" ng-if="prodInfo.kind == null">
-                    <input type="text"  ng-model="prodInfo.kind" ng-class="{'readonly-pointer': !prodInfo.$editing}" required="true" readonly="readonly" ng-if="prodInfo.kind != null">
+                    <input type="text"  ng-model="prodInfo.title" ng-class="{'readonly-pointer': !prodInfo.$editing}" required="true" readonly>
                 </div>
             </div>
             <div class="pro-list-tab row">
                 <div class="col-md-2">导入产品型号:</div>
                 <div class="col-md-4">
-                    <input type="text"  ng-model="prodInfo.cmpCode" ng-class="{'readonly-pointer': !prodInfo.$editing}" required="true" ng-readonly="!prodInfo.$editing"  ng-click="selectKind()" ng-disabled="!prodInfo.$editing" ng-if="prodInfo.pcmpcode == null">
-                    <input type="text"  ng-model="prodInfo.pcmpcode" ng-class="{'readonly-pointer': !prodInfo.$editing}"  ng-disabled="!prodInfo.$editing" ng-if="prodInfo.pcmpcode != null" readonly>
+                    <input type="text"  ng-model="prodInfo.cmpCode" ng-class="{'readonly-pointer': !prodInfo.$editing}" required="true" readonly>
                 </div>
-                <div class="col-md-2" ng-if="prodInfo.pbranden == null">导入品牌:</div>
-                <div class="col-md-4" ng-if="prodInfo.pbranden == null">
-                    <input type="text" ng-model="prodInfo.brand" type="text" placeholder="品牌" style="cursor: pointer;" ng-readonly="prodInfo.cmpUuId != null">
-                </div>
-                <div class="col-md-2" ng-if="prodInfo.pbranden != null">导入品牌:</div>
-                <div class="col-md-4" ng-if="prodInfo.pbranden != null">
-                    <input type="text" ng-model="prodInfo.pbranden" type="text" placeholder="品牌" style="cursor: pointer;" readonly>
+                <div class="col-md-2">导入品牌:</div>
+                <div class="col-md-4">
+                    <input type="text" ng-model="prodInfo.brand" ng-class="{'readonly-pointer': !prodInfo.$editing}" type="text" placeholder="品牌" style="cursor: pointer;" readonly>
                 </div>
             </div>
             <div class="pro-list-tab row">
@@ -179,13 +173,35 @@
                 <div class="col-md-2">状态:</div>
                 <div class="col-md-4">有效</div>
             </div>
-            <div class="com_title01 sty01" style="margin-bottom: 15px;" ng-if="matchresults.length > 0"><span>标准信息</span></div>
-            <div class="pro-list-tab row" style="padding-bottom: 5px;" ng-repeat = "result in matchresults ">
+            <div class="com_title01 sty01" style="margin-bottom: 15px;"><span>标准信息</span></div>
+            <div class="pro-list-tab row">
                 <div class="col-md-2" style="padding-right: 0;">标准产品名称(类目):</div>
-                <div class="col-md-4"><input type="text" ng-model="result.kindcn"></div>
+                <div class="col-md-4"> 
+                	<input type="text"  ng-model="prodInfo.kind" style="cursor: pointer;" required="true"
+                		ng-change="getSimilarKinds(prodInfo.kind)" name="kind" ng-focus="onFocus('kind')"
+                		typeahead="kind.kindCn for kind in getSimilarKinds($viewValue)"
+						autocomplete="off" typeahead-on-select="onAssociateKindClick($item, prodInfo)"
+						spellcheck="false" ng-class="{'readonly-pointer': !prodInfo.$editing}"  ng-readonly="!prodInfo.$editing">
+                </div>
                 <div class="col-md-2">标准品牌:</div>
-                <div class="col-md-4"><input type="text"  ng-model="result.branden"></div>
+                <div class="col-md-4">
+                	 <input type="text"  ng-model="prodInfo.pbranden" style="cursor: pointer;" required="true"
+                		ng-change="getSimilarBrands(prodInfo.pbranden)" name="pbranden" ng-focus="onFocus('pbranden')"
+                		typeahead="brand.brandEn for brand in getSimilarBrands($viewValue)"
+						autocomplete="off" typeahead-on-select="onAssociateBrandClick($item, prodInfo)"
+						spellcheck="false" ng-class="{'readonly-pointer': !prodInfo.$editing}"  ng-readonly="!prodInfo.$editing">
+                </div>
             </div>
+            <div class="pro-list-tab row"  style="padding-bottom: 5px;">
+             	<div class="col-md-2">标准型号:</div>
+                <div class="col-md-4"> 
+                	<input type="text"  ng-model="prodInfo.pcmpcode" style="cursor: pointer;" required="true"
+                		ng-change="getSimilarComponents(prodInfo.pcmpcode)" name="pcmpcode" ng-focus="onFocus('pcmpcode')"
+                		typeahead="cmp.code for cmp in getSimilarComponents($viewValue)"
+						autocomplete="off" typeahead-on-select="onAssociateComponentClick($item, prodInfo)"
+						spellcheck="false" ng-class="{'readonly-pointer': !prodInfo.$editing}" ng-readonly="!prodInfo.$editing">
+                </div>
+             </div>
             <div class="com_title01"><span>图片和详细说明</span></div>
             <dl>
                 <dd class="upload-pro">

+ 71 - 56
src/main/webapp/resources/tpl/index/purc/productDetail.html

@@ -75,15 +75,21 @@
 	background: #fff;
 	border-radius: 0;
 }
-.pro-list-tab{
-    font-size: 14px;
-    margin:10px 0;
-    line-height: 34px;
-}
+    .readonly-pointer {
+        cursor: pointer;
+    }
+    .pro-list-tab{
+        font-size: 14px;
+        margin:10px 0;
+        line-height: 34px;
+    }
 .pro-list-tab .col-md-2{
-    width: 120px;
+    width: 160px;
     margin-left: 5px;
 }
+.pro-list-tab .col-md-4{
+    width: 30%;
+}
 .pro-list-tab .col-md-4 input{
     border: #bfbfbf 1px solid !important;
     padding-left: 10px;
@@ -107,53 +113,40 @@
 #order-detail-list .table-default td{
     border-bottom: #ddd 1px solid;
 }
-.pro-list-tab .col-md-2 {
-    width: 160px;
-    margin-left: 5px;
-}
-.pro-list-tab .col-md-4 {
-    width: 30%;
-}
 .table>tbody+tbody{
     border-top: 0;
 }
 </style>
 <div class="wrap">
 	<div class="content">
-		<div class="com_head"><span>物料导入</span><span class="fr"><em>录入人:{{user.userName}}</em><time>日期:{{time}}</time></span></div>
+		<div class="com_head"><span>产品导入</span><span class="fr"><em>录入人:{{user.userName}}</em><time>日期:{{time}}</time></span></div>
 		<!--产品资料新增-->
         <div class="pro-add-tab pro-add-data clearfix">
             <div class="com_title01 sty01" style="margin-bottom: 15px;"><span>导入信息<em>*</em></span></div>
             <div class="pro-list-tab row">
-                <div class="col-md-2">导入物料编号:</div>
+                <div class="col-md-2">导入产品编号:</div>
                 <div class="col-md-4">
-                    <input type="text" ng-model="prodInfo.code" style="cursor: pointer;" required="true" ng-readonly="!prodInfo.$editing">
+                    <input type="text" ng-model="prodInfo.code" ng-class="{'readonly-pointer': !prodInfo.$editing}" required="true" readonly>
                 </div>
-                <div class="col-md-2">导入物料名称:</div>
+                <div class="col-md-2">导入产品名称:</div>
                 <div class="col-md-4">
-                    <input type="text"  ng-model="prodInfo.title" ng-class="{'readonly-pointer': !prodInfo.$editing}" required="true" ng-readonly="!prodInfo.$editing" ng-if="prodInfo.kind == null">
-                    <input type="text"  ng-model="prodInfo.kind" ng-class="{'readonly-pointer': !prodInfo.$editing}" required="true" readonly="readonly" ng-if="prodInfo.kind != null">
+                    <input type="text"  ng-model="prodInfo.title" ng-class="{'readonly-pointer': !prodInfo.$editing}" required="true" readonly>
                 </div>
             </div>
             <div class="pro-list-tab row">
-                <div class="col-md-2">导入物料型号:</div>
+                <div class="col-md-2">导入产品型号:</div>
                 <div class="col-md-4">
-                    <input type="text"  ng-model="prodInfo.cmpCode" ng-class="{'readonly-pointer': !prodInfo.$editing}" required="true" ng-readonly="!prodInfo.$editing"  ng-click="selectKind(prodInfo.pcmpcode)" ng-disabled="!prodInfo.$editing" ng-if="prodInfo.pcmpcode == null">
-                    <input type="text"  ng-model="prodInfo.pcmpcode" ng-class="{'readonly-pointer': !prodInfo.$editing}" readonly="readonly"  ng-disabled="!prodInfo.$editing" ng-if="prodInfo.pcmpcode != null">
-                </div>
-                <div class="col-md-2" ng-if="prodInfo.pbranden == null">导入品牌:</div>
-                <div class="col-md-4" ng-if="prodInfo.pbranden == null">
-                    <input type="text" ng-model="prodInfo.brand" type="text" placeholder="品牌" style="cursor: pointer;" ng-readonly="prodInfo.cmpUuId != null">
+                    <input type="text"  ng-model="prodInfo.cmpCode" ng-class="{'readonly-pointer': !prodInfo.$editing}" required="true" readonly>
                 </div>
-                <div class="col-md-2" ng-if="prodInfo.pbranden != null">导入品牌:</div>
-                <div class="col-md-4" ng-if="prodInfo.pbranden != null">
-                    <input type="text" ng-model="prodInfo.pbranden" type="text" placeholder="品牌" style="cursor: pointer;" readonly>
+                <div class="col-md-2">导入品牌:</div>
+                <div class="col-md-4">
+                    <input type="text" ng-model="prodInfo.brand" ng-class="{'readonly-pointer': !prodInfo.$editing}" type="text" placeholder="品牌" style="cursor: pointer;" readonly>
                 </div>
             </div>
             <div class="pro-list-tab row">
                 <div class="col-md-2">导入单位:</div>
                 <div class="col-md-4">
-                    <input type="text"  ng-model="prodInfo.unit" placeholder="单位" style="cursor: pointer;" ng-readonly="!prodInfo.$editing" list="unit">
+                    <input type="text"  ng-model="prodInfo.unit" placeholder="单位" ng-class="{'readonly-pointer': !prodInfo.$editing}" ng-readonly="!prodInfo.$editing" list="unit">
                     <datalist id="unit">
                         <option value="PCS">
                         <option value="KG">
@@ -161,36 +154,58 @@
                         <option value="M">
                     </datalist>
                 </div>
-                <div class="col-md-2">导入最小包装量:</div>
+                <div class="col-md-2">导入最小包装量: </div>
                 <div class="col-md-4">
-                    <input type="text" ng-model="prodInfo.minPack" placeholder="最小包装量" style="cursor: pointer;" ng-readonly="!prodInfo.$editing" ng-pattern="/^\+?[1-9]\d*$/">
+                    <input type="text" ng-model="prodInfo.minPack" placeholder="最小包装量" ng-class="{'readonly-pointer': !prodInfo.$editing}" ng-readonly="!prodInfo.$editing" ng-pattern="/^\+?[1-9]\d*$/">
                 </div>
             </div>
             <div class="pro-list-tab row">
                 <div class="col-md-2">导入最小订货量:</div>
                 <div class="col-md-4">
-                    <input type="text" ng-model="prodInfo.minOrder" placeholder="最小订货量" style="cursor: pointer;" ng-readonly="!prodInfo.$editing" ng-pattern="/^\+?[1-9]\d*$/">
+                    <input type="text" ng-model="prodInfo.minOrder" placeholder="最小订货量" ng-class="{'readonly-pointer': !prodInfo.$editing}" ng-readonly="!prodInfo.$editing" ng-pattern="/^\+?[1-9]\d*$/">
                 </div>
                 <div class="col-md-2">导入交货周期:</div>
                 <div class="col-md-4">
-                    <input type="text" ng-model="prodInfo.leadtime" placeholder="交货周期" style="cursor: pointer;" ng-readonly="!prodInfo.$editing" ng-pattern="/^\+?[1-9]\d*$/">
+                    <input type="text" ng-model="prodInfo.leadtime" placeholder="交货周期" ng-class="{'readonly-pointer': !prodInfo.$editing}" ng-readonly="!prodInfo.$editing" ng-pattern="/^\+?[1-9]\d*$/">
                 </div>
             </div>
             <div class="pro-list-tab row">
                 <div class="col-md-2">状态:</div>
                 <div class="col-md-4">有效</div>
             </div>
-            <div class="com_title01 sty01" style="margin-bottom: 15px;" ng-if="matchresults.length > 0"><span>标准信息</span></div>
-            <div class="pro-list-tab row" style="padding-bottom: 5px;" ng-repeat = "result in matchresults ">
+            <div class="com_title01 sty01" style="margin-bottom: 15px;"><span>标准信息</span></div>
+            <div class="pro-list-tab row">
                 <div class="col-md-2" style="padding-right: 0;">标准产品名称(类目):</div>
-                <div class="col-md-4"><input type="text" ng-model="result.kindcn"></div>
+                <div class="col-md-4"> 
+                	<input type="text"  ng-model="prodInfo.kind" style="cursor: pointer;" required="true"
+                		ng-change="getSimilarKinds(prodInfo.kind)" name="kind" ng-focus="onFocus('kind')"
+                		typeahead="kind.kindCn for kind in getSimilarKinds($viewValue)"
+						autocomplete="off" typeahead-on-select="onAssociateKindClick($item, prodInfo)"
+						spellcheck="false" ng-class="{'readonly-pointer': !prodInfo.$editing}"  ng-readonly="!prodInfo.$editing">
+                </div>
                 <div class="col-md-2">标准品牌:</div>
-                <div class="col-md-4"><input type="text"  ng-model="result.branden"></div>
+                <div class="col-md-4">
+                	 <input type="text"  ng-model="prodInfo.pbranden" style="cursor: pointer;" required="true"
+                		ng-change="getSimilarBrands(prodInfo.pbranden)" name="pbranden" ng-focus="onFocus('pbranden')"
+                		typeahead="brand.brandEn for brand in getSimilarBrands($viewValue)"
+						autocomplete="off" typeahead-on-select="onAssociateBrandClick($item, prodInfo)"
+						spellcheck="false" ng-class="{'readonly-pointer': !prodInfo.$editing}"  ng-readonly="!prodInfo.$editing">
+                </div>
             </div>
+            <div class="pro-list-tab row"  style="padding-bottom: 5px;">
+             	<div class="col-md-2">标准型号:</div>
+                <div class="col-md-4"> 
+                	<input type="text"  ng-model="prodInfo.pcmpcode" style="cursor: pointer;" required="true"
+                		ng-change="getSimilarComponents(prodInfo.pcmpcode)" name="pcmpcode" ng-focus="onFocus('pcmpcode')"
+                		typeahead="cmp.code for cmp in getSimilarComponents($viewValue)"
+						autocomplete="off" typeahead-on-select="onAssociateComponentClick($item, prodInfo)"
+						spellcheck="false" ng-class="{'readonly-pointer': !prodInfo.$editing}" ng-readonly="!prodInfo.$editing">
+                </div>
+             </div>
             <div class="com_title01"><span>图片和详细说明</span></div>
             <dl>
                 <dd class="upload-pro">
-                    <div class="fl">物料图片:</div>
+                    <div class="fl">产品图片:</div>
                     <div class="fr">
                         <span><input ng-file-select  ng-model="myFiles" type="file" ng-multiple="false" id="enImage" name="enImage" placeholder="图片或PDF文件" ng-disabled="!prodInfo.$editing"></span>
                         <a ng-click="showImg()" ng-if="prodInfo.attach">{{prodInfo.attach.name}}</a>
@@ -239,23 +254,23 @@
              <div class="com_title01" ng-if="matchresults.length > 0"><span>匹配结果</span></div>
             <div id="order-detail-list">
                 <table class="block table table-default table-striped table-hover" ng-if="matchresults.length > 0">
-                    <thead>
-                    <tr class="header">
-                        <th>类目</th>
-                        <th>品牌</th>
-                        <th>原厂型号</th>
-                        <th>标准料号</th>
-                        <th>操作</th>
-                    </tr>
-                    </thead>
+                       <thead>
+                            <tr class="header">
+                                <th>类目</th>
+                                <th>品牌</th>
+                                <th>原厂型号</th>
+                                <th>标准料号</th>
+                                <th>操作</th>
+                            </tr>
+                       </thead>
                     <tbody ng-repeat="result in matchresults">
-                    <tr>
-                        <td>{{result.kindcn}}</th>
-                        <td>{{result.branden}}</td>
-                        <td>{{result.cmpcode}}</td>
-                        <td>{{result.uuid}}</td>
-                        <td><a ng-click="updateone(result.id)">匹配</a></td>
-                    </tr>
+                        <tr>
+                            <td>{{result.kindcn}}</th>
+                            <td>{{result.branden}}</td>
+                            <td>{{result.cmpcode}}</td>
+                            <td>{{result.uuid}}</td>
+                            <td><a ng-click="updateone(result.id)">匹配</a></td>
+                        </tr>
                     </tbody>
                 </table>
             </div>
@@ -276,7 +291,7 @@
                 <button class="btn01" ng-if="!prodInfo.$editing" ng-click="update()">修改</button>
                 <button class="btn01" ng-if="prodInfo.$editing" ng-click="cancel()">取消</button>
                 <a class="btn02" ng-if="!prodInfo.$editing" ng-click="deleteById(prodInfo.id)">删除</a>
-               <!--  <a ui-sref="sale.uploadByBatch"  class="btn02" ng-if="!prodInfo.$editing">批量导入</a> -->
+                <!-- <a ui-sref="sale.uploadByBatch"  class="btn02" ng-if="!prodInfo.$editing">批量导入</a> -->
                 <a class="btn02" ng-click="submit(prodInfo)" ng-if="prodInfo.$editing" ng-disabled="productInfo.$invalid">提交</a>
             </div>
             <div id="image-box" style="display: none">