首页 > 代码库 > jquery 添加可操作,编辑不可操作

jquery 添加可操作,编辑不可操作

--jsp

 <td class="queryTitle" width="100">优惠券批次号</td>                        <td class="queryContent" width="100">                            <input class="inputText easyui-validatebox" type="text" id="EditPubliId" />                        </td>

--js

//添加优惠券促销窗口function addCouExDlg(){    //添加时去掉不可编辑    $("#EditPubliId").removeAttr("readonly");    $("#hideActivityId").val(‘‘);    $(‘#EditActName‘).val(‘‘);    $(‘#EditActNo‘).val(‘‘);    $(‘#EditActBeginDate‘).combo(‘setText‘,‘‘);    $(‘#EditActEndDate‘).combo(‘setText‘,‘‘);    $("#EditConditionType").combobox(‘setValue‘,"0");    $("#EditCjType").combobox(‘setValue‘,"1");    $(‘#EditCjCount‘).val(‘‘);    $(‘#EditPubliId‘).val(‘‘);    $(‘#EidtActivityDesc‘).val(‘‘);    $("input[name=‘publishRangeC‘]").attr("checked",false);     $(‘#addCouponPromoteDlg‘).window({        title:‘优惠券促销添加‘,        iconCls:‘icon-add‘,        width:693,        height:300,        left:100,        modal: true,        shadow: true,        collapsible:false,        minimizable:false,        maximizable:false    });    $(‘#addCouponPromoteDlg‘).window(‘move‘,{top:100});    $(‘#addCouponPromoteDlg‘).window(‘open‘);}

--修改

//优惠券活动修改框function showEdit(rowData){//dataStr    // $("#EditPubliId").removeAttr("readonly");    $("#hideActivityId").val(rowData.cjActivityId);    $(‘#EditActName‘).val(rowData.activityName);    $(‘#EditActNo‘).val(rowData.activityNo);    $(‘#EditActBeginDate‘).datebox("setValue",rowData.beginTime);    $(‘#EditActEndDate‘).datebox("setValue",rowData.endTime);    $("#EditConditionType").combobox(‘setValue‘,rowData.conditionType);    if(rowData.isEnable==‘Y‘){        $(‘input[name="isUseR"][value="http://www.mamicode.com/Y"]‘).attr(‘checked‘, true);    }else if(rowData.isEnable==‘N‘){        $(‘input[name="isUseR"][value="http://www.mamicode.com/N"]‘).attr(‘checked‘, true);    }    $("#EditCjType").combobox(‘setValue‘,rowData.cjType);    if(rowData.publishRange==null ||rowData.publishRange==‘‘){        $("input[name=‘publishRangeC‘]").attr("checked",false);    }    //checkbox 数据回显    var publishRange=rowData.publishRange.split(",");    for(var i = 0;i < publishRange.length; i++) {        $("input[name=‘publishRangeC‘][value="http://www.mamicode.com/+publishRange[i]+"]").attr(‘checked‘, true);    }    //定义隐藏域    $("#hiddendActivityNo").val(rowData.activityNo);    $("#hiddendPublishId").val(rowData.publishId);    $(‘#EditCjCount‘).val(rowData.cjCount);    $(‘#EditPubliId‘).val(rowData.publishId);    if(rowData.publishId!=null){        $("#EditPubliId").attr("readonly","readonly");    }    $(‘#EidtActivityDesc‘).val(rowData.activityDesc);    $(‘#addCouponPromoteDlg‘).window({        title:‘优惠券活动编辑‘,        iconCls:‘icon-add‘,        width:693,        height:300,        left:100,        modal: true,        shadow: true,        collapsible:false,        minimizable:false,        maximizable:false    });    $(‘#addCouponPromoteDlg‘).window(‘move‘,{top:100});    $(‘#addCouponPromoteDlg‘).window(‘open‘);}

--添加

//保存优惠券促销活动function saveCouponPromote(){    var cjActivityId = $("#hideActivityId").val();    var activityName = $(‘#EditActName‘).val();    var activityNo = $(‘#EditActNo‘).val();    var beginTime = $(‘#EditActBeginDate‘).datebox("getValue");    var endTime = $(‘#EditActEndDate‘).datebox("getValue");    var conditionType = $("#EditConditionType").combobox(‘getValue‘);    var isEnable = $("input[name=‘isUseR‘]:checked").val();    var cjType = $("#EditCjType").combobox(‘getValue‘);        var cjCount = $(‘#EditCjCount‘).val();    var publishId = $(‘#EditPubliId‘).val();    var cjValue = http://www.mamicode.com/$(‘#EditPubliId‘).val();    var activityDesc = $(‘#EidtActivityDesc‘).val();    if(checkCouponDate(publishId) == "expire"){        $.messager.alert(‘提示‘,‘优惠券有效期已过!‘);        return;    }//        if(cjActivityId==null||cjActivityId==‘‘){        if($(‘#hiddendActivityNo‘).val()!=activityNo){            if(!checkActivityNo(activityNo)){              $.messager.alert(‘提示‘,‘活动编码已存在!‘);              return;        }          //        }    }//   if(!checkPublishId(publishId)){//        $.messager.alert(‘提示‘,‘优惠券批次号已存在!‘);//        return;//    }         if($(‘#hiddendPublishId‘).val()!=publishId){           if(!checkPromotePublishId(cjValue)){           $.messager.alert(‘提示‘,‘优惠券批次号已存在!‘);           return;       }         }

 

jquery 添加可操作,编辑不可操作