Aslee 4 rokov pred
rodič
commit
0b19269ca3

+ 13 - 2
src/main/java/com/caimei/modules/zplm/web/CmBrandAuthProductController.java

@@ -23,6 +23,7 @@ import com.thinkgem.jeesite.common.utils.StringUtils;
 import com.caimei.modules.zplm.entity.CmBrandAuthProduct;
 import com.caimei.modules.zplm.service.CmBrandAuthProductService;
 
+import java.util.Iterator;
 import java.util.List;
 
 /**
@@ -60,8 +61,18 @@ public class CmBrandAuthProductController extends BaseController {
 
 	@RequestMapping(value = "form")
 	public String form(CmBrandAuthProduct cmBrandAuthProduct, Model model) {
-		List<CmBrandProductParam> paramList = cmBrandAuthProductService.getProductParams(cmBrandAuthProduct.getId());
-		cmBrandAuthProduct.setParamList(paramList);
+		List<CmBrandProductParam> paramList = cmBrandAuthProduct.getParamList();
+		if (StringUtils.isNotBlank(cmBrandAuthProduct.getId()) && paramList == null) {
+			List<CmBrandProductParam> dbParamList = cmBrandAuthProductService.getProductParams(cmBrandAuthProduct.getId());
+			cmBrandAuthProduct.setParamList(dbParamList);
+		} else if (paramList != null) {
+			//清除空数据
+			for (int i = 0; i < paramList.size(); i++) {
+				if (paramList.get(i) == null || StringUtils.isBlank(paramList.get(i).getName())) {
+					paramList.remove(i);
+				}
+			}
+		}
 		model.addAttribute("cmBrandAuthProduct", cmBrandAuthProduct);
 		return "modules/zplm/cmBrandAuthProductForm";
 	}

+ 8 - 5
src/main/resources/mappings/modules/zplm/CmBrandAuthMapper.xml

@@ -17,7 +17,7 @@
 		a.createBy AS "createBy.id",
 		cb.name AS "brandName",
 		cb.authLogo AS "authLogo",
-		su.login_name AS "createUserName"
+		su.name AS "createUserName"
 	</sql>
 	
 	<sql id="cmBrandAuthJoins">
@@ -66,7 +66,7 @@
 		<include refid="cmBrandAuthJoins"/>
 		<where>
 			
-		</where>		
+		</where>
 		<choose>
 			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
 				ORDER BY ${page.orderBy}
@@ -76,7 +76,7 @@
 		</choose>
 	</select>
 	<select id="findBrandList" resultType="com.caimei.modules.brand.entity.CmBrand">
-		select id, name, authLogo from cm_brand where status = '1' and delFlag = '0';
+		select id, name, authLogo from cm_brand where delFlag = '0';
 	</select>
 	<select id="findCountryList" resultType="com.caimei.modules.common.entity.Country">
 		select countryId, name from country;
@@ -86,9 +86,12 @@
 		from cm_brand_auth ba
 		left join cm_brand b on ba.brandId = b.id
 		<where>
-			brandId = #{brandId} and authParty = #{authParty} and agentFlag = #{agentFlag}
+			ba.brandId = #{brandId} and ba.authParty = #{authParty} and ba.agentFlag = #{agentFlag}
 			<if test="agentFlag == 1">
-				and agentName = #{agentName}
+				and ba.agentName = #{agentName}
+			</if>
+			<if test="id != null and id != ''">
+				and ba.id != #{id}
 			</if>
 		</where>
 		limit 1

+ 1 - 1
src/main/resources/mappings/modules/zplm/CmBrandAuthProductMapper.xml

@@ -11,7 +11,7 @@
         a.certificateImage AS "certificateImage",
 		a.createTime AS "createTime",
 		a.createBy AS "createBy.id",
-		su.login_name AS "createUserName"
+		su.name AS "createUserName"
 	</sql>
 	
 	<sql id="cmBrandAuthProductJoins">

+ 287 - 260
src/main/webapp/WEB-INF/views/modules/zplm/cmBrandAuthProductForm.jsp

@@ -1,280 +1,307 @@
 <%@ page contentType="text/html;charset=UTF-8" %>
-<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
 <html>
 <head>
-	<title>品牌授权商品管理</title>
-	<meta name="decorator" content="default"/>
-	<script type="text/javascript">
-		$(document).ready(function() {
-			//$("#name").focus();
-			$("#inputForm").validate({
-				submitHandler: function(form){
-					loading('正在提交,请稍等...');
-					form.submit();
-				},
-				errorContainer: "#messageBox",
-				errorPlacement: function(error, element) {
-					$("#messageBox").text("输入有误,请先更正。");
-					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
-						error.appendTo(element.parent().parent());
-					} else {
-						error.insertAfter(element);
-					}
-				}
-			});
-		});
-	</script>
-	<style>
-		.iconBox{
-			font-size: 0;
-		}
-		.controls .conList{
-			display: inline-block;
-			margin-right: 15px;
-		}
-		.conList .btn:nth-of-type(1){
-			margin-left: 25px;
-		}
-		.upload-content {
-			margin-top: -70px;
-		}
-		.upload-content .conList .btn:nth-of-type(1) {
-			width: 90px;
-			height: 100px;
-			border: 2px solid #eee;
-			background: #fff;
-			position: relative;
-		}
-		.upload-content .conList .btn:nth-of-type(1)>div {
-			position: absolute;
-			top: 50%;
-			left: 50%;
-			transform: translate(-50%, -50%);
-			color: #666;
-		}
-		.upload-content .conList .btn:nth-of-type(1) span {
-			font-size: 35px;
-		}
-		.upload-content .conList .btn:nth-of-type(1) h5 {
-			color: #666;
-		}
-		.cancel-upload {
-			background: transparent;
-			border: none;
-			box-shadow: none;
-			position: relative;
-			top: -38px;
-			left: -25px;
-			cursor: pointer;
-			z-index: 100;
-		}
-		.upload-content .conList ol li {
-			width: 114px;
-			min-height: 80px;
-			text-align: center;
-			background: #fff;
-			position: relative;
-			top: 120px;
-			margin-left: 2px;
-		}
-		.hide-pic {
-			display: none !important;
-		}
+    <title>品牌授权商品管理</title>
+    <meta name="decorator" content="default"/>
+    <script type="text/javascript">
+        $(document).ready(function () {
+            //$("#name").focus();
+            $("#inputForm").validate({
+                submitHandler: function (form) {
+                    loading('正在提交,请稍等...');
+                    form.submit();
+                },
+                errorContainer: "#messageBox",
+                errorPlacement: function (error, element) {
+                    $("#messageBox").text("输入有误,请先更正。");
+                    if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
+                        error.appendTo(element.parent().parent());
+                    } else {
+                        error.insertAfter(element);
+                    }
+                }
+            });
+        });
+    </script>
+    <style>
+        .iconBox {
+            font-size: 0;
+        }
+
+        .controls .conList {
+            display: inline-block;
+            margin-right: 15px;
+        }
+
+        .conList .btn:nth-of-type(1) {
+            margin-left: 25px;
+        }
+
+        .upload-content {
+            margin-top: -70px;
+        }
+
+        .upload-content .conList .btn:nth-of-type(1) {
+            width: 90px;
+            height: 100px;
+            border: 2px solid #eee;
+            background: #fff;
+            position: relative;
+        }
+
+        .upload-content .conList .btn:nth-of-type(1) > div {
+            position: absolute;
+            top: 50%;
+            left: 50%;
+            transform: translate(-50%, -50%);
+            color: #666;
+        }
+
+        .upload-content .conList .btn:nth-of-type(1) span {
+            font-size: 35px;
+        }
+
+        .upload-content .conList .btn:nth-of-type(1) h5 {
+            color: #666;
+        }
+
+        .cancel-upload {
+            background: transparent;
+            border: none;
+            box-shadow: none;
+            position: relative;
+            top: -38px;
+            left: -25px;
+            cursor: pointer;
+            z-index: 100;
+        }
+
+        .upload-content .conList ol li {
+            width: 114px;
+            min-height: 80px;
+            text-align: center;
+            background: #fff;
+            position: relative;
+            top: 120px;
+            margin-left: 2px;
+        }
+
+        .hide-pic {
+            display: none !important;
+        }
+
         .paramRow {
             margin-top: 10px;
         }
-	</style>
+    </style>
 </head>
 <body>
-	<ul class="nav nav-tabs">
-		<li><a href="${ctx}/zplm/cmBrandAuth/">品牌授权列表</a></li>
-		<li><a href="${ctx}/zplm/cmBrandAuthProduct/?authId=${cmBrandAuthProduct.authId}">商品列表</a></li>
-		<li class="active"><a href="${ctx}/zplm/cmBrandAuthProduct/form?id=${cmBrandAuthProduct.id}&authId=${cmBrandAuthProduct.authId}">商品${not empty cmBrandAuthProduct.id?'编辑':'添加'}</a></li>
-	</ul><br/>
-	<form:form id="inputForm" modelAttribute="cmBrandAuthProduct" action="${ctx}/zplm/cmBrandAuthProduct/save" method="post" class="form-horizontal">
-		<form:hidden path="id"/>
-		<form:hidden path="authId"/>
-		<sys:message content="${message}"/>
-		<div class="control-group">
-			<label class="control-label"><span class="help-inline"><font color="red">*</font> </span>商品名称:</label>
-			<div class="controls">
-				<form:input path="name" htmlEscape="false" maxlength="50" placeholder="建议输入30个字符效果最佳" class="input-xlarge required"/>
-			</div>
-		</div>
-		<div class="control-group">
-			<label class="control-label"><span class="help-inline"><font color="red">*</font> </span>商品SN码:</label>
-			<div class="controls">
-				<form:input path="snCode" htmlEscape="false" maxlength="255" onchange="inputnum(this)" style="position:relative" class="input-xlarge required"/>
-			</div>
-		</div>
-		<div class="control-group iconBox">
-			<label class="control-label"><span class="help-inline"><font color="red">*</font> </span>商品图片:</label>
-			<div class="controls upload-content" id="imageBox">
-				<div class="conList">
-					<form:hidden id="image" path="image" htmlEscape="false" maxlength="255" class="input-xlarge required"/>
-					<sys:ckfinder input="image" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
-					<br>
-					<label style="margin-left: 150px">建议图片分辨率542px*542px</label>
-				</div>
-			</div>
-		</div>
-		<div class="control-group iconBox">
-			<label class="control-label"><span class="help-inline"><font color="red">*</font> </span>授权牌照:</label>
-			<div class="controls upload-content" id="certificateImageBox">
-				<div class="conList">
-					<form:hidden id="certificateImage" path="certificateImage" htmlEscape="false" maxlength="255" class="input-xlarge required"/>
-					<sys:ckfinder input="certificateImage" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100" maxHeight="100"/>
-					<br>
-					<label style="margin-left: 150px">建议图片分辨率150px*112px</label>
-				</div>
-			</div>
-		</div>
-        <div class="control-group paramList">
-            <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>相关参数:</label> <button class="btn btn-primary" type="button" style="margin-left: 20px" onclick="addParam()">添加参数</button>
-			<div class="controls paramRow" id="paramRow0">
-				<input name="paramList[0].name" htmlEscape="false" class="input-small required" maxlength="10" value="品牌" placeholder="参数名称">
-				<input name="paramList[0].content" htmlEscape="false" class="input-xlarge required" maxlength="50" placeholder="输入参数信息">
-            </div>
-			<div class="controls paramRow" id="paramRow1">
-				<input name="paramList[1].name" htmlEscape="false" class="input-small required" maxlength="10" value="尺寸" placeholder="参数名称">
-				<input name="paramList[1].content" htmlEscape="false" class="input-xlarge required" maxlength="50" placeholder="输入参数信息">
-            </div>
-			<div class="controls paramRow" id="paramRow2">
-				<input name="paramList[2].name" htmlEscape="false" class="input-small required" maxlength="10" value="功率" placeholder="参数名称">
-				<input name="paramList[2].content" htmlEscape="false" class="input-xlarge required" maxlength="50" placeholder="输入参数信息">
+<ul class="nav nav-tabs">
+    <li><a href="${ctx}/zplm/cmBrandAuth/">品牌授权列表</a></li>
+    <li><a href="${ctx}/zplm/cmBrandAuthProduct/?authId=${cmBrandAuthProduct.authId}">商品列表</a></li>
+    <li class="active"><a
+            href="${ctx}/zplm/cmBrandAuthProduct/form?id=${cmBrandAuthProduct.id}&authId=${cmBrandAuthProduct.authId}">商品${not empty cmBrandAuthProduct.id?'编辑':'添加'}</a>
+    </li>
+</ul>
+<br/>
+<form:form id="inputForm" modelAttribute="cmBrandAuthProduct" action="${ctx}/zplm/cmBrandAuthProduct/save" method="post"
+           class="form-horizontal">
+    <form:hidden path="id"/>
+    <form:hidden path="authId"/>
+    <sys:message content="${message}"/>
+    <div class="control-group">
+        <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>商品名称:</label>
+        <div class="controls">
+            <form:input path="name" htmlEscape="false" maxlength="50" placeholder="建议输入30个字符效果最佳"
+                        class="input-xlarge required"/>
+        </div>
+    </div>
+    <div class="control-group">
+        <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>商品SN码:</label>
+        <div class="controls">
+            <form:input path="snCode" htmlEscape="false" maxlength="255" onchange="inputnum(this)"
+                        style="position:relative" class="input-xlarge required"/>
+        </div>
+    </div>
+    <div class="control-group iconBox">
+        <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>商品图片:</label>
+        <div class="controls upload-content" id="imageBox">
+            <div class="conList">
+                <form:hidden id="image" path="image" htmlEscape="false" maxlength="255" class="input-xlarge required"/>
+                <sys:ckfinder input="image" type="images" uploadPath="/photo" selectMultiple="false" maxWidth="100"
+                              maxHeight="100"/>
+                <br>
+                <label style="margin-left: 150px">建议图片分辨率542px*542px</label>
             </div>
-			<div class="controls paramRow" id="paramRow3">
-				<input name="paramList[3].name" htmlEscape="false" class="input-small required" maxlength="10" value="重量" placeholder="参数名称">
-				<input name="paramList[3].content" htmlEscape="false" class="input-xlarge required" maxlength="50" placeholder="输入参数信息">
+        </div>
+    </div>
+    <div class="control-group iconBox">
+        <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>授权牌照:</label>
+        <div class="controls upload-content" id="certificateImageBox">
+            <div class="conList">
+                <form:hidden id="certificateImage" path="certificateImage" htmlEscape="false" maxlength="255"
+                             class="input-xlarge required"/>
+                <sys:ckfinder input="certificateImage" type="images" uploadPath="/photo" selectMultiple="false"
+                              maxWidth="100" maxHeight="100"/>
+                <br>
+                <label style="margin-left: 150px">建议图片分辨率150px*112px</label>
             </div>
         </div>
-		<div class="form-actions">
-			<input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>
-			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
-		</div>
-	</form:form>
-	<script type = text/javascript>
-		//参数索引
-		var paramIndex = 4;
-		$(function () {
-			$('.upload-content .conList .btn:nth-of-type(1)').html('<div><span>+</span><h5>选择图片</h5></div>');
-			$('.upload-content .conList .btn:nth-of-type(2)').after('<img class="cancel-upload" src="/static/images/close-btn1.png">').remove();
-			$('.upload-content .conList').find('.cancel-upload').hide();
-			var observeEle = document.getElementsByClassName('upload-content')[0];
-			var observeEle1 = document.getElementsByClassName('upload-content')[1];
-			var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
-			var MutationObserverConfig = {
-				childList: true,
-				subtree: true,
-				characterData: true
-			};
-			var observer = new MutationObserver(function (mutations) {
-				$.each(mutations, function (index, item) {
-					if (item.type === 'childList') {
-						// 在创建新的 element 时调用
-						var target = $(item.target),
-								thisWrapper = target.closest('.conList'),
-								nextEle = thisWrapper.next();
-						thisWrapper.find('li').css('z-index', 99);
-						thisWrapper.find('.cancel-upload').show();
-						if (nextEle.hasClass('hide-pic')) {
-							nextEle.removeClass('hide-pic');
-						}
-					}
-				})
-			});
-			observer.observe(observeEle, MutationObserverConfig);
-			observer.observe(observeEle1, MutationObserverConfig);
+    </div>
+    <div class="control-group paramList">
+        <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>相关参数:</label>
+        <button class="btn btn-primary" type="button" style="margin-left: 20px" onclick="addParam()">添加参数</button>
+        <div class="controls paramRow" id="paramRow0">
+            <input name="paramList[0].name" htmlEscape="false" class="input-small required" maxlength="10"
+                   placeholder="建议输入品牌">
+            <input name="paramList[0].content" htmlEscape="false" class="input-xlarge required" maxlength="50"
+                   placeholder="输入参数信息">
+        </div>
+        <div class="controls paramRow" id="paramRow1">
+            <input name="paramList[1].name" htmlEscape="false" class="input-small required" maxlength="10"
+                   placeholder="建议输入尺寸">
+            <input name="paramList[1].content" htmlEscape="false" class="input-xlarge required" maxlength="50"
+                   placeholder="输入参数信息">
+        </div>
+        <div class="controls paramRow" id="paramRow2">
+            <input name="paramList[2].name" htmlEscape="false" class="input-small required" maxlength="10"
+                   placeholder="建议输入功率">
+            <input name="paramList[2].content" htmlEscape="false" class="input-xlarge required" maxlength="50"
+                   placeholder="输入参数信息">
+        </div>
+        <div class="controls paramRow" id="paramRow3">
+            <input name="paramList[3].name" htmlEscape="false" class="input-small required" maxlength="10"
+                   placeholder="建议输入重量">
+            <input name="paramList[3].content" htmlEscape="false" class="input-xlarge required" maxlength="50"
+                   placeholder="输入参数信息">
+        </div>
+    </div>
+    <div class="form-actions">
+        <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>
+        <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+    </div>
+</form:form>
+<script type=text/javascript>
+    //参数索引
+    var paramIndex = 4;
+    $(function () {
+        $('.upload-content .conList .btn:nth-of-type(1)').html('<div><span>+</span><h5>选择图片</h5></div>');
+        $('.upload-content .conList .btn:nth-of-type(2)').after('<img class="cancel-upload" src="/static/images/close-btn1.png">').remove();
+        $('.upload-content .conList').find('.cancel-upload').hide();
+        var observeEle = document.getElementsByClassName('upload-content')[0];
+        var observeEle1 = document.getElementsByClassName('upload-content')[1];
+        var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
+        var MutationObserverConfig = {
+            childList: true,
+            subtree: true,
+            characterData: true
+        };
+        var observer = new MutationObserver(function (mutations) {
+            $.each(mutations, function (index, item) {
+                if (item.type === 'childList') {
+                    // 在创建新的 element 时调用
+                    var target = $(item.target),
+                        thisWrapper = target.closest('.conList'),
+                        nextEle = thisWrapper.next();
+                    thisWrapper.find('li').css('z-index', 99);
+                    thisWrapper.find('.cancel-upload').show();
+                    if (nextEle.hasClass('hide-pic')) {
+                        nextEle.removeClass('hide-pic');
+                    }
+                }
+            })
+        });
+        observer.observe(observeEle, MutationObserverConfig);
+        observer.observe(observeEle1, MutationObserverConfig);
 
-			$('body').on('click', '.cancel-upload', function () {
-				var wrapper = $(this).closest('.conList');
-				wrapper.find('li').css('z-index', '-1');
-				wrapper.find('input').val('');
-				$(this).hide();
-				wrapper.removeClass("hide-pic");
-				wrapper.parent().append(wrapper.clone());
-				wrapper.remove();
-				$(".conList").each(function (i, ele) {
-					if ($(ele).find("input.input-xlarge").val()) {
-						$(ele).next().removeClass("hide-pic")
-					}
-				})
-			});
-			$(window).on("load", function () {
-				setTimeout(function () {
-					$("#imageBox").find("input.input-xlarge").each(function (i, ele) {
-						if ($(ele).val()) {
-							$(ele).next().find("li").css("z-index", "99");
-							$(ele).parents(".conList").find(".cancel-upload").show();
-							$(ele).parents(".conList").next().removeClass("hide-pic")
-						}
-					})
-					$("#certificateImageBox").find("input.input-xlarge").each(function (i, ele) {
-						if ($(ele).val()) {
-							$(ele).next().find("li").css("z-index", "99");
-							$(ele).parents(".conList").find(".cancel-upload").show();
-							$(ele).parents(".conList").next().removeClass("hide-pic")
-						}
-					})
-				}, 200);
-			});
+        $('body').on('click', '.cancel-upload', function () {
+            var wrapper = $(this).closest('.conList');
+            wrapper.find('li').css('z-index', '-1');
+            wrapper.find('input').val('');
+            $(this).hide();
+            wrapper.removeClass("hide-pic");
+            wrapper.parent().append(wrapper.clone());
+            wrapper.remove();
+            $(".conList").each(function (i, ele) {
+                if ($(ele).find("input.input-xlarge").val()) {
+                    $(ele).next().removeClass("hide-pic")
+                }
+            })
+        });
+        $(window).on("load", function () {
+            setTimeout(function () {
+                $("#imageBox").find("input.input-xlarge").each(function (i, ele) {
+                    if ($(ele).val()) {
+                        $(ele).next().find("li").css("z-index", "99");
+                        $(ele).parents(".conList").find(".cancel-upload").show();
+                        $(ele).parents(".conList").next().removeClass("hide-pic")
+                    }
+                })
+                $("#certificateImageBox").find("input.input-xlarge").each(function (i, ele) {
+                    if ($(ele).val()) {
+                        $(ele).next().find("li").css("z-index", "99");
+                        $(ele).parents(".conList").find(".cancel-upload").show();
+                        $(ele).parents(".conList").next().removeClass("hide-pic")
+                    }
+                })
+            }, 200);
+        });
 
-			var productId = ${empty cmBrandAuthProduct.id?'null':cmBrandAuthProduct.id};
-			if (productId != null) {
-				var paramListSize = ${cmBrandAuthProduct.paramList.size()} ;
-				paramIndex = paramListSize;
-				if (paramListSize > 4) {
-					var index = 4;
-					while (index < paramListSize) {
-						$(".paramList").append("<div class=\"controls paramRow\" id=\"paramRow"+index+"\">\n" +
-								"\t\t\t\t<input name=\"paramList["+index+"].name\" htmlEscape=\"false\" class=\"input-small required\" maxlength=\"10\" placeholder=\"参数名称\">\n" +
-								"\t\t\t\t<input name=\"paramList["+index+"].content\" htmlEscape=\"false\" class=\"input-xlarge required\" maxlength=\"50\" placeholder=\"输入参数信息\">\n" +
-								"\t\t\t\t<a onclick=\"deleteParam("+index+")\" style=\"cursor: pointer\">删除</a>\n" +
-								"            </div>");
-						index = index + 1;
-					}
-				}
-				var nameArray = new Array();
-				var contentArray = new Array();
-				<c:forEach items="${cmBrandAuthProduct.paramList}" var="item">
-					nameArray.push('${item.name}')
-					contentArray.push('${item.content}')
-				</c:forEach>
-				for (var i = 0; i < nameArray.length; i++) {
-					var nameInput = "paramList["+i+"].name";
-					var contentInput = "paramList["+i+"].content";
-					$('input[name="' + nameInput + '"]').val(nameArray[i]);
-					$('input[name="' + contentInput + '"]').val(contentArray[i]);
-				}
-			}
-		});
+        debugger
+        var paramListSize = ${empty cmBrandAuthProduct.paramList.size() ? 0: cmBrandAuthProduct.paramList.size()};
+        paramIndex = paramListSize > 0 ? paramListSize : paramIndex;
+        if (paramListSize > 4) {
+            var index = 4;
+            while (index < paramListSize) {
+                $(".paramList").append("<div class=\"controls paramRow\" id=\"paramRow" + index + "\">\n" +
+                    "\t\t\t\t<input name=\"paramList[" + index + "].name\" htmlEscape=\"false\" class=\"input-small required\" maxlength=\"10\" placeholder=\"参数名称\">\n" +
+                    "\t\t\t\t<input name=\"paramList[" + index + "].content\" htmlEscape=\"false\" class=\"input-xlarge required\" maxlength=\"50\" placeholder=\"输入参数信息\">\n" +
+                    "\t\t\t\t<a onclick=\"deleteParam(" + index + ")\" style=\"cursor: pointer\">删除</a>\n" +
+                    "            </div>");
+                index = index + 1;
+            }
+        }
+        var nameArray = new Array();
+        var contentArray = new Array();
+        <c:forEach items="${cmBrandAuthProduct.paramList}" var="item">
+        nameArray.push('${item.name}')
+        contentArray.push('${item.content}')
+        </c:forEach>
+        for (var i = 0; i < nameArray.length; i++) {
+            var nameInput = "paramList[" + i + "].name";
+            var contentInput = "paramList[" + i + "].content";
+            $('input[name="' + nameInput + '"]').val(nameArray[i]);
+            $('input[name="' + contentInput + '"]').val(contentArray[i]);
+        }
+    });
 
-		//删除参数
-		function deleteParam(index){
-			$("#paramRow" + index).remove();
-		}
+    //删除参数
+    function deleteParam(index) {
+        $("#paramRow" + index).remove();
+    }
 
-		//添加参数
-		function addParam() {
-			$(".paramList").append("<div class=\"controls paramRow\" id=\"paramRow"+paramIndex+"\">\n" +
-					"\t\t\t\t<input name=\"paramList["+paramIndex+"].name\" htmlEscape=\"false\" class=\"input-small required\" maxlength=\"10\" placeholder=\"参数名称\">\n" +
-					"\t\t\t\t<input name=\"paramList["+paramIndex+"].content\" htmlEscape=\"false\" class=\"input-xlarge required\" maxlength=\"50\" placeholder=\"输入参数信息\">\n" +
-					"\t\t\t\t<a onclick=\"deleteParam("+paramIndex+")\" style=\"cursor: pointer\">删除</a>\n" +
-					"            </div>")
-			paramIndex = paramIndex +1;
-		}
+    //添加参数
+    function addParam() {
+        $(".paramList").append("<div class=\"controls paramRow\" id=\"paramRow" + paramIndex + "\">\n" +
+            "\t\t\t\t<input name=\"paramList[" + paramIndex + "].name\" htmlEscape=\"false\" class=\"input-small required\" maxlength=\"10\" placeholder=\"参数名称\">\n" +
+            "\t\t\t\t<input name=\"paramList[" + paramIndex + "].content\" htmlEscape=\"false\" class=\"input-xlarge required\" maxlength=\"50\" placeholder=\"输入参数信息\">\n" +
+            "\t\t\t\t<a onclick=\"deleteParam(" + paramIndex + ")\" style=\"cursor: pointer\">删除</a>\n" +
+            "            </div>")
+        paramIndex = paramIndex + 1;
+    }
 
 
-		//限制只能输入数字和英文
-		function inputnum(obj, val) {
-			obj.value = obj.value.replace(/[^\w.\/]/ig, ""); //清除"数字"和"英文"以外的字符
-		}
+    //限制只能输入数字和英文
+    function inputnum(obj, val) {
+        obj.value = obj.value.replace(/[^\w.\/]/ig, ""); //清除"数字"和"英文"以外的字符
+    }
 
-		//错误提示
-		var errorMsg  = "${errorMsg}";
-		if(errorMsg){
-			alertx(errorMsg);
-		}
-	</script>
+    //错误提示
+    var errorMsg = "${errorMsg}";
+    if (errorMsg) {
+        alertx(errorMsg);
+    }
+</script>
 </body>
 </html>

+ 1 - 1
src/main/webapp/WEB-INF/views/modules/zplm/cmBrandAuthProductList.jsp

@@ -106,7 +106,7 @@
 		<div class="ul-form">
 			 <label>商品名称:</label>
 				<form:input path="name" htmlEscape="false" maxlength="50" class="input-medium"/>
-			 <label>sn码:</label>
+			 <label>商品sn码:</label>
 				<form:input path="snCode" htmlEscape="false" maxlength="255" class="input-medium"/>
 			&nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
 			  <a class="btn btn-primary" href="${ctx}/zplm/cmBrandAuthProduct/form?authId=${cmBrandAuthProduct.authId}">新增</a>