Просмотр исходного кода

替代物料验收反馈修改3

wangdy 8 лет назад
Родитель
Сommit
aa79b0381f

+ 27 - 4
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_materialPersonCtrl.js

@@ -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) {

+ 16 - 11
src/main/webapp/resources/view/vendor/forstore/vendor_material_person.html

@@ -1516,7 +1516,6 @@
 		font-size: 14px;
 		height: 32px;
 		line-height: 32px;
-		background: #f6fbfe;
 		padding-left: 10px;
 	}
 	.replace-row td > div > div {
@@ -1610,6 +1609,9 @@
 		display: inline-block;
 		width: 49%;
 	}
+	.edit-replace-box .content .content-line .form-item span em {
+		color: #e30e16
+	}
 	/*.edit-replace-box .content .content-line .form-item > span i {*/
 		/*color: #fd2637;*/
 		/*margin-right: 4px;*/
@@ -1696,7 +1698,7 @@
 	}
 	.edit-replace-box .content .content-line .form-item.form-right ul.similar-list {
 		width: 140px;
-		left: 59px;
+		left: 65px;
 	}
 	.edit-replace-box .content .content-line .form-item ul.similar-list li {
 		height: 30px;
@@ -1711,14 +1713,17 @@
 		background: #5078cb;
 		color: #fff;
 	}
+	.edit-replace-box .content .content-line .form-item input.error {
+		border-color: #e30e16;
+	}
 	.open-more{
 		text-align: center;
 		background: #f6f9ff;
 		clear: both;
 		height: 27px;
 		line-height: normal !important;
-		float: right !important;
 		margin-right: 7px;
+		margin-left: 94px;
 	}
 	.open-more a{
 		font-size: 12px;
@@ -1749,7 +1754,7 @@
 		position: relative;
 		height: 27px;
 		border-top: 1px dashed #5e9fcb;
-		top: 7px;
+		top: 9px;
 	}
 	.open-more div.active {
 		top: 19px;
@@ -2498,20 +2503,20 @@
 			</div>
 			<div class="content-line" ng-repeat="(key, mate) in replaceMaterialList">
 				<div class="form-item form-left">
-					<span><i>{{key + 1}}</i>型号:</span>
-					<input type="text" class="form-control" ng-model="mate.ptrCmpcode" ng-change="onCodeChange(mate.ptrCmpcode, key)" ng-blur="onCodeBlur(key)" placeholder="请输入型号名称">
-                    <ul class="similar-list" ng-show="mate.showSimilarCodeList" ng-mouseenter="setIsInCodeList(true)" ng-mouseleave="setIsInCodeList(false)">
+					<span><i>{{key + 1}}</i><em>*</em>型号:</span>
+					<input type="text" class="form-control" ng-model="mate.ptrCmpcode" ng-change="onCodeChange(mate.ptrCmpcode, key)" ng-blur="onCodeBlur(key)" ng-class="{'error': errorObj[key].code == 1}" placeholder="请输入型号名称">
+                    <ul class="similar-list" ng-show="mate.showSimilarCodeList && similarCode.length > 0 && mate.ptrCmpcode" ng-mouseenter="setIsInCodeList(true)" ng-mouseleave="setIsInCodeList(false)">
                         <li ng-repeat="sCode in similarCode" ng-bind="sCode.code" title="{{sCode.code}}" ng-click="setCode(key, sCode.code)"></li>
                     </ul>
 				</div>
 				<div class="form-item form-right">
-					<span>品牌:</span>
-					<input type="text" class="form-control" ng-model="mate.ptrBranden" ng-change="onBrandChange(mate.ptrBranden, key)" ng-blur="onBrandBlur(key)" placeholder="请输入品牌名称">
-                    <ul class="similar-list" ng-show="mate.showSimilarBrandList" ng-mouseenter="setIsInBrandList(true)" ng-mouseleave="setIsInBrandList(false)">
+					<span><em>*</em>品牌:</span>
+					<input type="text" class="form-control" ng-model="mate.ptrBranden" ng-change="onBrandChange(mate.ptrBranden, key)" ng-blur="onBrandBlur(key)" ng-class="{'error': errorObj[key].brand == 1}" placeholder="请输入品牌名称">
+                    <ul class="similar-list" ng-show="mate.showSimilarBrandList && similarBrand.length > 0 && mate.ptrBranden" ng-mouseenter="setIsInBrandList(true)" ng-mouseleave="setIsInBrandList(false)">
                         <li ng-repeat="sBrand in similarBrand" ng-bind="sBrand.nameEn" title="{{sBrand.nameEn}}" ng-click="setBrand(key, sBrand.nameEn)"></li>
                     </ul>
                     <i class="fa fa-minus-circle" ng-if="replaceMaterialList.length > 1" ng-click="setReplies('sub', key)"></i>
-					<i class="fa fa-plus-circle" ng-if="replaceMaterialList.length < 10" ng-click="setReplies('add', key)"></i>
+					<i class="fa fa-plus-circle" ng-if="replaceMaterialList.length -1 == key" ng-click="setReplies('add', key)"></i>
 				</div>
 			</div>
 		</div>