|
@@ -35,9 +35,6 @@
|
|
.conList .btn:nth-of-type(1){
|
|
.conList .btn:nth-of-type(1){
|
|
margin-left: 25px;
|
|
margin-left: 25px;
|
|
}
|
|
}
|
|
- .select2-choice{
|
|
|
|
- width: 100px;
|
|
|
|
- }
|
|
|
|
.upload-content {
|
|
.upload-content {
|
|
margin-top: -70px;
|
|
margin-top: -70px;
|
|
}
|
|
}
|
|
@@ -95,6 +92,7 @@
|
|
<li class="active"><a href="${ctx}/zplm/cmBrandAuthProduct/form?id=${cmBrandAuthProduct.id}&authId=${cmBrandAuthProduct.authId}">商品${not empty cmBrandAuthProduct.id?'编辑':'添加'}</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/>
|
|
</ul><br/>
|
|
<form:form id="inputForm" modelAttribute="cmBrandAuthProduct" action="${ctx}/zplm/cmBrandAuthProduct/save" method="post" class="form-horizontal">
|
|
<form:form id="inputForm" modelAttribute="cmBrandAuthProduct" action="${ctx}/zplm/cmBrandAuthProduct/save" method="post" class="form-horizontal">
|
|
|
|
+ <form:hidden path="id"/>
|
|
<form:hidden path="authId"/>
|
|
<form:hidden path="authId"/>
|
|
<sys:message content="${message}"/>
|
|
<sys:message content="${message}"/>
|
|
<div class="control-group">
|
|
<div class="control-group">
|
|
@@ -137,128 +135,126 @@
|
|
<div class="controls paramRow" id="paramRow3">
|
|
<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].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="输入参数信息">
|
|
<input name="paramList[3].content" htmlEscape="false" class="input-xlarge required" maxlength="50" placeholder="输入参数信息">
|
|
- </div>
|
|
|
|
- <div class="controls paramRow" id="paramRow4">
|
|
|
|
- <input name="paramList[4].name" htmlEscape="false" class="input-small required" maxlength="10" placeholder="参数名称">
|
|
|
|
- <input name="paramList[4].content" htmlEscape="false" class="input-xlarge required" maxlength="50" placeholder="输入参数信息">
|
|
|
|
- <a onclick="deleteParam(4)" style="cursor: pointer">删除</a>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="form-actions">
|
|
<div class="form-actions">
|
|
<input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>
|
|
<input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>
|
|
<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
|
|
<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
|
|
</div>
|
|
</div>
|
|
- <script type = text/javascript>
|
|
|
|
- $(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 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');
|
|
|
|
- }
|
|
|
|
|
|
+ </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 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(observeEle, 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")
|
|
|
|
|
|
+ $('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")
|
|
}
|
|
}
|
|
})
|
|
})
|
|
- });
|
|
|
|
- $(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")
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- }, 200);
|
|
|
|
- });
|
|
|
|
- var productId = ${empty cmBrandAuthProduct.id?'null':cmBrandAuthProduct.id};
|
|
|
|
- if (productId != null) {
|
|
|
|
- var paramListSize = ${cmBrandAuthProduct.paramList.size()} ;
|
|
|
|
- if (paramListSize == 4){
|
|
|
|
- $("#paramRow4").remove();
|
|
|
|
- }else if (paramListSize > 5) {
|
|
|
|
- var index = 5;
|
|
|
|
- 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]);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ }, 200);
|
|
});
|
|
});
|
|
|
|
|
|
- //参数索引
|
|
|
|
- var paramIndex = 5;
|
|
|
|
-
|
|
|
|
- //删除参数
|
|
|
|
- function deleteParam(index){
|
|
|
|
- $("#paramRow" + index).remove();
|
|
|
|
- paramIndex = paramIndex -1;
|
|
|
|
|
|
+ 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]);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ });
|
|
|
|
|
|
- //添加参数
|
|
|
|
- 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 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 inputnum(obj, val) {
|
|
|
|
- obj.value = obj.value.replace(/[^\w.\/]/ig, ""); //清除"数字"和"英文"以外的字符
|
|
|
|
- }
|
|
|
|
|
|
|
|
- </script>
|
|
|
|
- </form:form>
|
|
|
|
|
|
+ //限制只能输入数字和英文
|
|
|
|
+ function inputnum(obj, val) {
|
|
|
|
+ obj.value = obj.value.replace(/[^\w.\/]/ig, ""); //清除"数字"和"英文"以外的字符
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //错误提示
|
|
|
|
+ var errorMsg = "${errorMsg}";
|
|
|
|
+ if(errorMsg){
|
|
|
|
+ alertx(errorMsg);
|
|
|
|
+ }
|
|
|
|
+ </script>
|
|
</body>
|
|
</body>
|
|
</html>
|
|
</html>
|