用户注册



邮箱:

密码:

用户登录


邮箱:

密码:
记住登录一个月忘记密码?

发表随想


还能输入:200字
云代码 - jsp代码库

jsp、jquery知识积累

2017-03-17 作者: 知行合一心举报

[jsp]代码库

<%@ include file="../../../common.jsp"%>
<%@ page pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Cache-Control" content="must-revalidate" />
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="Cache-Control" content="no-store" />
<meta http-equiv="Expires" content="0" />
<title>新增/修改offer</title>
<link type="text/css" rel="stylesheet" href="<c:url value='/app/common_css/table_form.css'/>" />
<style type="text/css">
#regionForm table {
    table-layout: auto;
}
 
#formTab td {
    padding: 0;
}
 
.input_tit {
    width: 110px;
    text-align: right;
    margin-right: 5px;
    font-size: 12px;
    color: #444;
}
</style>
</head>
<body>
    <p class="m_t10">
        &nbsp;&middot;当前位置:组织管理 &gt;&gt;
        <a href="javascript: void(0);" class="ano_069">${groupName}</a>
        &gt;&gt; 产品权限个性配置
    </p>
    <div>
        <form id="dataForm" name="dataForm">
            <!-- 隐藏域——offerId -->
            <input type="hidden" id="groupId" name="groupId" value="${groupId}" />
            <table id="permissionConfig" border="1" style="width: 80%; font-family: Calibri;" align="center">
                <c:if test="${not empty list}">
                    <c:forEach items="${list}" var="data" varStatus="status">
                        <tr>
                            <td width="20%">
                                <em style="color: #f35821;">*</em>
                                入司阶段时间:
                            </td>
                            <td width="35%">
                                <span class="fixedAmount">从</span>
                                <input type="text" name="proCatAndCfgList[${status.index}].startTime" value="${data.startTime}" class="inputstyle i_w160 numberOnly" maxlength="5" />
                                <span class="fixedAmount">个月(开始)</span>
                            </td>
                            <td width="35%">
                                <span class="fixedAmount">到</span>
                                <input type="text" name="proCatAndCfgList[${status.index}].endTime" value="${data.endTime}" class="inputstyle i_w160 numberOnly" maxlength="5" />
                                <span class="fixedAmount">个月(结束)。</span>
                            </td>
                            <td width="10%" rowspan="3"><input type="button" class="deleteTr" value="删除"/></td>
                        </tr>
                        <tr>
                            <td width="20%">
                                <em style="color: #f35821;">*</em>
                                可销售产品类型:
                            </td>
                            <td width="70%" colspan="2">
                                <c:forEach items="${productTypeList}" var="productType">
                                    <span>
                                        <input type="checkbox" name="proCatAndCfgList[${status.index}].productTypeIdList" value="${productType.proCatCfgId}" class="productType"
                                            <c:forEach items="${data.productTypeList}" var="productType2">
                                                <c:if test="${productType.proCatCfgId == productType2.proCatCfgId}">
                                                    checked="checked"
                                                </c:if>
                                            </c:forEach>
                                        />${productType.proCatName}
                                    </span>
                                </c:forEach>
                            </td>
                        </tr>
                        <tr>
                            <td width="20%">
                                <em style="color: #f35821;">*</em>
                                可销售产品分类:
                            </td>
                            <td width="70%" colspan="2">
                                <c:forEach items="${data.productCategoryList}" var="productCategory">
                                    <span>
                                        <input type="checkbox" name="proCatAndCfgList[${status.index}].productCategoryIdList" value="${productCategory.proCatCfgId}"
                                            checked="checked"/>${productCategory.proCatName}
                                    </span>
                                </c:forEach>
                            </td>
                        </tr>
                    </c:forEach>
                </c:if>
                 
                 
                 
                <c:if test="${empty list}">
                    <tr>
                        <td width="20%">
                            <em style="color: #f35821;">*</em>
                            入司阶段时间:
                        </td>
                        <td width="35%">
                            <span class="fixedAmount">从</span>
                            <input type="text" name="proCatAndCfgList[0].startTime" class="inputstyle i_w160 numberOnly" maxlength="5" />
                            <span class="fixedAmount">个月(开始)</span>
                        </td>
                        <td width="35%">
                            <span class="fixedAmount">到</span>
                            <input type="text" name="proCatAndCfgList[0].endTime" class="inputstyle i_w160 numberOnly" maxlength="5" />
                            <span class="fixedAmount">个月(结束)。</span>
                        </td>
                        <td width="10%" rowspan="3"><input type="button" class="deleteTr" value="删除"/></td>
                    </tr>
                    <tr>
                        <td width="20%">
                            <em style="color: #f35821;">*</em>
                            可销售产品类型:
                        </td>
                        <td width="70%" colspan="2">
                            <c:forEach items="${productTypeList}" var="cfgProCat">
                                <span>
                                    <input type="checkbox" name="proCatAndCfgList[0].productTypeIdList" class="productType" value="${cfgProCat.proCatCfgId}" />${cfgProCat.proCatName}
                                </span>
                            </c:forEach>
                        </td>
                    </tr>
                    <tr>
                        <td width="20%">
                            <em style="color: #f35821;">*</em>
                            可销售产品分类:
                        </td>
                        <td width="70%" colspan="2">
                            <c:forEach items="${productCategoryList}" var="productCategory">
                                <input type="checkbox" name="proCatAndCfgList[0].productCategoryIdList" value="${productCategory.proCatCfgId}" />${productCategory.proCatName}
                            </c:forEach>
                        </td>
                    </tr>
                </c:if>
            </table>
            <table border="1" style="width: 80%; font-family: Calibri;" align="center">
                <tr>
                    <td colspan="4" align="center">
                        <a id="btn_save" href="javascript: savePermissionConfig();" class="button_a_blue">
                            <span>保存</span>
                        </a>
                        <a id="btn_back" href="javascript: add();" class="button_a_blue">
                            <span>添加阶段</span>
                        </a>
                        <a id="btn_back" href="javascript: back();" class="button_a_blue">
                            <span>返回</span>
                        </a>
                    </td>
                </tr>
            </table>
        </form>
    </div>
    <script type="text/javascript" src="../app/jquery/jquery-2.1.0.min.js"></script>
    <script type="text/javascript" src="<c:url value="/app/common_js/menu.js"/>"></script>
    <script type="text/javascript" src="<c:url value="/app/common_js/common.js"/>"></script>
    <script type="text/javascript" src="<c:url value="/app/script/common.js"/>"></script>
    <script language="javascript" type="text/javascript" src="../app/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript" language="javascript">
        //隔3行换一个颜色
        $(document).ready(function(){
          changeBackground();
        });
        function changeBackground(){
            $("table tr").css('background','none');
            $('table tr').each(function(index, item){
                var item = $(item);
                if( index % 6 == 0 ){
                    item.css('background','#FFFFFF').next().css('background','#FFFFFF').next().css('background','#FFFFFF');
                }
            });
        }
         
        //月份输入框只能输入数字
        $(".numberOnly").keyup(function(){  
            var tmptxt=$(this).val();
            $(this).val(tmptxt.replace(/\D|^0/g,''));
        }).bind("paste",function(){
            var tmptxt=$(this).val();
            $(this).val(tmptxt.replace(/\D|^0/g,''));
        }).css("ime-mode", "disabled");
         
        //删除添加的阶段
        $("body").on("click",".deleteTr",function(){
            var $parent=$(this).parent().parent();
            $parent.next().next().remove();//删除下下一行产品类型
            $parent.next().remove();//删除下一行产品分类
            $parent.remove();//删除当前行
            changeBackground();
        });
         
        //添加对应的可销售产品分类
        $("body").on("click",".productType",function(){
            var $cfgProCat=$(this).parent().parent().parent("tr").next().find("td").eq(1);
            var operate=false;// false:取消,true:选中
            if($(this).is(':checked')){
                operate=true;
            }
            var parentProCatCfgId=$(this).val();
            $.ajax({
                url : "/padelmadmin/permission/selectCfgProCatList",
                data : {parentProCatCfgId:parentProCatCfgId},
                dataType : "json",
                type : "POST",
                contentType : "application/x-www-form-urlencoded;charset=UTF-8",
                success : function(response) {
                    $.each(response.cfgProCatList, function(k,v){
                        if(operate){
                            var checkboxEle='<span><input type="checkbox" name="proCatAndCfgList['+i+'].productTypeIdList" value="'
                                +v.proCatCfgId+'" class="productType" checked="checked">'+v.proCatName+'</span>';
                            $cfgProCat.append(checkboxEle);
                        }else{
                            $cfgProCat.find("span").find('input[type="checkbox"][value='+v.proCatCfgId+']').parent("span").remove();
                        }
                     });
                },
                error : function(e) {
                    alert("系统异常!");
                }
            });
        });
 
        var back = function() {
            window.history.back();
        }
 
        //动态添加入司阶段
        var permissionConfigTr=$("#permissionConfig").find("tr");
        i=permissionConfigTr.length/3-1;//集合角标--全局变量
        if(!i){
            i=0;
        }
        var add = function() {
            i++;
             
            var repStr="proCatAndCfgList["+i;//替换成的字符串
            var rep=/\proCatAndCfgList\[\d*/g;//正则表达式
             
            var phase = '<tr><td width="20%"><em style="color: #f35821;">*</em>入司阶段时间:</td>'
                + '<td width="35%"><span class="fixedAmount">从</span><input type="text"'
                + 'name="proCatAndCfgList['+i+'].startTime" class="inputstyle i_w160" maxlength="2"/>'
                + '<span class="fixedAmount">个月</span></td>'
                + '<td width="35%"><span class="fixedAmount">到</span><input type="text"'
                + 'name="proCatAndCfgList['+i+'].endTime" class="inputstyle i_w160" maxlength="2"/>'
                + '<span class="fixedAmount">个月。</span></td>'
                +'<td width="10%" rowspan="3"><input type="button"  class="deleteTr" value="删除"/></td></tr>';
             
            var productType='<tr>'+$("#permissionConfig").find("tr").eq(1).html()+'</tr>';
            productType=productType.replace(rep, repStr);
             
            var productCategory='<tr><td width="20%"><em style="color: #f35821;">*</em>可销售产品分类:</td>'
                +'<td width="70%" colspan="2"></td></tr>';
             
            $("#permissionConfig").append(phase).append(productType).append(productCategory);
            //新增加的复选框取消选中
            $("#permissionConfig").find("tr").eq(-2).find("input:checkbox:checked").removeAttr("checked");
            changeBackground();
        }
         
        function savePermissionConfig() {
            $.ajax({
                url : "/padelmadmin/permission/savePermission",
                data : $('#dataForm').serialize(),
                dataType : "json",
                type : "POST",
                contentType : "application/x-www-form-urlencoded;charset=UTF-8",
                success : function(response) {
                    //alert(response.message);
                    alert("操作成功!");
                    window.location.href = "/padelmadmin/groupManager/toEditPage?groupId="+$("#groupId").val();
                },
                error : function(e) {
                    alert("系统异常!");
                }
            });
            //$("#dataForm").attr("action", "/padelmadmin/permission/savePermission").submit();
        }
    </script>
</body>
</html>


网友评论    (发表评论)

共12 条评论 1/1页

发表评论:

评论须知:

  • 1、评论每次加2分,每天上限为30;
  • 2、请文明用语,共同创建干净的技术交流环境;
  • 3、若被发现提交非法信息,评论将会被删除,并且给予扣分处理,严重者给予封号处理;
  • 4、请勿发布广告信息或其他无关评论,否则将会删除评论并扣分,严重者给予封号处理。


扫码下载

加载中,请稍后...

输入口令后可复制整站源码

加载中,请稍后...